/* ============================================================
   The Coffee Health Report — institutional stylesheet
   Palette: espresso browns + warm neutrals. Restrained, serious.
   ============================================================ */

:root {
  /* Coffee-brown scale */
  --espresso: #2a1a10;
  --coffee-900: #34210f;
  --coffee-800: #472d18;
  --coffee-700: #5d3a21;
  --coffee-600: #74492b;
  --coffee-500: #8a5a37;   /* primary accent */
  --coffee-400: #a56f48;
  --crema-300: #c79b73;
  --crema-200: #e3cdb2;
  --crema-100: #f0e2d2;

  /* Neutrals / paper */
  --paper: #fffdfb;
  --cream: #f7f1e9;
  --cream-2: #f2e9dd;
  --ink: #26201a;
  --muted: #6d6155;
  --line: #e6dccd;
  --line-strong: #d8cab5;

  /* Semantic (used sparingly) */
  --good: #2f7d5b;
  --good-bg: #e7f2ec;
  --caution: #b06c1e;
  --caution-bg: #f7ecdb;
  --risk: #a33a34;
  --risk-bg: #f6e5e3;
  --info: #35566f;

  /* Type */
  --serif: Georgia, "Iowan Old Style", "Palatino Linotype", "Book Antiqua", "Times New Roman", serif;
  --sans: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;

  --maxw: 1160px;
  --radius: 10px;
  --shadow: 0 1px 2px rgba(42, 26, 16, .06), 0 6px 24px rgba(42, 26, 16, .06);
  --shadow-sm: 0 1px 2px rgba(42, 26, 16, .08);
}

/* ---------- Reset-ish ---------- */
*, *::before, *::after { box-sizing: border-box; }
html { scroll-behavior: smooth; scroll-padding-top: 84px; -webkit-text-size-adjust: 100%; }
@media (prefers-reduced-motion: reduce) { html { scroll-behavior: auto; } }

body {
  margin: 0;
  font-family: var(--sans);
  color: var(--ink);
  background: var(--cream);
  line-height: 1.62;
  font-size: 17px;
  text-rendering: optimizeLegibility;
  -webkit-font-smoothing: antialiased;
}

h1, h2, h3, h4 { font-family: var(--serif); color: var(--coffee-900); line-height: 1.2; font-weight: 700; }
h2 { font-size: clamp(1.5rem, 1.1rem + 1.7vw, 2.15rem); margin: 0 0 .35em; letter-spacing: -.01em; }
h3 { font-size: 1.24rem; margin: 1.6em 0 .4em; color: var(--coffee-800); }
p { margin: 0 0 1.05em; }
a { color: var(--coffee-600); text-underline-offset: 2px; }
a:hover { color: var(--coffee-800); }
sup a { text-decoration: none; font-weight: 600; padding: 0 1px; }
strong { color: var(--coffee-900); }

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

/* ---------- Utilities ---------- */
.container { width: 100%; max-width: var(--maxw); margin-inline: auto; padding-inline: 22px; }
.visually-hidden {
  position: absolute !important; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}
.skip-link {
  position: absolute; left: 12px; top: -48px; z-index: 200;
  background: var(--coffee-800); color: #fff; padding: 10px 16px; border-radius: 0 0 8px 8px;
  transition: top .18s ease; text-decoration: none; font-weight: 600;
}
.skip-link:focus { top: 0; color:#fff; }

:focus-visible { outline: 3px solid var(--coffee-400); outline-offset: 2px; border-radius: 3px; }

/* ---------- Top utility strip ---------- */
.utility-bar {
  background: var(--espresso); color: var(--crema-200);
  font-size: .78rem; letter-spacing: .02em;
}
.utility-bar .container { display: flex; justify-content: space-between; align-items: center; gap: 12px; min-height: 34px; padding-block: 5px; }
.utility-bar a { color: var(--crema-200); }
.utility-bar .u-tag { text-transform: uppercase; letter-spacing: .14em; font-weight: 600; color: var(--crema-300); }

/* ---------- Header / nav ---------- */
.site-header {
  position: sticky; top: 0; z-index: 100;
  background: rgba(255,253,251,.94);
  backdrop-filter: saturate(1.2) blur(8px);
  border-bottom: 1px solid var(--line-strong);
}
.site-header .container { display: flex; align-items: center; justify-content: space-between; gap: 18px; min-height: 68px; }
.brand { display: flex; align-items: center; gap: 12px; text-decoration: none; }
.brand svg { flex: 0 0 auto; }
.brand-text { display: flex; flex-direction: column; line-height: 1.05; }
.brand-name { font-family: var(--serif); font-weight: 700; font-size: 1.16rem; color: var(--coffee-900); letter-spacing: -.01em; }
.brand-sub { font-size: .68rem; text-transform: uppercase; letter-spacing: .18em; color: var(--muted); font-weight: 600; }

.main-nav { display: flex; align-items: center; }
.main-nav ul { list-style: none; display: flex; gap: 2px; margin: 0; padding: 0; }
.main-nav a {
  display: block; padding: 9px 12px; border-radius: 7px;
  font-size: .92rem; font-weight: 600; color: var(--coffee-800); text-decoration: none;
  white-space: nowrap;
}
.main-nav a:hover { background: var(--crema-100); color: var(--coffee-900); }
.main-nav a.active { background: var(--coffee-700); color: #fff; }

.nav-toggle {
  display: none; border: 1px solid var(--line-strong); background: var(--paper);
  color: var(--coffee-800); border-radius: 8px; padding: 8px 12px; font-weight: 600; cursor: pointer;
  font-size: .9rem; align-items: center; gap: 8px;
}
.nav-toggle svg { display: block; }

@media (max-width: 920px) {
  .nav-toggle { display: inline-flex; }
  .main-nav {
    position: absolute; top: 100%; left: 0; right: 0;
    background: var(--paper); border-bottom: 1px solid var(--line-strong);
    box-shadow: var(--shadow); max-height: 0; overflow: hidden; transition: max-height .28s ease;
  }
  .main-nav.open { max-height: 640px; }
  .main-nav ul { flex-direction: column; padding: 10px 14px; gap: 0; }
  .main-nav a { padding: 12px 10px; border-radius: 6px; }
  .main-nav li + li { border-top: 1px solid var(--line); }
}
@media (prefers-reduced-motion: reduce) { .main-nav { transition: none; } }

/* ---------- Hero ---------- */
.hero {
  position: relative; overflow: hidden;
  background:
    radial-gradient(1200px 500px at 78% -12%, rgba(138,90,55,.16), transparent 60%),
    linear-gradient(180deg, #fffdfb 0%, #f7f1e9 100%);
  border-bottom: 1px solid var(--line);
}
.hero .container { padding-block: clamp(38px, 6vw, 74px); }
.hero-grid { display: grid; grid-template-columns: 1.35fr .9fr; gap: 40px; align-items: center; }
@media (max-width: 860px) { .hero-grid { grid-template-columns: 1fr; gap: 26px; } }

.eyebrow {
  display: inline-flex; align-items: center; gap: 8px;
  text-transform: uppercase; letter-spacing: .16em; font-size: .72rem; font-weight: 700;
  color: var(--coffee-600); background: var(--crema-100); border: 1px solid var(--crema-200);
  padding: 5px 11px; border-radius: 999px; margin-bottom: 16px;
}
.hero h1 {
  font-size: clamp(2.05rem, 1.3rem + 3.4vw, 3.4rem);
  margin: 0 0 .35em; letter-spacing: -.02em; color: var(--espresso);
}
.hero .lede { font-size: 1.14rem; color: #43382e; max-width: 46ch; margin-bottom: 22px; }
.hero-cta { display: flex; flex-wrap: wrap; gap: 12px; }

.btn {
  display: inline-flex; align-items: center; gap: 8px; text-decoration: none; cursor: pointer;
  font-weight: 600; font-size: .95rem; padding: 11px 20px; border-radius: 9px; border: 1px solid transparent;
}
.btn-primary { background: var(--coffee-700); color: #fff; }
.btn-primary:hover { background: var(--coffee-800); color: #fff; }
.btn-ghost { background: var(--paper); color: var(--coffee-800); border-color: var(--line-strong); }
.btn-ghost:hover { background: var(--crema-100); color: var(--coffee-900); }

.hero-card {
  background: var(--paper); border: 1px solid var(--line-strong); border-radius: 14px;
  padding: 22px 22px 8px; box-shadow: var(--shadow);
}
.hero-card h2 { font-size: 1.02rem; text-transform: uppercase; letter-spacing: .1em; color: var(--muted); margin-bottom: 14px; }
.stat-row { display: grid; grid-template-columns: 1fr 1fr; gap: 4px 18px; }
.stat { padding: 10px 0 14px; border-bottom: 1px solid var(--line); }
.stat .num { font-family: var(--serif); font-size: 1.85rem; font-weight: 700; color: var(--coffee-700); line-height: 1; }
.stat .lbl { font-size: .8rem; color: var(--muted); margin-top: 4px; }

/* ---------- Section scaffolding ---------- */
main section { padding-block: clamp(44px, 6vw, 76px); border-bottom: 1px solid var(--line); scroll-margin-top: 82px; }
main section:nth-of-type(even) { background: var(--paper); }
.section-head { max-width: 74ch; margin-bottom: 26px; }
.kicker {
  display: inline-block; text-transform: uppercase; letter-spacing: .15em; font-size: .74rem;
  font-weight: 700; color: var(--coffee-500); margin-bottom: 10px;
}
.section-head p.intro { font-size: 1.08rem; color: #443a30; margin-bottom: 0; }

.layout-2col { display: grid; grid-template-columns: 1fr 1fr; gap: 34px; align-items: start; }
@media (max-width: 900px) { .layout-2col { grid-template-columns: 1fr; gap: 26px; } }
.prose { max-width: 64ch; }
.prose h3:first-child { margin-top: 0; }

/* ---------- Figure / chart cards ---------- */
figure.chart-card {
  margin: 0; background: var(--paper); border: 1px solid var(--line-strong);
  border-radius: var(--radius); padding: 18px 18px 14px; box-shadow: var(--shadow-sm);
}
figure.chart-card.sticky { position: sticky; top: 90px; }
@media (max-width: 900px) { figure.chart-card.sticky { position: static; } }
.chart-title { font-family: var(--serif); font-weight: 700; color: var(--coffee-900); font-size: 1.05rem; margin: 2px 0 2px; }
.chart-sub { font-size: .82rem; color: var(--muted); margin-bottom: 12px; }
.chart-wrap { position: relative; width: 100%; }
.chart-wrap canvas { max-width: 100%; }
figure.chart-card figcaption { font-size: .78rem; color: var(--muted); margin-top: 12px; border-top: 1px dashed var(--line-strong); padding-top: 10px; }
figure.chart-card figcaption .src { font-style: italic; }

.chart-stack { display: grid; gap: 22px; }

/* ---------- Callouts / badges ---------- */
.callout {
  border-left: 4px solid var(--coffee-500); background: var(--cream-2);
  padding: 14px 18px; border-radius: 0 8px 8px 0; margin: 18px 0; font-size: .96rem;
}
.callout.good { border-left-color: var(--good); background: var(--good-bg); }
.callout.caution { border-left-color: var(--caution); background: var(--caution-bg); }
.callout.risk { border-left-color: var(--risk); background: var(--risk-bg); }
.callout .c-title { font-weight: 700; color: var(--coffee-900); display: block; margin-bottom: 3px; }

.badge {
  display: inline-flex; align-items: center; gap: 6px; font-size: .72rem; font-weight: 700;
  letter-spacing: .03em; text-transform: uppercase; padding: 3px 9px; border-radius: 999px;
  border: 1px solid; vertical-align: middle;
}
.badge::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: currentColor; }
.badge.strong { color: var(--good); background: var(--good-bg); border-color: #bcdcca; }
.badge.moderate { color: var(--caution); background: var(--caution-bg); border-color: #e8cfa6; }
.badge.weak { color: var(--risk); background: var(--risk-bg); border-color: #e6c3bf; }
.evidence-key { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; font-size: .82rem; color: var(--muted); margin-top: 8px; }

/* ---------- Data tables (accessible chart fallback + content) ---------- */
.data-table { width: 100%; border-collapse: collapse; font-size: .86rem; margin: 8px 0 4px; }
.data-table caption { text-align: left; font-size: .8rem; color: var(--muted); margin-bottom: 6px; }
.data-table th, .data-table td { text-align: left; padding: 8px 10px; border-bottom: 1px solid var(--line); }
.data-table thead th { background: var(--cream-2); color: var(--coffee-800); font-size: .78rem; text-transform: uppercase; letter-spacing: .04em; }
.data-table tbody tr:hover { background: var(--cream); }
details.table-toggle { margin-top: 10px; }
details.table-toggle summary { cursor: pointer; font-size: .82rem; font-weight: 600; color: var(--coffee-600); }
details.table-toggle[open] summary { margin-bottom: 8px; }

/* ---------- Key-takeaways list ---------- */
.takeaways { list-style: none; margin: 14px 0 0; padding: 0; }
.takeaways li { position: relative; padding-left: 28px; margin-bottom: 10px; font-size: .96rem; }
.takeaways li::before {
  content: ""; position: absolute; left: 0; top: 7px; width: 15px; height: 15px;
  background: var(--coffee-500);
  -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M20 6L9 17l-5-5' fill='none' stroke='black' stroke-width='3' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E") center/contain no-repeat;
  mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M20 6L9 17l-5-5' fill='none' stroke='black' stroke-width='3' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E") center/contain no-repeat;
}

/* ---------- Timeline (scandals) ---------- */
.timeline { position: relative; margin: 26px 0 0; padding: 0; list-style: none; }
.timeline::before { content: ""; position: absolute; left: 118px; top: 4px; bottom: 4px; width: 2px; background: var(--line-strong); }
.timeline li { position: relative; display: grid; grid-template-columns: 104px 1fr; gap: 22px; padding-bottom: 22px; }
.timeline .t-year { text-align: right; font-family: var(--serif); font-weight: 700; color: var(--coffee-700); font-size: 1.02rem; padding-top: 1px; }
.timeline .t-body { position: relative; padding-left: 22px; }
.timeline .t-body::before {
  content: ""; position: absolute; left: -6px; top: 6px; width: 13px; height: 13px; border-radius: 50%;
  background: var(--coffee-500); border: 3px solid var(--paper); box-shadow: 0 0 0 1px var(--coffee-300, var(--crema-300));
}
.timeline .t-title { font-weight: 700; color: var(--coffee-900); }
.timeline .t-meta { font-size: .85rem; color: var(--muted); }
.timeline .t-tag { display:inline-block; font-size:.68rem; font-weight:700; text-transform:uppercase; letter-spacing:.06em; padding:2px 7px; border-radius:4px; margin-left:6px; vertical-align:middle;}
.timeline .t-tag.fraud { background: var(--caution-bg); color: var(--caution); }
.timeline .t-tag.ethics { background: var(--risk-bg); color: var(--risk); }
.timeline .t-tag.legal { background: #e6edf2; color: var(--info); }
.timeline .t-tag.safety { background: var(--good-bg); color: var(--good); }
@media (max-width: 620px) {
  .timeline::before { left: 6px; }
  .timeline li { grid-template-columns: 1fr; gap: 2px; }
  .timeline .t-year { text-align: left; padding-left: 26px; }
  .timeline .t-body { padding-left: 26px; }
  .timeline .t-body::before { left: 0; }
}

/* ---------- FAQ ---------- */
.faq { max-width: 80ch; }
.faq details { border: 1px solid var(--line-strong); border-radius: 9px; background: var(--paper); margin-bottom: 12px; overflow: hidden; }
.faq summary {
  cursor: pointer; padding: 15px 18px; font-weight: 700; font-family: var(--serif); color: var(--coffee-900);
  font-size: 1.05rem; list-style: none; display: flex; justify-content: space-between; align-items: center; gap: 14px;
}
.faq summary::-webkit-details-marker { display: none; }
.faq summary::after { content: "+"; font-size: 1.4rem; color: var(--coffee-500); font-family: var(--sans); line-height: 1; }
.faq details[open] summary::after { content: "\2013"; }
.faq details[open] summary { border-bottom: 1px solid var(--line); }
.faq .faq-body { padding: 4px 18px 18px; color: #3d332b; }
.faq .faq-body p:last-child { margin-bottom: 0; }

/* ---------- Disclaimer band ---------- */
.disclaimer-band { background: var(--coffee-900); color: var(--crema-100); }
.disclaimer-band .container { padding-block: 26px; display: flex; gap: 16px; align-items: flex-start; }
.disclaimer-band svg { flex: 0 0 auto; margin-top: 2px; }
.disclaimer-band strong { color: #fff; }
.disclaimer-band a { color: var(--crema-200); }
.disclaimer-inline {
  font-size: .9rem; background: var(--caution-bg); border: 1px solid #e8cfa6; color: #5c4218;
  padding: 12px 16px; border-radius: 8px; display: flex; gap: 10px; align-items: flex-start;
}
.disclaimer-inline svg { flex: 0 0 auto; margin-top: 1px; }

/* ---------- References ---------- */
.references ol { padding-left: 1.3em; columns: 2; column-gap: 42px; font-size: .84rem; color: #423a31; }
@media (max-width: 760px) { .references ol { columns: 1; } }
.references li { margin-bottom: 10px; break-inside: avoid; padding-left: 4px; }
.references a { word-break: break-word; }

/* ---------- Footer ---------- */
.site-footer { background: var(--espresso); color: var(--crema-200); }
.site-footer .container { padding-block: 42px 30px; }
.footer-grid { display: grid; grid-template-columns: 1.4fr 1fr 1fr; gap: 34px; }
@media (max-width: 760px) { .footer-grid { grid-template-columns: 1fr; gap: 26px; } }
.site-footer h4 { color: #fff; font-size: .82rem; text-transform: uppercase; letter-spacing: .12em; margin: 0 0 12px; }
.site-footer a { color: var(--crema-200); text-decoration: none; }
.site-footer a:hover { color: #fff; text-decoration: underline; }
.footer-links { list-style: none; padding: 0; margin: 0; }
.footer-links li { margin-bottom: 8px; font-size: .9rem; }
.footer-about p { font-size: .9rem; color: var(--crema-300); max-width: 40ch; }
.social-row { display: flex; gap: 10px; margin-top: 6px; }
.social-row a {
  display: inline-flex; align-items: center; justify-content: center; width: 38px; height: 38px;
  border: 1px solid rgba(240,226,210,.24); border-radius: 9px; color: var(--crema-200);
}
.social-row a:hover { background: rgba(240,226,210,.12); color: #fff; }
.social-note { font-size: .74rem; color: var(--crema-300); margin-top: 10px; }
.footer-bottom { border-top: 1px solid rgba(240,226,210,.16); margin-top: 30px; padding-top: 18px; display: flex; justify-content: space-between; gap: 12px; flex-wrap: wrap; font-size: .8rem; color: var(--crema-300); }

.back-to-top {
  position: fixed; right: 20px; bottom: 20px; z-index: 90;
  width: 46px; height: 46px; border-radius: 50%; background: var(--coffee-700); color: #fff;
  border: none; cursor: pointer; box-shadow: var(--shadow); display: none; align-items: center; justify-content: center;
}
.back-to-top.show { display: inline-flex; }
.back-to-top:hover { background: var(--coffee-800); }

/* ---------- Print ---------- */
@media print {
  .site-header, .utility-bar, .back-to-top, .nav-toggle, .hero-cta { display: none !important; }
  body { background: #fff; font-size: 12px; }
  figure.chart-card { break-inside: avoid; }
}
