/* Shredded. Shared tokens and components. Home page layout lives in home.css. */
@view-transition { navigation: auto; }

:root {
  color-scheme: dark;
  --bg: #0A0A0A;
  --bg-1: #111113;
  --bg-2: #17171A;
  --bg-3: #212125;
  --text: #F3F1EC;
  --text-2: rgba(243, 241, 236, .66);
  --text-3: rgba(243, 241, 236, .42);
  --line: rgba(255, 255, 255, .09);
  --line-2: rgba(255, 255, 255, .17);

  /* Accent. One line to change it.
     Warm electric orange #FF6A2B (picked) · Ice blue #8FD3FF · Volt #D4FF3A */
  --accent: #FF6A2B;
  --accent-rgb: 255, 106, 43;
  --accent-ink: #140802;
  --accent-soft: rgba(var(--accent-rgb), .13);
  --accent-line: rgba(var(--accent-rgb), .42);

  /* Till receipt paper, used on the home page */
  --paper: #F1EEE6;
  --ink: #161412;

  --ok: #62D394;
  --miss: #FF7A7A;

  --r-s: 14px;
  --r-m: 20px;
  --r-l: 28px;
  --font: -apple-system, BlinkMacSystemFont, "SF Pro Display", "SF Pro Text", "Inter", "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --mono: ui-monospace, "SF Mono", SFMono-Regular, Menlo, Consolas, "Liberation Mono", monospace;

  /* Springs. Fallback first, real spring curves below where supported. */
  --spring: cubic-bezier(.34, 1.2, .64, 1);
  --spring-b: cubic-bezier(.34, 1.45, .64, 1);
  --ease: cubic-bezier(.22, 1, .36, 1);

  --shadow: 0 24px 60px -28px rgba(0, 0, 0, .9);
  --safe-b: env(safe-area-inset-bottom, 0px);
  --safe-t: env(safe-area-inset-top, 0px);
}
@supports (transition-timing-function: linear(0, 1)) {
  :root {
    /* damping .7: soft, about 4% overshoot */
    --spring: linear(0, .08 5%, .254 10%, .456 15%, .643 20%, .795 25%, .906 30%, .979 35%, 1.022 40%, 1.041 45%, 1.046 50%, 1.042 55%, 1.034 60%, 1.016 70%, 1.004 80%, .999 90%, 1);
    /* damping .5: bouncier, for small things */
    --spring-b: linear(0, .124 5%, .394 10%, .688 15%, .928 20%, 1.083 25%, 1.153 30%, 1.159 35%, 1.127 40%, 1.079 45%, 1.034 50%, 1 55%, .98 60%, .976 70%, .99 80%, 1.002 90%, 1);
  }
}

* { box-sizing: border-box; margin: 0; }
html { -webkit-text-size-adjust: 100%; background: var(--bg); scroll-behavior: smooth; scroll-padding-top: 72px; }
body {
  font-family: var(--font); font-size: 17px; line-height: 1.5; letter-spacing: -.011em;
  color: var(--text); background: var(--bg);
  -webkit-font-smoothing: antialiased; text-rendering: optimizeLegibility; overflow-x: clip;
}
img, svg { display: block; max-width: 100%; }
a { color: inherit; }
button, input, textarea, select { font: inherit; color: inherit; letter-spacing: inherit; }
button { -webkit-tap-highlight-color: transparent; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; border-radius: 8px; }
::selection { background: rgba(var(--accent-rgb), .35); }
[hidden] { display: none !important; }

h1, h2, h3 { font-weight: 750; letter-spacing: -.035em; line-height: 1.04; text-wrap: balance; }
h1 { font-size: clamp(38px, 11vw, 96px); letter-spacing: -.05em; line-height: .98; }
h2 { font-size: clamp(34px, 7.5vw, 56px); }
h3 { font-size: 22px; letter-spacing: -.025em; line-height: 1.15; }
p { text-wrap: pretty; }
.dim { color: var(--text-3); }
.muted { color: var(--text-2); }
.small { font-size: 14px; color: var(--text-3); }
.accent { color: var(--accent); }
.lead { font-size: clamp(19px, 2.4vw, 23px); color: var(--text-2); max-width: 30em; line-height: 1.42; }

.wrap { max-width: 1120px; margin: 0 auto; padding: 0 20px; }
.narrow { max-width: 760px; }
@media (min-width: 800px) { .wrap { padding: 0 32px; } }

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 56px; padding: 0 26px; border-radius: 999px; border: 1px solid var(--line);
  background: var(--bg-3); color: var(--text); font-weight: 650; font-size: 17px; line-height: 1;
  text-decoration: none; cursor: pointer; user-select: none; white-space: nowrap;
  transition: transform .6s var(--spring-b), background-color .2s, opacity .2s;
}
.btn:active, .press:active { transform: scale(.955); transition-duration: .1s; }
.press { transition: transform .6s var(--spring-b), background-color .2s, border-color .2s; cursor: pointer; }
.btn-primary { background: var(--accent); color: var(--accent-ink); border-color: transparent; }
.btn-ghost { background: rgba(255, 255, 255, .07); }
.btn-ink { background: var(--ink); color: var(--paper); border-color: transparent; }
.btn-block { display: flex; width: 100%; }
.btn-s { min-height: 40px; padding: 0 18px; font-size: 15px; }
.btn[disabled] { opacity: .35; pointer-events: none; }
.btn-sub { font-weight: 500; opacity: .72; }
@media (hover: hover) { .btn-ghost:hover { background: rgba(255, 255, 255, .11); } }

/* ---------- Bits ---------- */
.pill {
  display: inline-flex; align-items: center; gap: 8px; padding: 7px 13px; border-radius: 999px;
  font-size: 13px; font-weight: 600; letter-spacing: 0; color: var(--text-2);
  border: 1px solid var(--line-2); background: rgba(255, 255, 255, .04);
}
.pill.is-accent { color: var(--accent); border-color: var(--accent-line); background: var(--accent-soft); }
.dot { width: 7px; height: 7px; border-radius: 50%; background: currentColor; }
.card { background: var(--bg-1); border: 1px solid var(--line); border-radius: var(--r-l); padding: 24px; }
.glass {
  background: rgba(20, 20, 22, .62);
  -webkit-backdrop-filter: saturate(180%) blur(22px); backdrop-filter: saturate(180%) blur(22px);
  border: 1px solid var(--line);
}
.chip {
  min-height: 42px; padding: 0 16px; border-radius: 999px; border: 1px solid var(--line-2); background: transparent;
  font-size: 15px; font-weight: 600; color: var(--text-2);
}
.chip[aria-pressed="true"] { background: var(--text); color: var(--bg); border-color: transparent; }

/* Photo slot. Shows a labelled placeholder until the file exists. */
.ph { position: relative; overflow: hidden; background: var(--bg-2); display: grid; place-items: center; text-align: center; }
.ph::before {
  content: "Drop " attr(data-ph) "\A in assets/img/"; white-space: pre; padding: 16px;
  font: 600 12px/1.5 var(--mono); color: var(--text-3);
}
.ph img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }

/* ---------- Nav: an iOS-style bar ---------- */
.nav {
  position: fixed; z-index: 50; top: 0; left: 0; right: 0; padding-top: var(--safe-t);
  background: rgba(10, 10, 10, .62); -webkit-backdrop-filter: saturate(180%) blur(20px); backdrop-filter: saturate(180%) blur(20px);
  border-bottom: 1px solid var(--line);
}
.nav-in { max-width: 1120px; margin: 0 auto; height: 54px; padding: 0 12px 0 20px; display: flex; align-items: center; gap: 24px; }
.logo { display: inline-flex; align-items: baseline; font-weight: 800; font-size: 20px; letter-spacing: -.045em; text-decoration: none; }
.logo i { font-style: normal; color: var(--accent); }
.logo small { margin-left: 8px; font-size: 12px; font-weight: 550; letter-spacing: 0; color: var(--text-3); }
.nav-links { display: none; gap: 26px; margin-left: auto; font-size: 15px; font-weight: 550; }
.nav-links a { color: var(--text-2); text-decoration: none; transition: color .2s; }
.nav-links a:hover { color: var(--text); }
.nav .btn { margin-left: auto; }
@media (min-width: 800px) { .nav-links { display: flex; } .nav .btn { margin-left: 0; } .nav-in { padding: 0 32px; } }

/* ---------- Bottom sheet ---------- */
.sheet-wrap { position: fixed; inset: 0; z-index: 100; display: flex; align-items: flex-end; justify-content: center; }
.sheet-bg { position: absolute; inset: 0; background: rgba(0, 0, 0, .55); opacity: 0; transition: opacity .35s ease; }
.sheet {
  position: relative; width: 100%; max-width: 520px; max-height: 88dvh; overflow-y: auto; overscroll-behavior: contain;
  border-radius: var(--r-l) var(--r-l) 0 0; padding: 10px 20px calc(24px + var(--safe-b));
  background: rgba(26, 26, 29, .86); -webkit-backdrop-filter: saturate(180%) blur(30px); backdrop-filter: saturate(180%) blur(30px);
  border: 1px solid var(--line-2); border-bottom: 0; box-shadow: 0 -30px 80px rgba(0, 0, 0, .6);
  transform: translateY(105%); transition: transform .75s var(--spring);
}
.sheet-wrap.open .sheet { transform: translateY(var(--drag, 0px)); }
.sheet-wrap.open .sheet-bg { opacity: 1; }
.sheet-wrap.dragging .sheet { transition: none; }
.grab { width: 100%; padding: 4px 0 16px; cursor: grab; touch-action: none; }
.grab::before { content: ""; display: block; width: 38px; height: 5px; border-radius: 5px; background: rgba(255, 255, 255, .28); margin: 0 auto; }
.sheet h3 { font-size: 24px; margin-bottom: 8px; }
@media (min-width: 700px) {
  .sheet-wrap { align-items: center; }
  .sheet { border-radius: var(--r-l); border-bottom: 1px solid var(--line-2); transform: translateY(40px) scale(.96); opacity: 0; transition: transform .7s var(--spring), opacity .25s; }
  .sheet-wrap.open .sheet { transform: none; opacity: 1; }
}

/* ---------- iOS segmented control + switch ---------- */
.seg { position: relative; display: grid; grid-auto-flow: column; grid-auto-columns: 1fr; padding: 3px; border-radius: 13px; background: rgba(255, 255, 255, .08); }
.seg::before {
  content: ""; position: absolute; top: 3px; bottom: 3px; left: 3px; width: calc((100% - 6px) / var(--n, 2)); border-radius: 10px;
  background: rgba(255, 255, 255, .17); box-shadow: 0 2px 8px rgba(0, 0, 0, .35);
  transform: translateX(calc(var(--i, 0) * 100%)); transition: transform .55s var(--spring), opacity .2s;
}
.seg.none::before { opacity: 0; }
.seg button { position: relative; min-height: 40px; border: 0; background: none; font-size: 15px; font-weight: 600; color: var(--text-2); cursor: pointer; border-radius: 10px; }
.seg button[aria-pressed="true"] { color: var(--text); }
.switch { position: relative; width: 52px; height: 32px; flex: none; border-radius: 99px; border: 0; background: rgba(255, 255, 255, .16); cursor: pointer; transition: background-color .25s; }
.switch::after { content: ""; position: absolute; top: 2px; left: 2px; width: 28px; height: 28px; border-radius: 50%; background: #fff; box-shadow: 0 2px 6px rgba(0, 0, 0, .4); transition: transform .55s var(--spring-b); }
.switch[aria-checked="true"] { background: var(--accent); }
.switch[aria-checked="true"]::after { transform: translateX(20px); }

/* ---------- Simple content pages ---------- */
.page { padding: calc(110px + var(--safe-t)) 0 80px; }
.page h1 { font-size: clamp(40px, 9vw, 64px); margin-bottom: 20px; }
.page h2 { font-size: 26px; margin: 40px 0 12px; letter-spacing: -.03em; }
.page p, .page li { color: var(--text-2); margin-bottom: 12px; }
.page ul, .page ol { padding-left: 22px; }
.note { border: 1px dashed var(--line-2); border-radius: var(--r-m); padding: 16px 18px; color: var(--text-2); font-size: 15px; margin: 20px 0; }

/* ---------- Reduced motion ---------- */
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { animation-duration: .01ms !important; animation-delay: 0s !important; transition-duration: .01ms !important; transition-delay: 0s !important; }
  @view-transition { navigation: none; }
}
