/* ==========================================================================
   Milton Alvarez: a dark hotel room where the television would not stay off,
   until its light became daylight.  Design: docs/DESIGN.md.
   LAYERS: 0 tokens  1 base  2 room  3 header  4 the set (TV)  5 states
           6 the wall (reading)  7 the dawn  8 share theming  9 responsive
           10 reduced motion (end states)
   STATE CLASSES on <html> (JS sets them from the video's clock):
     is-on (permanent) . is-playing . is-dark . is-return . is-still (perm.)
     is-daylight (perm.) . is-powering (900 ms transient)
   RULE (GOTCHAS 5): state rules own --lit/--dim/--warm; keyframes own
   transform; the script owns --flick. Nothing animated is also set by a state.
   ========================================================================== */

/* ---- 0 tokens ---------------------------------------------------------- */
@property --lit  { syntax: '<number>'; inherits: true; initial-value: 0 }
@property --dim  { syntax: '<number>'; inherits: true; initial-value: 0 }
@property --warm { syntax: '<number>'; inherits: true; initial-value: 0 }

:root {
  --night:  #0b0e10;
  --wall:   #141c20;
  --glass:  #293439;
  --rain:   #70969a;
  --tv:     #edf4f7;
  --muted:  #b9b8b6;
  --sodium: #fbe506;
  --day:    #b7cbbb;
  --amber:  #e3a23b;

  --serif:   'Source Serif 4', 'Source Serif Pro', Georgia, 'Times New Roman', serif;
  --display: 'Source Serif 4 Display', 'Source Serif 4', Georgia, serif;
  --osd:     'VT323', ui-monospace, 'Cascadia Mono', Consolas, monospace;
  --sys:     system-ui, 'Segoe UI Symbol', 'Segoe UI', sans-serif;
}

/* ---- 1 base ------------------------------------------------------------ */
*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }
html {
  background: var(--night);          /* the page colour lives on html ONLY (GOTCHAS 1) */
  color: var(--tv);
  font-family: var(--serif);
  -webkit-text-size-adjust: 100%;
  scroll-behavior: smooth;
  scroll-padding-top: 1.2rem;
}
body { margin: 0; min-height: 100vh; overflow-x: hidden; }
img, svg, canvas { max-width: 100%; }
a { color: inherit; }
button { font: inherit; color: inherit; }
:focus-visible { outline: 3px solid var(--tv); outline-offset: 3px; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }


/* ---- 2 the room (fixed, decorative; objects only, no figure) ------------ */
.room { position: fixed; inset: 0; z-index: -2; overflow: hidden; pointer-events: none;
  --lit: .16; --dim: 0; --warm: 0;
  transition: --lit 1.4s ease, --dim .9s ease, --warm 2.4s ease; }
.paper { position: absolute; inset: 0; background-color: #0f1619;
  background-image:
    linear-gradient(180deg, rgba(0,0,0,.42), rgba(0,0,0,0) 38%, rgba(0,0,0,.5)),
    repeating-linear-gradient(90deg, rgba(255,255,255,.022) 0 2px, rgba(255,255,255,0) 2px 46px);
  transition: background-color 3.2s ease; }
.floor { position: absolute; left: 0; right: 0; bottom: 0; height: 22vh;
  background: linear-gradient(#0a1013, #05080a); border-top: 1px solid #1a262b; }
.sweep { position: absolute; inset: -20% -40%; opacity: 0; transform: translateX(-60%);
  background: linear-gradient(100deg, rgba(183,203,187,0) 30%, rgba(183,203,187,.20) 50%, rgba(183,203,187,0) 70%); }

.window { position: absolute; border: 12px solid #1b252a; border-radius: 3px; background: #0a1114; overflow: hidden;
  box-shadow: 0 0 0 2px #0a0f11, 0 0 90px rgba(112,150,154,.10), inset 0 0 44px rgba(0,0,0,.65);
  transition: border-color 3s ease, box-shadow 3s ease; }
.window canvas { position: absolute; inset: 0; width: 100%; height: 100%; display: block; }
.curtain { position: absolute; top: 0; bottom: 0; left: 0; width: 24%;
  background:
    repeating-linear-gradient(90deg, rgba(0,0,0,.35) 0 7px, rgba(255,255,255,.012) 7px 16px),
    linear-gradient(90deg, #0a1012, #111b1f 60%, rgba(17,27,31,0)); }
.mull::before, .mull::after { content: ""; position: absolute; background: #1b252a; transition: background-color 3s ease; }
.mull::before { left: 50%; top: 0; bottom: 0; width: 9px; margin-left: -4px; }
.mull::after  { top: 44%; left: 0; right: 0; height: 9px; }
.sill { position: absolute; left: 0; right: 0; bottom: 0; height: 12px; background: #202d33; border-top: 1px solid #33454c; }
.view { display: none; }

.chair { position: absolute; display: none; fill: #080d0f; }
.chair-body { fill: #080d0f; stroke: none; }
.chair-leg  { fill: none; stroke: #080d0f; stroke-width: 9; stroke-linecap: round; }
.chair-rim  { fill: none; stroke: #1f2f36; stroke-width: 2; }
.lamp { position: absolute; display: none; }
.lamp svg { width: 100%; height: auto; display: block; }
.lamp-stem { fill: none; stroke: #1c2a30; stroke-width: 6; stroke-linecap: round; }
.lamp-shade { fill: #142125; stroke: #2a3c44; stroke-width: 2; }
.lamp-lit { fill: var(--amber); opacity: calc(var(--warm) * .62); }
.lamp-glow { position: absolute; left: 50%; top: 14%; width: 520%; aspect-ratio: 1; transform: translate(-50%, -50%);
  background: radial-gradient(circle, rgba(227,162,59,.34), rgba(227,162,59,.10) 38%, rgba(227,162,59,0) 68%);
  opacity: var(--warm); }
.veil { position: absolute; inset: 0; opacity: var(--dim);
  background: radial-gradient(ellipse 60% 55% at 50% 40%, rgba(3,5,6,.74), rgba(3,5,6,.97)); }

.motes { position: fixed; inset: 0; width: 100%; height: 100%; z-index: -1; pointer-events: none; }
.grain { position: fixed; inset: 0; width: 100%; height: 100%; z-index: -1; pointer-events: none; opacity: 0; transition: opacity .9s ease; }
html.is-dark .grain { opacity: .06; }

/* ---- 3 header ---------------------------------------------------------- */
.top { position: absolute; top: 0; left: 0; right: 0; z-index: 5; padding: .9rem 3vw; }
.brand { display: inline-flex; align-items: center; gap: .55rem; min-height: 44px; padding-right: .5rem;
  font: 600 .95rem/1 var(--serif); letter-spacing: .06em; text-decoration: none; color: var(--muted); }
.brand:hover { color: var(--tv); }
.brand .mark { width: 28px; height: 28px; color: var(--muted); }
.brand .mark-led { fill: var(--amber); }

/* ---- 4 the set (the television) ---------------------------------------- */
.set { position: relative; --pad: clamp(8px, 1.4vw, 18px); --panel: 4.4rem;
  padding: 3.6rem 3vw 0; overflow-x: clip; }
.head { margin: 0 0 .9rem; text-align: center; }
h1 { margin: 0; font: 700 clamp(2.3rem, 1.55rem + 3.2vw, 4rem)/1 var(--display); letter-spacing: -.012em; }
.tune { display: inline-block; animation: tune-in 1.15s cubic-bezier(.2,.7,.2,1) both; }
.sub { margin: .3rem 0 0; font: italic 400 clamp(1.06rem, .95rem + .5vw, 1.4rem)/1.3 var(--serif); color: var(--muted); }

.tv { position: relative; margin: 0 auto;
  --lit: .16; --dim: 0; --warm: 0; --flick: 1;
  width: min(100%, calc((100svh - 13.6rem - var(--panel)) * 16 / 9 + 2 * var(--pad)), 72rem);
  transition: --lit 1.4s ease, --dim .9s ease; }

.cone { position: absolute; inset: -34% -26% -20% -26%; z-index: 0; pointer-events: none;
  transform-origin: 50% 46%; opacity: calc(var(--lit) * var(--flick)); }
.cone i { position: absolute; inset: 0; display: block; }
.cone-a { background: radial-gradient(ellipse 50% 50% at 50% 48%, rgba(214,236,244,.70) 0%, rgba(214,236,244,.34) 40%, rgba(214,236,244,.12) 66%, rgba(214,236,244,0) 100%); }
.cone-b { background: radial-gradient(ellipse 70% 66% at 50% 52%, rgba(112,150,154,.26), rgba(112,150,154,0) 78%); }

.bezel { position: relative; z-index: 2; padding: var(--pad) var(--pad) 0;
  border-radius: 26px 26px 14px 14px / 22px 22px 12px 12px;
  background: linear-gradient(155deg, #36444c 0%, #1e2a30 36%, #121a1e 100%);
  box-shadow: inset 0 1px 0 rgba(255,255,255,.14), inset 0 -2px 8px rgba(0,0,0,.6),
    0 34px 70px -24px rgba(0,0,0,.95), 0 0 0 1px #05080a; }

.glass { position: relative; aspect-ratio: 16 / 9; width: 100%; overflow: hidden; isolation: isolate;
  border-radius: 14px / 12px; background: #020405;
  box-shadow: 0 0 0 2px #04070a, 0 0 34px rgba(237,244,247,calc(var(--lit) * .18)); }
.poster { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; display: block;
  filter: url(#crt-fringe) brightness(.46) saturate(.55) contrast(1.06); }
html.is-on .poster { filter: none; }
.video-slot { position: absolute; inset: 0; z-index: 1; opacity: 0; transition: opacity .7s ease; }
.glass[data-live="1"] .video-slot { opacity: 1; }
.video-slot iframe { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; display: block; background: #000; }

.power { position: absolute; inset: 0; z-index: 4; display: grid; place-items: center; text-decoration: none; cursor: pointer; }
.power .ring { width: clamp(64px, 11vw, 104px); height: auto; overflow: visible; transition: transform .25s ease; }
.ring-arc { stroke: var(--tv); stroke-width: 2.6; stroke-linecap: round; stroke-dasharray: .84 .16; transform: rotate(-90deg);
  animation: ring-breathe 3.6s ease-in-out infinite; }
.tri { fill: var(--tv); }
.power:hover .ring { transform: scale(1.06); }
.power:focus-visible { outline: 3px solid var(--tv); outline-offset: -6px; }
.dur { position: absolute; left: .8rem; bottom: .55rem; font: 400 1.35rem/1 var(--osd); letter-spacing: .1em; color: var(--tv); text-shadow: 0 0 6px rgba(0,0,0,.9); }
html.is-on .power { display: none; }

.fx { position: absolute; inset: 0; z-index: 3; pointer-events: none; }
.fx i { position: absolute; inset: 0; display: block; }
.scan { background: repeating-linear-gradient(to bottom, rgba(0,0,0,0) 0 2px, rgba(0,0,0,.30) 2px 3px); opacity: .7; }
.glass[data-live="1"] .scan { opacity: .22; }
.curve { background:
  radial-gradient(130% 100% at 50% 42%, rgba(0,0,0,0) 58%, rgba(0,0,0,.34) 100%),
  linear-gradient(158deg, rgba(255,255,255,.07), rgba(255,255,255,0) 26%); }
.roll { top: -24%; bottom: auto; height: 24%;
  background: linear-gradient(to bottom, rgba(237,244,247,0), rgba(237,244,247,.07), rgba(237,244,247,0));
  animation: roll 9s linear infinite; }
html.is-on .roll { display: none; }

.crt { position: absolute; inset: 0; z-index: 6; pointer-events: none; background: #eaf4f8; opacity: 0; }
html.is-powering .crt { animation: crt-on .9s cubic-bezier(.22,.8,.2,1) both; }

/* the front panel */
.panel { display: flex; align-items: center; flex-wrap: wrap; gap: .5rem .9rem; padding: .62rem var(--pad) var(--pad);
  min-height: var(--panel); }
.led { flex: none; width: 11px; height: 11px; border-radius: 50%; background: var(--amber);
  box-shadow: 0 0 9px var(--amber); animation: led-standby 2.6s ease-in-out infinite; }
html.is-on .led { background: var(--tv); box-shadow: 0 0 10px var(--tv); animation: none; }
html.is-playing .led { animation: led-play 3.4s ease-in-out infinite; }
.keys { display: flex; align-items: center; flex-wrap: wrap; gap: .5rem; }
.key { display: inline-flex; align-items: center; justify-content: center; gap: .5rem; min-height: 44px; min-width: 44px;
  padding: .2rem .95rem; cursor: pointer; text-decoration: none; color: var(--tv);
  font: 400 1.32rem/1 var(--osd); letter-spacing: .14em;
  background: linear-gradient(#27333a, #172025); border: 1px solid #3b4b53; border-radius: 8px;
  box-shadow: 0 2px 0 #070a0b, inset 0 1px 0 rgba(255,255,255,.10);
  transition: border-color .2s ease, background-color .2s ease, transform .1s ease; }
.key:hover { border-color: var(--tv); }
.key:active { transform: translateY(1px); box-shadow: 0 1px 0 #070a0b; }
.key .glyph { font-family: var(--sys); font-size: .95rem; letter-spacing: 0; }
.readout { margin-left: auto; font: 400 clamp(1.7rem, 1.4rem + 1vw, 2.3rem)/1 var(--osd); letter-spacing: .14em;
  color: var(--sodium); text-shadow: 0 0 9px rgba(251,229,6,.45); font-variant-numeric: tabular-nums; }

.dresser { position: relative; z-index: 1; height: clamp(30px, 5vw, 66px); margin: -8px -5% 0; }
.dresser .edge { position: absolute; inset: 0; display: block; border-radius: 7px 7px 0 0;
  background: linear-gradient(#1b2529, #0e1518 52%, #090d0f); box-shadow: inset 0 1px 0 rgba(255,255,255,.10); }
.dresser .pool { position: absolute; left: 10%; right: 10%; top: -6px; height: 40px; display: block; z-index: 1;
  background: radial-gradient(ellipse 50% 100% at 50% 0%, rgba(237,244,247,.30), rgba(237,244,247,0) 72%);
  opacity: calc(var(--lit) * var(--flick) * .85); }

/* ---- 5 states ---------------------------------------------------------- */
/* base (standby): the room is dim, the set shows a faint reflection (--lit .16) */
html.is-on .room, html.is-on .tv { --lit: .82; }
html.is-still .room { --warm: 1; }
html.is-daylight .room, html.is-daylight .tv { --lit: .5; }
html.is-daylight .paper { background-color: #3a4c45; }
html.is-daylight .window { border-color: #2f4046; box-shadow: 0 0 0 2px #0a0f11, 0 0 150px rgba(183,203,187,.40), inset 0 0 30px rgba(255,255,255,.12); }
html.is-daylight .mull::before, html.is-daylight .mull::after { background: #2f4046; }
html.is-daylight .view { border-color: #2f4046; box-shadow: 0 0 0 2px #0a0f11, 0 0 90px rgba(183,203,187,.35), inset 0 0 26px rgba(255,255,255,.12); }
html.is-daylight .sweep { animation: dawn-sweep 3s ease-out both; }
/* the dark: 1:34 to 1:44. Declared AFTER is-on / is-daylight so it wins on specificity + order */
html.is-on.is-dark .room, html.is-on.is-dark .tv, html.is-dark .room, html.is-dark .tv { --lit: .1; --dim: .88; --warm: 0; }
/* the return: 1:44, "the TV comes on again. No electricity." */
html.is-return .room, html.is-return .tv { --lit: 1.15; --dim: 0; }
html.is-return .cone { animation: flare 1.1s ease-out both; }
html.is-return .led { background: #fff; box-shadow: 0 0 16px #fff; }

/* ---- 6 the wall (reading) ---------------------------------------------- */
.wall { position: relative; padding: clamp(2rem, 5vw, 4rem) 3vw 0; }
.reading { position: relative; max-width: 46rem; margin: 0 auto;
  padding: clamp(1.5rem, 4vw, 3.2rem) clamp(1.2rem, 4vw, 3.4rem) clamp(1.4rem, 3vw, 2.4rem);
  background-color: rgba(15, 22, 25, .955);
  background-image: repeating-linear-gradient(90deg, rgba(255,255,255,.02) 0 2px, rgba(255,255,255,0) 2px 44px);
  border: 1px solid #1f2d33; border-radius: 6px; box-shadow: 0 40px 90px -40px #000; }
.ch { scroll-margin-top: 1.2rem; }
.ch + .ch { margin-top: clamp(2.4rem, 5vw, 3.6rem); padding-top: clamp(1.8rem, 4vw, 2.6rem); border-top: 1px solid #243238; }
.osd { margin: 0 0 .7rem; font: 400 1.65rem/1 var(--osd); letter-spacing: .16em; color: var(--tv);
  text-shadow: 0 0 10px rgba(237,244,247,.42); display: flex; align-items: center; gap: .65rem; min-height: 1.1em; }
.osd::before { content: ""; width: 1.1em; height: .8em; flex: none;
  background: linear-gradient(90deg, currentColor 0 18%, transparent 18% 28%, currentColor 28% 46%, transparent 46% 56%, currentColor 56% 74%, transparent 74% 84%, currentColor 84%);
  clip-path: polygon(0 100%, 0 80%, 18% 80%, 18% 55%, 28% 55%, 28% 100%, 46% 100%, 46% 30%, 56% 30%, 56% 100%, 74% 100%, 74% 0, 84% 0, 84% 100%); opacity: .8; }
.osd.typing::after { content: ""; width: .5em; height: .95em; background: currentColor; animation: cursor .9s steps(2, jump-none) infinite; }
h2 { margin: 0 0 1.1rem; font: 700 clamp(1.7rem, 1.2rem + 1.9vw, 2.55rem)/1.14 var(--display); text-wrap: balance; }
.reading p, .reading li { font-size: clamp(1.06rem, 1rem + .3vw, 1.22rem); line-height: 1.64; }
.reading p { margin: 0 0 1.12em; text-align: justify; hyphens: auto; -webkit-hyphens: auto; hyphenate-limit-chars: 7 3 3; text-justify: inter-word; text-wrap: pretty; font-feature-settings: "onum" 1; }
.reading strong { font-weight: 600; }
.reading a { text-decoration: underline; text-decoration-thickness: 1px; text-underline-offset: .2em; text-decoration-color: var(--rain); }
.reading a:hover { text-decoration-thickness: 2px; text-decoration-color: var(--tv); }
.avail { margin: 0 0 1.3em; padding: 0; list-style: none; }
.avail li { position: relative; padding: .15rem 0 .15rem 1.5rem; }
.avail li::before { content: ""; position: absolute; left: 0; top: .78em; width: .75rem; height: 2px; background: var(--rain); }

.verse { margin: 2.1rem 0 2.1rem; padding: .3rem 0 .3rem clamp(1rem, 3vw, 1.7rem); border-left: 3px solid var(--rain); transition: border-color 2.4s ease; }
html.is-daylight .verse { border-left-color: var(--sodium); }
.verse p { margin: 0; text-align: left; hyphens: manual; text-wrap: balance;
  font: italic 400 clamp(1.7rem, 1.2rem + 1.9vw, 2.7rem)/1.22 var(--serif); }
.verse .w { transition: color .5s ease; }
html.js .verse .w { color: var(--muted); }
html.js .verse .w.lit { color: var(--tv); }

html.js .rv { opacity: 0; transform: translateY(10px); }
html.js .rv.in { opacity: 1; transform: none; transition: opacity .7s ease, transform .7s ease; }

/* the channel rail */
.rail { margin: 0 auto 1.4rem; max-width: 46rem; }
.rail-osd { display: none; }
.rail ol { display: flex; justify-content: center; gap: .3rem; margin: 0; padding: 0; list-style: none; }
.rail a { display: inline-flex; align-items: center; justify-content: center; min-width: 44px; min-height: 44px; padding: 0 .5rem;
  font: 400 1.5rem/1 var(--osd); letter-spacing: .1em; text-decoration: none; color: var(--muted);
  border: 1px solid #26353c; border-radius: 6px; background: rgba(15,22,25,.9); }
.rail a:hover { color: var(--tv); border-color: var(--rain); }
.rail a[aria-current="true"] { color: var(--tv); border-color: var(--tv); text-shadow: 0 0 8px rgba(237,244,247,.5); }
.rail-osd.tuning, .rail.tuning { animation: tuning .32s steps(3) both; }

/* ---- 7 the dawn (the harbour, the anchor, the last channel) ------------ */
.dawn { position: relative; margin-top: clamp(2.5rem, 6vw, 5rem); color: var(--night);
  background: linear-gradient(to bottom, rgba(38,53,47,0) 0, rgba(46,62,55,.92) 40px, #7f9d8d 150px, #adc4b5 260px, var(--day) 480px, #c3d4c7 100%); }
.harbour { position: relative; height: clamp(320px, 52vw, 540px); overflow: hidden; pointer-events: none; }
.harbour svg { position: absolute; inset: 0; width: 100%; height: 100%; max-width: none; display: block; }
.sea { opacity: .96; }
.headland { fill: #7f9a8a; opacity: .9; }
.waves path { fill: none; stroke: #5f7a6c; stroke-width: 2; opacity: .5; }
.waves path:nth-child(1) { animation: swell 22s linear infinite; }
.waves path:nth-child(2) { animation: swell 17s linear infinite reverse; }
.waves path:nth-child(3) { animation: swell 13s linear infinite; }
.waves path:nth-child(4) { animation: swell 10s linear infinite reverse; }
.sun { fill: var(--sodium); }
.sun-halo { opacity: 1; }
.glints path { fill: none; stroke: var(--sodium); stroke-width: 3; stroke-linecap: round; opacity: .75; animation: glint 5s ease-in-out infinite alternate; }
.glints { opacity: 0; transition: opacity 3s ease 1.5s; }
html.is-daylight .glints, html:not(.js) .glints { opacity: 1; }
html.js .sun-g { transform: translateY(78px); }
html.is-daylight .sun-g { transform: none; transition: transform 3.6s cubic-bezier(.2,.7,.2,1); }
.quay { fill: #1d2a2c; }
.quay-top { fill: #33484a; }
.quay-joints { fill: none; stroke: #0e1819; stroke-width: 2; opacity: .6; }
.bollard { fill: #1d2a2c; }
.anchor .stroke { fill: none; stroke: var(--night); stroke-width: 7; stroke-linecap: round; stroke-linejoin: round; }
.anchor .rope { stroke: #2f4143; stroke-width: 4; }
html.js .anchor .stroke { stroke-dasharray: 1; stroke-dashoffset: 1; }
html.is-daylight .anchor .stroke { animation: draw 2.4s cubic-bezier(.4,.1,.2,1) both; animation-delay: var(--d, 0s); }
.anchor-sway { transform-box: fill-box; transform-origin: 50% 4%; }
html.is-daylight .anchor-sway { animation: sway 7s ease-in-out 3s infinite alternate; }

.reading-end { background-color: transparent; background-image: none; border: 0; box-shadow: none; margin-top: 0; padding-top: clamp(1rem, 3vw, 2rem); }
.dawn .osd { color: var(--night); text-shadow: none; }
.dawn .reading p, .dawn .reading li { color: var(--night); }
.dawn h2 { color: var(--night); }
.dawn .reading a { text-decoration: none; background: linear-gradient(transparent 58%, var(--sodium) 58% 92%, transparent 92%); font-weight: 600; word-break: break-word; }
.dawn .reading a:hover { background: var(--sodium); }
.dawn .avail li::before { background: var(--night); }
.dawn .ch + .ch { border-top-color: rgba(11,14,16,.25); }
.dawn :focus-visible { outline-color: var(--night); }

.foot { max-width: 46rem; margin: 0 auto; padding: clamp(1.6rem, 4vw, 2.8rem) clamp(1.2rem, 4vw, 3.4rem) calc(2.6rem + env(safe-area-inset-bottom));
  border-top: 1px solid rgba(11,14,16,.25); color: var(--night); text-align: center; }
.foot p { margin: 0 0 .7rem; }
.foot-links { display: flex; flex-wrap: wrap; justify-content: center; gap: 0 1.3rem; }
.foot-links a { display: inline-block; min-height: 44px; line-height: 44px; padding: 0 .35rem; font: 600 1rem/44px var(--serif); text-decoration: underline; text-underline-offset: .2em; }
.foot-name { font: 700 1.15rem/1.2 var(--display); letter-spacing: .04em; }
.help { max-width: 34rem; margin: 1.2rem auto 0 !important; font: 400 .98rem/1.5 var(--serif); }
.help a { font-weight: 600; text-underline-offset: .2em; padding: .78rem .2rem; }   /* inline: the padding makes a 44 px target without moving the line */

/* ---- 8 share theming (the self-hosted dialog, re-drawn) ----------------- */
.share { --share-btn-bg: transparent; --share-btn-fg: var(--tv);
  --share-d-bg: #141c20; --share-d-panel: #1d282d; --share-d-fg: #edf4f7; --share-d-accent: #edf4f7; --share-d-on-accent: #0b0e10; }
.share .share-btn.key { background: linear-gradient(#27333a, #172025); color: var(--tv); border: 1px solid #3b4b53; border-radius: 8px; }
.share .share-dialog { font-family: var(--serif); }
.share .share-dialog::backdrop { background: rgba(3,5,6,.72); }

/* ---- 9 responsive ------------------------------------------------------ */
@media (min-width: 1100px) {
  .set { padding-left: 33vw; padding-right: 9vw; padding-top: 3.9rem; }
  .head { text-align: left; }
  .tv { margin-left: 0; }
  .window { display: block; left: 4vw; top: 8.2rem; width: 24vw; height: min(54vh, 30rem); }
  .chair { display: block; left: 8vw; bottom: 17vh; width: clamp(110px, 12.5vw, 200px); height: auto; }
  .lamp { display: block; right: 2.2vw; bottom: 18vh; width: clamp(54px, 5.6vw, 92px); }
  .wall { display: grid; grid-template-columns: minmax(0, 46rem) 5.6rem; gap: 1.6rem; padding-left: 33vw; padding-right: 3vw; justify-content: start; align-items: start; }
  .reading { margin: 0; }
  .rail { position: sticky; top: 38vh; grid-column: 2; grid-row: 1; margin: 0; max-width: none; align-self: start; }
  .rail-osd { display: block; margin: 0 0 .5rem; font: 400 2rem/1 var(--osd); letter-spacing: .12em; color: var(--tv); text-shadow: 0 0 12px rgba(237,244,247,.45); }
  .rail ol { flex-direction: column; align-items: stretch; gap: .35rem; }
  .rail a { justify-content: flex-start; }
  .dawn .reading, .dawn .foot { margin-left: 33vw; margin-right: auto; max-width: 46rem; }
  .dawn .foot { text-align: left; }
  .dawn .foot-links { justify-content: flex-start; }
  .dawn .help { margin-left: 0 !important; }
}
@media (max-width: 1099px) {
  .window, .dresser { display: none; }
  .set { padding-top: 3.4rem; }
  /* below 1100 px the window is a band under the television, so the rain is seen, not hidden behind it */
  .view { display: block; position: relative; z-index: 1; height: clamp(10.5rem, 34vw, 15rem); margin: -1.5rem 3% 0;
    border: 12px solid #1b252a; border-radius: 3px; background: #0a1114; overflow: hidden;
    box-shadow: 0 0 0 2px #0a0f11, 0 0 70px rgba(112,150,154,.10), inset 0 0 34px rgba(0,0,0,.65);
    transition: border-color 3s ease, box-shadow 3s ease; }
  .view canvas { position: absolute; inset: 0; width: 100%; height: 100%; display: block; }
  .view::before { content: ""; position: absolute; inset: 0; z-index: 2; pointer-events: none; background: rgba(3,5,6,.92); opacity: var(--dim); }   /* the dark reaches the band too */
  .view::after { content: ""; position: absolute; inset: 0; pointer-events: none; opacity: calc(var(--lit) * var(--flick) * .8);
    background: radial-gradient(ellipse 60% 90% at 50% -10%, rgba(214,236,244,.34), rgba(214,236,244,0) 72%); }
  .wall { padding-top: clamp(2.2rem, 6vw, 3.4rem); }
}
@media (max-width: 560px) {
  .keys { display: contents; }
  .panel { gap: .55rem .6rem; }
  .led { order: 1; }
  #btn-global-menu { order: 2; }
  .share { order: 3; }
  .readout { order: 4; margin-left: auto; }
  .key-watch { order: 5; flex: 1 1 100%; }
  .readout { font-size: 1.75rem; }
  .key { padding: .2rem .7rem; font-size: 1.2rem; }
  .osd { font-size: 1.5rem; }
  .reading p { hyphens: auto; }
}
@media (max-width: 380px) {
  .key { letter-spacing: .08em; padding: .2rem .55rem; }
  .keys { gap: .4rem; }
}

/* ---- keyframes --------------------------------------------------------- */
@keyframes tune-in {
  0%   { opacity: .15; filter: blur(2.5px); text-shadow: -7px 0 rgba(255,70,70,.8), 7px 0 rgba(70,225,255,.8); }
  55%  { opacity: .9;  filter: blur(.6px);  text-shadow: -3px 0 rgba(255,70,70,.55), 3px 0 rgba(70,225,255,.55); }
  100% { opacity: 1;   filter: blur(0);     text-shadow: 0 0 0 rgba(255,70,70,0), 0 0 0 rgba(70,225,255,0); }
}
@keyframes led-play { 0%, 100% { opacity: .72; } 50% { opacity: 1; } }
@keyframes led-standby { 0%, 100% { opacity: .45; } 50% { opacity: 1; } }
@keyframes ring-breathe { 0%, 100% { opacity: .55; } 50% { opacity: 1; } }
@keyframes roll { from { transform: translateY(0); } to { transform: translateY(520%); } }
@keyframes crt-on {                 /* a line, opened to a soft bloom, then gone: never a white-out */
  0%   { opacity: 1;   clip-path: inset(49.3% 50% 49.3% 50%); }
  24%  { opacity: 1;   clip-path: inset(49.3% 0 49.3% 0); }
  44%  { opacity: .34; clip-path: inset(18% 0 18% 0); }
  62%  { opacity: .22; clip-path: inset(0 0 0 0); }
  100% { opacity: 0;   clip-path: inset(0 0 0 0); }
}
@keyframes flare { 0% { transform: scale(.72); } 38% { transform: scale(1.34); } 100% { transform: scale(1.06); } }
@keyframes dawn-sweep { 0% { opacity: 0; transform: translateX(-60%); } 30% { opacity: 1; } 100% { opacity: 0; transform: translateX(60%); } }
@keyframes cursor { 0% { opacity: 1; } 100% { opacity: 0; } }
@keyframes tuning { 0% { opacity: .35; } 100% { opacity: 1; } }
@keyframes glint { from { opacity: .35; } to { opacity: .85; } }
@keyframes swell { from { transform: translateX(0); } to { transform: translateX(-240px); } }
@keyframes draw { from { stroke-dashoffset: 1; } to { stroke-dashoffset: 0; } }
@keyframes sway { from { transform: rotate(-.8deg); } to { transform: rotate(.8deg); } }

/* ---- 10 reduced motion: the same END STATES, at once --------------------- */
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { animation: none !important; transition: none !important; }
  .tune { opacity: 1; filter: none; }
  .crt, .roll, .sweep, .grain { display: none; }
  html.js .rv { opacity: 1; transform: none; }
  html.js .verse .w { color: var(--tv); }
  html.js .anchor .stroke { stroke-dashoffset: 0; }
  html.js .sun-g { transform: none; }
  .room, .tv { --lit: .16; }
  html.is-on .room, html.is-on .tv { --lit: .82; }
  html.is-daylight .room, html.is-daylight .tv { --lit: .5; }
}
/* no JavaScript: the standby set, everything readable, nothing hidden */
html:not(.js) .rv { opacity: 1; transform: none; }
