:root {
  --paper: #f6f2ea;
  --paper-strong: #fffdf8;
  --ink: #17231e;
  --muted: #667069;
  --line: #d8ded6;
  --sage: #dbe8df;
  --sage-deep: #275743;
  --amber: #f1dfb8;
  --danger: #8c332d;
  --danger-bg: #f4ded8;
  --shadow: 0 18px 55px rgba(33, 51, 42, 0.08);
  --radius-lg: 28px;
  --radius-md: 18px;
  --max: 1180px;
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  margin: 0;
  color: var(--ink);
  background: var(--paper);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
  line-height: 1.65;
}

button, input, textarea { font: inherit; }
a { color: inherit; }

.skip-link {
  position: fixed;
  left: 16px;
  top: -80px;
  z-index: 100;
  padding: 10px 14px;
  border-radius: 10px;
  background: var(--ink);
  color: white;
}

.skip-link:focus { top: 16px; }

.site-header {
  position: sticky;
  top: 0;
  z-index: 50;
  border-bottom: 1px solid rgba(216, 222, 214, 0.85);
  background: rgba(246, 242, 234, 0.9);
  backdrop-filter: blur(16px);
}

.header-inner {
  width: min(var(--max), calc(100% - 40px));
  min-height: 72px;
  margin: auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 28px;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  font-weight: 750;
  text-decoration: none;
}

.brand-mark {
  width: 30px;
  height: 30px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  color: var(--paper-strong);
  background: var(--sage-deep);
  font-size: 20px;
}

nav { display: flex; gap: 26px; }
nav a { color: var(--muted); font-size: 14px; font-weight: 700; text-decoration: none; }
nav a:hover, nav a:focus-visible { color: var(--ink); }

.hero {
  width: min(var(--max), calc(100% - 40px));
  margin: 0 auto;
  padding: 100px 0 76px;
  display: grid;
  grid-template-columns: minmax(0, 1.45fr) minmax(300px, 0.7fr);
  gap: 70px;
  align-items: end;
}

.eyebrow, .card-kicker {
  margin: 0 0 14px;
  color: var(--sage-deep);
  font-size: 12px;
  font-weight: 850;
  letter-spacing: 0.15em;
  text-transform: uppercase;
}

.eyebrow.danger { color: var(--danger); }

h1, h2, h3, p { margin-top: 0; }
h1, h2, h3 { line-height: 1.16; letter-spacing: -0.035em; }

h1 {
  margin-bottom: 26px;
  font-family: Georgia, "Noto Serif SC", serif;
  font-size: clamp(48px, 7vw, 86px);
  font-weight: 500;
}

.hero-lede { max-width: 720px; color: var(--muted); font-size: 18px; }
.hero-actions { margin-top: 34px; display: flex; flex-wrap: wrap; gap: 12px; }

.button {
  min-height: 48px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 1px solid transparent;
  border-radius: 999px;
  padding: 11px 20px;
  cursor: pointer;
  font-weight: 760;
  text-decoration: none;
  transition: transform 160ms ease, background 160ms ease;
}

.button:hover { transform: translateY(-1px); }
.button.primary { color: white; background: var(--sage-deep); }
.button.secondary { border-color: var(--ink); color: var(--ink); background: transparent; }
.button.ghost { color: var(--muted); background: transparent; }

.priority-card {
  position: relative;
  overflow: hidden;
  padding: 34px;
  border: 1px solid #c9d9ce;
  border-radius: var(--radius-lg);
  background: var(--sage);
  box-shadow: var(--shadow);
}

.priority-card::after {
  content: "";
  position: absolute;
  width: 140px;
  height: 140px;
  right: -50px;
  bottom: -60px;
  border: 26px solid rgba(39, 87, 67, 0.08);
  border-radius: 50%;
}

.priority-card h2 { max-width: 390px; font-size: 30px; }
.status-dot { display: block; width: 10px; height: 10px; margin-bottom: 28px; border-radius: 50%; background: #c56c39; box-shadow: 0 0 0 7px rgba(197, 108, 57, 0.14); }
.small { color: var(--muted); font-size: 13px; }

.emergency-strip {
  width: min(var(--max), calc(100% - 40px));
  margin: 0 auto 28px;
  padding: 28px 32px;
  display: grid;
  grid-template-columns: 0.72fr 1.4fr;
  gap: 40px;
  border: 1px solid #dfb8ae;
  border-radius: var(--radius-md);
  background: var(--danger-bg);
}

.emergency-strip h2 { margin-bottom: 0; font-size: 25px; }
.emergency-strip ul { margin: 0; padding-left: 20px; }

.section { padding: 96px max(20px, calc((100% - var(--max)) / 2)); }
.section.muted { background: #ebece5; }
.section-heading { max-width: 700px; margin-bottom: 42px; }
.section-heading h2 { margin-bottom: 14px; font-family: Georgia, "Noto Serif SC", serif; font-size: clamp(36px, 5vw, 56px); font-weight: 500; }
.section-heading > p:last-child { color: var(--muted); }

.summary-grid {
  display: grid;
  grid-template-columns: 1.25fr 0.75fr;
  gap: 18px;
}

.panel {
  padding: 30px;
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  background: var(--paper-strong);
}

.panel.wide { grid-row: span 2; }
.panel h3, .treatment-card h3, .food-rules h3 { font-size: 24px; }

.detail-list { margin: 0; padding: 0; list-style: none; }
.detail-list li { padding: 13px 0; display: grid; grid-template-columns: 94px 1fr; gap: 20px; border-bottom: 1px solid var(--line); }
.detail-list li:last-child { border-bottom: 0; }
.detail-list span { color: var(--muted); font-size: 13px; font-weight: 800; }
.detail-list strong { font-weight: 650; }

.tag-list { display: flex; flex-wrap: wrap; gap: 9px; }
.tag-list span, .avoid-card span { padding: 7px 12px; border-radius: 999px; background: var(--sage); font-size: 13px; font-weight: 720; }

.clinician-note {
  margin-top: 18px;
  padding: 27px 30px;
  display: flex;
  align-items: center;
  gap: 30px;
  justify-content: space-between;
  border-radius: var(--radius-md);
  color: white;
  background: var(--ink);
}

.clinical-update {
  margin-top: 18px;
  padding: 30px;
  display: grid;
  grid-template-columns: minmax(220px, .55fr) minmax(0, 1.45fr);
  gap: 36px;
  border: 1px solid #d7bf8a;
  border-radius: var(--radius-md);
  background: #f4e7c9;
}

.clinical-update h3 { margin-bottom: 0; font-size: 27px; }
.clinical-update p:last-child { margin-bottom: 0; }

.clinician-note p:last-child { margin-bottom: 0; }
.copy-button { flex: 0 0 auto; padding: 9px 14px; border: 1px solid rgba(255,255,255,.4); border-radius: 999px; color: white; background: transparent; cursor: pointer; }

.possibility-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 18px; }
.possibility-grid article { min-height: 230px; padding: 28px; border-top: 2px solid var(--sage-deep); background: var(--paper-strong); }
.possibility-grid article > span { color: var(--sage-deep); font-family: Georgia, serif; font-size: 32px; }
.possibility-grid h3 { margin-top: 38px; margin-bottom: 10px; font-size: 22px; }
.possibility-grid p { color: var(--muted); font-size: 14px; }

.treatment-stack { display: grid; gap: 18px; }
.treatment-card { padding: 32px; display: grid; grid-template-columns: 68px 1fr; gap: 24px; border: 1px solid var(--line); border-radius: var(--radius-md); background: var(--paper-strong); }
.treatment-card.featured { border-color: #b8cec0; background: var(--sage); }
.treatment-rank { width: 56px; height: 56px; display: grid; place-items: center; border: 1px solid currentColor; border-radius: 50%; color: var(--sage-deep); font-family: Georgia, serif; font-size: 26px; }
.treatment-card h3 { margin-bottom: 13px; }
.treatment-card code { padding: 2px 5px; border-radius: 5px; background: rgba(39,87,67,.09); }
.compact-list { margin: 14px 0 0; padding-left: 18px; color: var(--muted); }

.avoid-card { margin-top: 18px; padding: 30px; border-radius: var(--radius-md); background: var(--amber); }
.avoid-card > div { display: flex; flex-wrap: wrap; gap: 8px; }
.avoid-card span { background: rgba(255,255,255,.55); }
.avoid-card p { margin: 18px 0 0; }

.timeline { position: relative; display: grid; gap: 1px; overflow: hidden; border: 1px solid var(--line); border-radius: var(--radius-md); background: var(--line); }
.rx-note { margin-bottom: 18px; padding: 18px 22px; border-left: 4px solid var(--sage-deep); border-radius: 0 12px 12px 0; background: var(--sage); }
.timeline label { padding: 23px 28px; display: grid; grid-template-columns: 24px 1fr; gap: 18px; align-items: start; background: var(--paper-strong); cursor: pointer; }
.timeline label:hover { background: #fbfaf5; }
.timeline input { width: 20px; height: 20px; margin-top: 2px; accent-color: var(--sage-deep); }
.timeline input:checked + span { color: #7b837e; text-decoration: line-through; }
.timeline b { display: inline-block; width: 86px; color: var(--sage-deep); }

.day-tabs { margin-bottom: 18px; display: flex; gap: 8px; }
.day-tabs button { padding: 10px 18px; border: 1px solid var(--line); border-radius: 999px; color: var(--muted); background: transparent; cursor: pointer; font-weight: 800; }
.day-tabs button[aria-selected="true"] { border-color: var(--sage-deep); color: white; background: var(--sage-deep); }
.meal-day { display: grid; grid-template-columns: repeat(4, 1fr); gap: 16px; }
.meal-day[hidden] { display: none; }
.meal-day article { min-height: 210px; padding: 26px; display: flex; flex-direction: column; justify-content: flex-end; border-radius: var(--radius-md); background: var(--sage); }
.meal-day article:nth-child(2) { background: #efe3c7; }
.meal-day article:nth-child(3) { background: #dfe6ea; }
.meal-day article:nth-child(4) { background: #eadfdc; }
.meal-day article p { margin-bottom: auto; color: var(--muted); font-size: 13px; font-weight: 800; }
.meal-day article h3 { margin-bottom: 6px; font-size: 22px; }
.meal-day article span { color: var(--muted); font-size: 14px; }

.food-rules { margin-top: 20px; display: grid; grid-template-columns: repeat(3, 1fr); gap: 18px; }
.food-rules article { padding: 28px 0; border-top: 1px solid var(--ink); }
.food-rules p { color: var(--muted); }

.tracker-section { background: var(--ink); color: white; }
.tracker-section .section-heading > p:last-child { color: #aeb9b2; }
.tracker-section .eyebrow { color: #91bda5; }
.tracker { padding: 32px; display: grid; grid-template-columns: 1fr 1fr; gap: 26px; border: 1px solid rgba(255,255,255,.15); border-radius: var(--radius-lg); background: rgba(255,255,255,.05); }
.tracker label { display: grid; gap: 12px; }
.tracker label > span { display: flex; justify-content: space-between; gap: 18px; font-weight: 720; }
.tracker output { color: #b8d8c7; }
.tracker input[type="range"] { width: 100%; accent-color: #9fcbb4; }
.tracker .notes-label, .form-actions, .save-status { grid-column: 1 / -1; }
.tracker textarea { resize: vertical; border: 1px solid rgba(255,255,255,.2); border-radius: 12px; padding: 12px; color: white; background: rgba(255,255,255,.07); }
.tracker textarea::placeholder { color: #93a199; }
.form-actions { display: flex; flex-wrap: wrap; gap: 8px; }
.tracker .button.primary { color: var(--ink); background: #b8d8c7; }
.tracker .button.ghost { color: #c2cdc6; }
.save-status { min-height: 20px; margin: 0; color: #b8d8c7; }

.history { margin-top: 20px; display: grid; gap: 10px; }
.history-entry { padding: 18px 20px; display: grid; grid-template-columns: 130px 1fr; gap: 16px; border-bottom: 1px solid rgba(255,255,255,.15); }
.history-entry time { color: #9ab4a6; font-weight: 750; }
.history-entry p { margin: 0; color: #ced6d1; }

.decision-grid { margin-top: 50px; display: grid; grid-template-columns: repeat(4, 1fr); gap: 15px; }
.decision-grid article { padding: 25px; border: 1px solid rgba(255,255,255,.15); border-radius: var(--radius-md); }
.decision-day { margin-bottom: 32px; color: #9fcbb4; font-size: 12px; font-weight: 850; letter-spacing: .14em; }
.decision-grid h3 { font-size: 21px; }
.decision-grid article > p:last-child { color: #b7c1bb; font-size: 14px; }

.reference-links { display: grid; grid-template-columns: 1fr 1fr; border-top: 1px solid var(--line); }
.reference-links a { padding: 18px 2px; display: flex; justify-content: space-between; gap: 18px; border-bottom: 1px solid var(--line); text-decoration: none; }
.reference-links a:nth-child(odd) { padding-right: 30px; }
.reference-links a:nth-child(even) { padding-left: 30px; border-left: 1px solid var(--line); }
.reference-links a:hover { color: var(--sage-deep); }
.updated { margin-top: 30px; color: var(--muted); font-size: 13px; }

footer { padding: 30px max(20px, calc((100% - var(--max)) / 2)); display: flex; justify-content: space-between; gap: 28px; border-top: 1px solid var(--line); color: var(--muted); font-size: 13px; }
footer p { margin: 0; }

:focus-visible { outline: 3px solid #d5894e; outline-offset: 3px; }

@media (max-width: 900px) {
  nav { display: none; }
  .hero { padding-top: 72px; grid-template-columns: 1fr; gap: 38px; }
  .emergency-strip, .summary-grid { grid-template-columns: 1fr; }
  .clinical-update { grid-template-columns: 1fr; gap: 16px; }
  .panel.wide { grid-row: auto; }
  .possibility-grid { grid-template-columns: 1fr 1fr; }
  .meal-day { grid-template-columns: 1fr 1fr; }
  .food-rules { grid-template-columns: 1fr; }
  .decision-grid { grid-template-columns: 1fr 1fr; }
}

@media (max-width: 600px) {
  .header-inner, .hero, .emergency-strip { width: min(100% - 28px, var(--max)); }
  .header-inner { min-height: 62px; }
  .hero { padding: 54px 0 46px; }
  h1 { font-size: 45px; }
  .section { padding-top: 70px; padding-bottom: 70px; }
  .section-heading h2 { font-size: 39px; }
  .priority-card, .panel, .treatment-card, .tracker { padding: 23px; }
  .emergency-strip { padding: 23px; gap: 18px; }
  .possibility-grid, .meal-day, .decision-grid, .tracker, .reference-links { grid-template-columns: 1fr; }
  .treatment-card { grid-template-columns: 1fr; }
  .possibility-grid article { min-height: 0; }
  .possibility-grid h3 { margin-top: 24px; }
  .meal-day article { min-height: 180px; }
  .detail-list li { grid-template-columns: 1fr; gap: 3px; }
  .clinician-note { align-items: flex-start; flex-direction: column; }
  .timeline label { padding: 20px; }
  .timeline b { width: auto; display: block; margin-bottom: 4px; }
  .reference-links a, .reference-links a:nth-child(odd), .reference-links a:nth-child(even) { padding: 17px 0; border-left: 0; }
  footer { flex-direction: column; }
  .history-entry { grid-template-columns: 1fr; gap: 5px; }
}

@media print {
  .site-header, .hero-actions, .day-tabs, .tracker, .history, footer { display: none !important; }
  body { background: white; color: black; }
  .hero, .section, .emergency-strip { width: 100%; padding: 26px 0; margin: 0; }
  .hero { display: block; }
  .priority-card, .panel, .treatment-card, .avoid-card, .emergency-strip { box-shadow: none; break-inside: avoid; }
  .section.muted, .tracker-section { background: white; color: black; }
  .possibility-grid { grid-template-columns: repeat(2, 1fr); }
  .meal-day { display: grid !important; grid-template-columns: repeat(4, 1fr); margin-bottom: 12px; }
  .meal-day[hidden] { display: grid !important; }
  a { text-decoration: none; }
}
