/* BloodSugarEasy design system v2 — petrol teal / clinical off-white / muted green
   Display font: Plus Jakarta Sans (headings, brand); body: system stack. */

:root {
  --primary: #12444A;
  --primary-ink: #0C3136;
  --primary-soft: #1A5A62;
  --tint: #E7F0EE;
  --surface: #F5F8F7;
  --card: #FFFFFF;
  --ink: #1A2B2A;
  --muted: #5A6B6A;
  --line: #DCE6E4;
  --good: #4C9A70;
  --warn: #E0A43C;
  --bad: #D9463C;
  --low: #4A6FB5;
  --radius: 16px;
  --shadow: 0 1px 2px rgba(18, 68, 74, 0.06), 0 8px 24px -12px rgba(18, 68, 74, 0.18);
  --shadow-lift: 0 2px 4px rgba(18, 68, 74, 0.08), 0 16px 32px -12px rgba(18, 68, 74, 0.26);
  --font-display: "Plus Jakarta Sans", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
body {
  margin: 0;
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  font-size: 17px;
  line-height: 1.65;
  color: var(--ink);
  background: var(--surface);
}
img, svg { max-width: 100%; height: auto; }
a { color: var(--primary); text-underline-offset: 2px; }
a:hover { color: var(--primary-soft); }
h1, h2, h3 { font-family: var(--font-display); line-height: 1.22; color: var(--primary-ink); letter-spacing: -0.015em; }
h1 { font-size: clamp(1.7rem, 4.2vw, 2.3rem); font-weight: 800; margin: 0 0 .5em; }
h2 { font-size: 1.42rem; font-weight: 700; margin: 1.6em 0 .5em; }
h3 { font-size: 1.08rem; font-weight: 700; margin: 1.2em 0 .4em; }
.wrap { max-width: 1040px; margin: 0 auto; padding: 0 20px; }
.small { font-size: .88rem; }
.muted { color: var(--muted); }
:focus-visible { outline: 3px solid rgba(18, 68, 74, .45); outline-offset: 2px; border-radius: 4px; }
[id] { scroll-margin-top: 24px; }

.skip-link { position: absolute; left: -9999px; }
.skip-link:focus { left: 12px; top: 12px; background: #fff; padding: 8px 14px; z-index: 100; }

/* ---------------------------------------------------------------- header */
.site-header {
  background: linear-gradient(135deg, var(--primary-ink) 0%, var(--primary) 55%, var(--primary-soft) 100%);
  color: #fff;
  border-bottom: 3px solid rgba(255, 255, 255, 0.08);
}
.site-header-inner { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding-top: 16px; padding-bottom: 16px; flex-wrap: wrap; }
.brand { display: flex; align-items: center; gap: 11px; color: #fff; text-decoration: none; font-family: var(--font-display); font-weight: 800; font-size: 1.18rem; letter-spacing: -0.01em; }
.brand small { display: block; font-weight: 500; font-size: .7rem; letter-spacing: .06em; text-transform: uppercase; opacity: .68; margin-top: 1px; }
.brand-mark { display: inline-flex; width: 36px; height: 36px; flex: 0 0 auto; filter: drop-shadow(0 2px 4px rgba(0,0,0,.25)); }
.brand-mark svg { width: 100%; height: 100%; display: block; }
.site-nav { display: flex; gap: 4px; flex-wrap: wrap; }
.site-nav a { color: #E8F0EF; text-decoration: none; font-size: .93rem; font-weight: 500; padding: 7px 13px; border-radius: 999px; transition: background .15s ease; }
.site-nav a:hover { background: rgba(255, 255, 255, 0.12); color: #fff; }

/* --------------------------------------------------------- hero + sections */
.hero {
  padding: 46px 0 30px;
  background:
    radial-gradient(720px 320px at 85% -60px, rgba(76, 154, 112, 0.10), transparent 70%),
    linear-gradient(180deg, var(--tint) 0%, var(--surface) 78%);
}
.hero .lead { font-size: 1.13rem; color: var(--muted); max-width: 660px; }
.section { padding: 26px 0; }
.lead { font-size: 1.13rem; color: var(--muted); }

/* ----------------------------------------------------------- cards & grids */
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); padding: 24px 26px; }
.grid { display: grid; gap: 20px; }
.grid-2 { grid-template-columns: repeat(2, 1fr); }
.grid-3 { grid-template-columns: repeat(3, 1fr); }
@media (max-width: 800px) { .grid-2, .grid-3 { grid-template-columns: 1fr; } }

/* ------------------------------------------------------------- result page */
.verdict { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; margin: 10px 0 4px; }
.badge { display: inline-block; padding: 6px 15px; border-radius: 999px; color: #fff; font-family: var(--font-display); font-weight: 700; font-size: .93rem; letter-spacing: .01em; box-shadow: inset 0 -1px 0 rgba(0,0,0,.12); }
.reading-hero { font-family: var(--font-display); font-size: 2.7rem; font-weight: 800; color: var(--primary-ink); line-height: 1.05; letter-spacing: -0.02em; }
.reading-hero small { font-size: 1.05rem; font-weight: 600; color: var(--muted); letter-spacing: 0; }
.metrics { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 12px; margin: 20px 0; }
.metric { background: var(--card); border: 1px solid var(--line); border-radius: 12px; padding: 13px 15px; box-shadow: var(--shadow); }
.metric b { display: block; font-family: var(--font-display); font-size: 1.3rem; font-weight: 800; color: var(--primary-ink); letter-spacing: -0.01em; }
.metric span { font-size: .8rem; color: var(--muted); }
.context-tabs { display: flex; gap: 8px; margin: 16px 0; flex-wrap: wrap; }

/* chips */
.chip { display: inline-flex; align-items: center; gap: 7px; padding: 6px 13px; border-radius: 999px; border: 1px solid var(--line); background: var(--card); color: var(--primary); text-decoration: none; font-size: .9rem; font-weight: 500; transition: all .15s ease; }
.chip:hover { background: var(--primary); color: #fff; border-color: var(--primary); transform: translateY(-1px); }
.chip.current { background: var(--primary); color: #fff; border-color: var(--primary); }
.chip .dot { width: 8px; height: 8px; border-radius: 50%; flex: 0 0 auto; }
.chip-row { line-height: 2.3; }

/* --------------------------------------------------------------- forms */
.check-form { display: flex; gap: 12px; align-items: flex-end; flex-wrap: wrap; }
.check-field label { display: block; font-size: .8rem; font-weight: 600; color: var(--muted); margin-bottom: 5px; letter-spacing: .02em; }
.check-field input, .check-field select {
  font: inherit; border: 1.5px solid var(--line); border-radius: 10px; width: 170px; background: #fff;
  height: 47px; padding: 0 13px; line-height: normal; color: var(--ink);
  transition: border-color .15s ease;
}
/* selects: normalize native rendering so they match inputs exactly, add own chevron */
.check-field select {
  -webkit-appearance: none; -moz-appearance: none; appearance: none;
  padding-right: 36px;
  background-image: url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" width="14" height="9" viewBox="0 0 14 9"><path d="M1.5 1.5 7 7l5.5-5.5" fill="none" stroke="%235A6B6A" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"/></svg>');
  background-repeat: no-repeat;
  background-position: right 13px center;
}
.check-field.grow { flex: 1 1 210px; }
.check-field.grow input { width: 100%; min-width: 170px; }
@media (max-width: 560px) {
  .check-form { align-items: stretch; }
  .check-field, .check-field.grow { flex: 1 1 100%; }
  .check-field input, .check-field select { width: 100%; }
  .check-form .btn { flex: 1 1 100%; }
}
.check-field input:focus, .check-field select:focus { border-color: var(--primary); outline: none; box-shadow: 0 0 0 3px rgba(18, 68, 74, 0.12); }
.btn { font: inherit; font-family: var(--font-display); font-weight: 700; padding: 11px 21px; border-radius: 10px; border: 1.5px solid var(--line); background: var(--card); color: var(--primary); cursor: pointer; text-decoration: none; display: inline-block; transition: all .15s ease; }
.btn-primary { background: linear-gradient(135deg, var(--primary) 0%, var(--primary-soft) 100%); border-color: var(--primary); color: #fff; box-shadow: 0 2px 8px -2px rgba(18, 68, 74, .45); }
.btn-danger { background: var(--bad); border-color: var(--bad); color: #fff; }
.btn:hover { transform: translateY(-1px); box-shadow: var(--shadow-lift); }
.btn:active { transform: translateY(0); }

/* ------------------------------------------------------ journal save CTA */
.save-cta { display: flex; align-items: center; gap: 16px; flex-wrap: wrap; margin: 22px 0 6px; }
.btn-save {
  background: linear-gradient(135deg, var(--primary) 0%, var(--primary-soft) 100%);
  border-color: var(--primary); color: #fff; font-size: 1.02rem; padding: 14px 26px;
  box-shadow: 0 3px 12px -2px rgba(18, 68, 74, .5);
  display: inline-flex; align-items: center; gap: 10px;
}
.btn-save:hover { box-shadow: 0 6px 18px -4px rgba(18, 68, 74, .6); }
.btn-save.saved { background: var(--primary-ink); border-color: var(--primary-ink); box-shadow: none; }
.btn-save svg, .btn svg { flex: 0 0 auto; vertical-align: -3px; }
.card-icon { display: inline-flex; width: 34px; height: 34px; align-items: center; justify-content: center;
  border-radius: 9px; background: var(--tint); color: var(--primary); margin-bottom: 6px; }
.card-icon.warn { background: #FDF6E8; color: #B07818; }
.save-cta-note { color: var(--muted); }
.save-cta-note a { font-weight: 600; }

/* ------------------------------------------------------------------ faq */
.faq details { background: var(--card); border: 1px solid var(--line); border-radius: 12px; padding: 0; margin: 10px 0; box-shadow: var(--shadow); overflow: hidden; }
.faq summary { font-family: var(--font-display); font-weight: 700; cursor: pointer; color: var(--primary-ink); padding: 15px 18px; list-style: none; position: relative; padding-right: 44px; transition: background .15s ease; }
.faq summary::-webkit-details-marker { display: none; }
.faq summary::after { content: "+"; position: absolute; right: 18px; top: 50%; transform: translateY(-50%); font-size: 1.35rem; font-weight: 400; color: var(--good); transition: transform .2s ease; }
.faq details[open] summary::after { content: "–"; }
.faq summary:hover { background: var(--tint); }
.faq details p { margin: 0; padding: 2px 18px 16px; }

/* --------------------------------------------------------- article cards */
.article-card { display: flex; flex-direction: column; background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; text-decoration: none; color: inherit; box-shadow: var(--shadow); transition: all .18s ease; }
.article-card:hover { transform: translateY(-3px); box-shadow: var(--shadow-lift); }
.article-card img { display: block; width: 100%; height: auto; }
.article-card .body { padding: 16px 18px 20px; }
.article-card .kicker { font-size: .72rem; font-weight: 700; text-transform: uppercase; letter-spacing: .09em; color: var(--good); }
.article-card h3 { margin: 7px 0; }
.article-card p { margin: 0; font-size: .9rem; color: var(--muted); }
.kicker { font-size: .75rem; font-weight: 700; text-transform: uppercase; letter-spacing: .09em; }

/* --------------------------------------------------------------- alerts */
.alert { border-left: 5px solid var(--warn); background: #FDF6E8; border-radius: 10px; padding: 15px 18px; margin: 18px 0; box-shadow: var(--shadow); }
.alert-bad { border-left-color: var(--bad); background: #FBEBEA; }
.alert-good { border-left-color: var(--good); background: #EDF6F1; }

/* --------------------------------------------------------------- tables */
article table, .card table { border-collapse: collapse; width: 100%; font-size: .95rem; }
article th, .card th { text-align: left; padding: 10px 12px; border-bottom: 2px solid var(--line); font-family: var(--font-display); font-weight: 700; color: var(--primary-ink); background: var(--tint); }
article td, .card td { padding: 9px 12px; border-bottom: 1px solid var(--line); }
article tbody tr:hover, .card tbody tr:hover { background: var(--surface); }

/* --------------------------------------------------------------- journal */
.journal-list { list-style: none; margin: 0; padding: 0; }
.journal-list li { display: flex; gap: 12px; align-items: center; padding: 11px 0; border-bottom: 1px solid var(--line); flex-wrap: wrap; }
.journal-list li:last-child { border-bottom: none; }
.journal-dot { width: 12px; height: 12px; border-radius: 50%; flex: 0 0 auto; box-shadow: 0 0 0 3px rgba(0,0,0,.05); }
.journal-val { font-family: var(--font-display); font-weight: 800; min-width: 96px; }

/* ---------------------------------------------------------------- footer */
.site-footer { background: linear-gradient(180deg, var(--primary-ink) 0%, #092529 100%); color: #C9D8D6; margin-top: 56px; padding: 38px 0 28px; }
.site-footer a { color: #fff; text-decoration-color: rgba(255,255,255,.35); }
.site-footer strong { color: #fff; font-family: var(--font-display); }
.footer-cols { display: grid; grid-template-columns: 2fr 1fr 1fr; gap: 26px; }
.footer-cols ul { list-style: none; margin: 8px 0 0; padding: 0; }
.footer-cols li { margin: 5px 0; }
@media (max-width: 700px) { .footer-cols { grid-template-columns: 1fr; } }
.footer-note { border-top: 1px solid rgba(255,255,255,.14); margin-top: 24px; padding-top: 16px; }

/* ----------------------------------------------------------------- print */
@media print {
  .site-header, .site-footer, .site-nav, .no-print, .context-tabs, .chip-row, .check-form, .pa-consent { display: none !important; }
  body { background: #fff; font-size: 12pt; }
  .card { box-shadow: none; border: 1px solid #999; }
  a { color: #000; text-decoration: none; }
  .print-only { display: block !important; }
}
.print-only { display: none; }
