/* ==========================================================================
   Cross River Journal of Public Health — public theme
   All colours come from CSS variables emitted by the admin "Branding & colours"
   settings (see layouts/public.blade.php). Do not hard-code brand colours here.
   ========================================================================== */

:root {
  --crj-radius: 4px;
  --crj-maxw: 1240px;
  --bs-body-font-family: var(--crj-font-ui);
  --bs-body-color: var(--crj-text);
  --bs-body-bg: var(--crj-bg);
  --bs-link-color: var(--crj-link);
  --bs-link-color-rgb: var(--crj-link-rgb);
  --bs-link-hover-color: var(--crj-link-hover);
  --bs-link-hover-color-rgb: var(--crj-link-hover-rgb);
  --bs-primary: var(--crj-primary);
  --bs-primary-rgb: var(--crj-primary-rgb);
  --bs-secondary-color: var(--crj-muted);
  --bs-border-color: #d9d9d9;
  --bs-focus-ring-color: rgba(var(--crj-primary-rgb), .35);
}

body { font-family: var(--crj-font-ui); color: var(--crj-text); background: var(--crj-bg); font-size: 1rem; line-height: 1.55; }
a { color: var(--crj-link); text-underline-offset: 2px; }
a:hover { color: var(--crj-link-hover); }
h1, h2, h3, h4, h5 { font-family: var(--crj-font-ui); font-weight: 600; color: var(--crj-secondary); line-height: 1.25; }
.container-xl { max-width: var(--crj-maxw); }
.text-muted, .text-body-secondary { color: var(--crj-muted) !important; }

/* Accessibility */
.skip-link { position: absolute; left: -9999px; top: 0; z-index: 2000; background: var(--crj-primary); color: #fff; padding: .6rem 1rem; }
.skip-link:focus { left: .5rem; top: .5rem; color: #fff; }
:focus-visible { outline: 3px solid var(--crj-link); outline-offset: 2px; }
.btn:focus-visible, .form-control:focus, .form-select:focus { box-shadow: 0 0 0 .2rem rgba(var(--crj-primary-rgb), .3); border-color: var(--crj-primary); }

/* Buttons */
.btn { border-radius: var(--crj-radius); font-weight: 500; }
.btn-primary { --bs-btn-bg: var(--crj-btn-bg); --bs-btn-border-color: var(--crj-btn-bg); --bs-btn-color: var(--crj-btn-text);
  --bs-btn-hover-bg: var(--crj-link-hover); --bs-btn-hover-border-color: var(--crj-link-hover); --bs-btn-hover-color: var(--crj-btn-text);
  --bs-btn-active-bg: var(--crj-link-hover); --bs-btn-active-border-color: var(--crj-link-hover); }
.btn-outline-primary { --bs-btn-color: var(--crj-primary); --bs-btn-border-color: var(--crj-primary); --bs-btn-hover-bg: var(--crj-primary);
  --bs-btn-hover-border-color: var(--crj-primary); --bs-btn-hover-color: #fff; --bs-btn-active-bg: var(--crj-primary); }
.btn-accent { background: var(--crj-btn-accent-bg); border-color: var(--crj-btn-accent-bg); color: var(--crj-btn-accent-text); }
.btn-accent:hover, .btn-accent:focus { filter: brightness(.92); color: var(--crj-btn-accent-text); background: var(--crj-btn-accent-bg); }
.text-primary { color: var(--crj-primary) !important; }
.bg-surface { background: var(--crj-surface); }

/* Top utility bar */
.topbar { background: var(--crj-secondary); color: #fff; font-size: .85rem; }
.topbar a { color: #fff; text-decoration: none; }
.topbar a:hover { text-decoration: underline; }

/* Header */
.site-header { background: var(--crj-header-bg); color: var(--crj-header-text); border-bottom: 1px solid #e5e5e5; }
.site-header .brand { display: flex; align-items: center; gap: .75rem; color: var(--crj-header-text); text-decoration: none; min-width: 0; }
.site-header .brand img { max-height: 56px; width: auto; }
.site-header .brand-name { font-weight: 600; font-size: 1.1rem; line-height: 1.2; }
.site-header .brand-name small { display: block; font-weight: 400; font-size: .8rem; color: var(--crj-muted); }
.header-search { max-width: 340px; }
.header-actions .btn { white-space: nowrap; }

/* Main navigation */
.main-nav { background: var(--crj-nav-bg); border-bottom: 1px solid #e5e5e5; }
.main-nav .nav-link { color: var(--crj-nav-text); font-weight: 500; padding: .8rem .9rem; border-bottom: 3px solid transparent; }
.main-nav .nav-link:hover, .main-nav .nav-link:focus { color: var(--crj-primary); }
.main-nav .nav-link.active { border-bottom-color: var(--crj-accent); color: var(--crj-nav-text); }
.main-nav .dropdown-menu { border-radius: 0 0 var(--crj-radius) var(--crj-radius); border-color: #e5e5e5; box-shadow: 0 8px 20px rgba(0,0,0,.08); margin-top: 0; }
.main-nav .dropdown-item { padding: .45rem 1.1rem; }
.main-nav .dropdown-item.active, .main-nav .dropdown-item:active { background: var(--crj-surface); color: var(--crj-primary); }
@media (min-width: 992px) { .main-nav .dropdown:hover > .dropdown-menu { display: block; } }
@media (max-width: 991.98px) {
  .main-nav .nav-link { border-bottom: 0; border-left: 3px solid transparent; }
  .main-nav .nav-link.active { border-left-color: var(--crj-accent); }
  .main-nav .dropdown-menu { box-shadow: none; border: 0; padding-left: 1rem; }
}

/* Journal banner / hero */
.journal-hero { background: var(--crj-hero-bg); color: var(--crj-hero-text); }
.journal-hero h1 { color: var(--crj-hero-text); font-size: clamp(1.7rem, 3.2vw, 2.5rem); font-weight: 600; }
.journal-hero .lead { color: var(--crj-hero-text); opacity: .85; max-width: 48rem; }
.journal-hero .cover { max-width: 180px; box-shadow: 0 6px 18px rgba(0,0,0,.15); border: 1px solid #ddd; background: #fff; }
/* Links and buttons on the banner follow the banner text colour so they stay legible on a coloured background */
.journal-hero a:not(.btn) { color: var(--crj-hero-text); text-decoration-color: rgba(var(--crj-hero-text-rgb), .6); }
.journal-hero a:not(.btn):hover, .journal-hero a:not(.btn):focus { color: var(--crj-hero-text); text-decoration-color: var(--crj-hero-text); }
.journal-hero .btn-outline-primary { --bs-btn-color: var(--crj-hero-text); --bs-btn-border-color: var(--crj-hero-text);
  --bs-btn-hover-bg: var(--crj-hero-text); --bs-btn-hover-border-color: var(--crj-hero-text); --bs-btn-hover-color: var(--crj-hero-bg);
  --bs-btn-active-bg: var(--crj-hero-text); --bs-btn-active-border-color: var(--crj-hero-text); --bs-btn-active-color: var(--crj-hero-bg); }
.journal-hero .btn-accent, .cta-band .btn-accent { transition: background-color .15s, color .15s, border-color .15s; }
.journal-hero .btn-accent:hover, .journal-hero .btn-accent:focus-visible,
.cta-band .btn-accent:hover, .cta-band .btn-accent:focus-visible { filter: none; background: #fff; border-color: #fff; color: #000; }
.journal-hero .hero-search .form-control { border-color: transparent; }
.journal-hero .hero-search .btn-primary { --bs-btn-bg: var(--crj-link); --bs-btn-border-color: var(--crj-link);
  --bs-btn-hover-bg: color-mix(in srgb, var(--crj-link) 80%, #000); --bs-btn-hover-border-color: color-mix(in srgb, var(--crj-link) 80%, #000);
  --bs-btn-active-bg: color-mix(in srgb, var(--crj-link) 70%, #000); --bs-btn-color: #fff; --bs-btn-hover-color: #fff; }
.journal-hero .btn:focus-visible, .journal-hero .form-control:focus { box-shadow: 0 0 0 .2rem rgba(var(--crj-hero-text-rgb), .5); }
.identifier-list { display: flex; flex-wrap: wrap; gap: .4rem 1.4rem; font-size: .9rem; margin: 0; padding: 0; list-style: none; }
.identifier-list li strong { font-weight: 600; }
.hero-search .form-control { border-radius: var(--crj-radius) 0 0 var(--crj-radius); }

/* Page header (inner pages) */
.page-header { background: var(--crj-surface); border-bottom: 1px solid #e5e5e5; padding: 1.75rem 0 1.5rem; }
.page-header h1 { font-size: clamp(1.5rem, 2.6vw, 2.1rem); margin: 0; }
.breadcrumb { font-size: .85rem; margin-bottom: .5rem; }

/* Sections */
.home-section { padding: 2.5rem 0; }
.home-section + .home-section { border-top: 1px solid #ececec; }
.section-title { font-size: 1.45rem; margin-bottom: 1.1rem; display: flex; align-items: baseline; justify-content: space-between; gap: 1rem; flex-wrap: wrap; }
.section-title a { font-size: .9rem; font-weight: 500; }
.home-section .section-title { position: relative; padding-bottom: .6rem; }
.home-section .section-title::after { content: ""; position: absolute; left: 0; bottom: 0; width: 2.5rem; height: 3px; border-radius: 2px; background: var(--crj-accent); }
.home-section .lead-text { font-size: 1.1rem; line-height: 1.65; }
.section-icon { flex-shrink: 0; display: inline-flex; align-items: center; justify-content: center; width: 3rem; height: 3rem; border-radius: 50%;
  background: rgba(var(--crj-primary-rgb), .1); color: var(--crj-primary); font-size: 1.35rem; }

/* Article listing */
.article-item { padding: 1.1rem 0; border-bottom: 1px solid #e8e8e8; }
.article-item:last-child { border-bottom: 0; }
.article-item .meta-top { font-size: .8rem; color: var(--crj-muted); text-transform: none; display: flex; gap: .75rem; flex-wrap: wrap; align-items: center; }
.article-item h3 { font-size: 1.1rem; margin: .3rem 0 .35rem; font-weight: 600; }
.article-item h3 a { color: var(--crj-link); text-decoration: none; }
.article-item h3 a:hover { text-decoration: underline; }
.article-item .authors { font-size: .92rem; color: var(--crj-text); }
.article-item .meta-bottom { font-size: .85rem; color: var(--crj-muted); margin-top: .3rem; }
.badge-type { background: transparent; color: var(--crj-muted); font-weight: 600; padding: 0; }
.badge-access { font-weight: 600; font-size: .75rem; color: #2e7d32; }
.badge-access.abstract_only { color: var(--crj-muted); }

/* Cards */
.crj-card { border: 1px solid #e3e3e3; border-radius: var(--crj-radius); background: #fff; padding: 1.25rem; height: 100%; }
.crj-card h3 { font-size: 1.05rem; }
.link-tile { display: flex; gap: .85rem; align-items: center; padding: .85rem 1rem; border: 1px solid #e3e3e3; border-radius: calc(var(--crj-radius) * 2); text-decoration: none;
  color: var(--crj-text); background: #fff; height: 100%; font-weight: 500; transition: border-color .15s, box-shadow .15s, transform .15s; }
.link-tile:hover, .link-tile:focus-visible { border-color: var(--crj-primary); color: var(--crj-primary); box-shadow: 0 6px 16px rgba(var(--crj-primary-rgb), .12); transform: translateY(-2px); }
.link-tile .tile-icon { flex-shrink: 0; display: inline-flex; align-items: center; justify-content: center; width: 2.5rem; height: 2.5rem; border-radius: calc(var(--crj-radius) * 2);
  background: rgba(var(--crj-primary-rgb), .1); color: var(--crj-primary); font-size: 1.2rem; transition: background .15s, color .15s; }
.link-tile:hover .tile-icon, .link-tile:focus-visible .tile-icon { background: var(--crj-primary); color: #fff; }
.link-tile .tile-label { flex-grow: 1; }
.link-tile .tile-arrow { color: var(--crj-muted); font-size: .9rem; transition: transform .15s, color .15s; }
.link-tile:hover .tile-arrow, .link-tile:focus-visible .tile-arrow { color: var(--crj-primary); transform: translateX(3px); }
@media (prefers-reduced-motion: reduce) { .link-tile, .link-tile * { transition: none; } .link-tile:hover { transform: none; } }
.facts-card { border-top: 3px solid var(--crj-primary); box-shadow: 0 2px 10px rgba(0,0,0,.04); }
.facts-card-title { font-size: .85rem !important; text-transform: uppercase; letter-spacing: .06em; color: var(--crj-primary); margin-bottom: .75rem; }
.facts-card .journal-facts { margin-bottom: 0; }
.facts-card .journal-facts th, .facts-card .journal-facts td { padding: .5rem .25rem; border-color: #eee; }
.facts-card .journal-facts tr:last-child th, .facts-card .journal-facts tr:last-child td { border-bottom: 0; }
.facts-card .journal-facts th { color: var(--crj-muted); font-weight: 500 !important; }
.stat { text-align: center; padding: 1rem; }
.stat .num { font-size: 2rem; font-weight: 700; color: var(--crj-primary); line-height: 1.1; }
.stat .lbl { font-size: .85rem; color: var(--crj-muted); }
.cta-band { background: linear-gradient(120deg, var(--crj-primary) 45%, color-mix(in srgb, var(--crj-primary) 45%, var(--crj-link))); color: #fff;
  border-radius: calc(var(--crj-radius) * 2); padding: 2.25rem 2rem; box-shadow: 0 8px 24px rgba(var(--crj-primary-rgb), .2); }
.cta-band h2 { color: #fff; }
.issue-cover { width: 100%; max-width: 220px; border: 1px solid #ddd; background: #fff; }
.issue-cover-placeholder { width: 100%; max-width: 220px; aspect-ratio: 3/4; display: flex; flex-direction: column; justify-content: center; align-items: center; text-align: center;
  background: linear-gradient(160deg, var(--crj-primary), var(--crj-secondary)); color: #fff; border-radius: var(--crj-radius); padding: 1rem; font-weight: 600; }
.person-card img, .person-photo-placeholder { width: 88px; height: 88px; object-fit: cover; border-radius: 50%; }
.person-photo-placeholder { display: inline-flex; align-items: center; justify-content: center; background: var(--crj-surface); color: var(--crj-muted); font-size: 2rem; }

/* Article page */
.article-header { padding: 1.75rem 0 1rem; }
.article-header .type-line { font-size: .9rem; color: var(--crj-muted); display: flex; gap: 1rem; flex-wrap: wrap; }
.article-title { font-size: clamp(1.5rem, 2.8vw, 2.1rem); font-weight: 600; margin: .5rem 0 1rem; color: var(--crj-secondary); }
.author-list { list-style: none; padding: 0; margin: 0 0 .6rem; font-size: 1rem; }
.author-list li { display: inline; }
.author-list li:not(:last-child)::after { content: ", "; }
.author-list sup { font-size: .7em; }
.orcid-icon { display: inline-block; width: 16px; height: 16px; vertical-align: -2px; }
.affiliations { font-size: .88rem; color: var(--crj-muted); padding-left: 0; list-style: none; }
.article-body { font-family: var(--crj-font-body); font-size: 1.06rem; line-height: 1.75; }
.article-body h2 { font-family: var(--crj-font-ui); font-size: 1.3rem; margin-top: 2rem; padding-top: .5rem; border-top: 1px solid #eee; }
.article-body h3 { font-family: var(--crj-font-ui); font-size: 1.1rem; margin-top: 1.5rem; }
.article-body table { width: 100%; font-family: var(--crj-font-ui); font-size: .9rem; }
.article-body img { max-width: 100%; height: auto; }
.keywords .badge { background: var(--crj-surface); color: var(--crj-text); font-weight: 500; border: 1px solid #ddd; margin: 0 .3rem .3rem 0; text-decoration: none; }
.keywords .badge:hover { border-color: var(--crj-primary); color: var(--crj-primary); }
.references { font-family: var(--crj-font-ui); font-size: .92rem; }
.references li { margin-bottom: .55rem; word-break: break-word; }
.article-aside { position: sticky; top: 1rem; }
.article-aside .list-group-item { font-size: .9rem; }
.doi-line { font-size: .92rem; word-break: break-all; }
.article-dates { font-size: .88rem; color: var(--crj-muted); }
.toc-nav a { display: block; padding: .25rem 0; font-size: .9rem; text-decoration: none; }
.preview-banner { background: #fff3cd; border-bottom: 1px solid #ffe69c; }

/* CMS content */
.cms-content { font-size: 1.02rem; line-height: 1.7; }
.cms-content h2 { font-size: 1.35rem; margin-top: 1.8rem; }
.cms-content h3 { font-size: 1.15rem; margin-top: 1.4rem; }
.cms-content table { width: 100%; margin-bottom: 1rem; border-collapse: collapse; }
.cms-content th, .cms-content td { border: 1px solid #ddd; padding: .5rem .6rem; }
.cms-content blockquote { border-left: 4px solid var(--crj-accent); padding: .4rem 1rem; color: var(--crj-muted); margin: 1rem 0; background: var(--crj-surface); }
.cms-content img { max-width: 100%; height: auto; }
.cms-content iframe { max-width: 100%; aspect-ratio: 16/9; height: auto; width: 100%; border: 0; }
.cms-content .table-wrap, .table-responsive { overflow-x: auto; }
.pending-info { font-size: .95rem; }

/* Filters sidebar */
.filters .form-label { font-weight: 600; font-size: .85rem; margin-bottom: .2rem; }
.filters .card-body { padding: 1rem; }

/* Footer */
.site-footer { background: var(--crj-footer-bg); color: var(--crj-footer-text); border-top: 3px solid var(--crj-accent); font-size: .92rem; }
.site-footer a { color: var(--crj-footer-text); text-decoration: none; }
.site-footer a:hover { text-decoration: underline; }
.site-footer h2 { font-size: .95rem; text-transform: uppercase; letter-spacing: .04em; color: var(--crj-footer-text); }
.site-footer .footer-bottom { border-top: 1px solid rgba(128,128,128,.25); font-size: .85rem; }
.social-links a { display: inline-flex; width: 36px; height: 36px; align-items: center; justify-content: center; border: 1px solid rgba(128,128,128,.4); border-radius: 50%; margin-right: .35rem; }

/* Cookie notice */
.cookie-notice { position: fixed; bottom: 0; left: 0; right: 0; z-index: 1050; background: var(--crj-secondary); color: #fff; padding: .8rem 0; font-size: .9rem; }

/* Auth / account */
.auth-card { max-width: 480px; margin: 2.5rem auto; }
.btn-oauth { display: flex; align-items: center; justify-content: center; gap: .6rem; border: 1px solid #ccc; background: #fff; color: #222; }
.btn-oauth:hover { background: #f7f7f7; color: #000; }
.status-badge { font-size: .78rem; }

@media print {
  .site-header, .main-nav, .site-footer, .topbar, .article-aside, .cookie-notice, .no-print { display: none !important; }
  .article-body { font-size: 11pt; }
}

@media (max-width: 575.98px) {
  .site-header .brand img { max-height: 44px; max-width: 48vw; }
  .site-header .brand-name { font-size: .95rem; }
  .site-header .brand-name small { display: none; }
  .article-title { font-size: 1.45rem; }
}
