/* ==========================================================================
   IOL Advisor — Design System
   Tokens extracted from the Readdy v2 preview (2026-08-17)
   ========================================================================== */

@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700&family=Lora:wght@500;600;700&display=swap');

:root {
  /* Colors (converted from oklch tokens captured on the live preview) */
  --color-bg: #FAF7F0;              /* oklch(0.98 0.01 80) warm cream */
  --color-bg-alt: #F3EFE6;          /* slightly deeper cream, section bands */
  --color-text: #1C1C22;            /* oklch(0.12 0.01 280) near-black */
  --color-text-muted: #63636B;      /* oklch(0.4 0.01 280) medium gray */
  --color-border: #E4DFD3;
  --color-primary: #2F6B4F;         /* oklch(0.52 0.13 160) forest green */
  --color-primary-dark: #24543E;
  --color-primary-contrast: #FAF7F0;
  --color-accent-soft: #E7F0EA;     /* pale green backgrounds for badges */
  --color-warn-soft: #FBEFE4;       /* soft amber for "serious" tags */
  --color-danger-soft: #FBEAEA;

  --font-serif: 'Lora', Georgia, 'Times New Roman', serif;
  --font-sans: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;

  --radius: 8px;
  --radius-lg: 16px;
  --shadow-sm: 0 1px 2px rgba(28,28,34,0.06);
  --shadow-md: 0 4px 16px rgba(28,28,34,0.08);

  --max-width: 1120px;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }

body {
  margin: 0;
  font-family: var(--font-sans);
  font-size: 18px;
  line-height: 1.65;
  color: var(--color-text);
  background: var(--color-bg);
  -webkit-font-smoothing: antialiased;
}

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

a { color: inherit; text-decoration: none; }

h1, h2, h3, h4 {
  font-family: var(--font-serif);
  font-weight: 600;
  line-height: 1.15;
  margin: 0 0 0.5em;
  color: var(--color-text);
}
h1 { font-size: clamp(2.2rem, 4vw + 1rem, 3.5rem); line-height: 1.1; }
h2 { font-size: clamp(1.5rem, 2vw + 1rem, 2rem); }
h3 { font-size: 1.3rem; }
h4 { font-size: 1.1rem; }

p { margin: 0 0 1.1em; color: var(--color-text); }
p.lede { font-size: 1.15rem; color: var(--color-text-muted); }

ul, ol { padding-left: 1.3em; }
li { margin-bottom: 0.5em; }

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

/* Skip link for accessibility */
.skip-link {
  position: absolute; left: -9999px; top: 0;
  background: var(--color-primary); color: #fff; padding: 12px 20px; z-index: 200;
}
.skip-link:focus { left: 16px; top: 16px; }

/* ---------- Header ---------- */
.site-header {
  position: sticky; top: 0; z-index: 100;
  background: rgba(250,247,240,0.92);
  backdrop-filter: blur(6px);
  border-bottom: 1px solid var(--color-border);
}
.site-header .container {
  display: flex; align-items: center; justify-content: space-between;
  padding-top: 16px; padding-bottom: 16px; gap: 24px;
}
.brand { display: flex; flex-direction: column; line-height: 1.1; }
.brand-name { font-family: var(--font-serif); font-weight: 600; font-size: 1.4rem; }
.brand-tagline { font-size: 0.78rem; color: var(--color-text-muted); }

.nav-desktop { display: flex; align-items: center; gap: 4px; flex: 1; justify-content: center; }
.nav-desktop > .nav-item { position: relative; }
.nav-link {
  display: inline-flex; align-items: center; gap: 4px;
  padding: 10px 14px; border-radius: var(--radius);
  font-weight: 500; font-size: 0.98rem; white-space: nowrap;
}
.nav-link:hover, .nav-link:focus-visible { background: var(--color-accent-soft); color: var(--color-primary-dark); }

.nav-dropdown {
  position: absolute; top: 100%; left: 0; min-width: 240px;
  background: #fff; border: 1px solid var(--color-border); border-radius: var(--radius-lg);
  box-shadow: var(--shadow-md); padding: 8px; margin-top: 6px;
  opacity: 0; visibility: hidden; transform: translateY(4px);
  transition: opacity .15s ease, transform .15s ease, visibility .15s;
}
.nav-item:hover .nav-dropdown,
.nav-item:focus-within .nav-dropdown { opacity: 1; visibility: visible; transform: translateY(0); }
.nav-dropdown a { display: block; padding: 9px 12px; border-radius: 6px; font-size: 0.94rem; }
.nav-dropdown a:hover { background: var(--color-accent-soft); }

.header-actions { display: flex; align-items: center; gap: 10px; }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  font-family: var(--font-sans); font-weight: 600; font-size: 0.98rem;
  padding: 12px 22px; border-radius: var(--radius); border: 1px solid transparent;
  cursor: pointer; transition: background .15s, transform .05s, border-color .15s;
}
.btn:active { transform: translateY(1px); }
.btn-primary { background: var(--color-primary); color: var(--color-primary-contrast); }
.btn-primary:hover { background: var(--color-primary-dark); }
.btn-outline { background: transparent; border-color: var(--color-border); color: var(--color-text); }
.btn-outline:hover { border-color: var(--color-primary); color: var(--color-primary-dark); }
.btn-sm { padding: 8px 16px; font-size: 0.88rem; }

.menu-toggle { display: none; background: none; border: 1px solid var(--color-border); border-radius: var(--radius); padding: 8px 10px; }

.nav-mobile { display: none; border-top: 1px solid var(--color-border); text-align: left; }
.nav-mobile.open { display: block; padding: 14px 0 22px; }
.nav-mobile .nav-link { display: block; width: 100%; justify-content: flex-start; text-align: left; }

/* ---------- Hero / sections ---------- */
.section { padding: 64px 0; }
.section-alt { background: var(--color-bg-alt); }
.section-tight { padding: 40px 0; }

.eyebrow {
  display: inline-flex; align-items: center; gap: 8px;
  background: var(--color-accent-soft); color: var(--color-primary-dark);
  font-size: 0.85rem; font-weight: 600; padding: 7px 16px; border-radius: 999px;
  margin-bottom: 20px;
}

.hero .lede { max-width: 640px; }
.hero-actions { display: flex; gap: 12px; flex-wrap: wrap; margin-top: 28px; }

.breadcrumbs { font-size: 0.9rem; color: var(--color-text-muted); margin-bottom: 20px; }
.breadcrumbs a:hover { color: var(--color-primary-dark); }

/* ---------- Cards / grids ---------- */
.grid { display: grid; gap: 20px; }
.grid-3 { grid-template-columns: repeat(3, 1fr); }
.grid-2 { grid-template-columns: repeat(2, 1fr); }
@media (max-width: 860px) { .grid-3, .grid-2 { grid-template-columns: 1fr; } }

.card {
  background: #fff; border: 1px solid var(--color-border); border-radius: var(--radius-lg);
  padding: 26px; transition: box-shadow .15s, transform .15s;
}
a.card:hover { box-shadow: var(--shadow-md); transform: translateY(-2px); }
.card h3 { margin-bottom: 8px; }
.card p { margin-bottom: 8px; color: var(--color-text-muted); }
.card .meta { font-size: 0.82rem; color: var(--color-text-muted); }

.card-disabled {
  background: var(--color-bg-alt); border: 1px dashed var(--color-border); border-radius: var(--radius-lg);
  padding: 26px; opacity: 0.75;
}
.card-disabled h3 { color: var(--color-text-muted); }

.badge {
  display: inline-block; font-size: 0.72rem; font-weight: 600; letter-spacing: 0.02em;
  padding: 4px 10px; border-radius: 999px; text-transform: uppercase;
}
.badge-soon { background: var(--color-warn-soft); color: #8A5A28; }
.badge-common { background: var(--color-accent-soft); color: var(--color-primary-dark); }
.badge-moderate { background: var(--color-warn-soft); color: #8A5A28; }
.badge-serious { background: var(--color-danger-soft); color: #A13B3B; }

/* ---------- Tabs (IOL detail pages) ---------- */
.tabs { display: flex; gap: 6px; background: var(--color-bg-alt); padding: 6px; border-radius: 999px; width: fit-content; margin-bottom: 32px; }
.tab-btn {
  border: none; background: transparent; padding: 10px 20px; border-radius: 999px;
  font-family: var(--font-sans); font-weight: 600; font-size: 0.92rem; cursor: pointer; color: var(--color-text-muted);
}
.tab-btn.active { background: var(--color-primary); color: #fff; }
.tab-panel { display: none; }
.tab-panel.active { display: block; }

.range-bar { display: flex; gap: 6px; margin: 14px 0 6px; }
.range-bar .seg { flex: 1; height: 8px; border-radius: 4px; background: var(--color-border); }
.range-bar .seg.fill { background: var(--color-primary); }
.range-legend { display: flex; gap: 20px; font-size: 0.85rem; color: var(--color-text-muted); margin-bottom: 8px; }
.range-legend .dot { display: inline-block; width: 9px; height: 9px; border-radius: 50%; background: var(--color-primary); margin-right: 6px; }

.pros-cons { display: grid; grid-template-columns: 1fr 1fr; gap: 24px; margin: 24px 0; }
@media (max-width: 700px) { .pros-cons { grid-template-columns: 1fr; } }
.pros-cons h4 { margin-bottom: 10px; }
.pros-cons ul { list-style: none; padding: 0; }
.pros-cons li { padding-left: 26px; position: relative; }
.pros .li-icon::before { content: "✓"; position: absolute; left: 0; color: var(--color-primary); font-weight: 700; }
.cons .li-icon::before { content: "–"; position: absolute; left: 0; color: var(--color-text-muted); font-weight: 700; }
.pros li::before { content: "✓"; position: absolute; left: 0; color: var(--color-primary); font-weight: 700; }
.cons li::before { content: "–"; position: absolute; left: 0; color: #A13B3B; font-weight: 700; }

/* ---------- Table (compare tool) ---------- */
.table-wrap { overflow-x: auto; border: 1px solid var(--color-border); border-radius: var(--radius-lg); background: #fff; }
table.compare { border-collapse: collapse; width: 100%; min-width: 760px; }
table.compare th, table.compare td { padding: 16px 18px; text-align: left; border-bottom: 1px solid var(--color-border); vertical-align: top; }
table.compare thead th { font-family: var(--font-serif); background: var(--color-bg-alt); font-size: 1rem; font-weight: 600; }
table.compare td.crit { font-weight: 600; color: var(--color-text-muted); white-space: nowrap; }
table.compare td.crit i { color: var(--color-text-muted); margin-right: 8px; font-size: 1rem; vertical-align: -2px; }
table.compare tr:last-child td { border-bottom: none; }
table.compare .rating { font-weight: 600; display: block; }
table.compare .rating-sub { display: block; font-size: 0.82rem; color: var(--color-text-muted); font-weight: 400; }

/* Category color swatch in table header */
.cat-dot { display: inline-block; width: 10px; height: 10px; border-radius: 50%; margin-right: 8px; vertical-align: 1px; }
.cat-dot.cat-monofocal { background: #4F8F6C; background: oklch(0.65 0.11 160); }
.cat-dot.cat-enhanced  { background: #A9C9B7; background: oklch(0.78 0.08 160); }
.cat-dot.cat-edof      { background: #B99A72; background: oklch(0.70 0.06 65); }
.cat-dot.cat-fullrange { background: #5F8F75; background: oklch(0.60 0.06 140); }

/* 5-dot rating pips — filled dots take the tier color, empty dots stay neutral */
.dots { display: block; margin-bottom: 6px; white-space: nowrap; }
.dots .dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; margin-right: 3px; background: #E9E4DA; background: oklch(0.92 0.01 80); }
.dots[data-level="5"] .dot.on { background: #2F6B4F; background: oklch(0.52 0.13 160); }
.dots[data-level="4"] .dot.on { background: #4F8F6C; background: oklch(0.65 0.11 160); }
.dots[data-level="3"] .dot.on { background: #A9C9B7; background: oklch(0.78 0.08 160); }
.dots[data-level="2"] .dot.on { background: #B99A72; background: oklch(0.70 0.06 65); }
.dots[data-level="1"] .dot.on { background: #D6C0A0; background: oklch(0.80 0.05 65); }

/* "Understanding the ratings" legend dots, reusing the same tier scale */
.legend-dot { display: inline-block; width: 10px; height: 10px; border-radius: 50%; margin-right: 8px; vertical-align: 1px; }
.legend-dot.lv5 { background: #2F6B4F; background: oklch(0.52 0.13 160); }
.legend-dot.lv4 { background: #4F8F6C; background: oklch(0.65 0.11 160); }
.legend-dot.lv3 { background: #A9C9B7; background: oklch(0.78 0.08 160); }
.legend-dot.lv2 { background: #B99A72; background: oklch(0.70 0.06 65); }
.legend-dot.lv1 { background: #D6C0A0; background: oklch(0.80 0.05 65); }

/* ---------- Steps (patient guide) ---------- */
.steps { counter-reset: step; list-style: none; padding: 0; margin: 0; }
.steps li {
  counter-increment: step; display: flex; gap: 20px; padding: 20px 0;
  border-bottom: 1px solid var(--color-border);
}
.steps li:last-child { border-bottom: none; }
.steps li::before {
  content: counter(step); flex-shrink: 0; width: 36px; height: 36px; border-radius: 50%;
  background: var(--color-primary); color: #fff; display: flex; align-items: center; justify-content: center;
  font-weight: 700; font-family: var(--font-serif);
}

/* ---------- Article ---------- */
.article-meta { display: flex; gap: 14px; align-items: center; font-size: 0.88rem; color: var(--color-text-muted); margin-bottom: 24px; flex-wrap: wrap;}
.article-body { max-width: 720px; font-size: 1.08rem; }
.article-body h2 { margin-top: 1.6em; }

/* ---------- Disclaimer ---------- */
.disclaimer {
  background: var(--color-bg-alt); border: 1px solid var(--color-border); border-radius: var(--radius);
  padding: 18px 22px; font-size: 0.92rem; color: var(--color-text-muted); margin: 32px 0;
}

/* ---------- Footer ---------- */
.site-footer { background: #1C1C22; color: #D8D6CF; padding: 64px 0 32px; margin-top: 80px; }
.site-footer a:hover { color: #fff; }
.footer-grid { display: grid; grid-template-columns: 1.4fr repeat(4, 1fr); gap: 32px; }
@media (max-width: 900px) { .footer-grid { grid-template-columns: repeat(2, 1fr); } }
.footer-col h4 { color: #fff; font-family: var(--font-sans); font-size: 0.85rem; text-transform: uppercase; letter-spacing: 0.04em; margin-bottom: 14px; }
.footer-col ul { list-style: none; padding: 0; margin: 0; }
.footer-col li { margin-bottom: 10px; font-size: 0.92rem; color: #A9A69B; }
.footer-col .soon { color: #6b6960; }
.footer-brand p { color: #A9A69B; font-size: 0.92rem; }
.footer-bottom {
  margin-top: 48px; padding-top: 24px; border-top: 1px solid #35353D;
  display: flex; justify-content: space-between; flex-wrap: wrap; gap: 12px;
  font-size: 0.85rem; color: #8B887E;
}
.footer-bottom a { margin-left: 16px; }

/* ---------- Utility ---------- */
.center { text-align: center; }
.mt-0 { margin-top: 0; }
.text-muted { color: var(--color-text-muted); }
.stack { display: flex; flex-direction: column; gap: 12px; }
.divider { height: 1px; background: var(--color-border); border: none; margin: 40px 0; }

@media (max-width: 900px) {
  .nav-desktop { display: none; }
  .menu-toggle { display: inline-flex; }
}
