/*
  NutriFacts beta page.
  Every colour, size and radius is a token below. Tweak them here first.
  Colours are Apple's iOS system colours (light and dark).
*/

:root {
  color-scheme: light dark;

  /* Backgrounds */
  --bg: #f2f2f7;               /* systemGroupedBackground */
  --bg-elevated: #ffffff;      /* secondarySystemGroupedBackground */
  --fill: rgba(120, 120, 128, 0.12); /* tertiarySystemFill */
  --separator: rgba(60, 60, 67, 0.18);

  /* Text */
  --label: #000000;
  --label-secondary: rgba(60, 60, 67, 0.6);
  --label-tertiary: rgba(60, 60, 67, 0.3);

  /* Tints */
  --accent: #3f7d1f;          /* matcha, from the app icon; 5:1 with white */
  --blue: #007aff;
  --indigo: #5856d6;
  --orange: #ff9500;
  --green: #34c759;
  --teal: #30b0c7;
  --red: #ff3b30;
  --yellow: #ffcc00;
  --gray: #8e8e93;

  /* Carb bar segments */
  --seg-sugar: var(--orange);
  --seg-net: var(--yellow);
  --seg-fibre: var(--green);

  /* Type: SF Pro on Apple devices, system UI elsewhere */
  --font: -apple-system, BlinkMacSystemFont, "SF Pro Text", "Helvetica Neue", "Hiragino Sans", "Noto Sans JP", system-ui, sans-serif;
  --font-display: -apple-system, BlinkMacSystemFont, "SF Pro Display", "Helvetica Neue", "Hiragino Sans", system-ui, sans-serif;
  --text-hero: clamp(2.5rem, 6vw, 4.25rem);
  --text-title: clamp(2rem, 4vw, 3rem);
  --text-large: 1.1875rem;  /* 19px */
  --text-body: 1.0625rem;   /* 17px, iOS body */
  --text-footnote: 0.8125rem; /* 13px */

  /* Shape and space */
  --radius-card: 22px;
  --radius-control: 14px;
  --page-width: 1080px;
  --gutter: 20px;
  --section-space: clamp(72px, 10vw, 128px);
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #000000;
    --bg-elevated: #1c1c1e;
    --fill: rgba(118, 118, 128, 0.24);
    --separator: rgba(84, 84, 88, 0.6);
    --label: #ffffff;
    --label-secondary: rgba(235, 235, 245, 0.6);
    --label-tertiary: rgba(235, 235, 245, 0.3);
    --accent: #4e8f2a;
    --blue: #0a84ff;
    --indigo: #5e5ce6;
    --orange: #ff9f0a;
    --green: #30d158;
    --teal: #40c8e0;
    --red: #ff453a;
    --yellow: #ffd60a;
  }
}
:root[data-theme="dark"] {
  --accent: #4e8f2a;
  --bg: #000000;
  --bg-elevated: #1c1c1e;
  --fill: rgba(118, 118, 128, 0.24);
  --separator: rgba(84, 84, 88, 0.6);
  --label: #ffffff;
  --label-secondary: rgba(235, 235, 245, 0.6);
  --label-tertiary: rgba(235, 235, 245, 0.3);
  --blue: #0a84ff;
  --indigo: #5e5ce6;
  --orange: #ff9f0a;
  --green: #30d158;
  --teal: #40c8e0;
  --red: #ff453a;
  --yellow: #ffd60a;
}

/* Base */

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

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

body {
  margin: 0;
  background: var(--bg);
  color: var(--label);
  font: 400 var(--text-body)/1.47 var(--font);
  letter-spacing: -0.022em;
  -webkit-font-smoothing: antialiased;
}

h1, h2, h3 {
  margin: 0;
  font-family: var(--font-display);
  font-weight: 700;
  letter-spacing: -0.03em;
  line-height: 1.07;
}
h1 { font-size: var(--text-hero); }
h2 { font-size: var(--text-title); }
h3 { font-size: 1.1875rem; font-weight: 600; letter-spacing: -0.02em; line-height: 1.25; }

p { margin: 0; }
a { color: var(--accent); text-decoration: none; }
strong { font-weight: 600; }

.wrap { width: 100%; max-width: var(--page-width); margin: 0 auto; padding: 0 var(--gutter); }
.narrow { max-width: 720px; }
.muted { color: var(--label-secondary); }
.eyebrow { color: var(--accent); font-weight: 600; font-size: var(--text-body); margin-bottom: 12px; }
.lede, .body-large { font-size: var(--text-large); line-height: 1.42; color: var(--label-secondary); }
.body-large { color: var(--label); }
.body-large + .body-large { margin-top: 16px; }
.visually-hidden { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* Nav: translucent bar, like a UINavigationBar */

.nav {
  position: sticky; top: 0; z-index: 10;
  background: color-mix(in srgb, var(--bg) 72%, transparent);
  -webkit-backdrop-filter: saturate(180%) blur(20px);
  backdrop-filter: saturate(180%) blur(20px);
  border-bottom: 0.5px solid var(--separator);
}
.nav-inner { display: flex; align-items: center; justify-content: space-between; height: 56px; }
.brand { display: flex; align-items: center; gap: 10px; color: var(--label); font-weight: 600; font-size: 1.0625rem; }
.brand img { border-radius: 7px; }

/* Buttons: filled, capsule-ish, like .borderedProminent */

.button {
  appearance: none; border: 0; cursor: pointer;
  display: inline-flex; align-items: center; justify-content: center;
  min-height: 50px; padding: 0 22px;
  border-radius: var(--radius-control);
  background: var(--accent); color: #fff;
  font: 600 var(--text-body)/1 var(--font); letter-spacing: -0.02em;
  white-space: nowrap;
  transition: opacity 0.15s, transform 0.15s;
}
.button:hover { opacity: 0.88; }
.button:active { transform: scale(0.98); opacity: 0.75; }
.button:disabled { opacity: 0.5; cursor: default; }
.button-small { min-height: 34px; padding: 0 14px; border-radius: 999px; font-size: 0.9375rem; }

/* Sign-up form */

.signup { margin-top: 32px; max-width: 480px; }
.field { display: flex; gap: 10px; }
.field input {
  flex: 1; min-width: 0; min-height: 50px; padding: 0 16px;
  border: 0; border-radius: var(--radius-control);
  background: var(--bg-elevated); color: var(--label);
  font: 400 var(--text-body) var(--font); letter-spacing: -0.02em;
  box-shadow: inset 0 0 0 0.5px var(--separator);
  outline: none;
  transition: box-shadow 0.15s;
}
.field input::placeholder { color: var(--label-tertiary); }
.field input:focus { box-shadow: inset 0 0 0 2px var(--accent); }
.form-note { margin-top: 10px; font-size: var(--text-footnote); color: var(--label-secondary); }
.form-note.is-error { color: var(--red); }
.form-note.is-success { color: var(--green); font-weight: 600; }
.signup.is-done .field { display: none; }

@media (max-width: 520px) {
  .field { flex-direction: column; }
}

/* Hero */

.hero {
  display: grid; grid-template-columns: 1.1fr 0.9fr; gap: 48px; align-items: center;
  padding-top: clamp(48px, 8vw, 96px); padding-bottom: var(--section-space);
}
.hero h1 { max-width: 12ch; }
.hero .lede { margin-top: 20px; max-width: 36ch; }

@media (max-width: 860px) {
  .hero { grid-template-columns: 1fr; gap: 56px; }
  .hero-visual { order: 2; }
}

/* Phone frame around an app screenshot */

.hero-visual { display: flex; justify-content: center; }
.phone {
  width: 300px; max-width: 100%;
  padding: 9px; border-radius: 52px;
  background: #1c1c1e;
  box-shadow: 0 0 0 1px rgba(0,0,0,0.2), 0 30px 60px -20px rgba(0,0,0,0.35);
}
.phone img { display: block; width: 100%; height: auto; border-radius: 43px; }

/* Screenshot gallery: a row that scrolls sideways on small screens */

.screens {
  display: grid; grid-template-columns: repeat(4, minmax(220px, 1fr)); gap: 24px;
  max-width: var(--page-width); margin: 0 auto; padding: 0 var(--gutter) 8px;
  overflow-x: auto; scroll-snap-type: x mandatory; scrollbar-width: none;
}
.screens::-webkit-scrollbar { display: none; }
.screens figure { margin: 0; scroll-snap-align: center; }
.screens .phone { width: 100%; padding: 7px; border-radius: 40px; box-shadow: 0 0 0 1px rgba(0,0,0,0.2), 0 20px 40px -20px rgba(0,0,0,0.3); }
.screens .phone img { border-radius: 33px; }
.screens figcaption { margin-top: 16px; color: var(--label-secondary); font-size: var(--text-footnote); line-height: 1.45; }
.screens figcaption strong { display: block; color: var(--label); font-size: var(--text-body); margin-bottom: 2px; }

/* Carb bar, used by the explainer */

.carb-bar { display: flex; gap: 2px; height: 14px; border-radius: 6px; overflow: hidden; }
.seg { display: block; height: 100%; }
.seg-sugar { background: var(--seg-sugar); }
.seg-net { background: var(--seg-net); }
.seg-fibre { background: var(--seg-fibre); }
.seg-hidden {
  background: repeating-linear-gradient(135deg, var(--fill) 0 5px, transparent 5px 10px), var(--fill);
  box-shadow: inset 0 0 0 1px var(--separator);
}
.legend { display: flex; flex-wrap: wrap; gap: 12px; margin-top: 8px; color: var(--label-secondary); font-size: var(--text-footnote); }
.legend span { display: inline-flex; align-items: center; gap: 5px; }
.dot { display: inline-block; width: 8px; height: 8px; border-radius: 2px; }

/* Sections */

.section { padding-bottom: var(--section-space); }
.section-title { margin-bottom: 40px; }

.grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; }
@media (max-width: 860px) { .grid { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 560px) { .grid { grid-template-columns: 1fr; } }

.card { background: var(--bg-elevated); border-radius: var(--radius-card); padding: 28px; }
.card h3 { margin: 18px 0 8px; }
.card p { color: var(--label-secondary); }

.symbol {
  width: 44px; height: 44px; border-radius: 12px;
  display: grid; place-items: center;
  background: color-mix(in srgb, var(--tint) 14%, transparent);
  color: var(--tint);
}
.symbol svg { width: 24px; height: 24px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }

/* Split explainer */

.split { display: grid; grid-template-columns: 1fr 1fr; gap: 48px; align-items: center; }
.split h2 { margin-bottom: 20px; }
@media (max-width: 860px) { .split { grid-template-columns: 1fr; } }

.explainer { display: grid; gap: 28px; }
.explainer-head { display: flex; justify-content: space-between; margin-bottom: 10px; font-weight: 600; }
.explainer-head .muted { font-weight: 400; }

/* CTA */

.cta {
  background: var(--bg-elevated); border-radius: 32px;
  padding: clamp(40px, 7vw, 80px) clamp(20px, 5vw, 64px);
  text-align: center;
  display: flex; flex-direction: column; align-items: center;
}
.cta-icon { border-radius: 16px; margin-bottom: 24px; }
.cta h2 { max-width: 16ch; }
.cta .body-large { margin-top: 16px; max-width: 40ch; }
.cta .signup { width: 100%; margin-left: auto; margin-right: auto; }
.signup-large .field input, .signup-large .button { min-height: 56px; }

/* Confirmed page (confirmed.html), where Kit's confirm link lands */

.confirmed { padding-top: clamp(48px, 10vw, 120px); padding-bottom: var(--section-space); }
.confirmed-title { font-size: var(--text-title); }
.confirmed-button { margin-top: 32px; }

/* FAQ: inset grouped list */

.list { background: var(--bg-elevated); border-radius: var(--radius-card); overflow: hidden; }
details { border-bottom: 0.5px solid var(--separator); }
details:last-child { border-bottom: 0; }
summary {
  list-style: none; cursor: pointer;
  display: flex; justify-content: space-between; align-items: center; gap: 16px;
  padding: 18px 22px; font-weight: 500;
}
summary::-webkit-details-marker { display: none; }
summary::after {
  content: ""; flex: none; width: 8px; height: 8px;
  border-right: 2px solid var(--label-tertiary); border-bottom: 2px solid var(--label-tertiary);
  transform: rotate(45deg); transition: transform 0.2s;
}
details[open] summary::after { transform: rotate(-135deg); }
details p { padding: 0 22px 20px; color: var(--label-secondary); }

/* Developers */

.credits { padding-bottom: 48px; text-align: center; }
.credits-label { font-size: var(--text-footnote); color: var(--label-secondary); margin-bottom: 4px; }
.credits-names { display: flex; flex-wrap: wrap; justify-content: center; gap: 4px 10px; color: var(--label-tertiary); }
.credits-names a { color: var(--label); font-weight: 500; }
.credits-names a:hover { color: var(--accent); }

/* Footer */

.footer { padding: 32px 0 48px; border-top: 0.5px solid var(--separator); font-size: var(--text-footnote); }
.footer-inner { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 8px; }

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  * { transition: none !important; }
}

/* Presentation slide (present.html): sized to the screen so it fills a projector */

.present {
  min-height: 100vh; min-height: 100svh;
  display: grid; grid-template-columns: 1.15fr 0.85fr; align-items: center;
  gap: 6vw; padding: 6vh 7vw;
}
.present-brand { display: flex; align-items: center; gap: 0.6em; font: 600 clamp(1.25rem, 2.2vw, 2rem) var(--font-display); letter-spacing: -0.02em; }
.present-brand img { width: 1.9em; height: 1.9em; }
.present h1 { margin-top: 0.6em; font-size: clamp(2.5rem, 6vw, 6.5rem); max-width: 11ch; }
.present-lede { margin-top: 0.9em; max-width: 30ch; color: var(--label-secondary); font-size: clamp(1.125rem, 1.9vw, 1.9rem); line-height: 1.35; }
.present-url { margin-top: 1.4em; color: var(--accent); font: 600 clamp(1.125rem, 1.9vw, 1.9rem) var(--font-display); letter-spacing: -0.01em; }

.present-qr {
  margin: 0; justify-self: center; width: min(100%, 64vh, 520px);
  padding: 7%; border-radius: 9%;
  background: #fff; color: #1c1c1e; text-align: center;
  box-shadow: 0 0 0 1px var(--separator), 0 30px 60px -24px rgba(0,0,0,0.3);
}
.present-qr img { display: block; width: 100%; height: auto; image-rendering: pixelated; }
.present-qr figcaption { margin-top: 7%; font-size: clamp(0.9375rem, 1.4vw, 1.25rem); color: rgba(60, 60, 67, 0.6); }
.present-qr strong { display: block; color: #1c1c1e; font: 600 clamp(1.125rem, 1.9vw, 1.75rem) var(--font-display); letter-spacing: -0.02em; margin-bottom: 0.2em; }

@media (max-aspect-ratio: 1/1) {
  .present { grid-template-columns: 1fr; text-align: center; gap: 6vh; }
  .present-brand { justify-content: center; }
  .present h1, .present-lede { margin-left: auto; margin-right: auto; }
  .present-qr { width: min(100%, 70vw, 520px); }
}
