/* Shared base + the "inside the TV" section view.
   The home page skins the inside view through the --in-* variables. */

*, *::before, *::after { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body { background: #050507; color: #ddd; overflow: hidden; -webkit-font-smoothing: antialiased; }
button { font: inherit; color: inherit; }
:focus-visible { outline: 2px dashed currentColor; outline-offset: 4px; }

:root {
    --grain: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='220' height='220'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.85' numOctaves='3' stitchTiles='stitch'/%3E%3CfeColorMatrix type='saturate' values='0'/%3E%3C/filter%3E%3Crect width='220' height='220' filter='url(%23n)'/%3E%3C/svg%3E");
}

/* Film grain that jitters over everything */
.grain {
    position: fixed; inset: -50%; z-index: 90; pointer-events: none;
    background-image: var(--grain); opacity: .13; mix-blend-mode: overlay;
    animation: grain .5s steps(4) infinite;
}
@keyframes grain {
    0% { transform: translate(0, 0); } 25% { transform: translate(-3%, 2%); }
    50% { transform: translate(2%, -3%); } 75% { transform: translate(-1%, -2%); }
}

/* Generic on-screen bits */
.mp-eye { width: 100%; height: auto; display: block; animation: mp-blink 6s infinite; transform-origin: 50% 50%; }
@keyframes mp-blink { 0%, 93%, 100% { transform: scaleY(1); } 95% { transform: scaleY(.08); } }
.mp-eye-iris { animation: mp-look 7s ease-in-out infinite; }
@keyframes mp-look { 0%, 40%, 100% { transform: translateX(0); } 50%, 65% { transform: translateX(-14px); } 75%, 90% { transform: translateX(12px); } }

.mp-bars { position: absolute; inset: 0; display: grid; grid-template-rows: 67% 8% 25%; }
.mp-bars > div { display: flex; }
.mp-bars i { flex: 1; }
.mp-bars-bot i:nth-child(-n+4) { flex: 1.25; }

/* ── Inside the TV ─────────────────────────────────────────────────────── */
.inside {
    --in-bg: #06080a; --in-ink: #cfe9d6; --in-dim: #6c8a76; --in-accent: #7dffb0; --in-hot: #ff3d7f;
    --in-font: 'VT323', ui-monospace, monospace; --in-display: var(--in-font);
    position: fixed; inset: 0; z-index: 100;
    display: flex; flex-direction: column;
    background: radial-gradient(ellipse at 50% 40%, color-mix(in srgb, var(--in-bg) 80%, #fff 6%), var(--in-bg) 70%);
    color: var(--in-ink); font-family: var(--in-font); font-size: 20px;
    overflow: hidden;
}
.inside::before {           /* scanlines */
    content: ''; position: absolute; inset: 0; z-index: 20; pointer-events: none;
    background: repeating-linear-gradient(to bottom, rgba(0,0,0,.32) 0 1px, transparent 1px 3px);
}
.inside::after {            /* tube vignette + glass glare */
    content: ''; position: absolute; inset: 0; z-index: 21; pointer-events: none;
    box-shadow: inset 0 0 14vmin 2vmin rgba(0,0,0,.92);
    background: radial-gradient(ellipse 60% 40% at 30% 18%, rgba(255,255,255,.05), transparent 70%);
    animation: in-flicker 5s infinite;
}
@keyframes in-flicker { 0%, 100% { opacity: 1; } 47% { opacity: .92; } 48% { opacity: 1; } 72% { opacity: .96; } }

.inside.power-on { animation: in-on .6s cubic-bezier(.2,.8,.2,1) both; }
.inside.power-off { animation: in-off .42s ease-in both; }
@keyframes in-on {
    0% { transform: scale(.02, .004); filter: brightness(8); }
    35% { transform: scale(1, .004); filter: brightness(6); }
    100% { transform: scale(1, 1); filter: brightness(1); }
}
@keyframes in-off {
    0% { transform: scale(1, 1); filter: brightness(1); }
    55% { transform: scale(1, .004); filter: brightness(5); }
    100% { transform: scale(0, .004); filter: brightness(10); opacity: 0; }
}
@media (prefers-reduced-motion: reduce) {
    .inside.power-on, .inside.power-off, .grain { animation: none; }
}

.in-head, .in-foot {
    position: relative; z-index: 2;
    display: flex; align-items: center; justify-content: space-between; gap: 16px;
    padding: 18px clamp(16px, 4vw, 48px);
}
.in-head { border-bottom: 1px solid color-mix(in srgb, var(--in-ink) 18%, transparent); }
.in-osd, .in-eject { flex: none; white-space: nowrap; }
.in-osd { display: flex; gap: 14px; color: var(--in-accent); font-size: 26px; text-shadow: 0 0 8px var(--in-accent); }
.in-play { animation: in-blink 1.2s steps(2) infinite; }
@keyframes in-blink { 50% { opacity: 0; } }
.in-heading { min-width: 0; text-align: center; }
.in-no-ai { margin: 6px 0 0; color: var(--in-accent); font-size: 17px; letter-spacing: .12em; }
.in-title {
    margin: 0; font-family: var(--in-display); font-weight: 400; letter-spacing: .08em;
    font-size: clamp(26px, 4.5vw, 52px); text-transform: uppercase;
    text-shadow: 2px 0 rgba(255,0,80,.55), -2px 0 rgba(0,220,255,.55);
}
.in-eject {
    background: transparent; border: 1px solid currentColor; padding: 6px 14px; cursor: pointer;
    color: var(--in-ink); letter-spacing: .1em; font-size: 20px;
}
.in-eject:hover { background: var(--in-ink); color: var(--in-bg); }
.in-foot { color: var(--in-dim); font-size: 18px; border-top: 1px solid color-mix(in srgb, var(--in-ink) 12%, transparent); padding-block: 10px; }

.in-body {
    position: relative; z-index: 1; flex: 1; min-height: 0; overflow: auto;
    padding: clamp(16px, 3vw, 36px) clamp(16px, 4vw, 48px);
}

/* Gallery: cassette tapes as albums, frames as a contact sheet */
/* z-index: auto lets the thumbnails stack above the scanlines and vignette, so photos show unfiltered */
.is-gallery .in-body { z-index: auto; display: grid; grid-template-columns: minmax(200px, 260px) 1fr; gap: clamp(16px, 3vw, 40px); align-items: start; }
.in-tapes { display: flex; flex-direction: column; gap: 12px; }
.in-tape {
    position: relative; display: block; width: 100%; text-align: left; cursor: pointer;
    background: #141414; border: 0; border-radius: 4px; padding: 10px 10px 34px;
    box-shadow: inset 0 0 0 2px #262626, 0 4px 0 #000;
    transition: transform .15s;
}
.in-tape:hover { transform: translateX(6px); }
.in-tape.on { box-shadow: inset 0 0 0 2px var(--in-accent), 0 0 18px color-mix(in srgb, var(--in-accent) 40%, transparent); }
.in-tape-label { display: block; background: #e9e2cf; color: #1a1a1a; padding: 6px 10px; border-radius: 2px; border-top: 6px solid var(--in-hot); }
.in-tape-label b { display: block; font-size: 22px; font-weight: 400; line-height: 1; }
.in-tape-label small { font-size: 15px; opacity: .7; }
.in-tape-reels { position: absolute; left: 50%; bottom: 7px; transform: translateX(-50%); display: flex; gap: 46px; }
.in-tape-reels i { width: 20px; height: 20px; border-radius: 50%; background: repeating-conic-gradient(#000 0 30deg, #444 30deg 60deg); box-shadow: 0 0 0 3px #222; }
.in-tape.on .in-tape-reels i { animation: reel 1.4s linear infinite; }
@keyframes reel { to { transform: rotate(360deg); } }

.in-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(220px, 100%), 1fr)); gap: 14px; }
.in-thumb {
    position: relative; z-index: 22; padding: 0; border: 0; cursor: pointer; background: #000;
    aspect-ratio: 3 / 2; overflow: hidden;
    box-shadow: 0 0 0 1px color-mix(in srgb, var(--in-ink) 25%, transparent);
}
.in-grid.loaded .in-thumb { animation: thumb-in .45s steps(5) both; animation-delay: calc(var(--n) * 60ms); }
@keyframes thumb-in { from { opacity: 0; filter: brightness(4) contrast(3); transform: scaleY(.1); } }
.in-thumb img { width: 100%; height: 100%; object-fit: cover; display: block; transition: transform .4s; }
.in-thumb span { position: absolute; left: 8px; bottom: 4px; font-size: 18px; color: #fff; text-shadow: 0 0 4px #000; }
.in-thumb:hover img { transform: scale(1.06); }

.in-lb {
    position: absolute; inset: 0; z-index: 23; display: none;
    grid-template-columns: auto 1fr auto; align-items: center; gap: 12px; padding: 4vmin;
    background: rgba(0,0,0,.88);
}
.in-lb.open { display: grid; }
.in-lb figure { margin: 0; display: flex; flex-direction: column; align-items: center; gap: 10px; min-width: 0; }
.in-lb img { max-width: 100%; max-height: 74vh; box-shadow: 0 0 0 1px #333, 0 0 60px rgba(0,0,0,.8); }
.in-lb figcaption { color: var(--in-dim); font-size: 18px; letter-spacing: .08em; text-align: center; }
.in-lb button { background: none; border: 1px solid #444; color: var(--in-ink); padding: 8px 12px; cursor: pointer; }
.in-lb button:hover { border-color: var(--in-ink); }
.in-lb-x { position: absolute; top: 16px; right: 16px; }

/* About: ID card + typed log */
.in-about { display: grid; grid-template-columns: minmax(220px, 320px) 1fr; gap: clamp(20px, 4vw, 56px); max-width: 1100px; }
.in-about-side { align-self: start; }
.in-about-side .in-no-ai { margin-top: 12px; }
.in-id { border: 1px solid color-mix(in srgb, var(--in-ink) 30%, transparent); padding: 16px; background: rgba(0,0,0,.35); }
.in-id-photo { display: block; width: 100%; height: auto; background: #12081f; margin-bottom: 14px; }
.in-id dl { margin: 0; display: grid; grid-template-columns: auto 1fr; gap: 4px 14px; }
.in-id dt { color: var(--in-dim); }
.in-id dd { margin: 0; }
.in-id-contacts { margin-top: 14px; padding-top: 12px; border-top: 1px solid color-mix(in srgb, var(--in-ink) 30%, transparent); color: var(--in-dim); }
.in-id-contacts div { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 8px; }
.in-id-contacts a { display: block; width: 36px; height: 36px; color: var(--in-ink); transition: color .15s; }
.in-id-contacts a:hover, .in-id-contacts a:focus-visible { color: var(--in-accent); }
.in-id-contacts svg { display: block; width: 100%; height: 100%; }
.in-type { position: relative; padding-left: 2ch; white-space: pre-wrap; margin: 0; font-size: clamp(20px, 2.2vw, 28px); line-height: 1.35; }
.in-type::before { content: attr(data-prompts); position: absolute; inset: 0 auto 0 0; overflow: hidden; }

/* Not-yet-built channels */
.in-nosig { position: absolute; inset: 0; }
.in-nosig .mp-bars { opacity: .85; }
.in-nosig-msg {
    position: absolute; left: 50%; top: 40%; transform: translate(-50%, -50%);
    background: #000; padding: 18px 28px; text-align: center; box-shadow: 0 0 0 2px #fff;
    display: flex; flex-direction: column; gap: 6px; max-width: calc(100% - 32px);
}
.in-nosig-msg b { font-size: clamp(34px, 6vw, 64px); font-weight: 400; color: #fff; animation: in-blink 1s steps(2) infinite; }
.in-nosig-msg span { color: #aaa; }

@media (max-width: 720px) {
    .in-about { grid-template-columns: 1fr; }
    .is-gallery .in-body { display: block; }
    .in-tapes { flex-direction: row; overflow-x: auto; padding-bottom: 6px; margin-bottom: 16px; }
    .in-tape { min-width: 190px; }
    .in-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
    .in-tape:hover { transform: none; }
    .in-head { flex-wrap: wrap; }
    .in-heading { order: 3; width: 100%; text-align: left; }
    .in-lb { grid-template-columns: 1fr 1fr; }
    .in-lb figure { grid-column: 1 / -1; grid-row: 1; }
}

/* ── Album notes: title + artist statement above the contact sheet ─────── */
.in-album { min-width: 0; }
.in-notes { max-width: 72ch; margin-bottom: clamp(16px, 2.4vw, 28px); padding-left: 16px; border-left: 3px solid var(--in-hot); }
.in-notes h2 { margin: 0; font-weight: 400; font-size: clamp(30px, 3.4vw, 46px); line-height: 1; color: #fff; letter-spacing: .03em; }
.in-notes-meta { margin: 6px 0 12px; color: var(--in-accent); font-size: 17px; letter-spacing: .12em; }
.in-notes p:not(.in-notes-meta) { margin: 0 0 .7em; font-size: clamp(19px, 1.6vw, 22px); line-height: 1.35; }
.is-gallery .in-lb { bottom: var(--dock, 0px); }

/* ── Radio docked under the gallery (js/radio.js) ───────────────────────── */
.radio {
    --amber: #ffb347;
    position: relative; z-index: 3; flex: none;
    display: grid; grid-template-columns: 150px minmax(240px, 1fr) 96px auto auto; align-items: center; gap: clamp(10px, 1.4vw, 18px);
    padding: 14px clamp(16px, 3vw, 36px) 12px;
    background:
        linear-gradient(#b5b0a6, #6f6b64) 0 0 / 100% 3px no-repeat,
        repeating-linear-gradient(92deg, rgba(0,0,0,.2) 0 2px, transparent 2px 9px, rgba(255,220,180,.05) 9px 11px, transparent 11px 23px),
        linear-gradient(#45281a, #24130a);
    box-shadow: 0 -12px 30px rgba(0,0,0,.65), inset 0 3px 0 rgba(255,255,255,.08);
    color: #e9d9b8; font-family: 'VT323', ui-monospace, monospace;
}
.rd-grille { align-self: stretch; min-height: 80px; border-radius: 6px; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px;
    background: radial-gradient(circle, #0b0705 1.5px, transparent 2px) 0 0 / 7px 7px, linear-gradient(#2c1b10, #170d07);
    box-shadow: inset 0 0 0 2px #0e0805, inset 0 4px 12px rgba(0,0,0,.8); }
.rd-grille span { background: linear-gradient(#e2ddd2, #a9a397); color: #1c140e; padding: 1px 10px; border-radius: 2px; font-size: 18px; letter-spacing: .12em; box-shadow: 0 2px 4px rgba(0,0,0,.6); }
.rd-grille small { font-size: 13px; letter-spacing: .3em; color: #b9ab8c; }

.rd-dial { min-width: 0; padding: 6px 14px 4px; border-radius: 6px;
    background: radial-gradient(ellipse at 50% 120%, rgba(255,179,71,.18), transparent 70%), linear-gradient(#1c0f04, #0c0602);
    box-shadow: 0 0 0 3px #8d877b, 0 0 0 4px #2a2622, inset 0 0 18px rgba(0,0,0,.9);
    color: var(--amber); text-shadow: 0 0 6px rgba(255,179,71,.6); transition: filter .4s; }
.radio:not(.rd-on) .rd-dial { filter: brightness(.62) saturate(.8); }
.rd-now { overflow: hidden; white-space: nowrap; font-size: 22px; height: 24px; }
.rd-scroll { display: inline-block; padding-left: 100%; animation: rd-marquee 16s linear infinite; }
@keyframes rd-marquee { to { transform: translateX(-100%); } }
.rd-sweep .rd-now { animation: in-blink .12s steps(2) infinite; }
.rd-scale { position: relative; height: 30px; margin: 2px 4px; border-right: 2px solid rgba(255,179,71,.9);
    background: repeating-linear-gradient(90deg, rgba(255,179,71,.5) 0 1px, transparent 1px 2.5%) bottom / 100% 7px no-repeat,
                repeating-linear-gradient(90deg, rgba(255,179,71,.9) 0 2px, transparent 2px 20%) bottom / 100% 13px no-repeat; }
.rd-scale span { position: absolute; top: -2px; transform: translateX(-50%); font-size: 15px; opacity: .85; }
.rd-mark { position: absolute; bottom: 15px; width: 5px; height: 5px; border-radius: 50%; background: #ff6a3d; transform: translateX(-50%); }
.rd-needle { position: absolute; top: -3px; bottom: -3px; left: 0; width: 2px; background: #ff3020; box-shadow: 0 0 6px #ff3020; transform: translateX(-50%);
    transition: left .42s cubic-bezier(.4,1.4,.5,1); }
.rd-empty .rd-needle { left: 3% !important; opacity: .5; }
.rd-meta { display: flex; justify-content: space-between; font-size: 17px; opacity: .8; }

.rd-vu { position: relative; width: 96px; height: 66px; border-radius: 6px 6px 4px 4px; overflow: hidden;
    background: radial-gradient(ellipse at 50% 100%, #fff6dc, #e6d6ad 70%); box-shadow: 0 0 0 3px #8d877b, inset 0 -6px 10px rgba(0,0,0,.25); }
/* scale arc, with the red "over" zone on the right */
.rd-vu::before, .rd-vu::after { content: ''; position: absolute; left: 12%; right: 12%; top: 26%; height: 130%; border-radius: 50%; border: 2px solid transparent; border-top-color: #2a2018; }
.rd-vu::after { border-width: 3px; border-top-color: #c62a1a; clip-path: inset(0 0 0 70%); }
.rd-vu-needle { position: absolute; left: calc(50% - 1px); bottom: 4px; width: 2px; height: 50px; background: #15100c; transform-origin: 50% 100%; transform: rotate(-40deg); transition: transform .12s ease-out; }
.rd-vu span { position: absolute; left: 8px; bottom: 2px; font-size: 13px; color: #2a2018; }

.rd-keys { display: flex; gap: 4px; align-self: start; }
.rd-key { width: 30px; height: 58px; padding: 0 0 4px; border: 0; border-radius: 0 0 4px 4px; cursor: pointer; display: flex; align-items: flex-end; justify-content: center;
    background: linear-gradient(#f3ecd9, #cfc6ad); color: #2a2018; font-size: 20px; box-shadow: 0 5px 0 #6d6450, inset 0 -3px 0 rgba(0,0,0,.15); transition: transform .08s; }
.rd-key[aria-pressed="true"] { transform: translateY(4px); box-shadow: 0 1px 0 #6d6450, inset 0 3px 0 #ffb347; background: linear-gradient(#e3dbc5, #c4bb9f); }

.rd-ctl { display: flex; flex-direction: column; align-items: center; gap: 8px; }
.rd-btns { display: flex; align-items: center; gap: 8px; }
.rd-btns button, .rd-mute { border: 0; cursor: pointer; color: #1c140e; background: radial-gradient(circle at 35% 30%, #f2efe8, #a9a397 60%, #6f6b64); box-shadow: 0 3px 0 #1a120c, inset 0 -2px 3px rgba(0,0,0,.25); }
.rd-btns button { width: 40px; height: 40px; border-radius: 50%; font-size: 16px; }
.rd-btns .rd-play { width: 50px; height: 50px; font-size: 20px; }
.rd-btns button:active, .rd-mute:active { transform: translateY(2px); box-shadow: 0 1px 0 #1a120c; }
.rd-btns button:disabled { opacity: .45; cursor: default; }
.rd-row { display: flex; align-items: center; gap: 10px; }
.rd-vol { display: flex; align-items: center; gap: 6px; font-size: 16px; letter-spacing: .1em; }
.rd-vol input { width: 100px; accent-color: var(--amber); }
.rd-mute { position: relative; padding: 2px 8px 2px 20px; border-radius: 4px; font: inherit; font-size: 15px; letter-spacing: .08em; }
.rd-mute::before { content: ''; position: absolute; left: 7px; top: 50%; width: 7px; height: 7px; border-radius: 50%; transform: translateY(-50%); background: #3a2a10; }
.rd-mute[aria-pressed="true"]::before { background: #ffb02e; box-shadow: 0 0 6px #ffb02e; }

@media (max-width: 1100px) {
    .radio { grid-template-columns: minmax(240px, 1fr) auto auto; }
    .rd-grille, .rd-vu { display: none; }
}
/* No radio on small screens; js/radio.js also stops the music (keep in sync with SMALL there) */
@media (max-width: 720px) {
    .radio { display: none; }
}
.in-empty { color: var(--in-dim); font-size: 24px; letter-spacing: .08em; }
