/* Diabetes Pro website: every style for every page (docs/website-plan.md, "Look").
   Dark only. The palette is the App Store screenshots' (scripts/app-store-screenshots/slides.js).
   Sections: 1 tokens and base, 2 text pages (.prose), 3 shared pieces (nav, badge, footer),
   4 the marketing page, 5 motion (off under prefers-reduced-motion). */

/* 1. Tokens and base ------------------------------------------------------------------------ */

:root {
  color-scheme: dark;
  --bg: #1c1c1e;
  --bg-raised: #28282a;
  --text: #ffffff;
  --text-dim: #a1a1a6;
  --line: rgba(255, 255, 255, .1);

  /* Accents, from the app's input colors (slides.js ACCENT). The -rgb forms feed the glows. */
  --blue: #0a84ff;     --blue-rgb: 10 132 255;     /* basal */
  --green: #30d158;    --green-rgb: 48 209 88;     /* medication */
  --teal: #40c8e0;     --teal-rgb: 64 200 224;
  --orange: #ff9500;   --orange-rgb: 255 149 0;    /* bolus */
  --purple: #bf5af2;   --purple-rgb: 191 90 242;   /* keyword */
  --red: #e0383e;      --red-rgb: 224 56 62;       /* glucose */
  --chip: #00668c;     --chip-x: #d0d0d0;          /* the app's keyword chip */

  --accent: var(--blue);
  --accent-rgb: var(--blue-rgb);
  /* Accent text that still reads at 4.5:1 on --bg (the glucose red alone does not). */
  --accent-text: #64b5ff;

  --font: -apple-system, BlinkMacSystemFont, "SF Pro Display", system-ui, "Segoe UI", Roboto, sans-serif;
  --gutter: clamp(16px, 5vw, 48px);
  --max: 1200px;
  --radius: 18px;
}

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

html {
  background: var(--bg);
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
  scroll-padding-top: 72px;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--text-dim);
  font-family: var(--font);
  font-size: 1.125rem;            /* 18 px; 20 px on wide screens */
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  overflow-x: hidden;
}
@supports (overflow: clip) { body { overflow-x: clip; } }
@media (min-width: 1024px) { body { font-size: 1.25rem; } }

h1, h2, h3, h4 { color: var(--text); line-height: 1.15; margin: 0 0 .5em; font-weight: 700; letter-spacing: -.01em; }
p, ul, ol, figure, blockquote { margin: 0 0 1em; }
img, svg, picture { display: block; max-width: 100%; }
img { height: auto; }

a { color: var(--accent-text); text-underline-offset: .18em; text-decoration-thickness: 1px; }
a:hover { text-decoration-thickness: 2px; }
:focus-visible { outline: 3px solid var(--blue); outline-offset: 3px; border-radius: 4px; }

.skip-link {
  position: absolute; left: 12px; top: -100px; z-index: 100;
  padding: 10px 16px; border-radius: 10px; background: var(--text); color: var(--bg); font-weight: 600;
}
.skip-link:focus { top: 12px; }

/* 2. Text pages (privacy, support, terms, 404): <main class="page"><article class="prose"> ---- */

/* The minimum height keeps the footer low on a short page, such as the 404. */
.page { min-height: 60vh; padding: clamp(40px, 8vw, 96px) var(--gutter) clamp(64px, 10vw, 120px); }
.prose { max-width: 65ch; margin: 0 auto; overflow-wrap: break-word; }
.prose h1 { font-size: clamp(2.25rem, 5vw, 3.25rem); letter-spacing: -.02em; margin-bottom: .6em; }
.prose h2 { font-size: clamp(1.375rem, 3vw, 1.75rem); margin-top: 2em; }
.prose h3 { font-size: 1.15em; margin-top: 1.6em; }
.prose p, .prose li { color: var(--text-dim); }
.prose strong { color: var(--text); }
.prose ul, .prose ol { padding-left: 1.3em; }
.prose li { margin-bottom: .4em; }
.prose li::marker { color: var(--text-dim); }
.prose hr { border: 0; border-top: 1px solid var(--line); margin: 2.5em 0; }
.prose .meta { font-size: .9em; }

/* 3. Shared pieces ---------------------------------------------------------------------------- */

/* Nav: sticky, slim, blurred. On phones only the icon and the badge. */
.nav {
  position: sticky; top: 0; z-index: 50;
  background: rgba(28, 28, 30, .78);
  -webkit-backdrop-filter: saturate(180%) blur(20px);
  backdrop-filter: saturate(180%) blur(20px);
  border-bottom: 1px solid rgba(255, 255, 255, .06);
}
.nav__inner {
  max-width: var(--max); margin: 0 auto; padding: 8px var(--gutter);
  display: flex; align-items: center; gap: 24px; min-height: 60px;
}
.nav__brand { display: flex; align-items: center; gap: 10px; color: var(--text); text-decoration: none; font-weight: 700; font-size: 1.1875rem; letter-spacing: -.01em; }
/* "Pro" in the glucose red (Will). The name is 19 px bold, large text, where this red's 3.9:1 passes. */
.nav__pro { color: var(--red); }
.nav__brand img { width: 32px; height: 32px; }
.nav__links { display: none; margin-left: auto; gap: 28px; }
.nav__links a { color: var(--text-dim); text-decoration: none; font-size: .9375rem; }
.nav__links a:hover, .nav__links a[aria-current="page"] { color: var(--text); }
.nav .badge { margin-left: auto; }
.nav__name { display: none; }
@media (min-width: 560px) { .nav__name { display: inline; } }
@media (min-width: 800px) {
  .nav__links { display: flex; }
  .nav .badge { margin-left: 4px; }
}

/* Apple's App Store badge, used unaltered and never smaller than 40 px tall. Width and height are
   both fixed so the layout holds even while the file is missing (it then shows its alt text). */
.badge { display: inline-block; flex: none; border-radius: 8px; line-height: 0; }
.badge img { width: 120px; height: 40px; color: var(--text); font-size: .8125rem; line-height: 1.2; }
.badge--large img { width: 162px; height: 54px; }

.footer { border-top: 1px solid var(--line); padding: 48px var(--gutter) 56px; font-size: .875rem; }
.footer__inner { max-width: var(--max); margin: 0 auto; }
.footer__disclaimer { max-width: 65ch; }
.footer__links { display: flex; flex-wrap: wrap; gap: 8px 28px; margin: 24px 0; }
.footer__links a { color: var(--text); text-decoration: none; padding: 6px 0; }
.footer__links a:hover { text-decoration: underline; }
.footer__legal { margin: 0 0 .4em; }

/* 4. The marketing page ------------------------------------------------------------------------ */

/* The phones' glows reach past the screen edge on phones: clip them sideways, never downward. */
main { overflow-x: hidden; }
@supports (overflow: clip) { main { overflow-x: clip; } }

.accent-blue   { --accent: var(--blue);   --accent-rgb: var(--blue-rgb);   --accent-text: #64b5ff; }
.accent-green  { --accent: var(--green);  --accent-rgb: var(--green-rgb);  --accent-text: var(--green); }
.accent-teal   { --accent: var(--teal);   --accent-rgb: var(--teal-rgb);   --accent-text: var(--teal); }
.accent-orange { --accent: var(--orange); --accent-rgb: var(--orange-rgb); --accent-text: var(--orange); }
.accent-purple { --accent: var(--purple); --accent-rgb: var(--purple-rgb); --accent-text: #d08cf6; }
.accent-red    { --accent: var(--red);    --accent-rgb: var(--red-rgb);    --accent-text: #ff7a7e; }

.display {
  font-size: clamp(2.5rem, 6vw, 5rem);
  letter-spacing: -.035em; line-height: 1.02;
  text-wrap: balance;
}
.headline {
  font-size: clamp(2.25rem, 4.6vw, 4rem);
  letter-spacing: -.03em; line-height: 1.04;
  text-wrap: balance;
}
.headline--sub { font-size: clamp(1.75rem, 3.4vw, 2.75rem); }
.lede { font-size: clamp(1.1875rem, 1.6vw, 1.375rem); line-height: 1.5; max-width: 34ch; text-wrap: pretty; }
.eyebrow { color: var(--accent-text); font-size: clamp(1rem, 1.5vw, 1.25rem); font-weight: 600; letter-spacing: 0; margin-bottom: .6em; }

/* A phone: one framed capture (assets/img, 392 x 800 at 1x), upright, with its section's glow. */
.phone { position: relative; width: min(72vw, 300px); margin-inline: auto; }
.phone img { position: relative; width: 100%; }
.phone::before {
  content: ""; position: absolute; inset: -18% -45%; z-index: 0; pointer-events: none;
  background: radial-gradient(closest-side, rgb(var(--accent-rgb) / .26), rgb(var(--accent-rgb) / 0));
}
.phone--faded img {
  /* Fades out the Lock Screen's clock and date, as App Store slide 10 does. */
  -webkit-mask-image: linear-gradient(to bottom, transparent 22%, #000 52%);
  mask-image: linear-gradient(to bottom, transparent 22%, #000 52%);
}

/* The app's keyword chip: white with blue text, or blue when selected, and a gray "x" tab. */
.chip {
  display: inline-flex; align-items: stretch; overflow: hidden;
  border-radius: 999px; background: #fff; color: var(--chip);
  font-size: 1rem; font-weight: 500; line-height: 1; white-space: nowrap;
}
.chip > span:first-child { padding: .5em .7em .5em .85em; }
.chip__x::before { content: "x"; }
.chip__x { display: flex; align-items: center; padding: 0 .55em; background: var(--chip-x); color: #fff; font-size: .85em; }
.chip--selected { background: var(--chip); color: #fff; }
.chips { list-style: none; padding: 0; margin: 28px 0 0; display: flex; flex-wrap: wrap; gap: 10px; max-width: 30rem; }

/* Hero */
.hero { position: relative; isolation: isolate; overflow: hidden; padding: clamp(40px, 7vw, 88px) var(--gutter) clamp(56px, 8vw, 104px); }
.hero::before {
  content: ""; position: absolute; inset: 0; z-index: -1; pointer-events: none;
  background:
    radial-gradient(40% 38% at 26% 66%, rgb(var(--purple-rgb) / .22), transparent 70%),
    radial-gradient(38% 40% at 52% 62%, rgb(var(--red-rgb) / .18), transparent 70%),
    radial-gradient(36% 36% at 6% 100%, rgb(var(--orange-rgb) / .09), transparent 70%),
    radial-gradient(30% 34% at 86% 18%, rgb(var(--purple-rgb) / .12), transparent 70%);
}
.hero__inner { max-width: var(--max); margin: 0 auto; display: grid; gap: 32px; }
.hero__text { --accent-text: #d08cf6; }
.hero .lede { max-width: 30ch; }
.hero__phone .phone { --accent-rgb: var(--purple-rgb); }
.phone--tilted { transform: rotate(-6deg); }
.cta { display: flex; flex-wrap: wrap; align-items: center; gap: 12px 20px; margin-top: 28px; }
.cta__note { margin: 0; font-size: 1rem; }
.cta--center { justify-content: center; flex-direction: column; }

/* The pizza curve: a 1000 x 250 drawing. The chip is placed in the same box, at the meal (x 140). */
.curve { position: relative; aspect-ratio: 1000 / 250; width: 100%; }
.curve--cropped { width: 150%; }                 /* shows the meal and both rises, not the tail */
.curve-wrap, .hero__curve { overflow: hidden; }
.curve-wrap {                                   /* the cropped curve fades out instead of stopping */
  -webkit-mask-image: linear-gradient(to right, #000 82%, transparent);
  mask-image: linear-gradient(to right, #000 82%, transparent);
}
.curve__svg { position: absolute; inset: 0; width: 100%; height: 100%; overflow: visible; }
.curve__grid line { stroke: rgba(255, 255, 255, .05); stroke-width: 1; vector-effect: non-scaling-stroke; }
.curve__tail { stroke-width: 4; stroke-linecap: round; }
.curve__glow { stroke: var(--red); stroke-opacity: .55; stroke-width: 14; }
.curve__line { stroke-width: 5; stroke-linecap: round; stroke-linejoin: round; }
.curve__ticks line { stroke: rgba(255, 255, 255, .2); stroke-width: 2; stroke-linecap: round; }
.curve__pin { stroke: rgba(255, 255, 255, .85); stroke-width: 3; stroke-linecap: round; stroke-dasharray: .1 8; }
.curve__dot { fill: #fff; }
.curve__chip {
  position: absolute; left: 14%; bottom: 69%; transform: translateX(-26%);
  font-size: clamp(.75rem, 1.4vw, 1rem);
  box-shadow: 0 10px 28px rgba(0, 0, 0, .5);
}
.curve--cropped .curve__chip { font-size: clamp(.75rem, 1.2vw, .9375rem); }

/* 3. The idea: one centered paragraph. */
.idea { padding: clamp(64px, 10vw, 140px) var(--gutter) 0; }
.idea__text {
  max-width: 30ch; margin: 0 auto; text-align: center;
  color: var(--text); font-size: clamp(1.5rem, 3.2vw, 2.5rem); font-weight: 600;
  line-height: 1.28; letter-spacing: -.02em; text-wrap: balance;
}

/* Feature sections: text first on phones; text beside the phone on wide screens, alternating. */
.feature {
  max-width: var(--max); margin: 0 auto;
  padding: clamp(56px, 8vw, 112px) var(--gutter);
  display: grid; gap: 48px; align-items: center;
}
.feature__media { position: relative; }
.feature--sub { padding-top: 0; }
@media (min-width: 760px) {
  .feature { grid-template-columns: minmax(0, 1.1fr) minmax(0, 1fr); gap: clamp(40px, 6vw, 96px); }
  .feature--media-first .feature__media { order: -1; }
  .phone { width: clamp(260px, 27vw, 392px); }
}

.columns { display: grid; gap: 24px; margin-top: 32px; max-width: 40rem; }
.columns h3 { font-size: 1.125em; color: var(--accent-text); margin-bottom: .3em; }
.columns p { margin: 0; }
@media (min-width: 560px) { .columns { grid-template-columns: 1fr 1fr; gap: 32px; } }

.curve-wrap { margin: 28px 0 8px; }
.quote-card {
  margin: 20px 0 0; padding: 22px 24px; max-width: 34rem;
  background: var(--bg-raised); border-radius: var(--radius);
}
.quote-card figcaption { font-size: .9375rem; margin-bottom: 10px; }
.quote-card blockquote { margin: 0; }
.quote-card blockquote p { margin: 0; color: var(--text); font-size: clamp(1.125rem, 1.8vw, 1.375rem); font-weight: 600; line-height: 1.4; }

.tiles { list-style: none; padding: 0; margin: 32px 0 0; display: grid; gap: 14px; grid-template-columns: repeat(auto-fit, minmax(min(100%, 230px), 1fr)); }

.tile { background: var(--bg-raised); border-radius: var(--radius); padding: 20px 22px; }
.tile h3 { font-size: 1.0625em; margin-bottom: .35em; display: flex; flex-wrap: wrap; align-items: center; gap: 6px 10px; }
.tile p { margin: 0; font-size: .9375em; line-height: 1.5; }
.os {
  display: inline-block; padding: 3px 8px; border-radius: 999px;
  font-size: .75rem; font-weight: 600; letter-spacing: .01em; line-height: 1.2;
  color: var(--accent-text); background: rgb(var(--accent-rgb) / .14);
}

/* 11. Everything else: a grid of six, then two phones side by side. */
.more { max-width: var(--max); margin: 0 auto; padding: clamp(56px, 8vw, 112px) var(--gutter); text-align: center; }
.grid {
  list-style: none; padding: 0; margin: 40px auto 0; max-width: 60rem;
  display: grid; grid-template-columns: 1fr 1fr; gap: 12px; text-align: left;
}
@media (min-width: 760px) { .grid { grid-template-columns: repeat(3, 1fr); gap: 16px; } }
.grid li {
  display: flex; flex-direction: column; gap: 14px;
  background: var(--bg-raised); border-radius: var(--radius); padding: 20px;
  color: var(--text); font-weight: 600; font-size: 1rem; line-height: 1.35;
}
.grid svg { width: 30px; height: 30px; fill: none; stroke: var(--accent-text); stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round; }
.grid svg .fill { fill: rgb(var(--accent-rgb) / .22); stroke: none; }
.pair { display: flex; justify-content: center; gap: clamp(12px, 4vw, 56px); margin-top: clamp(48px, 7vw, 88px); }
.pair .phone { width: min(43vw, 340px); margin: 0; }

/* 12. Private by design */
.privacy { padding: clamp(56px, 8vw, 112px) var(--gutter); text-align: center; position: relative; isolation: isolate; }
.privacy::before {
  content: ""; position: absolute; inset: 10% 0; z-index: -1; pointer-events: none;
  background: radial-gradient(40% 50% at 50% 50%, rgb(var(--accent-rgb) / .12), transparent 70%);
}
.privacy > div { max-width: 46rem; margin: 0 auto; }
.eyebrow--plain { font-size: clamp(1rem, 1.5vw, 1.25rem); line-height: 1.4; }
.statement { color: var(--text); font-weight: 700; font-size: clamp(2.25rem, 5.4vw, 4.5rem); letter-spacing: -.03em; line-height: 1.05; text-wrap: balance; margin-bottom: .45em; }
.privacy .lede { margin-inline: auto; max-width: 36ch; }
.link-arrow { font-weight: 600; text-decoration: none; }
.link-arrow::after { content: " ›"; }
.link-arrow:hover { text-decoration: underline; }

/* 13. Final call to action */
.final { padding: clamp(56px, 9vw, 120px) var(--gutter) clamp(72px, 10vw, 140px); text-align: center; }
.final__icon { width: 96px; height: 96px; margin: 0 auto 28px; }
.final .display { margin-bottom: .2em; }

/* Hero layout. Phones: text, curve, phone. Wide: the text over the curve on the left, the tilted
   phone on the right, where the curve fades out. */
@media (min-width: 760px) {
  .hero__inner {
    grid-template-columns: minmax(0, 1fr) auto;
    grid-template-areas: "text phone" "curve phone";
    gap: 0 clamp(24px, 4vw, 64px);
    align-items: center;
  }
  .hero__text { grid-area: text; align-self: end; }
  .hero__curve { grid-area: curve; align-self: start; margin-top: clamp(16px, 3vw, 40px); }
  .hero__phone { grid-area: phone; position: relative; z-index: 1; }
  .hero__phone .phone { width: clamp(250px, 27vw, 370px); }
}
@media (max-width: 759.98px) {
  .hero__curve { -webkit-mask-image: linear-gradient(to right, #000 82%, transparent); mask-image: linear-gradient(to right, #000 82%, transparent); }
  .hero__curve .curve { width: 150%; }
  .hero__curve .curve__chip { font-size: .8125rem; }
  .hero__phone { margin-top: 8px; }
}

/* 5. Motion: the curve draws itself (the hero on load, section 6 when it comes into view); every
   other section fades up once. All of it only for people who have not asked for less motion. */
@media (prefers-reduced-motion: no-preference) {
  .curve__draw { stroke-dasharray: 1 2; }
  .curve--hero .curve__draw { animation: curve-draw 2.2s cubic-bezier(.45, 0, .25, 1) .5s both; }
  .curve--hero .curve__area { animation: curve-fade 1s ease 1.9s both; }
  .curve--hero .curve__tail { animation: curve-fade 1.2s ease 2.3s both; }
  .curve--hero .curve__chip, .curve--hero .curve__pin, .curve--hero .curve__dot { animation: curve-fade .6s ease .1s both; }

  .js .curve--on-view .curve__draw { stroke-dashoffset: 1.01; }
  .js .curve--on-view .curve__area, .js .curve--on-view .curve__tail,
  .js .curve--on-view .curve__chip, .js .curve--on-view .curve__pin, .js .curve--on-view .curve__dot { opacity: 0; }
  .js .curve--on-view.is-drawing .curve__draw { animation: curve-draw 2.2s cubic-bezier(.45, 0, .25, 1) .4s both; }
  .js .curve--on-view.is-drawing .curve__area { animation: curve-fade 1s ease 1.8s both; }
  .js .curve--on-view.is-drawing .curve__tail { animation: curve-fade 1.2s ease 2.2s both; }
  .js .curve--on-view.is-drawing .curve__chip,
  .js .curve--on-view.is-drawing .curve__pin,
  .js .curve--on-view.is-drawing .curve__dot { animation: curve-fade .6s ease both; }

  .reveal { transition: opacity .8s ease, transform .8s cubic-bezier(.2, .7, .2, 1); }
  .js .reveal.is-pending { opacity: 0; transform: translateY(16px); }
}
@keyframes curve-draw { from { stroke-dashoffset: 1.01; } to { stroke-dashoffset: 0; } }
@keyframes curve-fade { from { opacity: 0; } to { opacity: 1; } }
