/* Trunk website. Colours follow the app (SPEC 2b): Trunk orange with dark text in dark mode,
   the deeper red-orange with white text in light mode, neutral greys with no blue tint.
   System fonts only, so the page loads nothing from anyone else's server. */

:root {
  --bg: #000;
  --surface: #141416;
  --surface-2: #2a2a2d;
  --text: #f4f4f5;
  --muted: #a8a8ad;
  --accent: #ff7a2f;
  --on-accent: #1e1f24;
  --container: #5c2206;
  --on-container: #ffe3d3;
  --line: #2a2a2d;
  --field-line: #6e6e73; /* 3.6:1 on --surface: a form control's edge must be visible */
  --error: #e5484d;
  --radius: 14px;
  color-scheme: dark light;
}

@media (prefers-color-scheme: light) {
  :root {
    --bg: #fff;
    --surface: #f4f4f6;
    --surface-2: #e2e2e6;
    --text: #1e1f24;
    --muted: #55565c;
    --accent: #c2410c;
    --on-accent: #fff;
    --container: #ffe3d3;
    --on-container: #5c2206;
    --line: #e2e2e6;
    --field-line: #8a8a90; /* 3.1:1 on --surface */
    --error: #b42318; /* the dark scheme's red is too faint on white */
  }
}

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

html { scroll-behavior: smooth; -webkit-text-size-adjust: 100%; }
@media (prefers-reduced-motion: reduce) { html { scroll-behavior: auto; } }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 17px/1.6 system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}

a { color: var(--accent); text-underline-offset: 2px; }
a:focus-visible, button:focus-visible, input:focus-visible, textarea:focus-visible,
.scale-wrap:focus-visible, .tl-choices input:focus-visible + span {
  outline: 3px solid var(--accent);
  outline-offset: 2px;
}

h1, h2, h3 { line-height: 1.2; margin: 0 0 .5em; }
h1 { font-size: clamp(2rem, 5vw, 3.2rem); letter-spacing: -.02em; }
h2 { font-size: clamp(1.5rem, 3.4vw, 2.1rem); letter-spacing: -.01em; }
h3 { font-size: 1.1rem; }
p { margin: 0 0 1em; }

.wrap { max-width: 1080px; margin: 0 auto; padding: 0 20px; }
.narrow { max-width: 720px; }
.center { text-align: center; }
.small { font-size: .92rem; color: var(--muted); }

.visually-hidden {
  position: absolute; width: 1px; height: 1px; overflow: hidden;
  clip: rect(0 0 0 0); clip-path: inset(50%); white-space: nowrap;
}
.skip { position: absolute; left: -9999px; }
.skip:focus { left: 12px; top: 12px; z-index: 10; background: var(--accent); color: var(--on-accent); padding: 8px 12px; border-radius: 8px; }

/* Header */
.top { border-bottom: 1px solid var(--line); }
.top-row { display: flex; align-items: center; justify-content: space-between; gap: 16px; min-height: 64px; flex-wrap: wrap; }
.brand { display: flex; align-items: center; gap: 10px; color: var(--text); text-decoration: none; font-weight: 700; font-size: 1.2rem; }
.brand img { border-radius: 9px; }
.top nav { display: flex; gap: 20px; flex-wrap: wrap; }
.top nav a { color: var(--text); text-decoration: none; font-weight: 500; padding: 10px 0; }
.top nav a:hover { color: var(--accent); }

/* Buttons */
.btn {
  display: inline-flex; align-items: center; justify-content: center;
  min-height: 48px; padding: 12px 22px; border: 0; border-radius: 999px;
  background: var(--accent); color: var(--on-accent);
  font: inherit; font-weight: 700; text-decoration: none; cursor: pointer;
}
.btn:hover { filter: brightness(1.08); }
.btn[aria-disabled="true"] { opacity: .6; cursor: progress; }
/* When Send is showing an instruction ("Tick the box above to send"), it must stay readable. */
.btn[aria-disabled="true"].tl-waiting { opacity: 1; }
.btn-quiet { background: var(--surface-2); color: var(--text); }

/* Hero */
.hero { padding-block: 64px 56px; } /* block only: .wrap keeps the side padding (404 page) */
.hero-row { display: grid; grid-template-columns: 1.4fr 1fr; gap: 48px; align-items: center; }
.eyebrow { color: var(--accent); font-weight: 700; text-transform: uppercase; letter-spacing: .08em; font-size: .85rem; }
.lead { font-size: 1.15rem; color: var(--muted); max-width: 36em; }
.hero-art { display: flex; justify-content: center; }
.hero-art img { width: min(280px, 70vw); height: auto; border-radius: 22%; }

/* Store buttons: our own greyed-out placeholders, not Apple's or Google's badges (their badge
   rules forbid changing the colours and only allow them once the app is listed). */
.stores { display: flex; gap: 12px; flex-wrap: wrap; margin: 28px 0 20px; }
.store {
  display: inline-flex; align-items: center; gap: 10px;
  min-height: 56px; padding: 8px 18px 8px 14px; border-radius: 12px;
  border: 1px solid var(--line); background: var(--surface); color: var(--muted);
  cursor: not-allowed; user-select: none;
}
.store-icon { width: 24px; height: 24px; flex: none; }
.store span { display: flex; flex-direction: column; line-height: 1.2; font-weight: 600; }
.store small { font-size: .72rem; font-weight: 500; text-transform: uppercase; letter-spacing: .04em; }
.notify-line { display: flex; align-items: center; gap: 16px; flex-wrap: wrap; }
.notify-line span { color: var(--muted); font-size: .95rem; }

/* Sections */
/* Every section after the hero, so a new section gets the same spacing without a new rule. */
main > section:not(.hero), .policy { padding: 56px 0; border-top: 1px solid var(--line); }
.section-lead { font-size: 1.1rem; color: var(--muted); max-width: 46em; }
.trio, .grid { list-style: none; margin: 0; padding: 0; display: grid; gap: 20px; }
.trio { grid-template-columns: repeat(3, 1fr); }
.grid { grid-template-columns: repeat(3, 1fr); margin-top: 28px; }
.trio li, .grid li, .pair > div { background: var(--surface); border-radius: var(--radius); padding: 22px; }
.trio li p, .grid li p, .pair p { color: var(--muted); margin: 0; }
.trio h3 { color: var(--accent); }
.download .actions { margin: 24px 0; }

/* Privacy policy (privacy.html) */
.policy h2 { font-size: 1.3rem; margin-top: 1.8em; }
.policy p, .policy li { color: var(--muted); }
.policy strong { color: var(--text); }
.policy ul { padding-left: 1.2em; }
.policy li { margin-bottom: .6em; }
.meta { font-size: .92rem; }

/* RPE and RIR */
.effort-row { display: grid; grid-template-columns: minmax(260px, 1fr) 1.6fr; gap: 32px; align-items: start; margin-top: 28px; }
/* Only the table scrolls sideways when zoomed in on a phone, never the whole page. */
.scale-wrap { overflow-x: auto; background: var(--surface); border-radius: var(--radius); }
.scale { width: 100%; border-collapse: collapse; }
.scale caption { text-align: left; font-weight: 600; padding-bottom: 8px; }
.scale th, .scale td { padding: 10px 14px; text-align: left; border-bottom: 1px solid var(--line); }
.scale th { color: var(--muted); font-size: .85rem; text-transform: uppercase; letter-spacing: .04em; }
.scale td:first-child, .scale td:nth-child(2) { font-weight: 700; color: var(--accent); }
@media (min-width: 400px) { .scale td:first-child, .scale td:nth-child(2) { white-space: nowrap; } }
.scale tr:last-child td { border-bottom: 0; }
.ticks { list-style: none; margin: 0; padding: 0; display: grid; gap: 14px; }
.ticks li { padding-left: 30px; position: relative; color: var(--muted); }
/* Decorative: the second content value gives it empty alt text, so screen readers skip it. */
.ticks li::before { content: "✓"; content: "✓" / ""; position: absolute; left: 0; top: 0; color: var(--accent); font-weight: 700; }
.ticks strong { color: var(--text); }

/* Volume call-out */
main > section.volume { background: var(--container); color: var(--on-container); border-top: 0; }
.volume .eyebrow { color: inherit; opacity: .85; }
.volume .section-lead, .volume .note { color: inherit; }
.math-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; margin: 28px 0 20px; }
.math { background: var(--bg); color: var(--text); border-radius: var(--radius); padding: 20px; margin: 0; }
.math p { margin: 0; }
.math-what { font-weight: 700; }
.math .math-typed { color: var(--muted); margin-top: 6px; }
.math-typed b { color: var(--text); }
.math .math-sum { color: var(--muted); font-size: .95rem; margin-top: 10px; }
.math-total { font-size: 1.8rem; font-weight: 800; color: var(--accent); letter-spacing: -.01em; }
.note { font-size: .95rem; max-width: 46em; }

/* Library */
.pair { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; margin-top: 20px; }

/* Price */
.price-points { list-style: none; padding: 0; margin: 24px 0; display: flex; flex-wrap: wrap; justify-content: center; gap: 10px; }
.price-points li { background: var(--surface); border-radius: 999px; padding: 8px 16px; font-weight: 600; }

/* Footer */
.foot { border-top: 1px solid var(--line); padding: 28px 0 40px; color: var(--muted); font-size: .92rem; }
.foot-row { display: flex; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.foot a { color: var(--muted); }
.trademarks { font-size: .8rem; margin: 12px auto 0; }

@media (max-width: 860px) {
  .hero { padding-top: 40px; }
  .hero-row { grid-template-columns: 1fr; gap: 32px; }
  .hero-art { order: -1; justify-content: flex-start; }
  .hero-art img { width: 120px; }
  .trio, .grid, .effort-row, .math-grid, .pair { grid-template-columns: 1fr; }
}
@media (min-width: 861px) and (max-width: 1000px) {
  .grid { grid-template-columns: repeat(2, 1fr); }
}

/* Contact dialog (contact-form.js) */
html.tl-lock { overflow: hidden; }
.tl-dialog [hidden] { display: none !important; }
.tl-dialog {
  width: min(520px, calc(100vw - 24px)); max-height: calc(100dvh - 24px); overflow: auto;
  padding: 28px; border: 1px solid var(--line); border-radius: 18px;
  background: var(--surface); color: var(--text);
  overflow-wrap: anywhere; /* a long email address in the messages must wrap, not widen the box */
}
.tl-dialog::backdrop { background: rgba(0, 0, 0, .6); }
.tl-dialog h2 { font-size: 1.4rem; padding-right: 40px; }
.tl-close {
  position: absolute; top: 12px; right: 12px; width: 48px; height: 48px;
  border: 0; border-radius: 50%; background: transparent; color: var(--muted);
  font-size: 1.6rem; line-height: 1; cursor: pointer;
}
.tl-close:hover { background: var(--surface-2); color: var(--text); }
.tl-dialog fieldset { border: 0; padding: 0; margin: 0 0 16px; }
.tl-dialog legend { font-weight: 600; margin-bottom: 8px; padding: 0; }
.tl-choices { display: flex; flex-wrap: wrap; gap: 8px; }
.tl-choices label { position: relative; }
.tl-choices input { position: absolute; opacity: 0; inset: 0; margin: 0; cursor: pointer; }
.tl-choices span {
  display: inline-flex; align-items: center; min-height: 48px; padding: 8px 14px;
  border: 1px solid var(--field-line); border-radius: 999px; background: var(--bg); cursor: pointer;
}
.tl-choices input:checked + span { background: var(--container); color: var(--on-container); border: 2px solid var(--accent); padding: 7px 13px; }
/* A shape as well as a colour, as in the app (SPEC 2b): the picked chip gets a tick. */
.tl-choices input:checked + span::before { content: "✓"; content: "✓" / ""; margin-inline-end: 6px; font-weight: 700; }
.tl-field { margin-bottom: 14px; }
.tl-field label { display: block; font-weight: 600; margin-bottom: 4px; }
.tl-field small { font-weight: 400; color: var(--muted); }
.tl-field input, .tl-field textarea {
  width: 100%; padding: 12px; border: 1px solid var(--field-line); border-radius: 10px;
  background: var(--bg); color: var(--text); font: inherit;
}
.tl-field [aria-invalid="true"] { border: 2px solid var(--error); }
.tl-phones[aria-invalid="true"] .tl-choices span { border-color: var(--error); }
.tl-promise { font-size: .9rem; color: var(--muted); background: var(--bg); border-radius: 10px; padding: 10px 12px; }
.tl-hp { position: absolute; left: -9999px; width: 1px; height: 1px; overflow: hidden; }
.tl-error { color: var(--error); font-weight: 600; }
.tl-error a { margin-left: 4px; }
.tl-alt { font-size: .9rem; color: var(--muted); margin: 14px 0 0; }
.tl-done { text-align: center; padding: 12px 0; }
.tl-done:focus { outline: none; }
.tl-check {
  width: 56px; height: 56px; margin: 0 auto 12px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  background: var(--container); color: var(--on-container); font-size: 1.6rem;
}
