/* =========================================================================
   Health Mate — website styles
   Palette mirrors the Android app (ui/theme/Color.kt + DashboardScreen.kt)
   ========================================================================= */

:root {
  /* Core app palette */
  --cream:          #FBF3EA;   /* DashBg — warm cream */
  --cream-deep:     #F6EADC;
  --green:          #4CAF50;   /* DashGreen */
  --green-dark:     #43A047;   /* DashGreenDark */
  --green-light:    #6FCF7A;   /* BpGradStart */
  --green-deep:     #2E6F33;
  --green-tint:     #EAF6E5;   /* ColGreenBg */
  --green-tint-2:   #E8F5E9;
  --green-border:   #DCEBD7;   /* MedicalBlueDivider */
  --hero-wash:      #F0F7DC;

  /* Text */
  --ink:            #1F2A33;   /* DashTextDark */
  --ink-soft:       #4B5563;   /* BpUpdateLabel */
  --muted:          #9CA3AF;   /* DashTextGrey */

  /* Surfaces */
  --white:          #FFFFFF;
  --card-shadow:    0 10px 30px rgba(76, 175, 80, .10);
  --card-shadow-sm: 0 4px 14px rgba(31, 42, 51, .06);

  /* Accent colours — straight from the dashboard cards */
  --orange:         #F5A623;
  --orange-bg:      #FCEEDD;
  --purple:         #7E57C2;
  --purple-bg:      #EFEAFB;
  --blue:           #2196F3;
  --blue-bg:        #E6F1FB;
  --red:            #E53935;
  --red-bg:         #FDECEC;
  --red-ink:        #C62828;
  --amber-pill:     #FBE3B0;

  --radius-sm: 12px;
  --radius:    20px;
  --radius-lg: 28px;
  --radius-pill: 999px;

  --maxw: 1160px;
  --gutter: 24px;
}

/* ---------- Reset ---------- */
*, *::before, *::after { box-sizing: border-box; }

html { scroll-behavior: smooth; -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  font-family: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto,
               "Helvetica Neue", Arial, sans-serif;
  color: var(--ink);
  background: var(--cream);
  line-height: 1.6;
  font-size: 16px;
  overflow-x: hidden;
}

img { max-width: 100%; display: block; }
a { color: var(--green-dark); text-decoration: none; }
a:hover { color: var(--green-deep); }

h1, h2, h3, h4 { margin: 0 0 .5em; line-height: 1.2; font-weight: 700; letter-spacing: -.02em; }
h1 { font-size: clamp(2.1rem, 5.2vw, 3.5rem); }
h2 { font-size: clamp(1.7rem, 3.6vw, 2.5rem); }
h3 { font-size: 1.2rem; }
p  { margin: 0 0 1em; }

:focus-visible {
  outline: 3px solid var(--green);
  outline-offset: 3px;
  border-radius: 6px;
}

/* ---------- Layout helpers ---------- */
.wrap {
  width: 100%;
  max-width: var(--maxw);
  margin-inline: auto;
  padding-inline: var(--gutter);
}

section { padding: clamp(56px, 8vw, 104px) 0; }

.section-head { text-align: center; max-width: 680px; margin: 0 auto clamp(32px, 5vw, 56px); }
.section-head p { color: var(--ink-soft); font-size: 1.05rem; margin-bottom: 0; }

.eyebrow {
  display: inline-flex; align-items: center; gap: 8px;
  background: var(--green-tint);
  color: var(--green-deep);
  font-size: .78rem; font-weight: 700;
  letter-spacing: .09em; text-transform: uppercase;
  padding: 7px 16px; border-radius: var(--radius-pill);
  margin-bottom: 18px;
  border: 1px solid var(--green-border);
}

.lede { font-size: 1.12rem; color: var(--ink-soft); }

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 10px;
  font-weight: 700; font-size: 1rem;
  padding: 15px 30px;
  border-radius: var(--radius-pill);
  border: 2px solid transparent;
  cursor: pointer;
  transition: transform .18s ease, box-shadow .18s ease, background .18s ease, color .18s ease;
  white-space: nowrap;
}
.btn-primary {
  background: linear-gradient(135deg, var(--green-light), var(--green-dark));
  color: #fff;
  box-shadow: 0 6px 18px rgba(76, 175, 80, .22);
}
.btn-primary:hover { transform: translateY(-2px); box-shadow: 0 10px 24px rgba(76,175,80,.28); color:#fff; }
.btn-ghost {
  background: var(--white);
  color: var(--green-dark);
  border-color: var(--green-border);
  box-shadow: var(--card-shadow-sm);
}
.btn-ghost:hover { transform: translateY(-2px); border-color: var(--green); color: var(--green-deep); }
.btn-sm { padding: 11px 22px; font-size: .92rem; }

/* ---------- Header ---------- */
.site-header {
  position: sticky; top: 0; z-index: 60;
  background: rgba(251, 243, 234, .86);
  backdrop-filter: saturate(160%) blur(14px);
  -webkit-backdrop-filter: saturate(160%) blur(14px);
  border-bottom: 1px solid transparent;
  transition: border-color .25s ease, box-shadow .25s ease;
}
.site-header.is-stuck {
  border-bottom-color: var(--green-border);
  box-shadow: 0 6px 20px rgba(31,42,51,.05);
}
.nav {
  display: flex; align-items: center; justify-content: space-between;
  gap: 20px; min-height: 76px;
}
.brand { display: inline-flex; align-items: center; gap: 12px; color: var(--ink); font-weight: 800; font-size: 1.16rem; letter-spacing: -.02em; }
.brand img { width: 40px; height: 40px; border-radius: 11px; box-shadow: var(--card-shadow-sm); }
.brand span small { display: block; font-size: .68rem; font-weight: 600; color: var(--muted); letter-spacing: .06em; text-transform: uppercase; }

.nav-links { display: flex; align-items: center; gap: 30px; list-style: none; margin: 0; padding: 0; }
.nav-links a { color: var(--ink-soft); font-weight: 600; font-size: .95rem; position: relative; }
.nav-links a::after {
  content: ""; position: absolute; left: 0; right: 100%; bottom: -6px; height: 2px;
  background: var(--green); border-radius: 2px; transition: right .22s ease;
}
.nav-links a:hover, .nav-links a[aria-current="page"] { color: var(--ink); }
.nav-links a:hover::after, .nav-links a[aria-current="page"]::after { right: 0; }

.nav-cta { display: flex; align-items: center; gap: 12px; }

.nav-toggle {
  display: none; background: var(--white); border: 1px solid var(--green-border);
  width: 44px; height: 44px; border-radius: 12px; cursor: pointer;
  align-items: center; justify-content: center;
}
.nav-toggle span { display: block; width: 19px; height: 2px; background: var(--ink); border-radius: 2px; position: relative; transition: background .2s; }
.nav-toggle span::before, .nav-toggle span::after {
  content: ""; position: absolute; left: 0; width: 19px; height: 2px; background: var(--ink);
  border-radius: 2px; transition: transform .22s ease, top .22s ease;
}
.nav-toggle span::before { top: -6px; }
.nav-toggle span::after  { top: 6px; }
.nav-toggle[aria-expanded="true"] span { background: transparent; }
.nav-toggle[aria-expanded="true"] span::before { top: 0; transform: rotate(45deg); }
.nav-toggle[aria-expanded="true"] span::after  { top: 0; transform: rotate(-45deg); }

/* ---------- Hero ---------- */
.hero {
  position: relative;
  padding-top: clamp(40px, 6vw, 72px);
  padding-bottom: clamp(56px, 8vw, 96px);
  background: linear-gradient(180deg, var(--hero-wash) 0%, var(--cream) 62%);
  overflow: hidden;
}
.hero::after {
  content: ""; position: absolute; inset: auto -12% -30% auto;
  width: 520px; height: 520px; border-radius: 50%;
  background: radial-gradient(circle at 30% 30%, rgba(111,207,122,.22), transparent 68%);
  pointer-events: none;
}
.hero-leaves {
  position: absolute; top: -34px; right: -48px; width: min(400px, 46vw);
  opacity: .92; pointer-events: none; user-select: none;
}
.hero-grid {
  position: relative; z-index: 2;
  display: grid; grid-template-columns: 1.05fr .95fr; gap: clamp(28px, 5vw, 64px);
  align-items: center;
}
.hero h1 { margin-bottom: .35em; }
.hero h1 .accent { color: var(--green-dark); }
.hero-actions { display: flex; flex-wrap: wrap; gap: 14px; margin: 28px 0 24px; }

.hero-points { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: 10px 22px; }
.hero-points li { display: flex; align-items: center; gap: 8px; font-size: .93rem; font-weight: 600; color: var(--ink-soft); }
.hero-points li::before {
  content: "✓"; display: grid; place-items: center;
  width: 20px; height: 20px; border-radius: 50%;
  background: var(--green-tint); color: var(--green-dark); font-size: .72rem; font-weight: 900;
}

.hero-stats { display: flex; gap: 30px; margin-top: 34px; flex-wrap: wrap; }
.hero-stats .stat strong { display: block; font-size: 1.7rem; color: var(--green-dark); letter-spacing: -.03em; }
.hero-stats .stat span { font-size: .84rem; color: var(--muted); font-weight: 600; }

/* ---------- Phone frame ---------- */
.phone {
  position: relative; width: 100%; max-width: 310px; margin-inline: auto;
  background: #10161b;
  border-radius: 42px;
  padding: 10px;
  box-shadow: 0 30px 60px rgba(31, 42, 51, .22), 0 0 0 2px rgba(255,255,255,.55) inset;
}
.phone::before {
  content: ""; position: absolute; top: 18px; left: 50%; transform: translateX(-50%);
  width: 92px; height: 7px; border-radius: 99px; background: rgba(255,255,255,.22); z-index: 3;
}
.phone img { width: 100%; border-radius: 33px; display: block; }

.phone-hero { transform: rotate(-1.4deg); }
.phone-float { animation: floaty 6.5s ease-in-out infinite; }
@keyframes floaty {
  0%, 100% { transform: rotate(-1.4deg) translateY(0); }
  50%      { transform: rotate(-1.4deg) translateY(-14px); }
}

.hero-badge {
  position: absolute; z-index: 5;
  background: var(--white);
  border: 1px solid var(--green-border);
  border-radius: 16px;
  padding: 11px 15px;
  box-shadow: var(--card-shadow);
  display: flex; align-items: center; gap: 10px;
}
.hero-badge img { width: 30px; height: 30px; object-fit: contain; }
.hero-badge b { display: block; font-size: .95rem; line-height: 1.1; }
.hero-badge small { color: var(--muted); font-size: .72rem; font-weight: 600; }
.badge-bp    { top: 16%;  left: -26px; }
.badge-steps { bottom: 16%; right: -22px; }

/* ---------- Feature grid (mirrors the app's dashboard cards) ---------- */
.feature-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  grid-auto-rows: 1fr;   /* every row as tall as the tallest, so all nine tags line up */
  gap: 22px;
}
.f-card {
  background: var(--white);
  border: 1px solid var(--green-border);
  border-radius: var(--radius);
  padding: 26px 24px;
  box-shadow: var(--card-shadow-sm);
  transition: transform .22s ease, box-shadow .22s ease, border-color .22s ease;
  position: relative; overflow: hidden;
}
.f-card::after {
  content: ""; position: absolute; inset: auto -40px -60px auto;
  width: 150px; height: 150px; border-radius: 50%;
  background: var(--tint, var(--green-tint)); opacity: .5;
  transition: transform .3s ease;
}
.f-card:hover { transform: translateY(-6px); box-shadow: var(--card-shadow); border-color: var(--accent, var(--green)); }
.f-card:hover::after { transform: scale(1.18); }
.f-card > * { position: relative; z-index: 1; }
.f-icon {
  width: 56px; height: 56px; border-radius: 17px;
  background: var(--tint, var(--green-tint));
  display: grid; place-items: center; margin-bottom: 18px;
}
.f-icon img { width: 34px; height: 34px; object-fit: contain; }
.f-card h3 { margin-bottom: .4em; }
.f-card p { color: var(--ink-soft); font-size: .95rem; margin-bottom: 0; }
.f-tag {
  display: inline-block; margin-top: 14px;
  font-size: .74rem; font-weight: 800; letter-spacing: .06em; text-transform: uppercase;
  color: var(--accent, var(--green-dark));
  background: var(--tint, var(--green-tint));
  padding: 5px 12px; border-radius: var(--radius-pill);
}

/* card accent variants */
.t-green  { --tint: var(--green-tint);  --accent: var(--green-dark); }
.t-red    { --tint: var(--red-bg);      --accent: var(--red-ink); }
.t-orange { --tint: var(--orange-bg);   --accent: #C77C10; }
.t-purple { --tint: var(--purple-bg);   --accent: var(--purple); }
.t-blue   { --tint: var(--blue-bg);     --accent: #1668B3; }
.t-amber  { --tint: var(--amber-pill);  --accent: #9A6B14; }

/* ---------- Screens showcase ----------
   The source screenshots come off two different devices (720x1640 and
   1080x2400), so letting each frame size itself made the phones different
   heights and pushed the captions out of line. Every frame is therefore
   locked to one aspect ratio and the image is cropped to fill it — the
   bottoms of the phones and the caption baselines then line up exactly.   */
.screens { background: linear-gradient(180deg, var(--cream) 0%, var(--cream-deep) 100%); }
.screens .wrap { max-width: 1240px; }

/* Flex rather than grid: when the row count does not divide evenly (3 across
   leaves 2 over) the leftover row stays centred instead of hanging to the left. */
.screens-grid {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  align-items: flex-start;
  gap: 24px;
}

.screen-item {
  margin: 0;
  text-align: center;
  flex: 0 1 calc((100% - 3 * 24px) / 4);
  max-width: 250px;
}

/* One ratio for every frame, so every frame is the same height. */
.phone-fixed { max-width: none; width: 100%; }
.phone-fixed img {
  aspect-ratio: 1080 / 2400;
  object-fit: cover;
  object-position: top center;
}

/* At thumbnail width the full-size bezel radius looks oversized, so scale the
   frame chrome with it. */
.phone-fixed { padding: 7px; border-radius: 30px; }
.phone-fixed img { border-radius: 23px; }
.phone-fixed::before { top: 13px; width: 62px; height: 5px; }

/* Reserve both caption lines so a one-line title cannot shift its neighbours. */
.screen-item figcaption { margin-top: 18px; }
.screen-item h4 {
  margin: 0 0 3px;
  font-size: 1rem;
  min-height: 1.2em;
}
.screen-item p {
  color: var(--muted);
  font-size: .85rem;
  margin: 0;
  min-height: 2.6em;
}

/* ---------- Split / how-it-works ---------- */
.split { display: grid; grid-template-columns: 1fr 1fr; gap: clamp(30px, 5vw, 70px); align-items: center; }
.split.reverse .split-media { order: 2; }

.steps { list-style: none; margin: 0; padding: 0; counter-reset: step; }
.steps li {
  counter-increment: step;
  position: relative; padding-left: 62px; margin-bottom: 30px;
}
.steps li:last-child { margin-bottom: 0; }
.steps li::before {
  content: counter(step);
  position: absolute; left: 0; top: 0;
  width: 42px; height: 42px; border-radius: 14px;
  background: linear-gradient(135deg, var(--green-light), var(--green-dark));
  color: #fff; font-weight: 800; display: grid; place-items: center;
  box-shadow: 0 8px 18px rgba(76,175,80,.28);
}
.steps li::after {
  content: ""; position: absolute; left: 21px; top: 50px; bottom: -30px;
  width: 2px; background: var(--green-border);
}
.steps li:last-child::after { display: none; }
.steps h3 { margin-bottom: .25em; font-size: 1.08rem; }
.steps p { color: var(--ink-soft); font-size: .95rem; margin: 0; }

/* ---------- Ranges table ---------- */
.range-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(270px, 1fr)); gap: 22px; }
.range-card {
  background: var(--white); border: 1px solid var(--green-border);
  border-radius: var(--radius); padding: 26px 24px; box-shadow: var(--card-shadow-sm);
}
.range-card h3 { display: flex; align-items: center; gap: 10px; }
.range-card h3 img { width: 26px; height: 26px; object-fit: contain; }
.range-card table { width: 100%; border-collapse: collapse; font-size: .92rem; margin-top: 10px; }
.range-card th, .range-card td { text-align: left; padding: 9px 0; border-bottom: 1px solid var(--green-border); }
.range-card th { color: var(--muted); font-weight: 700; font-size: .78rem; text-transform: uppercase; letter-spacing: .06em; }
.range-card tr:last-child td { border-bottom: 0; }
.range-card td:last-child { text-align: right; font-weight: 700; color: var(--ink); }
.dot { display: inline-block; width: 9px; height: 9px; border-radius: 50%; margin-right: 8px; vertical-align: middle; }
.dot-green  { background: var(--green); }
.dot-amber  { background: var(--orange); }
.dot-red    { background: var(--red); }
.dot-blue   { background: var(--blue); }
.note-small { font-size: .82rem; color: var(--muted); margin: 14px 0 0; }

/* ---------- Privacy band ---------- */
.band {
  background: linear-gradient(135deg, var(--green-deep), var(--green-dark) 55%, var(--green) 100%);
  color: #fff; border-radius: var(--radius-lg);
  padding: clamp(34px, 5vw, 60px);
  box-shadow: 0 24px 50px rgba(46,111,51,.28);
  position: relative; overflow: hidden;
}
.band::before {
  content: ""; position: absolute; inset: -40% -20% auto auto; width: 460px; height: 460px;
  border-radius: 50%; background: rgba(255,255,255,.08);
}
.band > * { position: relative; z-index: 1; }
.band h2 { color: #fff; }
.band p { color: rgba(255,255,255,.88); }
.band .eyebrow { background: rgba(255,255,255,.16); color: #fff; border-color: rgba(255,255,255,.28); }
.band-points { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 22px; margin-top: 34px; }
.band-points div { background: rgba(255,255,255,.1); border: 1px solid rgba(255,255,255,.18); border-radius: var(--radius-sm); padding: 20px; }
.band-points h3 { color: #fff; font-size: 1rem; margin-bottom: .3em; }
.band-points p { font-size: .9rem; margin: 0; }

/* ---------- FAQ ---------- */
.faq { max-width: 820px; margin-inline: auto; }
.faq details {
  background: var(--white); border: 1px solid var(--green-border);
  border-radius: var(--radius-sm); margin-bottom: 14px; overflow: hidden;
  box-shadow: var(--card-shadow-sm);
}
.faq summary {
  cursor: pointer; padding: 20px 54px 20px 22px; font-weight: 700; position: relative;
  list-style: none;
}
.faq summary::-webkit-details-marker { display: none; }
.faq summary::after {
  content: "+"; position: absolute; right: 22px; top: 50%; transform: translateY(-50%);
  width: 26px; height: 26px; border-radius: 50%; background: var(--green-tint);
  color: var(--green-dark); display: grid; place-items: center; font-size: 1.1rem; font-weight: 800;
  transition: transform .2s ease;
}
.faq details[open] summary::after { content: "−"; transform: translateY(-50%) rotate(180deg); }
.faq details p { padding: 0 22px 20px; color: var(--ink-soft); margin: 0; font-size: .96rem; }

/* ---------- Final CTA ---------- */
.cta-final { text-align: center; }
.cta-final .inner {
  background: var(--white); border: 1px solid var(--green-border);
  border-radius: var(--radius-lg); padding: clamp(36px, 6vw, 68px);
  box-shadow: var(--card-shadow); position: relative; overflow: hidden;
}
.cta-final .inner::before {
  content: ""; position: absolute; inset: auto auto -120px -80px; width: 320px; height: 320px;
  border-radius: 50%; background: var(--green-tint); opacity: .7;
}
.cta-final .inner > * { position: relative; z-index: 1; }
.cta-final img.mark { width: 80px; height: 80px; border-radius: 22px; margin: 0 auto 20px; box-shadow: var(--card-shadow); }
.cta-final .hero-actions { justify-content: center; }

/* ---------- Footer ---------- */
.site-footer {
  background: var(--ink); color: rgba(255,255,255,.72);
  padding: 56px 0 30px; font-size: .92rem;
}
.footer-grid { display: grid; grid-template-columns: 1.4fr 1fr 1fr 1fr; gap: 34px; }
.site-footer h4 { color: #fff; font-size: .82rem; letter-spacing: .1em; text-transform: uppercase; margin-bottom: 16px; }
.site-footer ul { list-style: none; margin: 0; padding: 0; }
.site-footer li { margin-bottom: 10px; }
.site-footer a { color: rgba(255,255,255,.72); }
.site-footer a:hover { color: var(--green-light); }
.site-footer .brand { color: #fff; }
.site-footer .brand span small { color: rgba(255,255,255,.5); }
.footer-about { max-width: 320px; margin-top: 16px; font-size: .9rem; }
.footer-bottom {
  margin-top: 40px; padding-top: 22px; border-top: 1px solid rgba(255,255,255,.12);
  display: flex; justify-content: space-between; gap: 16px; flex-wrap: wrap;
  font-size: .85rem; color: rgba(255,255,255,.55);
}

/* ---------- Legal / doc pages ---------- */
.page-head {
  background: linear-gradient(180deg, var(--hero-wash), var(--cream));
  padding: clamp(46px, 7vw, 82px) 0 clamp(34px, 5vw, 54px);
  position: relative; overflow: hidden;
}
.page-head .hero-leaves { top: -40px; right: -60px; width: min(330px, 40vw); }
.page-head h1 { margin-bottom: .2em; }
.page-head p { color: var(--ink-soft); margin: 0; }

.doc { max-width: 840px; margin-inline: auto; }
.doc h2 { font-size: 1.45rem; margin-top: 2em; }
.doc h2:first-of-type { margin-top: 0; }
.doc h3 { font-size: 1.08rem; margin-top: 1.6em; }
.doc ul { padding-left: 22px; color: var(--ink-soft); }
.doc li { margin-bottom: 8px; }
.doc p { color: var(--ink-soft); }
.doc .callout {
  background: var(--white); border: 1px solid var(--green-border); border-left: 4px solid var(--green);
  border-radius: var(--radius-sm); padding: 20px 22px; box-shadow: var(--card-shadow-sm);
  margin: 26px 0;
}
.doc .callout p:last-child { margin-bottom: 0; }
.doc .callout strong { color: var(--ink); }

.toc {
  background: var(--white); border: 1px solid var(--green-border); border-radius: var(--radius);
  padding: 22px 26px; box-shadow: var(--card-shadow-sm); margin-bottom: 40px;
}
.toc h4 { margin: 0 0 12px; font-size: .78rem; letter-spacing: .1em; text-transform: uppercase; color: var(--muted); }
.toc ol { margin: 0; padding-left: 20px; columns: 2; column-gap: 34px; }
.toc li { margin-bottom: 7px; font-size: .93rem; }

/* ---------- Support page ---------- */
.support-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 22px; }

/* ---------- Reveal on scroll ---------- */
.reveal { opacity: 0; transform: translateY(22px); transition: opacity .6s ease, transform .6s ease; }
.reveal.in { opacity: 1; transform: none; }
@media (prefers-reduced-motion: reduce) {
  .reveal { opacity: 1; transform: none; transition: none; }
  .phone-float { animation: none; }
  html { scroll-behavior: auto; }
}

/* ---------- Responsive ---------- */
@media (max-width: 1100px) {
  .screens .wrap { max-width: 840px; }
  .screens-grid { gap: 26px; }
  .screen-item { flex-basis: calc((100% - 2 * 26px) / 3); }
}

@media (max-width: 680px) {
  .screens-grid { gap: 18px; }
  .screen-item { flex-basis: calc((100% - 18px) / 2); max-width: none; }
  .screen-item h4 { font-size: .92rem; }
  .screen-item p  { font-size: .78rem; }
}

@media (max-width: 980px) {
  .hero-grid { grid-template-columns: 1fr; text-align: center; }
  .hero-actions, .hero-points, .hero-stats { justify-content: center; }
  .hero-media { order: -1; }
  .hero-leaves { width: min(280px, 55vw); opacity: .7; }
  .split { grid-template-columns: 1fr; }
  .split.reverse .split-media { order: 0; }
  .footer-grid { grid-template-columns: 1fr 1fr; }
  .toc ol { columns: 1; }
}

@media (max-width: 760px) {
  :root { --gutter: 18px; }
  .nav-toggle { display: inline-flex; }
  .nav-links {
    position: absolute; top: 76px; left: 0; right: 0;
    flex-direction: column; align-items: stretch; gap: 0;
    background: var(--white);
    border-top: 1px solid var(--green-border);
    border-bottom: 1px solid var(--green-border);
    box-shadow: 0 16px 30px rgba(31,42,51,.08);
    padding: 8px 18px 16px;
    display: none;
  }
  .nav-links.open { display: flex; }
  .nav-links li { border-bottom: 1px solid var(--green-border); }
  .nav-links li:last-child { border-bottom: 0; }
  .nav-links a { display: block; padding: 15px 2px; font-size: 1rem; }
  .nav-links a::after { display: none; }
  .nav-cta .btn { display: none; }
  .badge-bp { left: -6px; }
  .badge-steps { right: -6px; }
  .hero-stats { gap: 22px; }
  .footer-grid { grid-template-columns: 1fr; }
}

/* =========================================================================
   Single-page additions
   Everything now lives in index.html, so anchored sections must clear the
   sticky header and the page needs its own way back to the top.
   ========================================================================= */

/* Sticky-header offset for every in-page jump target. */
section[id],
.doc h2[id],
.f-card[id],
.range-card[id] { scroll-margin-top: 96px; }

/* Skip link — visible only when focused by keyboard. */
.skip-link {
  position: absolute; left: -9999px; top: 0; z-index: 100;
  background: var(--green-dark); color: #fff;
  padding: 12px 20px; border-radius: 0 0 var(--radius-sm) 0;
  font-weight: 700;
}
.skip-link:focus { left: 0; color: #fff; }

/* Back-to-top button. */
.to-top {
  position: fixed; right: 22px; bottom: 22px; z-index: 55;
  width: 48px; height: 48px; border-radius: 50%;
  display: grid; place-items: center;
  background: var(--white); color: var(--green-dark);
  border: 1px solid var(--green-border);
  box-shadow: var(--card-shadow);
  font-size: 1.15rem; font-weight: 800; line-height: 1;
  opacity: 0; visibility: hidden; transform: translateY(12px);
  transition: opacity .25s ease, transform .25s ease, visibility .25s;
}
.to-top.show { opacity: 1; visibility: visible; transform: none; }
.to-top:hover { background: var(--green); color: #fff; border-color: var(--green); }

/* The privacy policy now sits inside a section, so its inner headings must not
   inherit the centred section-head treatment. */
#privacy-policy .doc h2 { text-align: left; }

/* Permissions table heading inside the support section. */
#permissions h3 { margin-bottom: .6em; }

@media (max-width: 760px) {
  section[id] { scroll-margin-top: 84px; }
  .to-top { right: 14px; bottom: 14px; width: 44px; height: 44px; }
}

/* ---------- Brand lockup ----------
   "Blood Sugar & Diabetes Diary" is far longer than a one-word product name,
   so the header lockup wraps to two tight lines instead of squeezing the nav. */
.brand-name {
  font-size: .95rem;
  line-height: 1.15;
  display: block;
  white-space: nowrap;   /* the product name reads as one line, never wrapped */
}
.brand-name small { margin-top: 2px; }

@media (max-width: 1180px) {
  .nav-links { gap: 22px; }
  .nav-links a { font-size: .9rem; }
}

@media (max-width: 1040px) {
  .brand-name { font-size: .86rem; }
  .nav-links { gap: 16px; }
}

@media (max-width: 760px) {
  .brand-name { font-size: .9rem; white-space: normal; }
}

/* ---------- Feature icon sizing ----------
   The source art has wildly different aspect ratios, so a flat width/height made a
   tall bottle read as much smaller than a wide heart. The PNGs are now normalised to
   one canvas with matched opaque area, so a single square box sizes them consistently. */
.f-icon img {
  width: 100%;
  height: 100%;
  max-width: 38px;
  max-height: 38px;
  object-fit: contain;
}

/* Cards whose icon is a line glyph rather than the 3D art. */
.f-icon-glyph { color: var(--accent, var(--green-dark)); }
.f-icon-glyph svg { width: 30px; height: 30px; }

/* ---------- Card tag alignment ----------
   Card copy runs to different lengths, so the tag pills used to sit at different
   heights across a row. Pushing the tag to the bottom of a flex column lines every
   pill in a row up on one baseline. */
.f-card {
  display: flex;
  flex-direction: column;
}
.f-card h3, .f-card p { flex: 0 0 auto; }
.f-tag { margin-top: auto; align-self: flex-start; }

/* Range-card and hero-badge icons get the same normalised treatment. */
.range-card h3 img { width: 28px; height: 28px; object-fit: contain; }
.hero-badge img    { width: 32px; height: 32px; object-fit: contain; }

/* Nine feature cards: three across gives three even rows instead of 4 + 4 + 1. */
@media (max-width: 900px) {
  .feature-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 560px) {
  .feature-grid { grid-template-columns: 1fr; }
}

/* ---------- Header fit ----------
   Seven nav items plus a full product name plus the CTA is a tight row, so nothing
   in the nav is allowed to wrap onto a second line; the sizes step down instead. */
.nav-links a { white-space: nowrap; }
.nav { gap: 16px; }
.brand { flex: 0 0 auto; }

@media (max-width: 1300px) {
  .nav-links { gap: 18px; }
  .nav-links a { font-size: .88rem; }
}
@media (max-width: 1150px) {
  .nav-links { gap: 14px; }
  .nav-links a { font-size: .83rem; }
  .brand-name { font-size: .84rem; }
  .brand img { width: 34px; height: 34px; }
}
@media (max-width: 1000px) {
  .nav-cta .btn { padding: 9px 16px; font-size: .85rem; }
}

/* ---------- Primary button: one pill, not two ----------
   .btn carries `border: 2px solid transparent` for the ghost variant. On the gradient
   primary that transparent border still gets painted under, and because the border-box
   and padding-box corner curves differ, it left a visible darker rim that read as a
   second button behind the first. The primary drops the border entirely and takes the
   2px back as padding, so the box size is unchanged. */
.btn-primary {
  border: 0;
  padding: 17px 32px;
  background-clip: padding-box;
}
.btn-primary.btn-sm { padding: 13px 24px; }

/* ---------- Contact ----------
   Two actions, centred as a pair: copy the address, or open a compose window. */
.contact-card {
  max-width: 660px;
  margin-inline: auto;
  background: var(--white);
  border: 1px solid var(--green-border);
  border-radius: var(--radius-lg);
  box-shadow: var(--card-shadow);
  padding: clamp(32px, 5vw, 52px);
  text-align: center;
}

.contact-mark {
  width: 68px; height: 68px; border-radius: 19px;
  margin: 0 auto 20px;
  box-shadow: 0 8px 20px rgba(46, 111, 51, .16);
}
.contact-label {
  font-size: .74rem; font-weight: 800; letter-spacing: .1em;
  text-transform: uppercase; color: var(--muted); margin: 0 0 8px;
}
.contact-address {
  display: inline-block;
  font-size: clamp(1.05rem, 2.6vw, 1.45rem);
  font-weight: 800; letter-spacing: -.02em;
  color: var(--ink);
  margin: 0 0 28px;
  word-break: break-all;
  border-bottom: 2px solid var(--green-border);
  padding-bottom: 4px;
  transition: color .18s ease, border-color .18s ease;
}
.contact-address:hover { color: var(--green-dark); border-color: var(--green); }

.contact-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 14px;
  justify-content: center;
  align-items: center;
  margin-bottom: 20px;
}
.contact-actions .btn { min-width: 210px; }

.contact-card .note-small { margin: 0; }
.contact-card .note-small.is-copied { color: var(--green-dark); font-weight: 700; }

@media (max-width: 560px) {
  .contact-actions { flex-direction: column; }
  .contact-actions .btn { width: 100%; min-width: 0; }
}
