/* g3-app · base.css (core)
   Tokens, fonts, reset, the phone column, shared components:
   F3 header, CTA pill, secondary pill, beige tiles, list rows, chips,
   bottom sheet, toast, fixed bottom bar. Feature css builds on these. */

@font-face {
  font-family: "Kentucky Fried Sans";
  src: url("../fonts/Kentucky-Regular.ttf") format("truetype");
  font-weight: 400; font-style: normal; font-display: swap;
}
@font-face {
  font-family: "Kentucky Fried Stripes";
  src: url("../fonts/KentuckyStripes-Bold.ttf") format("truetype");
  font-weight: 900; font-style: normal; font-display: swap;
}

:root {
  /* colour */
  --red: #F5002B;
  --ink: #101010;
  --beige: #F4F1EC;
  --muted: #6B665F;
  --white: #FFFFFF;
  --green-ink: #1B7A43;
  --red-ink: #B4001F;
  --red-soft: #FDECEF;
  --green-soft: #E6F3EA;
  --line: #EEEAE4;
  --handle: #D9D4CC;
  --scrim: #6E6A65;
  --scrim-a: rgba(110, 106, 101, 0.88);
  --on-ink-muted: #C9C3B9;
  --track-off: #3A3835;
  --green: #1F9D55;
  --dot-off: #9A948B;
  --red-glow: rgba(245, 0, 43, 0.28);

  /* type */
  --f-stripes: "Kentucky Fried Stripes", "Kentucky Fried Sans", system-ui, sans-serif;
  --f-sans: "Kentucky Fried Sans", system-ui, sans-serif;
  --f-ui: "Inter", system-ui, -apple-system, sans-serif;

  /* space */
  --gutter: 20px;
  --s-4: 4px; --s-6: 6px; --s-8: 8px; --s-10: 10px; --s-12: 12px; --s-14: 14px;
  --s-16: 16px; --s-18: 18px; --s-20: 20px; --s-22: 22px; --s-24: 24px; --s-32: 32px;

  /* radius */
  --r-chip: 999px;
  --r-pill: 999px;
  --r-tile: 20px;
  --r-card: 24px;
  --r-sheet: 28px;
  --r-toast: 16px;
  --r-photo: 20px;

  /* sizes */
  --btn: 40px;
  --cta-h: 56px;
  --col: 430px;
  --sat: env(safe-area-inset-top, 0px); /* raw status bar inset (core.js App.safeTop reads it) */
  --safe-top: max(env(safe-area-inset-top), 14px);
  --safe-bottom: max(env(safe-area-inset-bottom), 16px);

  /* motion */
  --ease: cubic-bezier(0.23, 1, 0.32, 1);
  --dur: 260ms;
  --dur-fast: 200ms;
  --dur-slow: 320ms;
}

/* reset */
*, *::before, *::after { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
/* document backgrounds follow the page edges (core.js App.edges): html = top colour, body = bottom */
html { -webkit-text-size-adjust: 100%; background: var(--edge-top-background, var(--white, #FFFFFF)); }
body {
  font-family: var(--f-ui);
  font-size: 15px;
  line-height: 20px;
  color: var(--ink);
  background: var(--edge-bottom-background, var(--white, #FFFFFF));
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  font-synthesis: none;
  overflow-wrap: anywhere;
  -webkit-tap-highlight-color: transparent;
}
img, svg { display: block; }
img { max-width: 100%; }
button { font: inherit; color: inherit; background: none; border: 0; padding: 0; margin: 0; cursor: pointer; text-align: inherit; }
a { color: inherit; }
input { font: inherit; color: inherit; }
h1, h2, h3, p { margin: 0; font-weight: inherit; font-size: inherit; line-height: inherit; }
ul { list-style: none; margin: 0; padding: 0; }
:focus-visible { outline: 2px solid var(--ink); outline-offset: 2px; }
html.is-locked { overflow: hidden; }

/* the phone column: full width on phones, centred column on desktop */
#app {
  position: relative;
  width: 100%;
  max-width: var(--col);
  min-height: 100vh;
  min-height: 100dvh;
  margin: 0 auto;
  background: var(--white);
}
@media (min-width: 600px) {
  #app { box-shadow: 0 0 0 1px var(--line); }
}
#view { position: relative; }
.screen { min-height: 100vh; min-height: 100dvh; background: var(--white); padding-bottom: 32px; }
.screen.has-bar { padding-bottom: 120px; }
/* Page changes (core.js render): the new page swaps in at once and only its in-flow content blocks
   ease up from a light dim (180ms); fixed bars and the edge strips never animate. No View Transition: its root snapshot carried the status bar strip, the toolbar
   strip and the fixed bars, so the page edges crossfaded between two pages' colours. */
/* no rubber band or pull-to-refresh on the page: the app never scrolls past its ends (sheets and lists keep theirs) */
html { overscroll-behavior-y: none; }
@media (prefers-reduced-motion: reduce) { ::view-transition-group(*), ::view-transition-old(*), ::view-transition-new(*) { animation: none !important; } }

/* overlays live in a fixed layer the width of the column */
.overlay-root {
  position: fixed; top: 0; bottom: 0; left: 50%;
  width: 100%; max-width: var(--col);
  transform: translateX(-50%);
  pointer-events: none;
  z-index: 55;
}
.overlay-root > * { pointer-events: auto; }
.sheet-root { position: fixed; inset: 0; z-index: 50; pointer-events: none; }
.sheet-root:empty { display: none; }
.sheet-root > * { pointer-events: auto; }

/* type helpers */
.t-stripes { font-family: var(--f-stripes); font-weight: 900; text-transform: uppercase; letter-spacing: -0.01em; }
.t-sans { font-family: var(--f-sans); font-weight: 400; }
.t-muted { color: var(--muted); }
.label-11 { font-family: var(--f-sans); font-size: 11px; line-height: 12px; text-transform: uppercase; }
.price { font-family: var(--f-sans); white-space: nowrap; }
.link-u { text-decoration: underline 1px; text-underline-position: from-font; font-weight: 600; }

/* round icon button (beige) */
.icon-btn {
  width: var(--btn); height: var(--btn); flex-shrink: 0;
  display: inline-flex; align-items: center; justify-content: center;
  border-radius: 999px; background: var(--beige); color: var(--ink);
  transition: transform var(--dur-fast) var(--ease);
}
.icon-btn:active { transform: scale(0.94); }
.icon-btn.is-ink { background: var(--ink); color: var(--white); }
.icon-btn.is-white { background: var(--white); }

/* F3 header: back, big Stripes title, context line + pencil, search, account slot */
.hdr {
  display: flex; align-items: flex-start; gap: 8px;
  padding: calc(var(--safe-top) + 4px) var(--gutter) 0;
}
.hdr-main { flex: 1 1 0; min-width: 0; display: flex; flex-direction: column; padding-left: 4px; }
.hdr-title {
  font-family: var(--f-stripes); font-weight: 900; text-transform: uppercase;
  font-size: 34px; line-height: 36px; letter-spacing: -0.01em; color: var(--ink);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.hdr-title.is-m { font-size: 28px; line-height: 36px; }
.hdr-title.is-s { font-size: 23px; line-height: 36px; }
.hdr.is-lg .hdr-title { font-size: 44px; line-height: 44px; }
.hdr.is-lg .hdr-title.is-m { font-size: 34px; line-height: 44px; }
.hdr.is-lg .hdr-title.is-s { font-size: 27px; line-height: 44px; }
.hdr-ctx {
  display: inline-flex; align-items: center; gap: 6px; align-self: flex-start;
  font-size: 13px; line-height: 16px; color: var(--muted);
  max-width: 100%;
}
.hdr-ctx span { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.hdr.is-lg .hdr-main { gap: 4px; }
.hdr-side { display: flex; gap: 8px; flex-shrink: 0; }
.nav-slot:empty { display: none; }

/* CTA: red pill with the white price pill */
.cta {
  display: flex; align-items: center; justify-content: center; gap: 12px;
  width: 100%; height: var(--cta-h); padding: 0 22px;
  border-radius: var(--r-pill); background: var(--red); color: var(--white);
  font-family: var(--f-sans); font-size: 18px; line-height: 22px;
  transition: transform var(--dur-fast) var(--ease), opacity var(--dur-fast) var(--ease);
}
.cta:active { transform: scale(0.98); }
.cta[disabled] { opacity: 0.4; pointer-events: none; }
.cta-price {
  background: var(--white); color: var(--ink); border-radius: var(--r-pill);
  padding: 4px 10px; font-size: 16px; line-height: 20px; white-space: nowrap;
}
.cta.is-split { justify-content: space-between; padding: 0 8px 0 22px; }
.cta.is-split .cta-label { min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.cta.is-split .cta-price { flex-shrink: 0; }
.cta.is-split .cta-price { padding: 8px 14px; }
.cta.is-sm { height: 46px; font-size: 17px; gap: 10px; }
.cta.is-sm .cta-price { padding: 3px 9px; font-size: 15px; line-height: 18px; }

/* secondary pills */
.btn-secondary {
  display: flex; align-items: center; justify-content: center; gap: 10px;
  width: 100%; height: var(--cta-h); padding: 0 22px;
  border-radius: var(--r-pill); border: 1.5px solid var(--ink); background: var(--white); color: var(--ink);
  font-family: var(--f-sans); font-size: 18px; line-height: 22px;
}
.btn-black {
  display: flex; align-items: center; justify-content: center; gap: 10px;
  width: 100%; height: var(--cta-h); padding: 0 22px;
  border-radius: var(--r-pill); background: var(--ink); color: var(--white);
  font-family: var(--f-sans); font-size: 18px; line-height: 22px;
}
.btn-secondary.is-sm, .btn-black.is-sm { height: 46px; font-size: 17px; }
.pill-sm {
  display: inline-flex; align-items: center; height: 34px; padding: 0 14px; flex-shrink: 0;
  border-radius: var(--r-pill); font-size: 14px; line-height: 18px; font-weight: 600;
  border: 1.5px solid var(--ink); background: transparent; color: var(--ink);
}
.pill-sm.is-white { background: var(--white); border-color: var(--white); }

/* round red arrow button used on tiles */
.go-dot {
  width: 34px; height: 34px; flex-shrink: 0; border-radius: 999px;
  display: inline-flex; align-items: center; justify-content: center;
  background: var(--red); color: var(--white);
}
.add-btn {
  width: 36px; height: 36px; flex-shrink: 0; border-radius: 999px;
  display: inline-flex; align-items: center; justify-content: center;
  background: var(--red); color: var(--white);
  transition: transform var(--dur-fast) var(--ease);
}
.add-btn:active { transform: scale(0.9); }
.add-btn.is-quiet { width: 40px; height: 40px; background: var(--beige); color: var(--ink); }
.add-btn.is-count { background: var(--ink); color: var(--white); font-family: var(--f-sans); font-size: 17px; }

/* beige tile */
.tile {
  position: relative; display: flex; flex-direction: column; justify-content: space-between;
  background: var(--beige); border-radius: var(--r-tile); padding: 16px; overflow: hidden;
  text-align: left; color: var(--ink);
  transition: transform var(--dur-fast) var(--ease);
}
.tile:active { transform: scale(0.98); }
.tile-name { font-family: var(--f-sans); font-size: 19px; line-height: 22px; }
.tile-sub { font-size: 12px; line-height: 16px; color: var(--muted); }

/* list rows with beige photo squares */
.rows { display: flex; flex-direction: column; padding: 0 var(--gutter); }
.row {
  display: flex; align-items: center; gap: 14px; padding: 14px 0;
  border-bottom: 1px solid var(--line); text-align: left; width: 100%;
}
.row:last-child { border-bottom: 0; }
.row-photo {
  width: 84px; height: 84px; flex-shrink: 0; border-radius: var(--r-photo);
  background: var(--beige); display: flex; align-items: center; justify-content: center; overflow: hidden;
}
.row-photo img { width: 72px; height: 64px; object-fit: contain; }
.row-main { flex: 1 1 0; min-width: 0; display: flex; flex-direction: column; gap: 3px; }
.row-name { font-family: var(--f-sans); font-size: 19px; line-height: 23px; }
.row-desc { font-size: 13px; line-height: 16px; color: var(--muted); }
.row-price { font-family: var(--f-sans); font-size: 17px; line-height: 22px; padding-top: 2px; white-space: nowrap; }
.row-price s { color: var(--muted); font-size: 14px; margin-left: 6px; }
.badge {
  align-self: flex-start; display: inline-flex; align-items: center; height: 20px; padding: 0 8px;
  border-radius: 999px; background: var(--red); color: var(--white);
  font-family: var(--f-sans); font-size: 11px; line-height: 12px; text-transform: uppercase;
}

/* settings style link rows (account sheet, profile) */
.lrow {
  display: flex; align-items: center; gap: 14px; height: 50px; width: 100%;
  border-bottom: 1px solid var(--line); text-align: left;
}
.lrow-ico { width: 22px; height: 22px; flex-shrink: 0; display: flex; align-items: center; justify-content: center; }
.lrow-label { flex: 1 1 0; font-size: 16px; line-height: 20px; font-weight: 500; }
.lrow-value { font-size: 14px; line-height: 18px; color: var(--muted); }
.lrow-chev { color: var(--muted); flex-shrink: 0; }

/* chips */
.chips {
  display: flex; gap: 8px; overflow-x: auto; padding: 18px var(--gutter) 0;
  scrollbar-width: none; scroll-padding: 0 var(--gutter);
}
.chips::-webkit-scrollbar { display: none; }
.chip {
  display: inline-flex; align-items: center; height: 40px; padding: 0 16px; flex-shrink: 0;
  border-radius: var(--r-chip); background: var(--beige); color: var(--ink);
  font-size: 14px; line-height: 18px; font-weight: 500; white-space: nowrap;
  transition: background-color var(--dur-fast) var(--ease), color var(--dur-fast) var(--ease);
}
.chip.is-active { background: var(--ink); color: var(--white); font-weight: 600; }
.chip.is-sm { height: 24px; padding: 0 10px; font-size: 12px; line-height: 14px; }

/* search field */
.search {
  display: flex; align-items: center; gap: 10px; height: 48px; padding: 0 18px;
  border-radius: 999px; background: var(--beige); color: var(--muted);
}
.search input {
  flex: 1 1 0; min-width: 0; border: 0; background: transparent; outline: none;
  font-size: 16px; line-height: 18px; color: var(--ink);
}
.search input::placeholder { color: var(--muted); }

/* section label */
.sec-label { font-size: 13px; line-height: 16px; font-weight: 600; color: var(--muted); }

/* status dot */
.dot { width: 8px; height: 8px; border-radius: 999px; background: var(--green); flex-shrink: 0; }
.dot.is-off { background: var(--dot-off); }

/* fixed bottom bar inside the column */
.bar-fixed {
  position: fixed; bottom: 0; left: 50%; transform: translateX(-50%);
  width: 100%; max-width: var(--col); z-index: 20;
  background: var(--white); border-top: 1px solid var(--line);
  padding: 12px var(--gutter) calc(var(--safe-bottom) + var(--foot-gap));
}

/* bottom sheet */
.sheet-scrim {
  position: fixed; inset: 0; background: var(--scrim-a);
  opacity: 0; transition: opacity var(--dur) var(--ease);
}
.sheet-scrim.is-solid { background: var(--scrim); }
.sheet {
  position: fixed; left: 0; right: 0; bottom: 0; margin: 0 auto; width: 100%; max-width: var(--col);
  max-height: calc(100% - 24px - var(--safe-top));
  display: flex; flex-direction: column;
  background: var(--white); border-radius: var(--r-sheet) var(--r-sheet) 0 0;
  transform: translateY(100%); transition: transform var(--dur-slow) var(--ease);
  will-change: transform;
}
.sheet.is-full { top: calc(var(--safe-top) + 24px); max-height: none; }
.sheet-layer.is-open .sheet-scrim { opacity: 1; }
.sheet-layer.is-open .sheet { transform: translateY(0); }
.sheet-layer.is-dragging .sheet { transition: none; }
/* closing is quicker than opening (the eye has already moved on) */
.sheet-layer.is-closing .sheet { transition-duration: 240ms; }
.sheet-layer.is-closing .sheet-scrim { transition-duration: 200ms; }
.sheet-layer { position: fixed; inset: 0; }
.sheet-grab { display: flex; justify-content: center; padding: 8px 0 6px; flex-shrink: 0; touch-action: none; cursor: grab; }
.sheet-grab i { width: 36px; height: 5px; border-radius: 3px; background: var(--handle); }
.sheet-notch {
  position: absolute; top: 0; left: 50%; width: 240px; height: 28px; margin-left: -120px;
  display: flex; justify-content: center; touch-action: none; z-index: 2;
}
.sheet-notch svg { position: absolute; left: 0; top: -1px; }
.sheet-notch-steps { position: absolute; top: 9px; display: flex; gap: 4px; }
.sheet-notch-steps i { width: 26px; height: 5px; border-radius: 3px; background: var(--white); }
.sheet-notch-steps i.is-on { background: var(--red); }
.sheet.has-notch { padding-top: 28px; }
.sheet-body { flex: 1 1 auto; overflow-y: auto; overscroll-behavior: contain; padding-bottom: calc(var(--safe-bottom) + var(--foot-gap)); }
.sheet-head { display: flex; align-items: flex-start; gap: 14px; padding: 10px var(--gutter) 18px; }
.sheet-title { flex: 1 1 0; font-family: var(--f-sans); font-size: 24px; line-height: 28px; }

/* toast */
.toast {
  position: absolute; left: var(--gutter); right: var(--gutter);
  bottom: calc(var(--toast-bottom, 0px) + var(--safe-bottom) + 12px);
  display: flex; align-items: center; gap: 10px; min-height: 48px; padding: 0 16px;
  border-radius: var(--r-toast); background: var(--ink); color: var(--white);
  font-size: 14px; line-height: 18px;
  opacity: 0; transform: translateY(12px);
  transition: opacity var(--dur) var(--ease), transform var(--dur) var(--ease);
  z-index: 5;
  pointer-events: none; /* status only: never swallows taps on the screen under it */
}
.toast.is-on { opacity: 1; transform: none; }
.toast-ico { width: 20px; height: 20px; flex-shrink: 0; border-radius: 999px; background: var(--green); display: flex; align-items: center; justify-content: center; }
.toast-text { flex: 1 1 0; padding: 14px 0; }
.toast-undo { pointer-events: auto; font-weight: 600; text-decoration: underline 1px; text-underline-offset: 3px; color: var(--white); padding: 10px 0 10px 8px; }

/* visually hidden */
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 1ms !important; transition-duration: 1ms !important; }
}

/* phones: the page ground is white, so iOS Safari tints the status bar area
   (time, battery) white; the beige ground only frames the phone column on
   wide screens */
@media (min-width: 600px) { html, body { background: var(--beige); } }

/* no double-tap zoom (Safari and the home-screen app view); pinch zoom stays.
   Fields keep at least 16px text so iOS never zooms in on focus. */
html, body, button, a, [role="button"], input, select, textarea, label { touch-action: manipulation; }
input, select, textarea { font-size: max(16px, 1em); }
/* while a sheet is open the toast moves to the top, clear of the sheet's buttons */
html.is-locked .toast { top: calc(env(safe-area-inset-top, 0px) + 12px); bottom: auto; transform: translateY(-12px); }
html.is-locked .toast.is-on { transform: none; }
/* product photos fill their beige squares (the PNGs carry their own margin) */
.row-photo img { width: 100%; height: 100%; object-fit: contain; transform: scale(1.22); }
/* in the Safari browser the toolbar already sits under the page, so bottom
   bars only keep a small gap; the home-screen app (standalone) keeps the
   home-indicator safe area */
/* iOS 26 Safari: the layout viewport ends right at the floating toolbar, which
   already keeps ~15px of air, so in the browser bottom CTAs add only --foot-gap */
:root { --safe-bottom: 0px; --foot-gap: 12px; } /* 12px = clear of the bottom edge strip */
@media (display-mode: standalone) { :root { --safe-bottom: max(env(safe-area-inset-bottom), 16px); --foot-gap: 18px; } }
.sheet-body:has(.bld-foot, .dlb-bar) { padding-bottom: 0; }

/* sheets dim the live screen behind them instead of hiding it */
:root { --scrim-a: rgba(24, 20, 16, 0.48); }
.sheet-scrim.is-solid { background: var(--scrim-a); }
/* no progress dashes on sheets: the notch is just the plain grab handle (the
   photo-slot strip inside multi-step sheets is the progress) */
.sheet-notch-steps, .sheet-notch svg { display: none !important; }
.sheet-notch { position: relative !important; left: auto !important; width: 100% !important; margin-left: 0 !important; height: auto !important; padding: 8px 0 6px; }
.sheet-notch::after { content: ""; width: 36px; height: 5px; border-radius: 3px; background: var(--handle); }
.sheet.has-notch { padding-top: 0 !important; }
/* empty-slot icons: solid, faded ink */
.slot-ico { color: var(--ink); opacity: 0.2; flex-shrink: 0; }

/* desktop stage: the app at phone size, no border, soft corners */
:root { --stage: #E8E3DA; } /* a step darker than --beige, so beige tiles inside the phone don't blend into the page */
html.is-stage, html.is-stage body { height: 100%; background: var(--stage); overflow: hidden; }
html.is-stage body > :not(.g3-stage) { display: none !important; }
.g3-stage { display: grid; place-items: center; height: 100%; padding: 24px; }
.g3-stage-phone {
  display: block; width: 402px; height: min(874px, 100%); border: 0; border-radius: 44px;
  background: var(--white); overflow: hidden;
}

/* seamless Safari edges: two thin fixed strips (added by core.js App.edges, outside every
   transformed ancestor) give Safari's status bar and toolbar the page's own top and bottom colour.
   In the home-screen app the top strip sits under the black-translucent status bar (the clock).
   Above every layer so Safari reads them; content keeps clear of them (--safe-top >= 14px,
   bottom bars end --foot-gap >= 12px above the edge). Phone widths only. */
/* iOS 26 Safari (checked in the simulator): it only extends real fixed boxes (a fixed
   pseudo-element on a static parent is ignored), and it follows live colour changes only when
   the fixed box's own background changes (a pseudo-only colour stays at its first value). So the
   strip box carries the colour too; ::after paints the same value on top. */
.edge-top, .edge-bottom { position: fixed; left: 0; right: 0; z-index: 90; pointer-events: none; }
.edge-top { top: 0; height: max(12px, env(safe-area-inset-top)); }
.edge-bottom { bottom: 0; height: max(12px, env(safe-area-inset-bottom)); }
.edge-top::after, .edge-bottom::after { content: ""; position: absolute; inset: 0; pointer-events: none; }
.edge-top, .edge-top::after { background: var(--edge-top-background, transparent); }
.edge-bottom, .edge-bottom::after { background: var(--edge-bottom-background, transparent); }
@media (min-width: 600px) { .edge-top, .edge-bottom { display: none; } }
/* iOS 26 home-screen app: the system softens the area just under the status bar, so top controls
   start a step lower there (every header uses --safe-top) */
@media (display-mode: standalone) { :root { --safe-top: calc(env(safe-area-inset-top, 0px) + 22px); } }
/* home-screen app, every screen except home (photo under the clock): the page itself starts below
   the status bar, so the area behind the clock is the html ground (App.edges paints it #0B0B0B for
   light screens) instead of a white page under iOS's grey blur. Content headers then only need the
   22px gap below the blur. Sheets and fixed layers stay viewport-based and keep the full inset. */
@media (display-mode: standalone) {
  body:not([data-screen="home"]) { margin-top: env(safe-area-inset-top, 0px); }
  body:not([data-screen="home"]) #view { --safe-top: 22px; }
}
