/* Flamingolo — styles. Tokens per claude-code-instructions.md §5; every class
   mirrors an inline style in the final design prototypes. */

/* ---------- fonts (self-hosted variable woff2, latin subset, OFL) ---------- */

@font-face {
  font-family: 'Bricolage Grotesque';
  font-style: normal;
  font-weight: 650 800;
  font-stretch: 100%;
  font-display: swap;
  src: url('../fonts/bricolage-grotesque-latin.woff2') format('woff2');
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
  font-family: 'Inter';
  font-style: normal;
  font-weight: 500 700;
  font-display: swap;
  src: url('../fonts/inter-latin.woff2') format('woff2');
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

/* ---------- tokens ---------- */

:root {
  /* surfaces */
  --bg:            #FFFFFF;
  --card:          #FFFFFF;
  --chip:          #FFF6EA;
  --tint:          #FADCE8;
  --tint-hover:    #FDF1F6;
  --tip-bg:        #FBEFD5;

  /* lines */
  --line:          #F0CFDD;
  --line-hover:    #E9A9C0;

  /* ink */
  --ink:           #33261D;
  --muted:         #8A6377;
  --faint:         #A67C95;
  --tip-label:     #A9781C;

  /* brand */
  --flamingo:      #E85C8A;
  --accent:        #C23A66;
  --accent-hover:  #A82F58;
  --beak:          #33261D;

  /* shadows */
  --sh-card: 0 2px 12px rgba(196,60,104,0.05);
  --sh-tray: 0 6px 20px rgba(196,60,104,0.13);
  --sh-cta:  0 4px 12px rgba(194,58,102,0.30);

  --display: 'Bricolage Grotesque', sans-serif;
}

/* ---------- base ---------- */

* { box-sizing: border-box; }

html, body {
  /* safety net: horizontal overflow would make mobile browsers zoom out,
     leaving fixed overlays smaller than the visual viewport */
  overflow-x: hidden;
  overflow-x: clip;
}

body {
  margin: 0;
  min-height: 100vh;
  background: var(--bg);
  font-family: 'Inter', sans-serif;
  font-weight: 500;
  color: var(--ink);
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 0 20px 64px;
  -webkit-text-size-adjust: 100%;
}
body.km-open { overflow: hidden; }

.col {
  width: 100%;
  max-width: 520px;
  display: flex;
  flex-direction: column;
  gap: 32px;
  position: relative;
}

button {
  font-family: inherit;
  cursor: pointer;
}
:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 3px;
}
[hidden] { display: none !important; }

@keyframes ballPop { from { transform: scale(.5); } to { transform: scale(1); } }

@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; animation: none !important; }
}

/* ---------- resume banner ---------- */

.banner {
  margin-top: 20px;
  margin-bottom: -24px;
  background: var(--tint);
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 14px 16px;
  display: flex;
  align-items: center;
  gap: 14px;
}
.banner-mascot { flex: none; align-self: flex-end; }
.banner-body { display: flex; flex-direction: column; gap: 10px; flex: 1; }
.banner-title { font-weight: 700; font-size: 15.5px; color: var(--ink); }
.banner-status { font-weight: 500; font-size: 13.5px; color: var(--muted); }
.banner-actions { display: flex; align-items: center; gap: 14px; }
.btn-resume {
  background: var(--accent);
  border: none;
  border-radius: 999px;
  padding: 10px 22px;
  font-weight: 700;
  font-size: 14.5px;
  color: var(--chip);
  transition: background .2s ease;
}
.btn-resume:hover { background: var(--accent-hover); }
.btn-discard {
  background: none;
  border: none;
  font-weight: 700;
  font-size: 14.5px;
  color: var(--muted);
  padding: 10px 4px;
}

/* ---------- hero ---------- */

.hero {
  display: flex;
  flex-direction: column;
  padding-top: 44px;
}
.hero-row {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
}
.page-title {
  margin: 18px 0 0;
  font-family: var(--display);
  font-weight: 650;
  font-size: 26px;
  letter-spacing: -0.01em;
  color: var(--ink);
}
.page-tagline {
  margin: 6px 0 0;
  font-weight: 500;
  font-size: 14px;
  color: var(--muted);
}
.hero-brand { display: flex; align-items: center; gap: 11px; flex: 1; min-width: 0; }
.hero-brand svg { flex: none; }
/* fluid below 398px so the hero row never overflows the viewport */
.hero-brand .wordmark { flex: 1; width: 100%; max-width: 190px; height: auto; }

/* small devices: logo gets its own line at full size, toggle centered below */
@media (max-width: 374px) {
  .hero-row {
    flex-direction: column;
    align-items: center;
    gap: 14px;
  }
  .hero-brand { flex: none; justify-content: center; }
  .hero-brand .wordmark { flex: none; width: 190px; max-width: calc(100vw - 95px); }
  .unit-toggle { margin-top: 0; }
  .page-title, .page-tagline { text-align: center; }
}

.unit-toggle {
  display: flex;
  background: transparent;
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 2px;
  margin-top: 6px;
  flex: none;
}
.unit-toggle button {
  border: none;
  border-radius: 999px;
  padding: 5px 10px;
  font-weight: 700;
  font-size: 11.5px;
  background: transparent;
  color: var(--faint);
  transition: background .2s ease, color .2s ease;
}
.unit-toggle button[aria-pressed="true"] {
  background: var(--tint);
  color: var(--ink);
}

/* ---------- calculator card ---------- */

.calc {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 26px;
  overflow: hidden;
  box-shadow: var(--sh-tray);
}

.tray {
  position: relative;
  background: var(--tint);
  border-bottom: 1px solid var(--line);
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 18px 22px 14px;
  overflow: hidden;
}
.lineup {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
}
.pizza {
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  flex: none;
  transition: width .35s ease, height .35s ease, margin-left .35s ease;
}
.pizza.pop { animation: ballPop .35s ease; }
.pizza-face {
  position: relative;
  border-radius: 50%;
  overflow: hidden;
  transition: width .35s ease, height .35s ease;
}
.topping {
  position: absolute;
  transition: width .35s ease, height .35s ease, margin .35s ease;
}
.tray-caption {
  margin-top: 12px;
  font-weight: 500;
  font-size: 12.5px;
  color: var(--faint);
  text-align: center;
}

.rows {
  display: flex;
  flex-direction: column;
  padding: 8px 20px 20px;
}
.row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 14px 0;
}
.row-label { display: flex; flex-direction: column; gap: 2px; }
.row-name { font-weight: 500; font-size: 17px; }
.row-sub { font-weight: 500; font-size: 12px; color: var(--faint); }
.divider { height: 1px; background: var(--line); }

.stepper { display: flex; align-items: center; }
.step-btn {
  width: 42px;
  height: 42px;
  border-radius: 50%;
  background: var(--chip);
  border: 1.5px solid var(--line);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 19px;
  color: var(--accent);
  padding: 0;
  user-select: none;
  -webkit-user-select: none;
  -webkit-touch-callout: none;
  touch-action: manipulation;
  transition: border-color .2s ease;
}
.step-btn:hover { border-color: var(--line-hover); }
.step-btn:active { transform: scale(0.92); }
.step-value {
  font-weight: 700;
  font-size: 21px;
  min-width: 84px;
  text-align: center;
  font-variant-numeric: tabular-nums;
}

/* below the 375px design baseline, rows stack: label on top, control centered */
@media (max-width: 374px) {
  .row {
    flex-direction: column;
    align-items: stretch;
    gap: 10px;
  }
  .row .row-label { align-items: center; text-align: center; }
  .row .stepper { justify-content: center; }
  .row .seg { align-self: center; max-width: 100%; }
}

.voice {
  font-weight: 500;
  font-size: 14px;
  color: var(--accent);
  text-align: right;
  padding: 0 0 10px;
}
.voice:empty { display: none; }

.seg {
  display: flex;
  background: var(--chip);
  border: 1.5px solid var(--line);
  border-radius: 999px;
  padding: 3px;
  width: 212px;
}
.seg button {
  flex: 1;
  border: none;
  border-radius: 999px;
  padding: 9px 6px;
  font-weight: 700;
  font-size: 13.5px;
  background: transparent;
  color: var(--muted);
  transition: background .2s ease, color .2s ease;
}
.seg button[aria-pressed="true"] {
  background: var(--accent);
  color: var(--chip);
}

.chev {
  display: inline-block;
  font-size: 12px;
  color: var(--faint);
  transition: transform .2s ease;
}
.chev.rot { transform: rotate(90deg); }

/* advanced: collapsed row */
.tune-collapsed {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 16px 0 6px;
  background: none;
  border: none;
  text-align: left;
  width: 100%;
}
.tune-collapsed .row-name { font-size: 16px; color: var(--muted); }
.tune-right { display: flex; align-items: center; gap: 10px; }
.tune-values { font-weight: 500; font-size: 14px; color: var(--faint); }

/* advanced: expanded box */
.advanced {
  margin-top: 14px;
  background: var(--chip);
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 4px 16px 8px;
}
.tune-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 0;
  background: none;
  border: none;
  text-align: left;
  width: 100%;
}
.tune-head .row-name { font-weight: 700; font-size: 16px; color: var(--ink); }
.tune-head .chev { color: var(--muted); }
.advanced .row { padding: 6px 0 14px; }
.advanced .row + .divider + .row { padding: 14px 0 12px; }
.advanced .row-name { font-size: 16px; }
.advanced .step-btn { background: var(--card); }

/* ---------- section headers ---------- */

.section { display: flex; flex-direction: column; gap: 14px; }
.section.results { gap: 18px; }
.section-head { display: flex; align-items: center; gap: 10px; }
.section-head svg { flex: none; }
.section-title {
  margin: 0;
  font-family: var(--display);
  font-weight: 650;
  font-size: 22px;
  letter-spacing: -0.01em;
  color: var(--accent);
}
.section-rule { flex: 1; height: 2px; border-radius: 2px; background: var(--line); }

/* ---------- results journey ---------- */

.journey {
  position: relative;
  padding-left: 38px;
  display: flex;
  flex-direction: column;
  gap: 14px;
}
.spine {
  position: absolute;
  left: 13px;
  top: 14px;
  bottom: 14px;
  border-left: 2px dotted var(--line);
}
.journey-item { position: relative; }
.day-node {
  position: absolute;
  left: -38px;
  top: 12px;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: var(--accent);
  color: var(--chip);
  font-weight: 700;
  font-size: 14px;
  display: flex;
  align-items: center;
  justify-content: center;
}
.result-card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 18px;
  padding: 16px 18px;
  display: flex;
  flex-direction: column;
  gap: 11px;
  box-shadow: var(--sh-card);
}
.result-head {
  display: flex;
  flex-wrap: wrap; /* on narrow screens the kicker drops to its own line whole */
  align-items: baseline;
  justify-content: space-between;
  gap: 8px;
}
.result-title {
  font-family: var(--display);
  font-weight: 650;
  font-size: 18px;
  letter-spacing: -0.01em;
}
.result-kicker {
  font-weight: 700;
  font-size: 11.5px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--accent);
  white-space: nowrap;
}
.result-row {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 8px;
}
.result-key { font-weight: 500; font-size: 15px; color: var(--muted); }
.result-val { font-weight: 700; font-size: 16px; font-variant-numeric: tabular-nums; white-space: nowrap; }
.val-wrap {
  display: flex;
  align-items: baseline;
  gap: 7px;
  font-variant-numeric: tabular-nums;
}
.val-hint { font-weight: 500; font-size: 13px; color: var(--faint); white-space: nowrap; }
.val-hint:empty { display: none; }

.sleep-wrap { position: relative; display: flex; }
.sleep-chip {
  background: var(--chip);
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 7px 14px;
  font-weight: 500;
  font-size: 13px;
  color: var(--muted);
}

.total-row {
  display: flex;
  flex-wrap: wrap; /* on narrow screens the sum drops whole to a second line, right-aligned */
  justify-content: space-between;
  align-items: baseline;
  gap: 10px;
  padding: 2px 6px 0 38px;
}
.total-key { font-weight: 500; font-size: 15px; color: var(--muted); white-space: nowrap; }
.total-wrap {
  display: flex;
  align-items: baseline;
  gap: 7px;
  font-variant-numeric: tabular-nums;
  margin-left: auto;
}
.total-sub { font-weight: 500; font-size: 14px; color: var(--faint); white-space: nowrap; }
.total-val { font-weight: 700; font-size: 19px; color: var(--ink); white-space: nowrap; }

.cta {
  background: var(--accent);
  border: none;
  border-radius: 999px;
  padding: 18px;
  text-align: center;
  font-weight: 700;
  font-size: 18px;
  color: var(--chip);
  box-shadow: var(--sh-cta);
  width: 100%;
  transition: background .2s ease;
}
.cta:hover { background: var(--accent-hover); }
.cta:active { transform: scale(0.98); }

/* ---------- timeline (The plan) ---------- */

.plan { display: flex; flex-direction: column; gap: 12px; }
.plan-row { display: flex; align-items: flex-start; gap: 12px; }
.plan-day {
  flex: none;
  width: 48px;
  font-weight: 700;
  font-size: 12px;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--accent);
  padding-top: 7px;
}
.plan-chips {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
}
.chip {
  background: var(--chip);
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 6px 12px;
  font-weight: 500;
  font-size: 13px;
  color: var(--ink);
}
.chip-arrow { font-weight: 700; font-size: 13px; color: var(--faint); }

/* ---------- steps / mistakes / FAQ accordions ---------- */

.day-head {
  margin: 0;
  font-family: var(--display);
  font-weight: 650;
  font-size: 18px;
  letter-spacing: -0.01em;
  padding: 4px 2px 0;
}
.day-head.day2 { padding-top: 8px; }

.acc {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 14px;
  overflow: hidden;
  box-shadow: var(--sh-card);
}
.acc-head {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  padding: 14px 16px;
  background: none;
  border: none;
  text-align: left;
  transition: background .2s ease;
}
.acc-head:hover { background: var(--tint-hover); }
.acc-head.plain { padding: 16px; }
.step-num {
  flex: none;
  width: 26px;
  height: 26px;
  border-radius: 50%;
  background: var(--tint);
  color: var(--accent);
  font-weight: 700;
  font-size: 13px;
  display: flex;
  align-items: center;
  justify-content: center;
}
.acc-title { flex: 1; font-weight: 700; font-size: 15.5px; color: var(--ink); }
.acc-body {
  padding: 0 16px 16px 54px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.acc-body.flush { padding-left: 16px; gap: 12px; }
.acc-text { font-weight: 500; font-size: 14.5px; line-height: 1.55; color: var(--ink); }
.acc-text strong { font-weight: 700; color: var(--ink); }
.tip {
  background: var(--tip-bg);
  border-radius: 10px;
  padding: 10px 12px;
  font-weight: 500;
  font-size: 13.5px;
  line-height: 1.5;
  color: var(--ink);
}
.tip strong { font-weight: 700; color: var(--tip-label); }

/* ---------- footer ---------- */

.footer {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  padding-top: 14px;
}
.footer-note {
  text-align: center;
  font-weight: 500;
  font-size: 13px;
  color: var(--muted);
}

/* ---------- Kitchen Mode overlay ---------- */

.km {
  position: fixed;
  inset: 0; /* anchored to both viewport edges — more robust than an explicit height */
  z-index: 100;
  overflow: hidden;
  background: var(--bg);
  font-family: 'Inter', sans-serif;
  color: var(--ink);
  display: flex;
  flex-direction: column;
}
.km-top {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 16px 10px;
}
.km-exit {
  flex: none;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: var(--chip);
  border: 1px solid var(--line);
  font-weight: 700;
  font-size: 16px;
  color: var(--muted);
}
.km-phase {
  flex: 1;
  text-align: center;
  font-weight: 700;
  font-size: 14px;
  color: var(--muted);
}
.km-count {
  flex: none;
  width: 40px;
  text-align: right;
  font-weight: 500;
  font-size: 13px;
  color: var(--faint);
  font-variant-numeric: tabular-nums;
}
.km-progress {
  height: 5px;
  background: var(--line);
  border-radius: 3px;
  margin: 0 16px;
}
.km-progress-fill {
  height: 100%;
  background: var(--accent);
  border-radius: 3px;
  transition: width .3s ease;
}

.km-screen {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 24px;
  text-align: center;
}

/* ingredient screen — the whole screen is the tap target */
.km-ing {
  gap: 12px;
  background: none;
  border: none;
  transition: background .2s ease;
}
.km-ing:active { background: rgba(196,60,104,0.06); }
.km-add { font-weight: 500; font-size: 19px; color: var(--muted); }
.km-ing-name {
  font-family: var(--display);
  font-weight: 650;
  font-size: 34px;
  letter-spacing: -0.01em;
}
.km-ing-amt {
  font-weight: 700;
  font-size: 64px;
  color: var(--accent);
  font-variant-numeric: tabular-nums;
  line-height: 1.1;
  max-width: 100%;
}
/* long imperial amounts ("2 lb 6.8 oz") scale down instead of bleeding off narrow screens */
.km-ing-amt.long { font-size: min(64px, calc((100vw - 48px) / 6)); }
.km-ing-hint { font-weight: 500; font-size: 18px; color: var(--faint); min-height: 24px; }
.km-tap { margin-top: 26px; font-weight: 500; font-size: 15px; color: var(--faint); }

/* action / info screen — whole screen advances, like ingredient screens */
.km-txt {
  gap: 16px;
  background: none;
  border: none;
  color: inherit;
  transition: background .2s ease;
}
.km-txt:active { background: rgba(196,60,104,0.06); }
.km-txt-title {
  font-family: var(--display);
  font-weight: 650;
  font-size: 32px;
  letter-spacing: -0.01em;
  max-width: 340px;
}
.km-txt-body { font-weight: 500; font-size: 18px; line-height: 1.6; color: var(--ink); max-width: 340px; }
.km-txt-extra { font-weight: 700; font-size: 17px; color: var(--accent); max-width: 340px; }
.km-txt-extra:empty { display: none; }

/* timer screen */
.km-timer { gap: 16px; }
.km-timer-title {
  font-family: var(--display);
  font-weight: 650;
  font-size: 28px;
  letter-spacing: -0.01em;
}
.km-timer-note { font-weight: 500; font-size: 17px; line-height: 1.5; color: var(--muted); max-width: 340px; }
.km-presets { display: flex; gap: 10px; margin-top: 14px; }
/* keeps controls' space after they deactivate, so the clock doesn't re-center */
.km .ghost { visibility: hidden; }
/* proof duration selector — same segmented control as the yeast toggle, sized for KM */
.km-seg { width: 250px; margin-top: 14px; }
.km-seg button { font-size: 15px; padding: 10px 6px; }
.km-preset {
  border: 2px solid var(--accent);
  background: none;
  border-radius: 999px;
  padding: 14px 22px;
  font-weight: 700;
  font-size: 18px;
  color: var(--accent);
  transition: background .2s ease, color .2s ease;
}
.km-preset:hover { background: var(--accent); color: var(--chip); }
.km-countdown {
  font-weight: 700;
  /* capped so "2:59:59" fits narrow phones; 76px from ~390px viewports up */
  font-size: min(76px, calc((100vw - 48px) / 4.5));
  font-family: ui-monospace, Menlo, monospace;
  font-variant-numeric: tabular-nums;
  color: var(--ink);
  line-height: 1.1;
}
.km-done-msg {
  font-family: var(--display);
  font-weight: 650;
  font-size: 34px;
  color: var(--accent);
}

/* done screen */
.km-donescreen { gap: 22px; }
.km-buon {
  font-family: var(--display);
  font-weight: 800;
  font-size: 46px;
  letter-spacing: -0.015em;
}
.km-finish {
  background: var(--accent);
  border: none;
  border-radius: 999px;
  padding: 16px 28px;
  font-weight: 700;
  font-size: 17px;
  color: var(--chip);
  box-shadow: var(--sh-cta);
  transition: background .2s ease;
}
.km-finish:hover { background: var(--accent-hover); }

/* bottom bar */
.km-bottom {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px 20px 24px;
  padding-bottom: calc(24px + env(safe-area-inset-bottom));
}
.km-back {
  background: none;
  border: none;
  font-weight: 700;
  font-size: 16px;
  color: var(--muted);
  padding: 12px 16px;
}
.km-back.hide { visibility: hidden; }
.km-next {
  background: none;
  border: none;
  font-weight: 700;
  font-size: 16px;
  color: var(--accent);
  padding: 12px 16px;
}
