/* ============================================================
   LIVERDECODED — Tag / Topic Page Stylesheet
   Shared across: /tags/bilirubin/, /tags/fibroscan/,
                  /tags/liver-enzymes/ (and future tag pages)
   Palette: Forest Green / Warm Amber / Off-White
   Fonts:   Playfair Display (headings) + DM Sans (body)
   ============================================================ */

/* ── Design Tokens ─────────────────────────────────────────── */
:root {
  --green:        #1a4a35;
  --green-mid:    #2d6a4f;
  --green-light:  #e8f3ee;
  --green-faint:  #f2f8f5;
  --green-glow:   #74c69d;

  --amber:        #b8762a;
  --amber-dark:   #9a6020;
  --amber-light:  #fdf0dc;

  --teal:         #1d5f6e;
  --teal-light:   #e3f2f5;
  --plum:         #4a2d6b;
  --plum-light:   #f0ebf8;
  --slate:        #2b4363;
  --slate-light:  #eaeff6;

  --text:         #2d3748;
  --text-muted:   #64748b;
  --text-faint:   #94a3b8;

  --bg:           #faf8f3;
  --bg-card:      #ffffff;
  --border:       #e5e0d8;
  --border-light: #ede9e1;

  --radius-sm:    8px;
  --radius:       12px;
  --radius-lg:    18px;

  --shadow-sm:    0 1px 4px rgba(0,0,0,0.06);
  --shadow:       0 3px 14px rgba(0,0,0,0.08);
  --shadow-lg:    0 8px 32px rgba(0,0,0,0.13);

  --max-w:        1080px;
  --prose-w:      720px;
  --nav-h:        60px;
}

/* ── Reset ─────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; font-size: 16px; }
body {
  font-family: 'DM Sans', sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.68;
  -webkit-font-smoothing: antialiased;
}
h1,h2,h3,h4 { font-family: 'Playfair Display', serif; line-height: 1.22; }
a   { color: inherit; text-decoration: none; }
img { display: block; max-width: 100%; }

/* ── Layout ─────────────────────────────────────────────────── */
.container     { max-width: var(--max-w);   margin: 0 auto; padding: 0 24px; }
.container-sm  { max-width: var(--prose-w); margin: 0 auto; padding: 0 24px; }

/* ── Type Helpers ───────────────────────────────────────────── */
.section-label {
  display: block;
  font-family: 'DM Sans', sans-serif;
  font-size: 11.5px;
  font-weight: 700;
  letter-spacing: 1.3px;
  text-transform: uppercase;
  color: var(--amber);
  margin-bottom: 10px;
}
.section-title {
  font-size: clamp(22px, 3vw, 32px);
  font-weight: 700;
  color: var(--green);
  margin-bottom: 10px;
}
.section-sub {
  font-size: 15.5px;
  color: var(--text-muted);
  line-height: 1.75;
  max-width: 580px;
}

/* ── Buttons ────────────────────────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 11px 22px;
  border-radius: var(--radius-sm);
  font-family: 'DM Sans', sans-serif;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.18s, transform 0.18s, box-shadow 0.18s;
  text-decoration: none;
  border: none;
  white-space: nowrap;
}
.btn-sm { padding: 8px 16px; font-size: 13px; }

.btn-primary { background: var(--amber); color: #fff; }
.btn-primary:hover {
  background: var(--amber-dark);
  transform: translateY(-1px);
  box-shadow: 0 4px 14px rgba(184,118,42,0.32);
}
.btn-green   { background: var(--green); color: #fff; }
.btn-green:hover  { background: var(--green-mid); transform: translateY(-1px); }
.btn-outline { background: transparent; color: var(--green); border: 1.5px solid var(--green); }
.btn-outline:hover { background: var(--green-light); }


/* ============================================================
   NAV
   ============================================================ */


/* ============================================================
   TOPIC HERO
   ============================================================ */
.topic-hero {
  padding: 56px 24px 52px;
  position: relative;
  overflow: hidden;
}
/* colour variants — set via class on the element */
.topic-hero--green  { background: linear-gradient(135deg, #12352a 0%, var(--green) 60%, #1d5060 100%); }
.topic-hero--teal   { background: linear-gradient(135deg, #0e3340 0%, var(--teal) 60%, #1a4a35 100%); }
.topic-hero--amber  { background: linear-gradient(135deg, #5a3010 0%, var(--amber) 60%, #8a5520 100%); }

.topic-hero::before {
  content: '';
  position: absolute;
  inset: 0;
  background:
    radial-gradient(ellipse 55% 70% at 92% 20%, rgba(255,255,255,0.06) 0%, transparent 55%),
    radial-gradient(ellipse 40% 50% at 5%  85%, rgba(116,198,157,0.07) 0%, transparent 55%);
  pointer-events: none;
}
.topic-hero::after {
  content: '';
  position: absolute;
  inset: 0;
  background-image:
    linear-gradient(rgba(255,255,255,0.022) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255,255,255,0.022) 1px, transparent 1px);
  background-size: 48px 48px;
  pointer-events: none;
}

.topic-hero__inner {
  position: relative;
  z-index: 1;
  max-width: var(--max-w);
  margin: 0 auto;
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 40px;
  align-items: end;
}

.topic-hero__breadcrumb {
  font-size: 12.5px;
  color: rgba(255,255,255,0.55);
  margin-bottom: 16px;
  display: flex;
  align-items: center;
  gap: 6px;
}
.topic-hero__breadcrumb a { color: rgba(255,255,255,0.65); transition: color 0.15s; }
.topic-hero__breadcrumb a:hover { color: #fff; }
.topic-hero__breadcrumb span { color: rgba(255,255,255,0.35); }

.topic-hero__tag {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: rgba(255,255,255,0.10);
  border: 1px solid rgba(255,255,255,0.16);
  color: rgba(255,255,255,0.85);
  font-size: 11.5px;
  font-weight: 600;
  letter-spacing: 0.6px;
  padding: 5px 13px;
  border-radius: 50px;
  margin-bottom: 16px;
}

.topic-hero h1 {
  font-size: clamp(26px, 4.5vw, 44px);
  font-weight: 700;
  color: #fff;
  line-height: 1.18;
  margin-bottom: 14px;
}

.topic-hero__desc {
  font-size: 16px;
  color: rgba(255,255,255,0.78);
  line-height: 1.75;
  max-width: 560px;
  margin-bottom: 24px;
}

.topic-hero__actions { display: flex; gap: 10px; flex-wrap: wrap; }

/* right side: quick-ref card */
.topic-hero__ref {
  background: rgba(255,255,255,0.08);
  border: 1px solid rgba(255,255,255,0.14);
  border-radius: var(--radius);
  padding: 20px 22px;
  min-width: 220px;
  flex-shrink: 0;
}
.topic-hero__ref-title {
  font-size: 10.5px;
  font-weight: 700;
  letter-spacing: 1px;
  text-transform: uppercase;
  color: var(--green-glow);
  margin-bottom: 12px;
}
.ref-row {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 12px;
  padding: 7px 0;
  border-bottom: 1px solid rgba(255,255,255,0.08);
  font-size: 13px;
}
.ref-row:last-child { border-bottom: none; padding-bottom: 0; }
.ref-row__label { color: rgba(255,255,255,0.55); }
.ref-row__val   { font-weight: 600; color: rgba(255,255,255,0.88); font-size: 13.5px; }
.ref-row__val.ok   { color: #74c69d; }
.ref-row__val.warn { color: #fbbf6a; }
.ref-row__val.bad  { color: #f87171; }


/* ============================================================
   CONTENT LAYOUT — sidebar + prose
   ============================================================ */
.content-layout {
  max-width: var(--max-w);
  margin: 0 auto;
  padding: 56px 24px 72px;
  display: grid;
  grid-template-columns: 1fr 260px;
  gap: 48px;
  align-items: start;
}

/* ── Prose ──────────────────────────────────────────────────── */
.prose h2 {
  font-size: 24px;
  color: var(--green);
  margin: 40px 0 14px;
  padding-top: 8px;
  border-top: 1px solid var(--border);
}
.prose h2:first-child { margin-top: 0; border-top: none; padding-top: 0; }

.prose h3 {
  font-size: 18px;
  color: var(--text);
  margin: 28px 0 10px;
}

.prose p {
  font-size: 15.5px;
  color: var(--text);
  line-height: 1.82;
  margin-bottom: 16px;
}
.prose p:last-child { margin-bottom: 0; }

.prose strong { color: var(--green); font-weight: 600; }

.prose a {
  color: var(--green-mid);
  font-weight: 500;
  text-decoration: underline;
  text-underline-offset: 2px;
  transition: color 0.15s;
}
.prose a:hover { color: var(--green); }

.prose ul {
  list-style: none;
  margin: 0 0 16px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.prose ul li {
  font-size: 15px;
  color: var(--text-muted);
  display: flex;
  align-items: flex-start;
  gap: 9px;
  line-height: 1.6;
}
.prose ul li::before {
  content: '';
  width: 6px;
  height: 6px;
  background: var(--green-light);
  border: 1.5px solid var(--green-mid);
  border-radius: 50%;
  flex-shrink: 0;
  margin-top: 7px;
}

/* ── Tables ─────────────────────────────────────────────────── */
.data-table-wrap {
  overflow-x: auto;
  margin: 24px 0;
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
  border: 1px solid var(--border);
}
.data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 14px;
  background: var(--bg-card);
}
.data-table thead th {
  background: var(--green);
  color: #fff;
  padding: 12px 16px;
  text-align: left;
  font-weight: 600;
  font-size: 12.5px;
  letter-spacing: 0.4px;
  white-space: nowrap;
}
.data-table thead th:first-child { border-radius: var(--radius) 0 0 0; }
.data-table thead th:last-child  { border-radius: 0 var(--radius) 0 0; }
.data-table tbody tr { border-bottom: 1px solid var(--border-light); }
.data-table tbody tr:last-child { border-bottom: none; }
.data-table tbody tr:nth-child(even) { background: var(--green-faint); }
.data-table td {
  padding: 11px 16px;
  color: var(--text);
  vertical-align: middle;
  line-height: 1.5;
}
.data-table td:first-child { font-weight: 600; }

/* status badges in tables */
.tbl-ok   { color: #1a7a44; font-weight: 600; }
.tbl-warn { color: var(--amber-dark); font-weight: 600; }
.tbl-bad  { color: #c0392b; font-weight: 600; }
.tbl-info { color: var(--teal); font-weight: 600; }

/* ── Callout box ────────────────────────────────────────────── */
.callout {
  border-left: 4px solid var(--green);
  background: var(--green-faint);
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
  padding: 16px 20px;
  margin: 24px 0;
}
.callout--amber { border-color: var(--amber); background: var(--amber-light); }
.callout--teal  { border-color: var(--teal);  background: var(--teal-light); }
.callout p { font-size: 14.5px; color: var(--text); margin-bottom: 0; line-height: 1.65; }
.callout strong { color: var(--green); }
.callout--amber strong { color: var(--amber-dark); }

/* ── Sidebar ────────────────────────────────────────────────── */
.sidebar { position: sticky; top: calc(var(--nav-h) + 20px); display: flex; flex-direction: column; gap: 18px; }

.sidebar-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: var(--shadow-sm);
}
.sidebar-card__head {
  background: var(--green);
  padding: 13px 18px;
}
.sidebar-card__head h4 {
  font-family: 'DM Sans', sans-serif;
  font-size: 13.5px;
  font-weight: 600;
  color: #fff;
}
.sidebar-card__head p { font-size: 11.5px; color: rgba(255,255,255,0.6); margin-top: 2px; }

.sidebar-card__body { padding: 16px 18px; }
.sidebar-card__body p { font-size: 13.5px; color: var(--text-muted); line-height: 1.65; margin-bottom: 12px; }
.sidebar-card__body p:last-child { margin-bottom: 0; }

.sidebar-links { list-style: none; display: flex; flex-direction: column; gap: 0; }
.sidebar-links li a {
  display: flex;
  align-items: flex-start;
  gap: 9px;
  padding: 10px 0;
  border-bottom: 1px solid var(--border-light);
  font-size: 13.5px;
  color: var(--text-muted);
  transition: color 0.15s;
  line-height: 1.45;
}
.sidebar-links li:last-child a { border-bottom: none; padding-bottom: 0; }
.sidebar-links li a:hover { color: var(--green); }
.sidebar-links li a span { flex-shrink: 0; margin-top: 1px; }

.sidebar-card__foot {
  padding: 14px 18px;
  border-top: 1px solid var(--border-light);
  background: var(--green-faint);
}


/* ============================================================
   RELATED LINKS SECTION
   ============================================================ */
.related {
  background: var(--green-faint);
  border-top: 1px solid #d8ebe0;
  border-bottom: 1px solid #d8ebe0;
  padding: 56px 24px;
}
.related__inner {
  max-width: var(--max-w);
  margin: 0 auto;
}
.related__header { margin-bottom: 28px; }
.related-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 14px;
}
.related-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
  box-shadow: var(--shadow-sm);
  display: flex;
  flex-direction: column;
  gap: 8px;
  transition: box-shadow 0.2s, transform 0.2s;
  position: relative;
  overflow: hidden;
}
.related-card::before {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 3px;
}
.related-card--guide::before  { background: var(--green); }
.related-card--book::before   { background: var(--amber); }
.related-card--tool::before   { background: var(--teal); }
.related-card:hover { box-shadow: var(--shadow-lg); transform: translateY(-2px); }
.related-card__type {
  font-size: 10.5px;
  font-weight: 700;
  letter-spacing: 0.9px;
  text-transform: uppercase;
  color: var(--text-faint);
}
.related-card h3 {
  font-size: 15.5px;
  font-weight: 600;
  color: var(--text);
  line-height: 1.35;
  font-family: 'Playfair Display', serif;
}
.related-card p { font-size: 13px; color: var(--text-muted); line-height: 1.55; flex: 1; }
.related-card__cta {
  font-size: 13px;
  font-weight: 600;
  color: var(--green-mid);
  display: flex;
  align-items: center;
  gap: 5px;
  margin-top: 4px;
  transition: gap 0.18s;
}
.related-card:hover .related-card__cta { gap: 9px; }


/* ============================================================
   FAQ
   ============================================================ */
.faq {
  padding: 64px 24px;
  background: var(--bg);
}
.faq__inner {
  max-width: 760px;
  margin: 0 auto;
}
.faq__header { margin-bottom: 36px; }
.faq__list { display: flex; flex-direction: column; }

.faq__item { border-bottom: 1px solid var(--border); }
.faq__item:first-child { border-top: 1px solid var(--border); }

.faq__q {
  width: 100%;
  background: none;
  border: none;
  cursor: pointer;
  text-align: left;
  padding: 18px 0;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  font-family: 'Playfair Display', serif;
  font-size: 16.5px;
  font-weight: 600;
  color: var(--text);
  transition: color 0.18s;
}
.faq__q:hover { color: var(--green); }

.faq__chevron {
  width: 22px; height: 22px;
  border-radius: 50%;
  background: var(--green-light);
  display: grid;
  place-items: center;
  flex-shrink: 0;
  transition: background 0.2s;
}
.faq__chevron svg {
  width: 11px; height: 11px;
  stroke: var(--green);
  transition: transform 0.28s ease;
}
.faq__item--open .faq__chevron { background: var(--green); }
.faq__item--open .faq__chevron svg { stroke: #fff; transform: rotate(180deg); }

.faq__a { overflow: hidden; max-height: 0; transition: max-height 0.35s ease; }
.faq__item--open .faq__a { max-height: 400px; }

.faq__a-inner {
  padding-bottom: 20px;
  font-size: 15px;
  color: var(--text-muted);
  line-height: 1.82;
}
.faq__a-inner a { color: var(--green-mid); font-weight: 600; text-decoration: underline; text-underline-offset: 2px; }


/* ============================================================
   TOPICS STRIP
   ============================================================ */
.topics-strip {
  background: var(--bg-card);
  border-top: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
  padding: 26px 24px;
}
.topics-strip__inner {
  max-width: var(--max-w);
  margin: 0 auto;
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}
.topics-strip__label {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.9px;
  text-transform: uppercase;
  color: var(--text-faint);
  white-space: nowrap;
  margin-right: 4px;
}
.topic-chip {
  font-size: 13px;
  font-weight: 500;
  color: var(--text-muted);
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 50px;
  padding: 5px 13px;
  transition: background 0.15s, color 0.15s, border-color 0.15s;
}
.topic-chip:hover { background: var(--green-light); color: var(--green); border-color: #b7ddc8; }
.topic-chip--active { background: var(--green-light); color: var(--green); border-color: #b7ddc8; font-weight: 600; }
.topic-chip--all { font-weight: 700; color: var(--green); }


/* ============================================================
   DISCLAIMER
   ============================================================ */
.disclaimer {
  background: var(--amber-light);
  border-top: 1px solid #e8c080;
  padding: 14px 24px;
}
.disclaimer__inner {
  max-width: var(--max-w);
  margin: 0 auto;
  display: flex;
  align-items: flex-start;
  gap: 10px;
  font-size: 13px;
  color: #5a3a0a;
  line-height: 1.6;
}


/* ============================================================
   FOOTER
   ============================================================ */
footer {
  background: #0f2d1f;
  color: rgba(255,255,255,0.62);
  padding: 52px 24px 28px;
}
.footer__inner { max-width: var(--max-w); margin: 0 auto; }
.footer__top {
  display: grid;
  grid-template-columns: 1.4fr 1fr 1fr 1fr;
  gap: 36px;
  margin-bottom: 36px;
  padding-bottom: 36px;
  border-bottom: 1px solid rgba(255,255,255,0.08);
}
.footer__brand p { font-size: 13px; line-height: 1.72; margin: 10px 0 16px; }
.footer__socials { display: flex; gap: 9px; }
.footer__social {
  width: 33px; height: 33px;
  background: rgba(255,255,255,0.07);
  border: 1px solid rgba(255,255,255,0.1);
  border-radius: 8px;
  display: grid;
  place-items: center;
  font-size: 13px;
  color: rgba(255,255,255,0.7);
  transition: background 0.18s;
}
.footer__social:hover { background: rgba(255,255,255,0.14); color: #fff; }
.footer__col h5 {
  font-family: 'DM Sans', sans-serif;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 1px;
  text-transform: uppercase;
  color: rgba(255,255,255,0.38);
  margin-bottom: 14px;
}
.footer__col ul { list-style: none; display: flex; flex-direction: column; gap: 9px; }
.footer__col ul li a { font-size: 13.5px; color: rgba(255,255,255,0.62); transition: color 0.15s; }
.footer__col ul li a:hover { color: var(--green-glow); }
.footer__bottom {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
  font-size: 12px;
}


/* ============================================================
   RESPONSIVE
   ============================================================ */
@media (max-width: 900px) {
  .topic-hero__inner  { grid-template-columns: 1fr; }
  .topic-hero__ref    { display: none; }
  .content-layout     { grid-template-columns: 1fr; }
  .sidebar            { position: static; }
  .footer__top        { grid-template-columns: 1fr 1fr; }
}
@media (max-width: 600px) {
  .nav__links a:not(.nav__cta) { display: none; }
  .related-grid   { grid-template-columns: 1fr; }
  .footer__top    { grid-template-columns: 1fr; gap: 24px; }
  .footer__bottom { flex-direction: column; text-align: center; }
  .topic-hero__actions { flex-direction: column; }
  .topic-hero__actions .btn { justify-content: center; }
}
