/* Tossa website.
 *
 * Type is the platform's own system font, sized in rem so the reader's text size is respected;
 * tracking and leading change with size (tight on display text, open on body). Sora is kept for
 * the wordmark only. Colours are the app's. Floating chrome is a translucent material with the
 * page scrolling under it. Everything that moves has a reduced-motion equivalent. */
:root {
  --accent: #2b59ff;
  --accent-press: #1f47dc;
  --on-accent: #ffffff;
  --bg: #ffffff;
  --bg-alt: #f5f6f8;
  --surface: #f4f5f7;
  --raised: #ffffff;
  --selected: #eaf0ff;
  --text: #0e0f12;
  --muted: #5d6471;
  --hairline: rgba(14, 15, 18, 0.1);
  --material: rgba(255, 255, 255, 0.72);
  --material-edge: rgba(255, 255, 255, 0.6);
  --shadow-s: 0 1px 2px rgba(14, 22, 60, 0.06), 0 8px 24px rgba(14, 22, 60, 0.08);
  --shadow-l: 0 2px 4px rgba(14, 22, 60, 0.06), 0 30px 70px rgba(14, 22, 60, 0.18);
  --danger: #c62828;
  /* Close to a critically damped spring: quick start, no overshoot, soft landing. */
  --settle: cubic-bezier(0.22, 1, 0.36, 1);
  --font: -apple-system, BlinkMacSystemFont, "SF Pro Text", "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --wordmark: Sora, var(--font);
  color-scheme: light dark;
}

@media (prefers-color-scheme: dark) {
  :root {
    --accent: #5b82ff;
    --accent-press: #7a9aff;
    --bg: #0d0e11;
    --bg-alt: #121317;
    --surface: #17191e;
    --raised: #1d2026;
    --selected: #18213f;
    --text: #f3f4f6;
    --muted: #9aa0ab;
    --hairline: rgba(255, 255, 255, 0.12);
    --material: rgba(13, 14, 17, 0.7);
    --material-edge: rgba(255, 255, 255, 0.08);
    --shadow-s: 0 1px 2px rgba(0, 0, 0, 0.3), 0 8px 24px rgba(0, 0, 0, 0.35);
    --shadow-l: 0 2px 4px rgba(0, 0, 0, 0.3), 0 30px 70px rgba(0, 0, 0, 0.6);
    --danger: #ff8a80;
  }
}

* { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; scroll-padding-top: 4.5rem; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 400 1.0625rem/1.55 var(--font);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  /* A short page still ends with its footer at the bottom of the window. */
  min-height: 100vh; min-height: 100dvh; display: flex; flex-direction: column;
}
main { flex: 1; }

h1, h2, h3 { margin: 0; font-weight: 700; font-optical-sizing: auto; text-wrap: balance; }
h1 { font-size: clamp(2.5rem, 6.4vw, 4.75rem); line-height: 1.04; letter-spacing: -0.035em; }
h2 { font-size: clamp(1.9rem, 3.8vw, 3rem); line-height: 1.08; letter-spacing: -0.028em; }
h3 { font-size: 1.25rem; line-height: 1.2; letter-spacing: -0.015em; font-weight: 600; }
p { margin: 0; text-wrap: pretty; }

a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; text-underline-offset: 0.18em; }
:focus-visible { outline: 3px solid var(--accent); outline-offset: 3px; border-radius: 0.5rem; }

img { max-width: 100%; height: auto; display: block; }

.wrap { width: min(68rem, 100% - 2.5rem); margin-inline: auto; }

/* ---------- Header: a material that floats over the page ---------- */
.site-header {
  position: sticky; top: 0; z-index: 20;
  background: var(--material);
  -webkit-backdrop-filter: saturate(180%) blur(20px);
  backdrop-filter: saturate(180%) blur(20px);
  /* The dividing line shows only once content is under the bar. */
  box-shadow: 0 1px 0 transparent;
  transition: box-shadow 200ms ease;
}
.site-header[data-scrolled] { box-shadow: 0 1px 0 var(--hairline); }
.site-header .wrap { display: flex; align-items: center; justify-content: space-between; gap: 0.75rem; height: 3.5rem; }
.brand { display: inline-flex; align-items: center; gap: 0.6rem; color: var(--text); font-family: var(--wordmark); font-weight: 700; font-size: 1.3rem; letter-spacing: -0.02em; }
.brand:hover { text-decoration: none; }
.brand-mark { width: 1.9rem; height: 1.9rem; border-radius: 0.55rem; background: #2b59ff; display: grid; place-items: center; }
.brand-mark svg { width: 100%; height: 100%; }
.nav { display: flex; gap: 1.5rem; font-size: 0.9375rem; font-weight: 500; }
.nav a { color: var(--muted); padding: 0.4rem 0; transition: color 150ms ease; }
.nav a:hover, .nav a[aria-current="page"] { color: var(--text); text-decoration: none; }

/* ---------- Buttons: answer the press itself, not the release ---------- */
.button {
  display: inline-flex; align-items: center; justify-content: center; gap: 0.6rem;
  min-height: 3.25rem; padding: 0 1.5rem; border: 0; border-radius: 62rem;
  background: var(--accent); color: var(--on-accent);
  font: 600 1.0625rem/1 var(--font); letter-spacing: -0.01em; white-space: nowrap;
  cursor: pointer; -webkit-tap-highlight-color: transparent; touch-action: manipulation;
  transition: transform 320ms var(--settle), background-color 150ms ease;
}
.button:hover { text-decoration: none; background: var(--accent-press); }
.button:active { transform: scale(0.97); transition-duration: 100ms; }
.button svg { width: 1.25rem; height: 1.25rem; flex: none; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.button.secondary, .button.soon { background: var(--surface); color: var(--text); }
.button.secondary:hover, .button.soon:hover { background: color-mix(in srgb, var(--surface) 86%, var(--text)); }
.button:disabled { opacity: 0.55; cursor: default; transform: none; }
span.button.soon { cursor: default; }

/* ---------- Hero ---------- */
.hero { padding: clamp(3rem, 8vw, 6rem) 0 0; text-align: center; overflow: hidden; }
/* One sentence to a line; each wraps on its own when the screen is narrow. */
.hero h1 span { display: block; }
.lead { font-size: clamp(1.15rem, 1.7vw, 1.4rem); line-height: 1.4; letter-spacing: -0.01em; color: var(--muted); }
.hero .lead { max-width: 36ch; margin: 1.4rem auto 2rem; text-wrap: balance; }

/* The download buttons. Without script both stores show; with it, the one for this device leads. */
.get { display: grid; justify-items: center; gap: 0.9rem; }
.get-buttons { display: flex; flex-wrap: wrap; justify-content: center; gap: 0.75rem; }
.store-wrap { position: relative; display: inline-flex; }
.store-wrap[hidden] { display: none; }
.get-note { font-size: 0.875rem; line-height: 1.45; letter-spacing: 0.005em; color: var(--muted); max-width: 44ch; }

/* "Coming soon": grows out of the button that asked for it, and leaves the same way. */
.tip {
  position: absolute; left: 50%; bottom: calc(100% + 0.6rem); z-index: 5;
  padding: 0.6rem 0.9rem; border-radius: 0.9rem; white-space: nowrap;
  background: var(--text); color: var(--bg);
  font-size: 0.9375rem; font-weight: 600; letter-spacing: -0.005em;
  box-shadow: var(--shadow-s);
  transform-origin: 50% calc(100% + 0.6rem);
  transform: translateX(-50%) scale(0.86); opacity: 0; filter: blur(6px);
  pointer-events: none;
  transition: transform 260ms var(--settle), opacity 180ms ease, filter 220ms ease;
}
.tip::after { content: ""; position: absolute; left: 50%; top: 100%; width: 0.7rem; height: 0.7rem; background: inherit; transform: translate(-50%, -55%) rotate(45deg); border-radius: 0.12rem; }
.store-wrap[data-open] .tip { transform: translateX(-50%) scale(1); opacity: 1; filter: none; }

.stage { position: relative; width: min(56rem, 100%); margin: clamp(2.5rem, 6vw, 4.5rem) auto 0; padding-bottom: clamp(2rem, 5vw, 3.5rem); }
.stage::before { content: ""; position: absolute; inset: 18% -12% -6%; z-index: -1; background: radial-gradient(60% 60% at 50% 45%, color-mix(in srgb, var(--accent) 22%, transparent), transparent 70%); }
.tv { width: 100%; border-radius: 1.1rem; border: 0.55rem solid #0b0c10; background: #0b0c10; box-shadow: 0 0 0 1px var(--hairline), var(--shadow-l); }
/* On the dark page a black bezel disappears into the background, so there the devices get a
   graphite frame and a stronger glow behind them. */
@media (prefers-color-scheme: dark) {
  .tv, .phone { border-color: #30343d; box-shadow: 0 0 0 1px rgba(255, 255, 255, 0.14), var(--shadow-l); }
  .stage::before { inset: 8% -14% -8%; background: radial-gradient(62% 62% at 50% 45%, color-mix(in srgb, var(--accent) 38%, transparent), transparent 72%); }
}
.tv-stand { width: 26%; height: 0.6rem; margin: 0.7rem auto 0; border-radius: 0.4rem; background: var(--hairline); }
.phone { position: absolute; right: 4%; bottom: 0; width: 21%; border-radius: clamp(0.9rem, 2.4vw, 1.9rem); border: clamp(0.25rem, 0.6vw, 0.45rem) solid #0b0c10; background: #0b0c10; box-shadow: 0 0 0 1px var(--hairline), var(--shadow-l); }

/* ---------- Sections ---------- */
section { padding: clamp(3.5rem, 8vw, 6.5rem) 0; }
.section-head { max-width: 40rem; margin: 0 auto clamp(2rem, 4vw, 3.25rem); text-align: center; }
.section-head .lead { margin-top: 0.9rem; }
.tint { background: var(--bg-alt); }

.grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 1rem; }
.card { background: var(--surface); border-radius: 1.75rem; padding: 1.75rem; }
.tint .card { background: var(--raised); box-shadow: var(--shadow-s); }
.card h3 { margin-bottom: 0.5rem; }
.card p { color: var(--muted); font-size: 1rem; line-height: 1.5; }
.icon { width: 2.75rem; height: 2.75rem; border-radius: 0.85rem; background: var(--selected); color: var(--accent); display: grid; place-items: center; margin-bottom: 1.1rem; }
.icon svg { width: 1.4rem; height: 1.4rem; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }

.steps { counter-reset: step; display: grid; grid-template-columns: repeat(3, 1fr); gap: 1rem; padding: 0; margin: 0; list-style: none; }
.steps li { counter-increment: step; background: var(--surface); border-radius: 1.75rem; padding: 1.75rem; }
.steps li::before { content: counter(step); display: block; font-size: 3.25rem; font-weight: 700; line-height: 1; letter-spacing: -0.04em; color: var(--accent); margin-bottom: 1rem; font-variant-numeric: tabular-nums; }
.steps h3 { margin-bottom: 0.4rem; }
.steps p { color: var(--muted); font-size: 1rem; line-height: 1.5; }

/* Open a link with a code */
.codes .wrap { display: grid; grid-template-columns: 1fr 1fr; gap: clamp(1.5rem, 5vw, 4rem); align-items: center; }
.codes .lead { margin: 0.9rem 0 1.6rem; }
.code-sample { display: grid; place-items: center; gap: 1rem; background: var(--raised); border-radius: 2rem; padding: clamp(2rem, 5vw, 3.25rem) 1.25rem; box-shadow: var(--shadow-s); }
.digits { display: flex; gap: clamp(0.3rem, 1vw, 0.55rem); }
.digits span { display: grid; place-items: center; width: clamp(2.2rem, 6vw, 3.25rem); height: clamp(2.9rem, 8vw, 4.1rem); border-radius: 0.9rem; background: var(--surface); font-size: clamp(1.4rem, 3.6vw, 2rem); font-weight: 700; letter-spacing: 0; font-variant-numeric: tabular-nums; }
.code-sample p { font-size: 0.9375rem; color: var(--muted); }

/* Private by design */
.private .wrap { display: grid; grid-template-columns: 1fr 1fr; gap: clamp(1.5rem, 5vw, 4rem); align-items: start; }
.private .lead { margin-top: 0.9rem; }
.checks { margin: 0; padding: 0; list-style: none; display: grid; gap: 1.1rem; }
.checks li { display: flex; gap: 0.85rem; align-items: flex-start; font-size: 1.0625rem; line-height: 1.5; }
.checks svg { flex: none; width: 1.5rem; height: 1.5rem; margin-top: 0.1rem; padding: 0.22rem; border-radius: 50%; background: var(--selected); fill: none; stroke: var(--accent); stroke-width: 3; stroke-linecap: round; stroke-linejoin: round; }

.closing { text-align: center; }
.closing h2 { margin-bottom: 1.75rem; }

/* Sections ease in once, as they are first reached. Without script nothing is hidden. */
.js [data-reveal] { opacity: 0; transform: translateY(0.9rem); transition: opacity 450ms ease, transform 600ms var(--settle); }
.js [data-reveal].in { opacity: 1; transform: none; }

/* ---------- Footer ---------- */
.site-footer { padding: 1.75rem 0 2.5rem; color: var(--muted); font-size: 0.875rem; letter-spacing: 0.005em; box-shadow: 0 -1px 0 var(--hairline); }
.site-footer .wrap { display: flex; flex-wrap: wrap; gap: 0.75rem 1.5rem; justify-content: space-between; align-items: center; }
.site-footer nav { display: flex; flex-wrap: wrap; gap: 0.5rem 1.25rem; }
.site-footer a { color: var(--muted); white-space: nowrap; }
.site-footer a:hover { color: var(--text); text-decoration: none; }

/* ---------- Reading pages: privacy, terms ---------- */
.doc { padding: clamp(3rem, 7vw, 5rem) 0 clamp(3.5rem, 8vw, 5.5rem); }
.doc .wrap { width: min(44rem, 100% - 2.5rem); }
.doc h1 { font-size: clamp(2.25rem, 5.4vw, 3.5rem); }
.doc .updated { color: var(--muted); margin: 0.9rem 0 2.25rem; font-size: 0.9375rem; }
.doc h2 { font-size: 1.5rem; line-height: 1.2; letter-spacing: -0.02em; margin: 2.5rem 0 0.7rem; }
.doc p { margin: 0 0 0.9rem; }
.doc ul { padding-left: 1.3rem; margin: 0 0 0.9rem; }
.doc li { margin-bottom: 0.4rem; }
.doc .summary { background: var(--surface); border-radius: 1.5rem; padding: 1.4rem 1.5rem; margin-bottom: 0.5rem; }
.doc .summary p:last-child { margin-bottom: 0; }

/* ---------- Create a code ---------- */
.create { padding: clamp(3rem, 7vw, 5rem) 0 clamp(3.5rem, 8vw, 5.5rem); }
.create .wrap { width: min(42rem, 100% - 2.5rem); }
.create h1 { font-size: clamp(2.25rem, 5.4vw, 3.5rem); }
.create .lead { margin: 1rem 0 2rem; }
.create-form label { display: block; font-weight: 600; font-size: 0.9375rem; margin-bottom: 0.5rem; }
.field { display: flex; gap: 0.6rem; }
.field input { flex: 1; min-width: 0; height: 3.25rem; padding: 0 1.1rem; border-radius: 1rem; border: 1px solid var(--hairline); background: var(--surface); color: var(--text); font: inherit; transition: border-color 150ms ease, background-color 150ms ease; }
.field input:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; background: var(--bg); }
.field input::placeholder { color: var(--muted); opacity: 0.8; }
.note { font-size: 0.875rem; line-height: 1.45; letter-spacing: 0.005em; color: var(--muted); margin-top: 0.9rem; }
.form-message { color: var(--danger); font-weight: 500; margin: 0.75rem 0 0; }
.result { background: var(--surface); border-radius: 2rem; padding: 2.25rem 1.75rem; text-align: center; }
.result-label { color: var(--muted); font-size: 0.9375rem; font-weight: 600; }
.code { margin: 0.4rem 0 0.3rem; font-weight: 700; font-size: clamp(3.25rem, 13vw, 5.25rem); letter-spacing: 0.04em; line-height: 1.1; color: var(--accent); -webkit-user-select: all; user-select: all; font-variant-numeric: tabular-nums; }
.result-link { margin: 0 0 0.4rem; color: var(--muted); font-size: 0.9375rem; overflow-wrap: anywhere; }
.cta { display: flex; flex-wrap: wrap; gap: 0.75rem; align-items: center; }
.result .cta { justify-content: center; margin-top: 1.25rem; }

/* ---------- Not found ---------- */
.center { min-height: 62vh; display: grid; place-items: center; text-align: center; padding: 3.5rem 0; }
.center h1 { font-size: clamp(2.25rem, 5.4vw, 3.5rem); margin-bottom: 0.9rem; }
.center p { color: var(--muted); max-width: 44ch; margin: 0 auto 1.6rem; }

/* ---------- Narrower screens ---------- */
@media (max-width: 52rem) {
  .grid, .steps { grid-template-columns: 1fr; }
  .codes .wrap, .private .wrap { grid-template-columns: 1fr; }
  .nav { gap: 1rem; }
}
/* Narrow phones: the logo and three links have to share one row. */
@media (max-width: 26.5rem) {
  .brand { font-size: 1.2rem; gap: 0.5rem; }
  .nav { gap: 0.75rem; font-size: 0.875rem; white-space: nowrap; }
  .get-buttons { flex-direction: column; align-self: stretch; width: 100%; }
  .get-buttons .store-wrap, .get-buttons .button { width: 100%; }
}
/* The section link is the first to go: the page itself is one scroll away. */
@media (max-width: 30rem) { .nav a[href="/#how"] { display: none; } }
/* Stacked on a phone. "flex: 1" would then apply to the height and squash the input, so the
   input keeps its own height here. */
@media (max-width: 32.5rem) {
  .field { flex-direction: column; }
  .field input { flex: none; width: 100%; }
}

/* ---------- People who asked for less ---------- */
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .button, .button:active { transform: none; transition: background-color 150ms ease, opacity 150ms ease; }
  .button:active { opacity: 0.75; }
  .js [data-reveal] { transform: none; transition: opacity 200ms ease; }
  .tip, .store-wrap[data-open] .tip { transform: translateX(-50%); filter: none; transition: opacity 200ms ease; }
}
@media (prefers-reduced-transparency: reduce) {
  .site-header { background: var(--bg); -webkit-backdrop-filter: none; backdrop-filter: none; box-shadow: 0 1px 0 var(--hairline); }
}
@media (prefers-contrast: more) {
  :root { --muted: var(--text); --hairline: var(--text); }
  .site-header { background: var(--bg); -webkit-backdrop-filter: none; backdrop-filter: none; box-shadow: 0 1px 0 var(--hairline); }
  .card, .steps li, .button.secondary, .button.soon, .code-sample, .result, .doc .summary { outline: 1px solid var(--text); }
}
