/* Home: the hero instrument, the YouTube frame, the specification, privacy and install.
   The Panel model's own styles are in panel.css. */

/* ---------- Hero ---------- */

.hero { position: relative; isolation: isolate; padding: clamp(28px, 5vw, 80px) 0 clamp(72px, 9vw, 128px); overflow: clip; }
/* The sky behind the hero takes the colour of the hour you'll finish (home.js mixes it). */
.hero::before {
  content: ""; position: absolute; inset: -20% -10% 0; z-index: -1; pointer-events: none;
  background:
    radial-gradient(55% 55% at 78% 30%, var(--sky-a), transparent 72%),
    radial-gradient(40% 40% at 12% 10%, var(--sky-b), transparent 72%);
  opacity: 0.7;
}
:root[data-resolved-theme="dark"] .hero::before { opacity: 0.45; }
.hero-grid { display: grid; gap: clamp(44px, 6vw, 80px); align-items: center; }
@media (min-width: 1000px) { .hero-grid { grid-template-columns: minmax(0, 1fr) minmax(0, 470px); } }
.hero .eyebrow { color: var(--ink-2); }
.hero-title { font-size: var(--t-hero); line-height: 0.94; letter-spacing: -0.024em; }
.hero-title .line { display: block; }
.hero .lede { margin-top: 1.5rem; max-width: 46ch; }
.hero-cta { margin-top: 2.25rem; display: grid; justify-items: start; gap: 0.9rem; }
.hero-cta .also { color: var(--muted); font-size: var(--t-small); }
.hero-cta .also a { color: var(--ink); font-weight: 520; text-decoration: underline; text-decoration-color: var(--line-strong); text-decoration-thickness: 1.5px; }
.hero-cta .also a:hover { text-decoration-color: var(--accent); }
.facts { list-style: none; margin: 2.25rem 0 0; padding: 1.1rem 0 0; border-top: 1px solid var(--line); display: flex; flex-wrap: wrap; gap: 0.4rem 1.6rem; color: var(--muted); font-size: var(--t-small); }
.facts li { display: inline-flex; align-items: center; gap: 0.5rem; }
.facts li::before { content: ""; width: 5px; height: 5px; border-radius: 50%; background: var(--faint); }
.facts { font-variant-numeric: tabular-nums; }

/* Entrance: one rise, no stagger beyond a beat. CSS only; visible without JS. */
.js .hero-in, .js .hero-title .line { animation: rise 0.9s var(--ease) both; animation-delay: calc(80ms + var(--d, 0) * 90ms); }
@keyframes rise { from { opacity: 0; transform: translateY(14px); } }

/* ---------- The instrument ---------- */

.stage {
  position: relative;
  padding: clamp(12px, 2.4vw, 26px);
  border-radius: 28px;
  background: var(--surface);
  border: 1px solid var(--line);
  box-shadow: var(--shadow-lg);
  display: grid; gap: 18px;
  width: 100%; max-width: 560px;
}
.stage-cap { display: flex; align-items: center; gap: 0.55rem; font-family: var(--mono); font-size: var(--t-label); letter-spacing: 0.08em; text-transform: uppercase; color: var(--muted); }
.stage-cap .dot { width: 7px; height: 7px; border-radius: 50%; background: var(--red); box-shadow: 0 0 0 3px var(--accent-soft); }
.readout { display: grid; gap: 0.15rem; padding: 0 0.15rem; }
.readout-label { font-family: var(--serif); font-style: italic; font-size: 1.5rem; line-height: 1; color: var(--muted); }
.readout-time { display: flex; align-items: baseline; gap: 0.3em; line-height: 1; margin-top: 0.15rem; }
.readout-time .num { font-size: clamp(3.75rem, 2.5rem + 5vw, 5.75rem); font-weight: 420; letter-spacing: -0.05em; color: var(--ink); }
.readout-time .period { font-family: var(--mono); font-size: clamp(1.1rem, 0.9rem + 0.8vw, 1.4rem); color: var(--muted); }
.readout-time .period:empty { display: none; }
.readout-sub { margin-top: 0.6rem; display: flex; flex-wrap: wrap; justify-content: space-between; align-items: baseline; gap: 0.35rem 1rem; color: var(--muted); font-size: var(--t-small); }
.readout-sub .num { color: var(--ink); }
.readout-sub .saves { font-size: 0.875rem; color: var(--ink-2); }
.readout-sub .saves:empty { display: none; }
.stage .cp { box-shadow: var(--shadow-sm); }

.stage-controls { display: grid; gap: 0.35rem; padding: 0 0.15rem; }
.stage-controls label { display: flex; justify-content: space-between; align-items: baseline; font-size: 0.875rem; font-weight: 520; color: var(--ink-2); }
.stage-controls label b { font-weight: 500; color: var(--ink); }
/* Scale marks sit where their speeds are on the track: (s − 0.25) / 3.75. */
.stage-controls .marks { position: relative; height: 1.2em; font-family: var(--mono); font-size: 0.75rem; color: var(--muted); }
.stage-controls .marks span { position: absolute; top: 0; white-space: nowrap; translate: -50% 0; }
.stage-controls .marks .m-min { left: 0; translate: 0 0; }
.stage-controls .marks .m-1 { left: 20%; }
.stage-controls .marks .m-2 { left: 46.667%; translate: -1ch 0; color: var(--ink-2); }
.stage-controls .marks .m-max { left: auto; right: 0; translate: 0 0; }

input[type="range"].speed-slider {
  --p: 33.33%;
  width: 100%; height: 32px; margin: 0; appearance: none; background: transparent; cursor: pointer; touch-action: pan-y;
}
input[type="range"].speed-slider::-webkit-slider-runnable-track {
  height: 4px; border-radius: 2px;
  background:
    linear-gradient(var(--muted), var(--muted)) calc(46.667% - 0.5px) 50% / 1px 12px no-repeat,
    linear-gradient(90deg, var(--ink) var(--p), var(--line-strong) var(--p));
}
input[type="range"].speed-slider::-moz-range-track { height: 4px; border-radius: 2px; background: var(--line-strong); }
input[type="range"].speed-slider::-moz-range-progress { height: 4px; border-radius: 2px; background: var(--ink); }
input[type="range"].speed-slider::-webkit-slider-thumb {
  appearance: none; width: 22px; height: 22px; margin-top: -9px; border-radius: 50%;
  background: var(--surface); border: 2px solid var(--ink); box-shadow: var(--shadow-sm);
  transition: transform 0.15s var(--ease-ui);
}
input[type="range"].speed-slider::-moz-range-thumb {
  width: 18px; height: 18px; border-radius: 50%; background: var(--surface); border: 2px solid var(--ink);
}
input[type="range"].speed-slider:active::-webkit-slider-thumb { transform: scale(1.1); }
input[type="range"].speed-slider:focus-visible { outline: none; }
input[type="range"].speed-slider:focus-visible::-webkit-slider-thumb { outline: 2px solid var(--accent); outline-offset: 3px; }
input[type="range"].speed-slider:focus-visible::-moz-range-thumb { outline: 2px solid var(--accent); outline-offset: 3px; }

/* ---------- Inside YouTube (sticky story) ---------- */

.story-grid { display: grid; gap: 2.5rem; }
@media (min-width: 1000px) {
  .story-grid { grid-template-columns: minmax(0, 0.55fr) minmax(0, 1.45fr); gap: clamp(2.5rem, 4.5vw, 4rem); align-items: start; }
}
.story-steps { list-style: none; margin: 0; padding: 0; display: grid; gap: 2rem; }
@media (min-width: 1000px) { .story-steps { gap: 26vh; padding-block: 12vh 28vh; } }
.story-step { max-width: 40ch; }
.story-step .n { font-size: var(--t-label); letter-spacing: 0.12em; color: var(--muted); }
.story-step h3 { margin-top: 0.5rem; font-size: clamp(1.35rem, 1.15rem + 0.8vw, 1.75rem); }
.story-step p { margin-top: 0.6rem; color: var(--muted); }
.story-step samp { font-size: 0.92em; color: var(--ink); }
@media (min-width: 1000px) {
  .story-step h3, .story-step p { transition: color 0.4s var(--ease); }
  .story.is-live .story-step:not(.is-active) h3 { color: var(--muted); }
  .story.is-live .story-step.is-active .n { color: var(--accent-ink); }
  .story-sticky { position: sticky; top: calc(50vh - min(260px, 30vw)); }
}
@media (max-width: 999px) { .story-sticky { order: -1; } }

/* An abstract YouTube watch page: neutral shapes, no marks. */
.yt {
  --yt-bg: #0f0f0f; --yt-fg: #f1f1f1; --yt-line: rgba(255, 255, 255, 0.12); --yt-tonal: rgba(255, 255, 255, 0.1);
  position: relative; border-radius: 18px; overflow: clip; background: var(--yt-bg); color: var(--yt-fg);
  border: 1px solid var(--line-strong); box-shadow: var(--shadow-lg);
  font-family: Roboto, var(--font); letter-spacing: 0; font-size: 12px; line-height: 1.4;
}
:root[data-resolved-theme="light"] .yt.auto { --yt-bg: #fff; --yt-fg: #0f0f0f; --yt-line: rgba(0, 0, 0, 0.1); --yt-tonal: rgba(0, 0, 0, 0.06); }
.yt-bar { display: flex; align-items: center; gap: 12px; height: 44px; padding: 0 16px; border-bottom: 1px solid var(--yt-line); }
.yt-bar .logo { width: 22px; height: 16px; border-radius: 4px; background: var(--yt-tonal); flex: none; }
.yt-bar i { display: block; width: 56px; height: 10px; border-radius: 5px; background: var(--yt-tonal); }
.yt-bar .search { flex: 1; max-width: 44%; height: 26px; border-radius: 13px; border: 1px solid var(--yt-line); margin-inline: auto; }
.yt-bar .av { width: 24px; height: 24px; border-radius: 50%; background: var(--yt-tonal); }
.yt-body { display: grid; grid-template-columns: minmax(0, 1.25fr) minmax(0, 1fr); gap: 16px; padding: 16px; }
@media (max-width: 600px) { .yt-body { grid-template-columns: 1fr; } .yt-side .sk { display: none; } }
.yt-main { display: grid; gap: 12px; align-content: start; min-width: 0; }
.player {
  position: relative; aspect-ratio: 16 / 9; border-radius: 10px; overflow: clip;
  background: radial-gradient(70% 60% at 70% 30%, #34303d 0%, transparent 70%), linear-gradient(180deg, #1c1b20, #0b0b0d);
}
.player .scene { position: absolute; left: 14%; right: 14%; top: 18%; height: 44%; border-radius: 8px; border: 1px solid rgba(255, 255, 255, 0.08); background: rgba(255, 255, 255, 0.04); }
.player .ctl { position: absolute; left: 0; right: 0; bottom: 0; padding: 6px 10px 8px; background: linear-gradient(transparent, rgba(0, 0, 0, 0.7)); color: #fff; }
.player .bar { position: relative; height: 3px; border-radius: 2px; background: rgba(255, 255, 255, 0.28); margin-bottom: 8px; }
.player .bar i { position: absolute; left: 0; top: 0; bottom: 0; width: calc(var(--played, 0.2) * 100%); background: rgba(255, 255, 255, 0.9); border-radius: 2px; transition: width 1s linear; }
.player .ctl-row { display: flex; align-items: center; gap: 8px; font-size: 11px; font-variant-numeric: tabular-nums; white-space: nowrap; }
.player .ctl-row svg { width: 14px; height: 14px; fill: #fff; }
.player .badge { opacity: 0; transition: opacity 0.4s; }
.yt:not([data-step="1"]) .player .badge { opacity: 1; }
.yt-title { height: 14px; width: 72%; border-radius: 7px; background: var(--yt-tonal); }
.yt-meta { display: flex; gap: 8px; align-items: center; }
.yt-meta .av { width: 28px; height: 28px; border-radius: 50%; background: var(--yt-tonal); }
.yt-meta .sk { height: 9px; border-radius: 5px; background: var(--yt-tonal); }
.yt-meta .w1 { width: 88px; } .yt-meta .w2 { width: 48px; }
.yt-meta .pill { margin-left: auto; height: 28px; width: 72px; border-radius: 14px; background: var(--yt-tonal); }
.yt-side { display: grid; gap: 10px; align-content: start; min-width: 0; }
.yt-side .sk { display: grid; grid-template-columns: 44% 1fr; gap: 8px; }
.yt-side .sk i { display: block; aspect-ratio: 16 / 9; border-radius: 6px; background: var(--yt-tonal); }
.yt-side .sk b { display: grid; gap: 6px; align-content: start; }
.yt-side .sk b::before, .yt-side .sk b::after { content: ""; height: 8px; border-radius: 4px; background: var(--yt-tonal); }
.yt-side .sk b::after { width: 60%; }
.yt[data-step="3"] .yt-side .sk, .yt[data-step="4"] .yt-side .sk, .yt[data-step="5"] .yt-side .sk { display: none; }
.yt[data-step="5"] .cp-scope[data-scope="video"] { display: none; }

/* The Panel at the frame's scale. */
.yt .cp { font-size: 12px; line-height: 18px; }
.yt .cp-remaining { font-size: 16px; line-height: 24px; }
.yt .cp-row { padding: 6px 4px 10px 12px; }
.yt .cp-speed { height: 28px; margin-right: 2px; }
.yt .cp-speed .cp-icon { width: 26px; height: 26px; }
.yt .cp-speed .cp-icon svg { width: 16px; height: 16px; }
.yt .cp-icon { width: 30px; height: 30px; }
.yt .cp-icon svg { width: 18px; height: 18px; }
.yt .cp-speed-val { min-width: 34px; padding: 0 4px; font-size: 11px; }
.yt .cp-finish { font-size: 11px; }
.yt .cp-scope { padding: 10px 12px 8px; }
.yt .cp-trow { height: 32px; padding: 0 10px; }
.yt .cp-hl { height: 32px; transform: translateY(calc(var(--current, 0) * 32px)); }
.yt .cp select, .yt .cp input { height: 28px; }
.yt .cp-apply { height: 28px; padding: 0 12px; border-radius: 14px; }

/* The ring moves to the part each step is about; everything else steps back. */
.yt .focus { position: absolute; inset: 0; pointer-events: none; z-index: 3; }
.yt .ring { position: absolute; border-radius: 12px; border: 2px solid var(--red); box-shadow: 0 0 0 4px rgba(255, 0, 51, 0.16); opacity: 0; transition: left 0.5s var(--ease), top 0.5s var(--ease), width 0.5s var(--ease), height 0.5s var(--ease), opacity 0.3s; }
.yt[data-step="1"] .ring, .yt[data-step="2"] .ring, .yt[data-step="3"] .ring, .yt[data-step="4"] .ring { opacity: 1; }
.yt .player, .yt .cp { transition: opacity 0.4s var(--ease); }
.yt[data-step="1"] .player, .yt[data-step="3"] .player, .yt[data-step="4"] .player { opacity: 0.55; }
.yt[data-step="2"] .cp { opacity: 0.45; }

/* ---------- Specification ---------- */

.spec { display: grid; gap: clamp(40px, 5vw, 56px) clamp(32px, 5vw, 72px); }
@media (min-width: 900px) { .spec { grid-template-columns: 1fr 1fr; } }
.spec-h { display: flex; align-items: baseline; gap: 0.8rem; padding-bottom: 0.9rem; border-bottom: 1px solid var(--line-strong); font-size: 1rem; font-weight: 560; letter-spacing: -0.01em; }
.spec-h .num { min-width: 2.2ch; font-size: var(--t-label); letter-spacing: 0.08em; color: var(--muted); }
.spec dl, .ledger { margin: 0; }
.spec dl > div, .ledger > div { display: grid; gap: 0.25rem 1.5rem; padding: 1rem 0; border-bottom: 1px solid var(--line); }
@media (min-width: 560px) { .spec dl > div, .ledger > div { grid-template-columns: 9.5rem minmax(0, 1fr); } }
.spec dt, .ledger dt { font-family: var(--mono); font-size: 0.8125rem; letter-spacing: 0.02em; color: var(--muted); padding-top: 0.12em; }
.spec dd, .ledger dd { margin: 0; color: var(--ink-2); font-size: var(--t-small); line-height: 1.6; }
.spec dd .num { color: var(--ink); }
.spec samp { display: table; margin-top: 0.55rem; padding: 0.2rem 0.55rem; border-radius: 6px; background: var(--sunken); color: var(--ink); font-size: 0.8125rem; }

/* ---------- Privacy ---------- */

.privacy { display: grid; gap: clamp(32px, 4vw, 48px); padding-top: clamp(32px, 4vw, 48px); border-top: 1px solid var(--line-strong); }
@media (min-width: 960px) { .privacy { grid-template-columns: minmax(0, 0.9fr) minmax(0, 1.1fr); gap: clamp(48px, 6vw, 96px); } }
.privacy h2 { font-size: var(--t-h2); }
.privacy .lede { margin-top: 1.1rem; max-width: 44ch; }
.privacy .arrow-link { margin-top: 1.5rem; }
.ledger { border-top: 1px solid var(--line); }
.ledger code { font-size: 0.9em; color: var(--ink); }
.ledger b { color: var(--ink); font-weight: 600; }

/* ---------- Install ---------- */

.install .mobile-note { padding: clamp(20px, 3vw, 28px); display: grid; gap: 1rem; }
.install .mobile-note h3 { font-size: 1.125rem; }
.install .mobile-note p { margin-top: 0.35rem; color: var(--muted); font-size: var(--t-small); }
.js:not(.is-mobile) .install .mobile-note { display: none; }
.install .mobile-note { margin: 0 0 1rem; }

/* ---------- Final call ---------- */

.final .band { background: var(--surface); }
.final .band > :not(.big-time) { position: relative; }
.final .big-time { position: absolute; right: -0.06em; bottom: -0.16em; font-size: clamp(4.5rem, 15vw, 12rem); font-weight: 500; line-height: 0.8; letter-spacing: -0.06em; color: var(--ink); opacity: 0.045; white-space: nowrap; pointer-events: none; user-select: none; }
