/* ============================================================
   4TUNHUB Lab - the main site's design, applied to a workshop.
   Governed by 4tunhub.com's docs/art-direction.md: quiet surfaces,
   one typeface, generous space, colour used once. Tokens are copied,
   not imported (blueprint, "The seam with 4tunhub.com").
   ============================================================ */

@font-face {
  font-family: "Instrument Sans Variable";
  font-style: normal; font-display: swap; font-weight: 400 700;
  src: url(fonts/instrument-sans-latin-ext-wght-normal.woff2) format("woff2");
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF,
    U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020,
    U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
}
@font-face {
  font-family: "Instrument Sans Variable";
  font-style: normal; font-display: swap; font-weight: 400 700;
  src: url(fonts/instrument-sans-latin-wght-normal.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;
}

/* DAY - the base values, so a page whose theme script cannot run is light. */
:root {
  --bg: #ffffff; --surface: #f5f5f7; --surface-2: #ffffff;
  --fg: #1d1d1f; --muted: #6e6e73; --subtle: #86868b;
  --border: #e8e8ed; --hairline: #d2d2d7;
  --primary: #1d1d1f; --on-primary: #ffffff; --primary-hover: #000000;
  --accent: #b25000; --danger: #c4311b; --success: #1f7a3a; --brand: #ffb000;
  --glass: rgb(255 255 255 / 0.78);
  --shadow-e1: 0 1px 2px rgb(0 0 0 / 0.04);
  --shadow-e2: 0 2px 6px rgb(0 0 0 / 0.04), 0 18px 48px -18px rgb(0 0 0 / 0.22);
  --r-field: 0.75rem; --r-card: 1.125rem; --r-tile: 1.75rem;
  --ease-apple: cubic-bezier(0.28, 0.11, 0.32, 1);
  --ease-out: cubic-bezier(0.25, 1, 0.5, 1);
  --font: "Instrument Sans Variable", -apple-system, BlinkMacSystemFont, "Segoe UI",
    Roboto, "Helvetica Neue", Arial, sans-serif;
  --tab-h: 0px;
}
/* NIGHT - set by theme.js from the visitor's clock, or their choice. */
:root[data-theme="dark"] {
  --bg: #000000; --surface: #141416; --surface-2: #1d1d1f;
  --fg: #f5f5f7; --muted: #a1a1a6; --subtle: #6e6e73;
  --border: #2c2c2e; --hairline: #424245;
  --primary: #f5f5f7; --on-primary: #1d1d1f; --primary-hover: #ffffff;
  --accent: #ffb340; --danger: #ff6a55; --success: #4cc76f;
  --glass: rgb(22 22 23 / 0.78);
  --shadow-e1: 0 0 0 1px rgb(255 255 255 / 0.04);
  --shadow-e2: 0 0 0 1px rgb(255 255 255 / 0.06), 0 24px 60px -24px rgb(0 0 0 / 0.9);
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html { background: var(--bg); color-scheme: light; -webkit-text-size-adjust: 100%; }
html[data-theme="dark"] { color-scheme: dark; }
body {
  margin: 0; min-height: 100vh; display: flex; flex-direction: column;
  background: var(--bg); color: var(--fg); font-family: var(--font);
  font-size: 1.0625rem; line-height: 1.53; letter-spacing: -0.003em;
  -webkit-font-smoothing: antialiased; -moz-osx-font-smoothing: grayscale;
  padding-bottom: var(--tab-h);
  transition: background-color .5s var(--ease-out), color .5s var(--ease-out);
}
::selection { background: #ffcf4d; color: #1d1d1f; }
h1, h2, h3 { text-wrap: balance; margin: 0; }
p { text-wrap: pretty; margin: 0; }
a { color: var(--accent); text-underline-offset: .2em; text-decoration-thickness: 1px; text-decoration: none; }
a:hover { text-decoration: underline; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; }
img { max-width: 100%; }
.figure { font-variant-numeric: tabular-nums; }

.wrap { width: 100%; max-width: 1080px; margin-inline: auto; padding-inline: 20px; }
@media (min-width: 720px) { .wrap { padding-inline: 32px; } }

.skip { position: absolute; left: 12px; top: -48px; z-index: 60; background: var(--primary);
  color: var(--on-primary); padding: 10px 16px; border-radius: 999px; }
.skip:focus { top: 12px; }

/* ---------- the bar ---------- */
.glass { background: var(--glass); -webkit-backdrop-filter: saturate(1.8) blur(20px);
  backdrop-filter: saturate(1.8) blur(20px); }
.bar { position: sticky; top: 0; z-index: 40; border-bottom: 1px solid var(--border);
  padding-top: env(safe-area-inset-top, 0px); }
.bar-in { height: 56px; display: flex; align-items: center; gap: 24px; }
.brand { display: flex; align-items: center; gap: 10px; color: var(--fg); text-decoration: none; }
.brand:hover { text-decoration: none; opacity: .85; }
.logo { height: 28px; width: auto; display: block; }
:root[data-theme="dark"] .only-light, :root:not([data-theme="dark"]) .only-dark { display: none; }
.brand-lab { font-weight: 700; font-size: 1.0625rem; letter-spacing: -0.02em;
  padding-left: 10px; border-left: 1px solid var(--hairline); line-height: 1.2; }
.beta { font-size: .75rem; font-weight: 600; color: var(--accent); background: var(--surface);
  padding: 2px 8px; border-radius: 999px; }
.topnav { display: none; gap: 28px; margin-left: 12px; }
.topnav a { color: var(--muted); font-size: .9375rem; font-weight: 500; text-underline-offset: .35em; }
.topnav a:hover { color: var(--fg); }
.topnav a[aria-current="page"] { color: var(--fg); text-decoration: underline; text-decoration-color: var(--brand);
  text-decoration-thickness: 2px; }
#lang { margin-left: auto; }
@media (min-width: 900px) { .topnav:not([hidden]) { display: flex; } }

/* ---------- controls: pills ---------- */
.pill { display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  height: 44px; padding: 0 22px; border-radius: 999px; border: 0; cursor: pointer;
  font: 500 .9375rem/1 var(--font); letter-spacing: -0.01em; white-space: nowrap;
  background: var(--primary); color: var(--on-primary); text-decoration: none;
  transition: background-color .2s ease-out, transform .2s ease-out, opacity .2s; }
.pill:hover { background: var(--primary-hover); text-decoration: none; }
.pill:active { transform: scale(.97); }
.pill:disabled { opacity: .45; pointer-events: none; }
.pill-lg { height: 52px; padding: 0 28px; font-size: 1rem; }
.pill-soft { background: var(--surface); color: var(--fg); }
.pill-soft:hover { background: var(--border); }
.pill-quiet { height: 32px; padding: 0 14px; font-size: .8125rem; font-weight: 600;
  background: var(--surface); color: var(--fg); }
.pill-quiet:hover { background: var(--border); }
.pill-ghost { background: none; color: var(--accent); padding: 0 12px; }
.pill-ghost:hover { background: var(--surface); }
.row { display: flex; flex-wrap: wrap; gap: 12px; align-items: center; }

/* ---------- type ---------- */
main { flex: 1; padding-block: 40px 72px; }
@media (min-width: 720px) { main { padding-block: 64px 112px; } }
/* minmax(0, 1fr): a grid track otherwise grows to its widest unbreakable
   child, and a phone scrolls sideways (found at 375 px, pass 33). */
.view, .stage, .tile, .head, .side, .field-row, .card { display: grid; grid-template-columns: minmax(0, 1fr); }
.view { gap: 32px; }
@media (prefers-reduced-motion: no-preference) {
  .view { animation: rise .7s var(--ease-apple) both; }
}
@keyframes rise { from { opacity: 0; transform: translateY(16px); } to { opacity: 1; transform: none; } }
.eyebrow { font-size: .9375rem; line-height: 1.4; font-weight: 600; letter-spacing: -0.005em; color: var(--accent); }
.display { font-size: clamp(2.25rem, 5.6vw, 4rem); line-height: 1.04; letter-spacing: -0.034em; font-weight: 700; }
.title { font-size: clamp(1.875rem, 4.4vw, 3rem); line-height: 1.07; letter-spacing: -0.028em; font-weight: 700; }
.headline { font-size: clamp(1.25rem, 2vw, 1.5rem); line-height: 1.2; letter-spacing: -0.012em; font-weight: 600; }
.lead { font-size: clamp(1.125rem, 1.6vw, 1.3125rem); line-height: 1.5; color: var(--muted); max-width: 40ch; }
.muted { color: var(--muted); }
.small { font-size: .875rem; line-height: 1.45; }
.head { display: grid; gap: 12px; }

/* ---------- surfaces ---------- */
.tile { background: var(--surface); border-radius: var(--r-tile); padding: 28px; display: grid; gap: 16px; }
@media (min-width: 720px) { .tile { padding: 40px; } }
.card { background: var(--surface-2); border-radius: var(--r-card); padding: 20px 22px;
  display: grid; gap: 8px; box-shadow: var(--shadow-e1); }
.tile .card { box-shadow: none; }
.lift { transition: transform .35s var(--ease-out), box-shadow .35s var(--ease-out); }
.lift:hover { transform: translateY(-4px); box-shadow: var(--shadow-e2); }
.grid2 { display: grid; gap: 20px; }
@media (min-width: 900px) { .grid2 { grid-template-columns: minmax(0, 1.6fr) minmax(0, 1fr); align-items: start; } }

/* ---------- the journey (order is real: numbers allowed) ---------- */
.journey { list-style: none; margin: 0; padding: 0; display: grid; gap: 4px; }
.leg { display: grid; grid-template-columns: 40px 1fr auto; gap: 4px 16px; align-items: center;
  padding: 16px 18px; border-radius: var(--r-card); color: var(--fg); text-decoration: none; }
a.leg:hover { background: var(--surface-2); text-decoration: none; }
.leg .n { width: 32px; height: 32px; border-radius: 50%; display: grid; place-items: center;
  font-weight: 600; font-size: .9375rem; background: var(--surface-2); color: var(--muted);
  box-shadow: inset 0 0 0 1px var(--hairline); font-variant-numeric: tabular-nums; }
.leg.done .n { background: var(--success); color: #fff; box-shadow: none; }
.leg.now { background: var(--surface-2); box-shadow: var(--shadow-e1); }
.leg.now .n { background: var(--primary); color: var(--on-primary); box-shadow: none; }
.leg.locked { opacity: .55; }
.leg .n { grid-row: 1 / span 2; }
.leg .n svg { width: 18px; height: 18px; stroke-width: 2.4; }
.leg .t { grid-column: 2; font-weight: 600; letter-spacing: -0.01em; }
.leg .s { grid-column: 2; grid-row: 2; font-size: .9375rem; color: var(--muted); }
.leg .go { font-size: .875rem; font-weight: 600; color: var(--accent); grid-row: 1 / span 2; grid-column: 3;
  opacity: 0; transition: opacity .2s; }
a.leg:hover .go, a.leg:focus-visible .go, .leg.now .go { opacity: 1; }
li.leg { grid-template-columns: 40px 1fr; }
li.leg .n { grid-row: auto; }

.hero { align-items: center; }
.art { place-items: center; padding: 32px; aspect-ratio: 16 / 10; }
.art svg { width: 100%; max-width: 420px; height: auto; color: var(--fg); }
.art .wall { stroke: var(--subtle); }
.art .dim { stroke: var(--subtle); stroke-dasharray: 3 5; }
.art .acc { stroke: var(--accent); stroke-width: 3; }
@media (prefers-reduced-motion: no-preference) {
  .art .acc { animation: press 2.6s var(--ease-apple) infinite; }
}
@keyframes press { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(6px); } }
.side { display: grid; gap: 20px; }
.head-row { display: grid; gap: 20px; }
@media (min-width: 900px) { .head-row { grid-template-columns: 1fr auto; align-items: end; } }
.lead.wide { max-width: 62ch; }
.problem { max-width: 640px; }
.subtle { color: var(--subtle); }
main:focus { outline: none; }
.toast { position: fixed; z-index: 55; left: 50%; bottom: calc(var(--tab-h) + 20px); transform: translateX(-50%);
  display: flex; gap: 16px; align-items: center; padding: 12px 14px 12px 22px; border-radius: 999px;
  box-shadow: var(--shadow-e2); font-size: .9375rem; white-space: nowrap; }
.toast a { font-weight: 600; padding: 6px 12px; border-radius: 999px; background: var(--primary); color: var(--on-primary); }
.toast a:hover { text-decoration: none; background: var(--primary-hover); }
@media (prefers-reduced-motion: no-preference) {
  .toast { animation: toast .5s var(--ease-apple) both; }
}
@keyframes toast { from { opacity: 0; transform: translate(-50%, 16px); } to { opacity: 1; transform: translate(-50%, 0); } }

/* eight steps as one bar of segments */
.meter { display: grid; grid-template-columns: repeat(var(--n, 8), 1fr); gap: 4px; margin-top: 6px; }
.meter i { height: 6px; border-radius: 999px; background: var(--hairline); }
.meter i.ok { background: var(--success); }
.meter i.try { background: var(--danger); }

.live { display: inline-flex; align-items: center; gap: 8px; font-size: .9375rem; color: var(--muted); }
.live::before { content: ""; width: 8px; height: 8px; border-radius: 50%; background: var(--subtle); }
.live.on::before { background: var(--brand); box-shadow: 0 0 0 4px rgb(255 176 0 / .18); }
.facts { display: grid; gap: 14px; margin: 0; }
.facts div { display: grid; gap: 2px; }
.facts dt { font-size: .875rem; color: var(--muted); }
.facts dd { margin: 0; font-weight: 600; }

/* ---------- notices ---------- */
.banner { margin-top: 16px; padding: 12px 18px; border-radius: var(--r-card);
  background: var(--surface); font-size: .9375rem; }
.banner.warn::before, .note.warn::before { content: "●"; color: var(--brand); margin-right: 8px; }
.note { padding: 16px 20px; border-radius: var(--r-card); background: var(--surface); color: var(--fg); }
.note.good { background: color-mix(in srgb, var(--success) 12%, var(--surface)); }
.note.bad { background: color-mix(in srgb, var(--danger) 10%, var(--surface)); }

/* ---------- the brief, on paper in both themes ---------- */
.doc { background: #ffffff; border-radius: var(--r-tile); box-shadow: inset 0 0 0 1px var(--border);
  overflow: hidden; }
.doc iframe { display: block; width: 100%; min-height: 70vh; border: 0; background: #fff;
  color-scheme: light; }

/* ---------- forms ---------- */
.stage { display: grid; gap: 14px; }
.stage-h { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; }
.field-row { display: grid; gap: 10px; padding: 16px 18px; background: var(--surface-2);
  border-radius: var(--r-card); }
.tile.stage { gap: 14px; }
@media (min-width: 720px) { .tile.stage { padding: 28px; } }
form.stage { gap: 20px; }
.field-top { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.field-top label { font-weight: 600; letter-spacing: -0.01em; line-height: 1.35; }
.field { display: flex; align-items: stretch; background: var(--surface); border-radius: var(--r-field);
  box-shadow: inset 0 0 0 1px transparent; transition: box-shadow .2s; }
.field:focus-within { box-shadow: inset 0 0 0 2px var(--accent); }
.field input { flex: 1; min-width: 0; width: 100%; border: 0; background: none; color: var(--fg);
  font: 500 1.125rem/1.2 var(--font); font-variant-numeric: tabular-nums; padding: 14px 16px; outline: 0; }
.field span { align-self: center; padding: 0 16px; color: var(--muted); font-weight: 500; white-space: nowrap; }
.badge { font-size: .8125rem; font-weight: 600; padding: 3px 10px; border-radius: 999px;
  background: var(--surface); color: var(--muted); white-space: nowrap; }
.badge.ok { background: color-mix(in srgb, var(--success) 16%, transparent); color: var(--success); }
.badge.try { background: color-mix(in srgb, var(--danger) 14%, transparent); color: var(--danger); }
.dock { position: sticky; bottom: calc(var(--tab-h) + 12px); z-index: 20; display: flex; align-items: center;
  justify-content: space-between; gap: 16px; padding: 10px 10px 10px 22px; border-radius: 999px;
  box-shadow: var(--shadow-e2); }
.tick { display: flex; gap: 14px; align-items: flex-start; font-size: 1rem; cursor: pointer;
  padding: 16px 18px; border-radius: var(--r-card); background: var(--surface); }
.tick:hover { background: var(--border); }
.tick input { width: 22px; height: 22px; margin: 1px 0 0; accent-color: var(--primary); flex: none; }
.terms { list-style: none; margin: 0; padding: 0; display: grid; gap: 16px; }
.terms li { display: grid; grid-template-columns: 24px 1fr; gap: 14px; align-items: start; }
.terms svg { width: 22px; height: 22px; color: var(--success); margin-top: 2px; }
.pbar { height: 6px; border-radius: 999px; background: var(--hairline); overflow: hidden; }
.pbar i { display: block; height: 100%; width: 0; background: var(--fg); transition: width .25s ease-out; }

.drop { display: grid; place-items: center; gap: 10px; text-align: center; padding: 48px 20px;
  border-radius: var(--r-tile); background: var(--surface); cursor: pointer;
  box-shadow: inset 0 0 0 2px transparent; transition: box-shadow .2s, background-color .2s; }
.drop:hover, .drop.over { box-shadow: inset 0 0 0 2px var(--hairline); }
.drop:focus-within { box-shadow: inset 0 0 0 2px var(--accent); }
.drop input { position: absolute; width: 1px; height: 1px; opacity: 0; }
.drop svg { width: 40px; height: 40px; color: var(--muted); }
.drop b { font-weight: 600; }

/* ---------- reports: the engine's markup, typeset ---------- */
.report { display: grid; gap: 14px; background: var(--surface); border-radius: var(--r-tile); padding: 24px; }
@media (min-width: 720px) { .report { padding: 36px; } }
@media (prefers-reduced-motion: no-preference) { .report { animation: rise .8s var(--ease-apple) both; } }
.entry .report { background: none; padding: 0; animation: none; }
.report header { display: grid; gap: 2px; }
.report header h1 { font-size: 1.25rem; letter-spacing: -0.012em; font-weight: 600; }
.report header p, .report .attempt, .report footer p { color: var(--muted); font-size: .9375rem; }
.report .result { font-weight: 600; font-size: 1.0625rem; }
.report .progress { font-size: .9375rem; }
.report .notice { background: var(--surface-2); padding: 12px 16px; border-radius: var(--r-field); font-size: .9375rem; }
.report .checks { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; }
.report .check { display: grid; gap: 4px; background: var(--surface-2); padding: 14px 18px 14px 40px;
  border-radius: var(--r-field); position: relative; }
.report .check::before { content: ""; position: absolute; left: 18px; top: 21px; width: 10px; height: 10px;
  border-radius: 50%; background: var(--hairline); }
.report .check--correct::before, .report .check--pass::before, .report .check--clear::before { background: var(--success); }
.report .check--wrong::before, .report .check--fail::before { background: var(--danger); }
.report .check--advisory::before, .report .check--correct_method::before { background: var(--brand); }
.report .check h3 { font-size: 1rem; font-weight: 600; letter-spacing: -0.01em; }
.report .check p { font-size: .9375rem; color: var(--muted); }
.report .check p:nth-of-type(1) { color: var(--fg); font-weight: 500; }
/* a step not answered this time: one quiet line, not a card */
.report .check--not_attempted { display: flex; justify-content: space-between; align-items: baseline; gap: 12px;
  padding-block: 10px; background: none; }
.report .check--not_attempted::before { top: 18px; }
.report .check--not_attempted h3 { font-weight: 500; color: var(--muted); }
.report .check--not_attempted p, .report .check--not_attempted p:nth-of-type(1) { font-size: .8125rem;
  font-weight: 500; color: var(--subtle); white-space: nowrap; }
.report footer { padding-top: 4px; }

.entries { display: grid; gap: 12px; }
.entry { background: var(--surface); border-radius: var(--r-card); }
.entry summary { list-style: none; cursor: pointer; display: flex; align-items: center; gap: 12px;
  justify-content: space-between; padding: 18px 22px; border-radius: var(--r-card); }
.entry summary::-webkit-details-marker { display: none; }
.entry summary:hover { background: var(--border); }
.entry .body { padding: 4px 22px 22px; }
.entry[open] summary { border-bottom-left-radius: 0; border-bottom-right-radius: 0; }

/* ---------- loading ---------- */
.skeleton { display: grid; gap: 16px; }
.skeleton i { display: block; height: 20px; border-radius: 999px; background: var(--surface); }
.skeleton i:first-child { height: 56px; width: 60%; border-radius: var(--r-card); }
.skeleton i:last-child { height: 160px; border-radius: var(--r-tile); }
.spin { width: 18px; height: 18px; border-radius: 50%; border: 2px solid var(--hairline);
  border-top-color: var(--fg); animation: spin .8s linear infinite; flex: none; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ---------- phone: the tab bar under the thumb ---------- */
.tabbar { position: fixed; left: 0; right: 0; bottom: 0; z-index: 45; display: grid;
  grid-template-columns: repeat(5, 1fr); border-top: 1px solid var(--border);
  padding-bottom: env(safe-area-inset-bottom, 0px); }
.tabbar a { display: grid; justify-items: center; gap: 2px; padding: 9px 2px 8px; color: var(--muted);
  font-size: .6875rem; font-weight: 600; letter-spacing: 0; text-decoration: none; }
.tabbar a svg { width: 24px; height: 24px; }
.tabbar a[aria-current="page"] { color: var(--fg); }
.tabbar a[aria-current="page"] svg { color: var(--accent); }
body.has-tabs { --tab-h: calc(62px + env(safe-area-inset-bottom, 0px)); }
@media (min-width: 900px) { .tabbar { display: none !important; } body.has-tabs { --tab-h: 0px; } }

/* ---------- footer: small type on the grey band ---------- */
.foot { background: var(--surface); border-top: 1px solid var(--border); color: var(--muted);
  font-size: .8125rem; line-height: 1.5; }
.foot-in { display: grid; gap: 20px; padding-block: 40px calc(32px + var(--tab-h)); }
@media (min-width: 900px) {
  .foot-in { grid-template-columns: 1fr auto auto; align-items: center; padding-block: 48px; }
  .fine { grid-column: 1 / -1; }
}
.foot-brand { display: flex; align-items: center; gap: 12px; }
.foot-links { display: flex; flex-wrap: wrap; gap: 8px 20px; }
.foot a { color: var(--fg); }
.segmented { display: inline-flex; padding: 3px; gap: 2px; border-radius: 999px; background: var(--surface-2);
  box-shadow: var(--shadow-e1); width: max-content; }
.segmented button { border: 0; background: none; color: var(--muted); font: 600 .8125rem var(--font);
  padding: 7px 14px; border-radius: 999px; cursor: pointer; }
.segmented button[aria-pressed="true"] { background: var(--surface); color: var(--fg); }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important;
    transition-duration: .01ms !important; scroll-behavior: auto !important; }
}
@media print {
  .bar, .tabbar, .foot, .dock, #banner { display: none !important; }
  body { padding: 0; }
}
