/* ============================================================
   The Clinical Review — Stylesheet
   Layout cloned from The Dental Review (Divi/Extra theme structure)
   Branding: Clinical navy + coral accent
   ============================================================ */

:root {
  /* Brand palette */
  --tcr-navy:        #0c2a4a;   /* primary — masthead, headings, footer */
  --tcr-navy-deep:   #081e36;   /* footer background */
  --tcr-coral:       #e85d4a;   /* accent — links, hover, CTA */
  --tcr-coral-dark:  #c84634;   /* coral hover */
  --tcr-amber:       #f4a93a;   /* secondary accent — section labels */

  /* Neutrals */
  --tcr-white:       #ffffff;
  --tcr-cream:       #faf8f5;
  --tcr-grey-50:     #f5f5f5;
  --tcr-grey-100:    #ebebeb;
  --tcr-grey-200:    #d9d9d9;
  --tcr-grey-400:    #999999;
  --tcr-grey-600:    #666666;
  --tcr-grey-800:    #333333;
  --tcr-text:        #2a2a2a;

  /* Typography */
  --font-display: "Merriweather", Georgia, "Times New Roman", serif;
  --font-body:    "Source Sans 3", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;

  /* Layout */
  --max-width: 1180px;
  --gutter: 24px;
}

/* ---------- Reset & base ---------- */

*, *::before, *::after { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  margin: 0;
  font-family: var(--font-body);
  font-size: 16px;
  line-height: 1.6;
  color: var(--tcr-text);
  background: var(--tcr-white);
}

img { max-width: 100%; height: auto; display: block; }

a {
  color: var(--tcr-coral);
  text-decoration: none;
  transition: color 0.2s ease;
}
a:hover { color: var(--tcr-coral-dark); }

h1, h2, h3, h4, h5, h6 {
  font-family: var(--font-display);
  font-weight: 700;
  color: var(--tcr-navy);
  margin: 0 0 0.5em;
  line-height: 1.25;
}

h1 { font-size: 2.25rem; }
h2 { font-size: 1.75rem; }
h3 { font-size: 1.25rem; }
h4 { font-size: 1.05rem; }

p { margin: 0 0 1em; }

.container {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 0 var(--gutter);
}

/* ---------- Top utility bar ---------- */

.utility-bar {
  background: var(--tcr-navy-deep);
  color: var(--tcr-white);
  font-size: 0.85rem;
}
.utility-bar .container {
  display: flex;
  justify-content: flex-end;
  gap: 24px;
  padding-top: 8px;
  padding-bottom: 8px;
}
.utility-bar a {
  color: var(--tcr-white);
  opacity: 0.85;
}
.utility-bar a:hover { opacity: 1; color: var(--tcr-amber); }

/* ---------- Masthead ---------- */

.masthead {
  background: var(--tcr-white);
  border-bottom: 1px solid var(--tcr-grey-100);
  padding: 28px 0 20px;
}
.masthead .container {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 20px;
}
.site-logo {
  font-family: var(--font-display);
  font-weight: 900;
  font-size: 2.1rem;
  color: var(--tcr-navy);
  letter-spacing: -0.02em;
  line-height: 1;
}
.site-logo .the {
  display: block;
  font-size: 0.7rem;
  font-weight: 400;
  letter-spacing: 0.4em;
  color: var(--tcr-coral);
  margin-bottom: 4px;
  text-transform: uppercase;
}
.site-logo:hover { color: var(--tcr-navy); }

.tagline {
  font-style: italic;
  color: var(--tcr-grey-600);
  font-size: 0.95rem;
}

/* ---------- Primary navigation ---------- */

.primary-nav {
  background: var(--tcr-navy);
  border-top: 3px solid var(--tcr-coral);
}
.primary-nav .container {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
}
.primary-nav ul {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-wrap: wrap;
}
.primary-nav li { position: relative; }
.primary-nav a {
  display: block;
  color: var(--tcr-white);
  padding: 14px 18px;
  font-weight: 600;
  font-size: 0.92rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}
.primary-nav a:hover,
.primary-nav a.active {
  background: var(--tcr-coral);
  color: var(--tcr-white);
}

.nav-toggle {
  display: none;
  background: none;
  border: none;
  color: var(--tcr-white);
  font-size: 1.5rem;
  padding: 14px 18px;
  cursor: pointer;
}

/* ---------- Homepage two-column grid ---------- */
/*
  Desktop layout:
    [ main column        ][ sidebar ]
    width ratio ~ 7:3 with 32px gutter
  Mobile:
    Single column, with interleaved widget order via order: var(--mobile-order)
*/

.home-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 320px;
  gap: 32px;
  margin-top: 20px;
}

.home-main {
  min-width: 0;  /* prevents grid blowout */
}

.home-sidebar {
  min-width: 0;
}

/* Mobile: collapse to single column with interleaved order */
@media (max-width: 900px) {
  .home-grid {
    grid-template-columns: 1fr;
    gap: 16px;
  }
  .home-main, .home-sidebar {
    display: contents;
  }
  /* Now all immediate children of .home-main and .home-sidebar are siblings
     in the grid. We use --mobile-order set inline on each child to control
     their visual order on mobile. */
  .home-grid > * > * {
    order: var(--mobile-order, 99);
  }
}

/* ---------- Ad slots ---------- */
/* Two ad formats, sharing common transition/positioning logic. */

.ad-slot {
  position: relative;
  display: block;
  margin: 18px 0;
  background: var(--tcr-grey-50);
  overflow: hidden;
}

/* Leaderboard format — 2000x248 source. Fills its container width.
   Source ratio 8.06:1 -> CSS aspect-ratio: 2000 / 248 */
.ad-leaderboard {
  width: 100%;
  aspect-ratio: 2000 / 248;
  margin-left: auto;
  margin-right: auto;
}

/* Tile format — 2000x1666 source. Fills its container width.
   Source ratio 1.2:1 -> CSS aspect-ratio: 2000 / 1666 */
.ad-tile {
  width: 100%;
  aspect-ratio: 2000 / 1666;
  margin: 0 auto 18px;
}

/* Each ad slot may contain multiple <a> elements (one per ad in the rotation).
   Only the .is-active one is visible. Others are stacked beneath, fading in/out. */
.ad-slot a {
  position: absolute;
  inset: 0;
  display: block;
  opacity: 0;
  transition: opacity 0.6s ease-in-out;
  pointer-events: none;
}
.ad-slot a.is-active {
  opacity: 1;
  pointer-events: auto;
}
.ad-slot img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

/* On mobile, leaderboards may not have desktop dimensions —
   they swap to the mobile variant if specified in ads.json */
@media (max-width: 600px) {
  .ad-leaderboard {
    aspect-ratio: 750 / 220;
    max-width: 100%;
  }
}

/* ---------- Sidebar widgets ---------- */

.sidebar-widget {
  margin-bottom: 28px;
  border: 1px solid var(--tcr-grey-100);
  background: var(--tcr-white);
}

.widget-header {
  background: var(--tcr-navy);
  color: var(--tcr-white);
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 0.92rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  padding: 10px 14px;
}

.widget-body {
  padding: 4px 0;
}

.widget-body .muted {
  color: var(--tcr-grey-600);
  padding: 14px;
  margin: 0;
  font-size: 0.9rem;
}

.widget-footer {
  background: var(--tcr-cream);
  border-top: 1px solid var(--tcr-grey-100);
  padding: 10px 14px;
  text-align: right;
  font-size: 0.85rem;
}
.widget-footer a {
  color: var(--tcr-coral);
  font-weight: 600;
  text-decoration: none;
}
.widget-footer a:hover {
  color: var(--tcr-coral-dark);
  text-decoration: underline;
}

/* TGA-feed item — title + snippet, with separator between items */
.tga-item {
  display: block;
  padding: 12px 14px;
  border-bottom: 1px solid var(--tcr-grey-100);
  text-decoration: none;
  color: var(--tcr-text);
  transition: background 0.15s;
}
.tga-item:last-child {
  border-bottom: none;
}
.tga-item:hover {
  background: var(--tcr-cream);
}
.tga-item .tga-title {
  display: block;
  font-weight: 700;
  font-size: 0.92rem;
  line-height: 1.3;
  color: var(--tcr-navy);
  margin-bottom: 4px;
}
.tga-item .tga-snippet {
  display: block;
  font-size: 0.83rem;
  color: var(--tcr-grey-600);
  line-height: 1.4;
}
.tga-item .tga-date {
  display: block;
  font-size: 0.75rem;
  color: var(--tcr-grey-400);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  margin-top: 6px;
}

/* Recent-posts item — compact title + date list */
.recent-item {
  display: block;
  padding: 10px 14px;
  border-bottom: 1px solid var(--tcr-grey-100);
  text-decoration: none;
  color: var(--tcr-text);
  transition: background 0.15s;
}
.recent-item:last-child {
  border-bottom: none;
}
.recent-item:hover {
  background: var(--tcr-cream);
}
.recent-item .recent-title {
  display: block;
  font-weight: 600;
  font-size: 0.9rem;
  line-height: 1.35;
  color: var(--tcr-navy);
  margin-bottom: 3px;
}
.recent-item .recent-meta {
  display: block;
  font-size: 0.75rem;
  color: var(--tcr-grey-400);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

/* ---------- Legacy ad-banner class kept for non-index pages ---------- */
/* Article/section/discipline pages still use the simpler banner format */
.ad-banner {
  text-align: center;
  margin: 18px 0;
}
.ad-banner img {
  margin: 0 auto;
  max-width: 100%;
}

/* ---------- Featured / hero ---------- */

.featured-hero {
  margin: 24px 0 32px;
}
.featured-hero .hero-card {
  position: relative;
  overflow: hidden;
  border-radius: 2px;
  background: var(--tcr-navy);
}
.featured-hero img {
  width: 100%;
  height: auto;
  opacity: 0.85;
}
.featured-hero .hero-overlay {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  padding: 32px 28px 24px;
  background: linear-gradient(to top, rgba(8,30,54,0.95) 0%, rgba(8,30,54,0.6) 60%, transparent 100%);
  color: var(--tcr-white);
}
.featured-hero .hero-overlay .label {
  display: inline-block;
  background: var(--tcr-coral);
  color: var(--tcr-white);
  padding: 4px 10px;
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  margin-bottom: 10px;
}
.featured-hero h2 {
  color: var(--tcr-white);
  margin-bottom: 6px;
  font-size: 1.8rem;
}
.featured-hero h2 a { color: var(--tcr-white); }
.featured-hero h2 a:hover { color: var(--tcr-amber); }
.featured-hero .meta {
  color: rgba(255,255,255,0.8);
  font-size: 0.85rem;
}

/* Text-only hero variant — used when the featured article has no hero image.
   Navy box with prominent headline + excerpt + meta, no image placeholder. */
.featured-hero .hero-card-textonly {
  background: linear-gradient(135deg, var(--tcr-navy) 0%, #1a4575 100%);
  min-height: 280px;
  display: flex;
  align-items: center;
  padding: 40px 36px;
  position: relative;
}
.featured-hero .hero-card-textonly::before {
  content: "";
  position: absolute;
  top: 28px;
  right: 28px;
  width: 80px;
  height: 80px;
  background: var(--tcr-amber);
  opacity: 0.85;
  border-radius: 50%;
  pointer-events: none;
}
.featured-hero .hero-text-content {
  position: relative;
  z-index: 1;
  max-width: 80%;
  color: var(--tcr-white);
}
.featured-hero .hero-text-content .label {
  display: inline-block;
  background: var(--tcr-coral);
  color: var(--tcr-white);
  padding: 4px 10px;
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  margin-bottom: 14px;
}
.featured-hero .hero-card-textonly h2 {
  font-size: 2rem;
  line-height: 1.25;
  margin-bottom: 16px;
  color: var(--tcr-white);
}
.featured-hero .hero-card-textonly h2 a { color: var(--tcr-white); }
.featured-hero .hero-card-textonly h2 a:hover { color: var(--tcr-amber); }
.featured-hero .hero-excerpt {
  color: rgba(255,255,255,0.92);
  font-size: 1.05rem;
  line-height: 1.55;
  margin-bottom: 16px;
}
.featured-hero .hero-card-textonly .meta {
  color: rgba(255,255,255,0.8);
  font-size: 0.85rem;
}
@media (max-width: 600px) {
  .featured-hero .hero-card-textonly { padding: 28px 22px; min-height: 220px; }
  .featured-hero .hero-card-textonly h2 { font-size: 1.5rem; }
  .featured-hero .hero-excerpt { font-size: 0.95rem; }
  .featured-hero .hero-card-textonly::before { width: 50px; height: 50px; top: 18px; right: 18px; }
}

/* ---------- Section blocks ---------- */

.section-block {
  margin: 40px 0;
}
.section-header {
  border-bottom: 2px solid var(--tcr-navy);
  padding-bottom: 8px;
  margin-bottom: 24px;
  display: flex;
  justify-content: space-between;
  align-items: baseline;
}
.section-header h2 {
  margin: 0;
  font-size: 1.5rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}
.section-header h2::before {
  content: "";
  display: inline-block;
  width: 8px;
  height: 8px;
  background: var(--tcr-coral);
  margin-right: 10px;
  vertical-align: 3px;
}
.section-header .latest-label {
  font-size: 0.8rem;
  color: var(--tcr-grey-400);
  text-transform: uppercase;
  letter-spacing: 0.1em;
}

/* Lead article + list — section default layout */
.section-body {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 28px;
}

.article-lead .lead-image {
  margin-bottom: 14px;
}
.article-lead h3 {
  font-size: 1.4rem;
  line-height: 1.3;
}
.article-lead h3 a { color: var(--tcr-navy); }
.article-lead h3 a:hover { color: var(--tcr-coral); }
.article-lead .meta {
  color: var(--tcr-grey-600);
  font-size: 0.85rem;
  margin-bottom: 10px;
}
.article-lead .excerpt {
  color: var(--tcr-grey-800);
  font-size: 0.95rem;
}

.article-list { list-style: none; padding: 0; margin: 0; }
.article-list-item {
  display: flex;
  gap: 14px;
  padding: 12px 0;
  border-bottom: 1px solid var(--tcr-grey-100);
}
.article-list-item:last-child { border-bottom: none; }
.article-list-item .thumb {
  flex: 0 0 80px;
  width: 80px;
  height: 80px;
  background: var(--tcr-grey-100);
  overflow: hidden;
}
.article-list-item .thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}
.article-list-item .info h4 {
  font-size: 0.98rem;
  line-height: 1.3;
  margin-bottom: 4px;
}
.article-list-item .info h4 a { color: var(--tcr-navy); }
.article-list-item .info h4 a:hover { color: var(--tcr-coral); }
.article-list-item .meta {
  font-size: 0.78rem;
  color: var(--tcr-grey-600);
}
.article-list-item .discipline {
  display: inline-block;
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--tcr-coral);
  font-weight: 700;
}

/* ---------- Disciplines bar ---------- */

.disciplines-bar {
  background: var(--tcr-cream);
  border-top: 1px solid var(--tcr-grey-100);
  border-bottom: 1px solid var(--tcr-grey-100);
  padding: 14px 0;
  margin: 8px 0 24px;
}
.disciplines-bar .label {
  display: inline-block;
  font-size: 0.78rem;
  font-weight: 700;
  color: var(--tcr-navy);
  text-transform: uppercase;
  letter-spacing: 0.1em;
  margin-right: 12px;
}
.disciplines-bar a {
  display: inline-block;
  color: var(--tcr-grey-800);
  font-size: 0.85rem;
  margin: 0 8px 4px 0;
  padding: 2px 0;
}
.disciplines-bar a:hover { color: var(--tcr-coral); }

/* ---------- Sidebar (single article, archive pages) ---------- */

.layout-with-sidebar {
  display: grid;
  grid-template-columns: 1fr 320px;
  gap: 40px;
  margin: 32px 0;
}

.sidebar-block {
  margin-bottom: 32px;
}
.sidebar-block h4 {
  font-size: 0.95rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  border-bottom: 2px solid var(--tcr-navy);
  padding-bottom: 6px;
  margin-bottom: 14px;
}
.sidebar-block .recent-list { list-style: none; padding: 0; margin: 0; }
.sidebar-block .recent-list li {
  display: flex;
  gap: 10px;
  padding: 8px 0;
  border-bottom: 1px solid var(--tcr-grey-100);
}
.sidebar-block .recent-list .thumb {
  flex: 0 0 60px;
  width: 60px; height: 60px;
  background: var(--tcr-grey-100);
  overflow: hidden;
}
.sidebar-block .recent-list .thumb img {
  width: 100%; height: 100%; object-fit: cover;
}
.sidebar-block .recent-list a {
  font-size: 0.85rem;
  line-height: 1.3;
  color: var(--tcr-navy);
  font-weight: 600;
  display: block;
}
.sidebar-block .recent-list .date {
  font-size: 0.75rem;
  color: var(--tcr-grey-600);
  display: block;
  margin-top: 3px;
  font-weight: 400;
}

.tag-cloud a {
  display: inline-block;
  background: var(--tcr-grey-50);
  color: var(--tcr-grey-800);
  font-size: 0.78rem;
  padding: 4px 10px;
  margin: 0 4px 6px 0;
  border-radius: 2px;
  border: 1px solid var(--tcr-grey-100);
}
.tag-cloud a:hover {
  background: var(--tcr-coral);
  color: var(--tcr-white);
  border-color: var(--tcr-coral);
}

/* ---------- Single article ---------- */

.article-page {
  background: var(--tcr-white);
}
.article-header {
  margin-bottom: 24px;
}
.article-header .label {
  display: inline-block;
  background: var(--tcr-coral);
  color: var(--tcr-white);
  padding: 4px 10px;
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  margin-bottom: 14px;
}
.article-header h1 {
  font-size: 2.2rem;
  line-height: 1.2;
  margin-bottom: 12px;
}
.article-header .meta {
  color: var(--tcr-grey-600);
  font-size: 0.9rem;
  border-bottom: 1px solid var(--tcr-grey-100);
  padding-bottom: 14px;
}
.article-hero { margin: 24px 0; }
.article-body {
  font-size: 1.05rem;
  line-height: 1.75;
  color: var(--tcr-grey-800);
}
.article-body p { margin-bottom: 1.2em; }
.article-body h2, .article-body h3 { margin-top: 1.6em; }
.article-body blockquote {
  border-left: 4px solid var(--tcr-coral);
  padding: 6px 20px;
  margin: 24px 0;
  font-style: italic;
  color: var(--tcr-grey-800);
  background: var(--tcr-cream);
}
.article-body ul, .article-body ol { margin-bottom: 1.2em; }

/* ---------- Footer ---------- */

.site-footer {
  background: var(--tcr-navy-deep);
  color: rgba(255,255,255,0.85);
  padding: 50px 0 28px;
  margin-top: 60px;
}
.site-footer h4 {
  color: var(--tcr-white);
  font-size: 0.95rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  border-bottom: 2px solid var(--tcr-coral);
  padding-bottom: 8px;
  margin-bottom: 16px;
}
.site-footer a {
  color: rgba(255,255,255,0.85);
}
.site-footer a:hover { color: var(--tcr-amber); }
.footer-cols {
  display: grid;
  grid-template-columns: 1.3fr 1fr 1fr;
  gap: 40px;
}
.footer-cols ul { list-style: none; padding: 0; margin: 0; }
.footer-cols li { padding: 4px 0; font-size: 0.92rem; }
.footer-bottom {
  text-align: center;
  font-size: 0.85rem;
  color: rgba(255,255,255,0.6);
  padding-top: 28px;
  margin-top: 28px;
  border-top: 1px solid rgba(255,255,255,0.1);
}

/* ---------- Empty state ---------- */

.empty-state {
  padding: 24px;
  background: var(--tcr-grey-50);
  color: var(--tcr-grey-600);
  text-align: center;
  font-style: italic;
  border: 1px dashed var(--tcr-grey-200);
}

/* ---------- Responsive ---------- */

@media (max-width: 900px) {
  .layout-with-sidebar { grid-template-columns: 1fr; }
  .footer-cols { grid-template-columns: 1fr; gap: 28px; }
  .section-body { grid-template-columns: 1fr; }
  .featured-hero h2 { font-size: 1.4rem; }
}

@media (max-width: 700px) {
  .nav-toggle { display: block; margin-left: auto; }
  .primary-nav ul {
    display: none;
    width: 100%;
    flex-direction: column;
  }
  .primary-nav ul.open { display: flex; }
  .primary-nav a { padding: 12px 18px; border-bottom: 1px solid rgba(255,255,255,0.1); }
  h1 { font-size: 1.6rem; }
  .article-header h1 { font-size: 1.6rem; }
  .masthead { padding: 18px 0 14px; }
  .site-logo { font-size: 1.6rem; }
}
