/*
 * The homepage's Feed card: one card with two sets, a beige 1990s computer monitor and a dark 1980s TV.
 * The TV is the default set, set by the card's data-model in the homepage; only the flap switches sets.
 * Each set's design lives in variables at the top of its section, so it can be tuned in one place.
 * Add ?sliders to the homepage's address to tune them live; the shipped page never loads the sliders.
 */

/*
 * Design knobs: the lightness of each set's plastic, and the shape of the monitor's screen (width over height).
 * Every cabinet color comes from the set's lightness, so a whole set can be made darker or lighter at once:
 * faces in shadow sit below it, faces catching the light above it.
 */
.feed_set{
    --tv-cabinet: 24%;
    --monitor-cabinet: 91%;
    --monitor-plastic: 45 14%;
    --monitor-ratio: 1.08;
    --tone-deep: hsl(var(--plastic) calc(var(--cabinet) - 14%));
    --tone-shadow: hsl(var(--plastic) calc(var(--cabinet) - 9%));
    --tone-dim: hsl(var(--plastic) calc(var(--cabinet) - 4%));
    --tone: hsl(var(--plastic) var(--cabinet));
    --tone-raised: hsl(var(--plastic) calc(var(--cabinet) + 5%));
    --tone-lit: hsl(var(--plastic) calc(var(--cabinet) + 10%));
    --glow: 0 0 0;
    --glow-full: 0 0 0;
    --glow-value: 0;
    --glow-alpha: 0;
    opacity: 1;
    display: flex;
    flex-direction: column;
    align-items: stretch;
    padding: 0;
    overflow: visible;
    background: linear-gradient(var(--tone-raised), var(--tone) 70%);
    border-radius: 4px;
    box-shadow: var(--card-shadow);
}

.feed_set[data-model="tv"]{
    --cabinet: var(--tv-cabinet);
    --plastic: var(--tv-hue) var(--tv-saturation);
    --card-shadow:
        inset 0 1px 0 rgba(255, 255, 255, 0.16),
        0 1px 1px rgba(0, 0, 0, 0.25),
        0 3px 4px -1px rgba(0, 0, 0, 0.2),
        0 14px 22px -8px rgba(0, 0, 0, 0.35);
}

.feed_set[data-model="monitor"]{
    --cabinet: var(--monitor-cabinet);
    --plastic: var(--monitor-plastic);
    --card-shadow:
        inset 0 1px 0 rgba(255, 255, 255, 0.7),
        inset 0 -2px 0 rgba(0, 0, 0, 0.06),
        0 1px 1px rgba(0, 0, 0, 0.12),
        0 3px 4px -1px rgba(0, 0, 0, 0.1),
        0 14px 22px -8px rgba(0, 0, 0, 0.22);
    border-radius: 5px;
    background: var(--tone);
}

/* The homepage presses the whole card; here only a press on the screen does, not one on the chin or the power button. */
.feed_set:active{
    transform: none;
    box-shadow: var(--card-shadow);
}

.feed_set:has(.tv_link:active){
    transform: scale(0.98);
    box-shadow:
        0 1px 1px rgba(0, 0, 0, 0.2),
        0 2px 3px rgba(0, 0, 0, 0.12);
}

/* The link covers the screen only. */
.feed_set .tv_link{
    position: absolute;
    inset: 0;
    border-radius: inherit;
}

.feed_set .tv_link:focus-visible{
    outline: 2px solid #6dff86;
    outline-offset: -4px;
}

.feed_set button{
    -webkit-tap-highlight-color: transparent;
}

.feed_set .tv_front{
    position: relative;
    display: flex;
    flex-direction: column;
}

/* The frame slopes in toward the tube: its top face is in shadow, its bottom face catches the light. */
/* The frame's opening is rounded like the tube: its corners are filled with the frame's own faces, shadowed at the top and lit at the bottom. */
.feed_set .tv_bezel{
    position: relative;
    display: flex;
    border-style: solid;
    background: linear-gradient(var(--tone-shadow) 50%, var(--tone-lit) 50%);
}

/*
 * While the tube is lit, the picture's color spills onto the frame around it.
 * The light is screened onto the frame, so it can only brighten it: a dark picture leaves the frame as it is.
 * It starts just outside the tube's dark rim, so the rim stays dark and the picture still sits under the frame.
 */
.feed_set .tv_bezel::after{
    content: "";
    position: absolute;
    inset: -2px;
    z-index: 1;
    pointer-events: none;
    border-radius: 8px / 7px;
    box-shadow: 0 0 14px 3px rgb(var(--glow) / var(--glow-alpha));
    mix-blend-mode: screen;
    transition: box-shadow 300ms;
}

.feed_set:is([data-power="on"], [data-power="turning-on"]){
    --glow-alpha: var(--glow-strength);
}

/* Off, the tube is smooth light grey-green glass with a soft reflection, perfectly still, like the set unplugged. Each set draws its own dark rim. */
.feed_set .tv_screen{
    position: relative;
    flex: 1;
    overflow: hidden;
    border-radius: 6px / 5px;
    background:
        linear-gradient(155deg, rgba(255, 255, 255, 0.12), transparent 45%),
        radial-gradient(ellipse at 42% 32%, #97a39c, #6d7871 60%, #5a645e);
}

.feed_set .tv_picture{
    position: absolute;
    inset: 0;
    background: #000;
    transform: scale(0, 0);
}

/* Scanlines belong to the picture, so they open and collapse with it. */
.feed_set .tv_picture::after{
    content: "";
    position: absolute;
    inset: 0;
    pointer-events: none;
    background: repeating-linear-gradient(0deg, rgba(0, 0, 0, 0.22) 0 1px, transparent 1px 3px);
}

.feed_set[data-power="on"] .tv_picture{
    transform: none;
}

/* Turning on: a bright dot opens into a line, then the picture rolls open, overexposed for a moment. */
.feed_set[data-power="turning-on"] .tv_picture{
    animation: tv_collapse_on 650ms cubic-bezier(0.2, 0.7, 0.3, 1) forwards;
}

@keyframes tv_collapse_on{
    0%{
        transform: scale(0.01, 0.006);
        filter: brightness(6);
    }
    30%{
        transform: scale(1, 0.006);
        filter: brightness(5);
    }
    70%{
        transform: scale(1, 1.03);
        filter: brightness(1.8);
    }
    100%{
        transform: none;
        filter: none;
    }
}

/* Turning off: the picture collapses to a line, then to a dot that fades. */
.feed_set[data-power="turning-off"] .tv_picture{
    animation: tv_collapse_off 520ms cubic-bezier(0.5, 0, 0.8, 0.4) forwards;
}

@keyframes tv_collapse_off{
    0%{
        transform: none;
        filter: none;
        opacity: 1;
    }
    40%{
        transform: scale(1, 0.006);
        filter: brightness(4);
        opacity: 1;
    }
    75%{
        transform: scale(0.02, 0.006);
        filter: brightness(6);
        opacity: 1;
    }
    100%{
        transform: scale(0, 0);
        filter: brightness(6);
        opacity: 0;
    }
}

/* Videos fill the screen, cropped by their longer side. */
.feed_set .tv_media{
    position: absolute;
    inset: 0;
    display: block;
    width: 100%;
    height: 100%;
    object-fit: cover;
    filter: saturate(1.15) contrast(1.05);
    visibility: hidden;
}

.feed_set .tv_media.shown{
    visibility: visible;
}

.feed_set .tv_picture canvas{
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    image-rendering: pixelated;
    visibility: hidden;
}

.feed_set[data-phase="static"] .tv_picture canvas{
    visibility: visible;
}

/* The on-screen display: the entry's date in glowing green, like a channel number. It appears and disappears at once, as on old sets. */
/* The date, on screen in the top right corner, the same on both sets. */
.feed_set{
    --date-size: 14px;
}

/* Static between videos lasts at least this long, more while the next video loads (see feed-card.js). */
.feed_set{
    --static-time: 1000ms;
}

.feed_set .tv_osd{
    position: absolute;
    top: 9px;
    right: 11px;
    font-family: Menlo, monospace;
    font-size: var(--date-size);
    font-weight: bold;
    line-height: 1;
    letter-spacing: 0.04em;
    color: #6dff86;
    text-shadow:
        0 0 2px rgba(109, 255, 134, 0.9),
        0 0 6px rgba(109, 255, 134, 0.5),
        1px 1px 0 rgba(0, 0, 0, 0.6);
    visibility: hidden;
}

.feed_set .tv_osd.shown{
    visibility: visible;
}

/* Darker corners and a soft highlight over the glass. */
.feed_set .tv_glass{
    position: absolute;
    inset: 0;
    pointer-events: none;
    background: radial-gradient(ellipse at 30% 12%, rgba(255, 255, 255, 0.09), transparent 40%);
    box-shadow: inset 0 0 22px 4px rgba(0, 0, 0, 0.35);
    border-radius: inherit;
}

.feed_set .tv_name{
    position: static;
    width: auto;
    margin: 0;
    font-weight: 600;
    transform: none;
}

/* The name opens the Feed too, and keeps the set's lettering. */
.feed_set .tv_name a{
    color: inherit;
}

.feed_set .tv_chin{
    position: relative;
    display: flex;
    flex-direction: column;
}

.feed_set .tv_base{
    position: relative;
}

.feed_set .tv_grille{
    position: absolute;
}

/* The flap switches to the other set. */
.feed_set .tv_flap{
    position: absolute;
    left: calc(50% - 56px);
    width: 112px;
    padding: 0;
    border: 0;
    background: none;
    cursor: pointer;
}

.feed_set .tv_flap:focus-visible{
    outline: 2px solid currentColor;
    outline-offset: 2px;
}

/* The power button's hit area is a 60 by 60 square in the card's bottom right corner; the key drawn inside it is smaller. */
.feed_set .tv_power{
    position: absolute;
    right: 0;
    bottom: 0;
    z-index: 3;
    display: flex;
    align-items: flex-end;
    justify-content: flex-end;
    width: 60px;
    height: 60px;
    padding: 0;
    border: 0;
    background: none;
    cursor: pointer;
}

.feed_set .tv_key{
    position: relative;
    display: grid;
    place-items: center;
    transition: transform 60ms;
}

.feed_set .tv_power:active .tv_key{
    transform: translateY(1px);
}

.feed_set .tv_power:focus-visible{
    outline: none;
}

.feed_set .tv_power:focus-visible .tv_key{
    outline: 2px solid currentColor;
    outline-offset: 4px;
}

/* The light belongs to the cabinet, not the key, so it stays still when the key is pressed. It fades on and off. */
.feed_set .tv_led{
    position: absolute;
    width: 4px;
    height: 4px;
    border-radius: 50%;
    transition:
        background-color 200ms,
        box-shadow 200ms;
}

/*************************************************************************************
*
* The TV: a dark set, a top lip and seam, the name on the first chin, a slim second chin with the speaker grille and the power key.
*
*************************************************************************************/

/* The frame sits between two grooves, each with the same flat band between it and the frame. */
.feed_set[data-model="tv"] .tv_front{
    flex: 1;
    padding: 16px var(--tv-front-side) var(--tv-groove-gap);
}

.feed_set[data-model="tv"] .tv_chin{
    color: #e4e4df;
}

.feed_set[data-model="tv"] .tv_front::before{
    content: "";
    position: absolute;
    top: calc(16px - 1px - var(--tv-groove-gap));
    left: 0;
    right: 0;
    height: 1px;
    background: rgba(0, 0, 0, 0.35);
    box-shadow: 0 1px 0 rgba(255, 255, 255, 0.08);
}

.feed_set[data-model="tv"] .tv_bezel{
    flex: 1;
    padding: var(--frame-top) var(--frame-side) var(--frame-bottom);
    border-width: 0;
    background: none;
    box-shadow:
        0 -1px 0 rgba(0, 0, 0, 0.25),
        0 1px 0 rgba(255, 255, 255, 0.1);
}

/*
 * The TV's design, in one place: the flat front beside the frame, the flat band between each groove and the frame, the frame's faces and the lip where each side starts to tilt,
 * the band with the name under the tube, the narrower step it sits on (a height of 0 removes it), the second chin's height, the flap, the grille, and the feet.
 */
.feed_set[data-model="tv"]{
    --tv-hue: 209;
    --tv-saturation: 3%;
    --tv-front-side: 4px;
    --tv-groove-gap: 6px;
    --tv-name-height: 26px;
    --tv-name-size: 16px;
    --tv-base-height: 34px;
    --tv-step-height: 1px;
    --tv-step-inset: 3px;
    --tv-step-corner: 2px;
    --tv-grille-pitch: 2px;
    --tv-frame-top: 7px;
    --tv-frame-side: 16px;
    --tv-frame-bottom: 3px;
    --tv-lip: 2px;
    --tv-screen-corner: 0px;
    --tv-flap-width: 84px;
    --tv-flap-across: 0px;
    --tv-mark-across: 10px;
    --tv-mark-up: 9px;
    --tv-mark-size: 4px;
    --tv-mark-shadow: none;
    --tv-feet: block;
    --tv-key-bottom: calc((var(--tv-base-height) - 16px) / 2);
    --frame-top: var(--tv-frame-top);
    --frame-side: var(--tv-frame-side);
    --frame-bottom: var(--tv-frame-bottom);
    --tube-edge: rgba(0, 0, 0, 0.6);
    --tv-light: 0.2;
    --glow-strength: var(--tv-light);
}

/*
 * While the tube is lit, its light falls only on the frame's faces, the ones that tilt in toward it, lips included,
 * never on the flat front facing the viewer. It is screened onto them, so it only brightens: strongest at the tube, fading outward.
 */
.feed_set[data-model="tv"] .tv_bezel::after{
    display: none;
}

.feed_set[data-model="tv"] .tv_slope{
    --face-light: rgb(var(--glow) / var(--glow-alpha));
    transition: --face-light 300ms;
}

.feed_set[data-model="tv"] .tv_slope::after{
    content: "";
    position: absolute;
    inset: 0;
    mix-blend-mode: screen;
}

.feed_set[data-model="tv"] .tv_slope_top::after{
    background: linear-gradient(color-mix(in srgb, var(--face-light) 35%, transparent), var(--face-light) var(--frame-top));
}

.feed_set[data-model="tv"] .tv_slope_bottom::after{
    background: linear-gradient(to top, color-mix(in srgb, var(--face-light) 35%, transparent), var(--face-light) var(--frame-bottom));
}

.feed_set[data-model="tv"] .tv_slope_left::after{
    background: linear-gradient(to right, color-mix(in srgb, var(--face-light) 35%, transparent), var(--face-light) var(--frame-side));
}

.feed_set[data-model="tv"] .tv_slope_right::after{
    background: linear-gradient(to left, color-mix(in srgb, var(--face-light) 35%, transparent), var(--face-light) var(--frame-side));
}

/* The tube's corners are only slightly rounded. */
/* The TV's dark rim is the tube's own border, with the glass starting inside it, so no light glass shows at the rim's outer edge. */
.feed_set[data-model="tv"] .tv_screen{
    box-sizing: border-box;
    border: 2px solid var(--tube-edge);
    border-radius: var(--tv-screen-corner);
    background-clip: padding-box;
}

/*
 * The TV's faces are flat and meet at hard angles: the top one in shadow, the bottom one lit.
 * Each side starts with a thin lip at its own angle, catching the light, before it tilts in toward the tube.
 */
.feed_set[data-model="tv"] .tv_slope_top{
    background: var(--tone-shadow);
}

.feed_set[data-model="tv"] .tv_slope_bottom{
    background: var(--tone-lit);
}

.feed_set[data-model="tv"] .tv_slope_left{
    background: linear-gradient(to right, var(--tone-raised) var(--tv-lip), var(--tone) var(--tv-lip));
}

.feed_set[data-model="tv"] .tv_slope_right{
    background: linear-gradient(to left, var(--tone-raised) var(--tv-lip), var(--tone) var(--tv-lip));
}

/* The groove under the frame, just above the name, matching the one at the top. */
.feed_set[data-model="tv"] .tv_chin::before{
    content: "";
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 1px;
    background: rgba(0, 0, 0, 0.35);
    box-shadow: 0 1px 0 rgba(255, 255, 255, 0.08);
}

/* Brushed metal letters centred on the first chin, where the maker's name would be. */
.feed_set[data-model="tv"] .tv_name{
    display: flex;
    align-items: center;
    justify-content: center;
    height: var(--tv-name-height);
    padding: 0;
    font-size: var(--tv-name-size);
    line-height: 1;
    letter-spacing: 0.03em;
    text-align: center;
    color: #e4e4df;
    text-shadow: 0 -1px 0 rgba(0, 0, 0, 0.5);
}

/*
 * The upper body, with the tube and the name, sits on a narrower step, which sits on the second chin, as on the original set.
 * So the TV is drawn as two bodies, each with its own rounded corners and shadow, behind the set's parts: the upper one, and the second chin.
 * Beside the step, the page shows between them, with the upper body's shadow falling on it. The step takes its height from the screen above.
 */
.feed_set[data-model="tv"]{
    isolation: isolate;
    background: none;
}

.feed_set[data-model="tv"],
.feed_set[data-model="tv"]:active,
.feed_set[data-model="tv"]:has(.tv_link:active){
    box-shadow: none;
}

.feed_set[data-model="tv"]::before,
.feed_set[data-model="tv"]::after{
    content: "";
    position: absolute;
    z-index: -1;
    left: 0;
    right: 0;
}

.feed_set[data-model="tv"]::before{
    top: 0;
    bottom: calc(var(--tv-base-height) + var(--tv-step-height));
    background: linear-gradient(var(--tone-raised), var(--tone) 80%);
    border-radius: 4px 4px var(--tv-step-corner) var(--tv-step-corner);
    box-shadow: var(--card-shadow);
}

.feed_set[data-model="tv"]::after{
    bottom: 0;
    height: var(--tv-base-height);
    background: var(--tone-dim);
    border-radius: var(--tv-step-corner) var(--tv-step-corner) 4px 4px;
    box-shadow:
        0 1px 1px rgba(0, 0, 0, 0.25),
        0 3px 4px -1px rgba(0, 0, 0, 0.2),
        0 14px 22px -8px rgba(0, 0, 0, 0.35);
}

.feed_set[data-model="tv"]:has(.tv_link:active)::before,
.feed_set[data-model="tv"]:has(.tv_link:active)::after{
    box-shadow:
        0 1px 1px rgba(0, 0, 0, 0.2),
        0 2px 3px rgba(0, 0, 0, 0.12);
}

/* The step itself, set back under the upper body, in its shadow. */
.feed_set[data-model="tv"] .tv_name{
    position: relative;
}

.feed_set[data-model="tv"] .tv_name::after{
    content: "";
    position: absolute;
    top: 100%;
    left: var(--tv-step-inset);
    right: var(--tv-step-inset);
    height: var(--tv-step-height);
    background: linear-gradient(rgba(0, 0, 0, 0.45), rgba(0, 0, 0, 0.15)), var(--tone-dim);
}

.feed_set[data-model="tv"] .tv_base{
    margin-top: var(--tv-step-height);
    height: var(--tv-base-height);
    background: var(--tone-dim);
    border-top: 1px solid var(--tone-shadow);
    border-radius: var(--tv-step-corner) var(--tv-step-corner) 4px 4px;
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.07);
}

/*
 * The flap beside the speaker grille, where the original set has its model badge: smooth glossy black against the chin's matt plastic,
 * set in with a dark seam, reaching down to the bottom edge like the monitor's. Pressed, it tips in at the top, as the monitor's does.
 */
.feed_set[data-model="tv"] .tv_flap{
    left: calc(50% - var(--tv-flap-width) / 2 + var(--tv-flap-across));
    top: 0;
    bottom: 0;
    width: var(--tv-flap-width);
    border-radius: 0;
    background:
        linear-gradient(rgba(255, 255, 255, 0.07), rgba(255, 255, 255, 0.02) 35%, transparent 60%),
        var(--tone-deep);
    box-shadow:
        0 -1px 0 rgba(0, 0, 0, 0.45),
        1px 0 0 rgba(0, 0, 0, 0.45),
        -1px 0 0 rgba(0, 0, 0, 0.45),
        inset 0 1px 0 rgba(255, 255, 255, 0.1);
}

.feed_set[data-model="tv"] .tv_flap:active{
    background:
        linear-gradient(rgba(255, 255, 255, 0.03), transparent 50%),
        var(--tone-deep);
    box-shadow:
        0 -1px 0 rgba(0, 0, 0, 0.45),
        1px 0 0 rgba(0, 0, 0, 0.45),
        -1px 0 0 rgba(0, 0, 0, 0.45),
        inset 0 2px 3px -1px rgba(0, 0, 0, 0.5);
}

/* An unlit orange mark on the flap, where the original has its orange "15 System", hinting that the flap can be pressed. */
.feed_set[data-model="tv"] .tv_flap::before{
    content: "";
    position: absolute;
    left: var(--tv-mark-across);
    bottom: var(--tv-mark-up);
    width: var(--tv-mark-size);
    height: var(--tv-mark-size);
    border-radius: 50%;
    background: #b08a3e;
    box-shadow: var(--tv-mark-shadow);
}

/* Two small feet under the second chin, standing the set on the page; --tv-feet shows or hides them. */
.feed_set[data-model="tv"] .tv_base::before,
.feed_set[data-model="tv"] .tv_base::after{
    content: "";
    position: absolute;
    display: var(--tv-feet);
    bottom: -3px;
    width: 28px;
    height: 3px;
    background: hsl(var(--plastic) calc(var(--cabinet) - 12%));
    border-radius: 0 0 2px 2px;
}

.feed_set[data-model="tv"] .tv_base::before{
    left: 22px;
}

.feed_set[data-model="tv"] .tv_base::after{
    right: 22px;
}

/*
 * The speaker grille: fine holes over the second chin's full height, from its left edge up to the flap.
 * They are spaced to fit, so no row or column is ever cut.
 */
.feed_set[data-model="tv"] .tv_grille{
    top: 0;
    bottom: 0;
    left: 0;
    width: calc(50% - var(--tv-flap-width) / 2 + var(--tv-flap-across));
    background: radial-gradient(circle, var(--tone-deep) 0.5px, transparent 0.8px) 0 0 / var(--tv-grille-pitch) var(--tv-grille-pitch) space;
}

/* The power key is always centred on the second chin's height. */
.feed_set[data-model="tv"] .tv_power{
    padding: 0 12px var(--tv-key-bottom) 0;
}

/* A rectangular key set into a dark well. */
.feed_set[data-model="tv"] .tv_key{
    width: 36px;
    height: 16px;
    border-radius: 1.5px;
    background: linear-gradient(var(--tone-lit), var(--tone));
    box-shadow:
        0 0 0 1px var(--tone-deep),
        inset 0 1px 0 rgba(255, 255, 255, 0.14),
        0 1px 1px 1px rgba(0, 0, 0, 0.3);
    color: #6dff86;
}

.feed_set[data-model="tv"] .tv_power:active .tv_key{
    background: linear-gradient(var(--tone-dim), var(--tone));
    box-shadow:
        0 0 0 1px var(--tone-deep),
        inset 0 1px 2px rgba(0, 0, 0, 0.45);
}

.feed_set[data-model="tv"] .tv_key svg{
    display: none;
}

/* The TV's light sits on the key, centred a little above its middle, so it goes down with the key. */
.feed_set[data-model="tv"] .tv_led{
    right: 28px;
    bottom: calc(var(--tv-key-bottom) + 8px);
    z-index: 1;
    background: #36443a;
    box-shadow: inset 0 1px 1px rgba(0, 0, 0, 0.5);
    transition:
        background-color 400ms,
        box-shadow 400ms,
        transform 60ms;
}

.feed_set[data-model="tv"] .tv_power:active .tv_led{
    transform: translateY(1px);
}

/*************************************************************************************
*
* The monitor: beige plastic in one piece, a tall tube, the name on the left of the chin,
* a flap reaching down to the bottom edge, and a round grey power key with its light beside it.
*
*************************************************************************************/

.feed_set[data-model="monitor"] .tv_front{
    padding: 15px 10px 0;
}

/* The monitor's frame is four curved faces rolling down to the tube; where two faces meet at a corner, they meet along a seam. */
.feed_set[data-model="monitor"] .tv_bezel{
    display: block;
    padding: var(--frame-top) var(--frame-side) var(--frame-bottom);
    border-width: 0;
    border-radius: 3px;
    background: none;
    box-shadow: none;
}

.feed_set[data-model="monitor"] .tv_bezel::after{
    display: none;
}

/* The monitor's design, in one place: the frame's faces, how dark the side curves get, the flap, the power group, and the name. */
.feed_set[data-model="monitor"]{
    --monitor-frame-top: 4px;
    --monitor-frame-side: 12px;
    --monitor-frame-bottom: 3px;
    --frame-top: var(--monitor-frame-top);
    --frame-side: var(--monitor-frame-side);
    --frame-bottom: var(--monitor-frame-bottom);
    --curve-depth: 1;
    --flap-height: 32px;
    --power-gap: 0px;
    --power-lift: 0px;
    --name-across: 21px;
    --name-down: 7px;
    --tube-edge: #161512;
    --tube-rim: 1.5px;
    --monitor-light: 0.3;
    --glow-strength: var(--monitor-light);
}

/*
 * Both sets build their frame from four faces, sized by --frame-top, --frame-side and --frame-bottom.
 * Each face reaches past the tube's corner, under the tube, so the frame fills the gap behind the tube's rounded corners.
 * Its color stays the same past its own edge.
 */
.feed_set .tv_slope{
    position: absolute;
    inset: 0;
    pointer-events: none;
    background-repeat: no-repeat;
}

.feed_set .tv_slope_top{
    clip-path: polygon(0 0, 100% 0, calc(100% - 2 * var(--frame-side)) calc(2 * var(--frame-top)), calc(2 * var(--frame-side)) calc(2 * var(--frame-top)));
}

.feed_set .tv_slope_bottom{
    clip-path: polygon(calc(2 * var(--frame-side)) calc(100% - 2 * var(--frame-bottom)), calc(100% - 2 * var(--frame-side)) calc(100% - 2 * var(--frame-bottom)), 100% 100%, 0 100%);
}

.feed_set .tv_slope_left{
    clip-path: polygon(0 0, calc(2 * var(--frame-side)) calc(2 * var(--frame-top)), calc(2 * var(--frame-side)) calc(100% - 2 * var(--frame-bottom)), 0 100%);
}

.feed_set .tv_slope_right{
    clip-path: polygon(calc(100% - 2 * var(--frame-side)) calc(2 * var(--frame-top)), 100% 0, 100% 100%, calc(100% - 2 * var(--frame-side)) calc(100% - 2 * var(--frame-bottom)));
}

/* Seen straight on, the top face goes straight back to the tube: only a thin edge of it shows, rolling smoothly into shadow. */
.feed_set[data-model="monitor"] .tv_slope_top{
    background-image: linear-gradient(transparent, hsl(var(--plastic) 50% / 0.24) var(--frame-top));
}

/* The bottom face is a flat shelf going straight back: a thin edge of it shows, rolling smoothly into the light. */
.feed_set[data-model="monitor"] .tv_slope_bottom{
    background-image: linear-gradient(to top, var(--tone), var(--tone-lit) var(--frame-bottom));
}

/*
 * The side faces curve from the front in toward the tube over a longer distance, darker as they turn away.
 * They start clear, so the curve always begins from the case's own color, which lightens toward the top.
 * --curve-depth sets how dark they get.
 */
.feed_set[data-model="monitor"] .tv_slope_left{
    background-image: linear-gradient(
        to right,
        transparent,
        hsl(var(--plastic) 50% / calc(0.15 * var(--curve-depth))) calc(0.25 * var(--frame-side)),
        hsl(var(--plastic) 45% / calc(0.4 * var(--curve-depth))) calc(0.55 * var(--frame-side)),
        hsl(var(--plastic) 40% / calc(0.7 * var(--curve-depth))) calc(0.8 * var(--frame-side)),
        hsl(var(--plastic) 35% / calc(0.9 * var(--curve-depth))) var(--frame-side)
    );
}

.feed_set[data-model="monitor"] .tv_slope_right{
    background-image: linear-gradient(
        to left,
        transparent,
        hsl(var(--plastic) 50% / calc(0.15 * var(--curve-depth))) calc(0.25 * var(--frame-side)),
        hsl(var(--plastic) 45% / calc(0.4 * var(--curve-depth))) calc(0.55 * var(--frame-side)),
        hsl(var(--plastic) 40% / calc(0.7 * var(--curve-depth))) calc(0.8 * var(--frame-side)),
        hsl(var(--plastic) 35% / calc(0.9 * var(--curve-depth))) var(--frame-side)
    );
}

/*
 * While the tube is lit, the picture's light falls on the frame's faces, strongest at the tube and fading outward.
 * It is laid over the faces in the picture's color at full brightness, as strong as the picture is bright,
 * so a red picture tints the frame red, and a dark one leaves it as it is.
 */
@property --face-light{
    syntax: "<color>";
    inherits: true;
    initial-value: transparent;
}

.feed_set[data-model="monitor"] .tv_slope{
    --face-light: rgb(var(--glow-full) / calc(var(--glow-alpha) * var(--glow-value)));
    transition: --face-light 300ms;
}

.feed_set[data-model="monitor"] .tv_slope::after{
    content: "";
    position: absolute;
    inset: 0;
}

.feed_set[data-model="monitor"] .tv_slope_top::after{
    background: linear-gradient(transparent, var(--face-light) var(--frame-top));
}

.feed_set[data-model="monitor"] .tv_slope_bottom::after{
    background: linear-gradient(to top, transparent, var(--face-light) var(--frame-bottom));
}

.feed_set[data-model="monitor"] .tv_slope_left::after{
    background: linear-gradient(to right, transparent, var(--face-light) var(--frame-side));
}

.feed_set[data-model="monitor"] .tv_slope_right::after{
    background: linear-gradient(to left, transparent, var(--face-light) var(--frame-side));
}

.feed_set[data-model="monitor"] .tv_screen{
    width: 100%;
    border-radius: 0;
    box-shadow: none;
    aspect-ratio: var(--monitor-ratio);
}

/* The monitor's dark rim is drawn inside the glass, over the picture, so it never covers the frame's faces. */
.feed_set[data-model="monitor"] .tv_glass{
    box-shadow:
        inset 0 0 0 var(--tube-rim) var(--tube-edge),
        inset 0 calc(var(--tube-rim) + 1px) 0 rgba(0, 0, 0, 0.35),
        inset 0 0 22px 4px rgba(0, 0, 0, 0.35);
}

/* The name, printed in warm grey on the left of the chin, like the maker's logo. */
.feed_set[data-model="monitor"] .tv_name{
    padding: var(--name-down) var(--name-across) 0;
    font-size: 14px;
    letter-spacing: 0.02em;
    color: hsl(var(--plastic) calc(var(--cabinet) - 50%));
    text-shadow: 0 1px 0 rgba(255, 255, 255, 0.6);
}

.feed_set[data-model="monitor"] .tv_chin{
    flex: 1;
}

/* The flap is placed against the chin itself. */
.feed_set[data-model="monitor"] .tv_base{
    position: static;
}

.feed_set[data-model="monitor"] .tv_grille{
    display: none;
}

/* The flap over the adjustment knobs reaches down to the bottom edge. */
.feed_set[data-model="monitor"] .tv_flap{
    bottom: 0;
    height: var(--flap-height);
    border-radius: 2px 2px 0 0;
    background:
        radial-gradient(circle, var(--tone-shadow) 0.7px, transparent 1px) 50% 4px / 3px 3px no-repeat,
        linear-gradient(var(--tone-raised), var(--tone));
    background-size: 9px 6px, auto;
    box-shadow:
        0 -1px 0 var(--tone-shadow),
        1px 0 0 var(--tone-shadow),
        -1px 0 0 var(--tone-shadow),
        inset 0 1px 0 rgba(255, 255, 255, 0.7),
        inset 0 -2px 0 rgba(0, 0, 0, 0.06);
}

/* Pressed, the flap tips in at the top: evenly a little darker, its top highlight turned into a soft shadow. */
.feed_set[data-model="monitor"] .tv_flap:active{
    background:
        radial-gradient(circle, var(--tone-deep) 0.7px, transparent 1px) 50% 4px / 3px 3px no-repeat,
        var(--tone-dim);
    background-size: 9px 6px, auto;
    box-shadow:
        0 -1px 0 var(--tone-shadow),
        1px 0 0 var(--tone-shadow),
        -1px 0 0 var(--tone-shadow),
        inset 0 2px 3px -1px rgba(0, 0, 0, 0.18),
        inset 0 -2px 0 rgba(0, 0, 0, 0.06);
}

/*
 * As on the original, the power key and its light sit just right of the flap, not in the corner.
 * The button's hit area starts where the flap's ends, so the two never overlap; --power-gap and --power-lift move the group.
 */
.feed_set[data-model="monitor"] .tv_power{
    right: auto;
    left: calc(50% + 56px + var(--power-gap));
    bottom: var(--power-lift);
    padding: 0 18px 12px 0;
}

/* A round grey key with the power symbol pressed into it; only the key lightens on hover, not the ring around it. */
.feed_set[data-model="monitor"] .tv_key{
    width: 18px;
    height: 18px;
    border-radius: 50%;
    background: linear-gradient(hsl(45 4% 82%), hsl(45 4% 70%));
    box-shadow:
        0 0 0 1px hsl(var(--plastic) calc(var(--cabinet) - 22%)),
        0 0 0 3px var(--tone-dim),
        inset 0 1px 0 rgba(255, 255, 255, 0.7),
        0 1px 1px 1px rgba(0, 0, 0, 0.1);
    color: hsl(45 4% 48%);
}

.feed_set[data-model="monitor"] .tv_power:active .tv_key{
    background: linear-gradient(hsl(45 4% 68%), hsl(45 4% 76%));
    box-shadow:
        0 0 0 1px hsl(var(--plastic) calc(var(--cabinet) - 22%)),
        0 0 0 3px var(--tone-dim),
        inset 0 1px 2px rgba(0, 0, 0, 0.25);
}

.feed_set[data-model="monitor"] .tv_key svg{
    width: 11px;
    height: 11px;
    filter: drop-shadow(0 1px 0 rgba(255, 255, 255, 0.6));
}

.feed_set[data-model="monitor"] .tv_led{
    right: 46px;
    bottom: 19px;
    background: #9aa596;
    box-shadow: inset 0 1px 1px rgba(0, 0, 0, 0.3);
}

/*************************************************************************************
*
* The drawing: the set drawn in ink on paper, like the sketchbooks: outlines drawn by hand, hatching for depth,
* the tube's recess, the name, a slotted grille, the flap and the power key. Flat, with no light or shadow of its own.
*
* The lines are images drawn by feed-card.js: each line a path with a slight unevenness, overshooting at the corners, like a pen.
* They are drawn once, and again only when the set's size or a design value changes, so the set is as cheap to show as the others.
* Each part shows its image through a variable: --drawing-outline, --drawing-recess, --drawing-grille, --drawing-flap and --drawing-key.
*
*************************************************************************************/

/* The drawing's design, in one place: paper, ink, how uneven the lines are, the frame around the recess, the recess's depth on each side, hatching, and the chin. */
.feed_set[data-model="drawing"]{
    --drawing-paper-hue: 38;
    --drawing-paper-saturation: 12%;
    --drawing-paper-lightness: 95.5%;
    --drawing-sepia: 81%;
    --drawing-line: 1px;
    --drawing-wobble: 1.5;
    --drawing-margin: 20px;
    --drawing-depth-top: 7px;
    --drawing-depth-side: 9px;
    --drawing-depth-bottom: 4px;
    --drawing-hatch: 3px;
    --drawing-name-height: 24px;
    --drawing-base-height: 32px;
    --drawing-flap-width: 64px;
    --drawing-sticker-size: 20px;
    --sticker-size: var(--drawing-sticker-size);
    --drawing-power-time: 700ms;
    --drawing-video-tone: 0.4;
    --drawing-sticker-hue: 50;
    --drawing-sticker-saturation: 85%;
    --drawing-sticker-lightness: 66%;
    --drawing-sticker-across: 7px;
    --drawing-sticker-up: 6px;
    --paper: hsl(var(--drawing-paper-hue) var(--drawing-paper-saturation) var(--drawing-paper-lightness));
    --ink: color-mix(in srgb, #1c1a18, #5b3a22 var(--drawing-sepia));
    --frame-top: var(--drawing-depth-top);
    --frame-side: var(--drawing-depth-side);
    --frame-bottom: var(--drawing-depth-bottom);
    --glow-strength: 0;
    --sticker-across: var(--drawing-sticker-across);
    --sticker-up: var(--drawing-sticker-up);
    --card-shadow: 0 1px 2px rgba(0, 0, 0, 0.08);
    border-radius: 2px;
    background:
        url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='180' height='180'%3E%3Cfilter id='g'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='2' stitchTiles='stitch'/%3E%3CfeColorMatrix values='0 0 0 0 0.35 0 0 0 0 0.3 0 0 0 0 0.2 0 0 0 0.16 0'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23g)'/%3E%3C/svg%3E"),
        var(--paper);
    color: var(--ink);
}

/* The set's outline and the line under the front. The image reaches 4px past the card, so lines can overshoot its corners. */
.feed_set[data-model="drawing"]::before{
    content: "";
    position: absolute;
    inset: -4px;
    z-index: 2;
    pointer-events: none;
    background: var(--drawing-outline) 0 0 / 100% 100% no-repeat;
}

.feed_set[data-model="drawing"] .tv_front{
    flex: 1;
    padding: var(--drawing-margin) var(--drawing-margin) calc(var(--drawing-margin) * 0.6);
}

/* The recess: its outer edge, the tube's edge, a line at each corner between them, and its walls hatched, the light coming from the top left. */
.feed_set[data-model="drawing"] .tv_bezel{
    flex: 1;
    padding: var(--frame-top) var(--frame-side) var(--frame-bottom);
    border-width: 0;
    background: none;
}

.feed_set[data-model="drawing"] .tv_bezel::before{
    content: "";
    position: absolute;
    inset: -4px;
    z-index: 1;
    pointer-events: none;
    background: var(--drawing-recess) 0 0 / 100% 100% no-repeat;
}

.feed_set[data-model="drawing"] .tv_bezel::after,
.feed_set[data-model="drawing"] .tv_slope,
.feed_set[data-model="drawing"] .tv_glass{
    display: none;
}

/* Off, the tube is drawn: hatched all over, more densely toward its edges, with a clear reflection at the top left (drawn by feed-card.js). */
.feed_set[data-model="drawing"] .tv_screen{
    border-radius: 0;
    background:
        var(--drawing-screen) 0 0 / 100% 100% no-repeat,
        color-mix(in srgb, var(--paper), var(--ink) 5%);
}

/* On, the picture is drawn in rather than lit: no glow, and scanlines ruled by hand. Static is pen strokes on paper (see feed-card.js). */
.feed_set[data-model="drawing"] .tv_picture{
    background: var(--paper);
}

.feed_set[data-model="drawing"] .tv_picture::after{
    background: var(--drawing-scanlines) 0 0 / 100% 100% no-repeat;
}

/*
 * The video takes on the paper a little, so it sits in the drawing like a print: warmer, less saturated, a touch softer,
 * with the paper's grain over it. --drawing-video-tone sets how much, from 0 (the video as it is) to 1.
 */
.feed_set[data-model="drawing"] .tv_media{
    filter:
        sepia(calc(var(--drawing-video-tone) * 0.45))
        saturate(calc(1 - var(--drawing-video-tone) * 0.45))
        contrast(calc(1 - var(--drawing-video-tone) * 0.12))
        brightness(calc(1 + var(--drawing-video-tone) * 0.05));
}

.feed_set[data-model="drawing"] .tv_screen::after{
    content: "";
    position: absolute;
    inset: 0;
    pointer-events: none;
    background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='180' height='180'%3E%3Cfilter id='g'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='2' stitchTiles='stitch'/%3E%3CfeColorMatrix values='0 0 0 0 0.35 0 0 0 0 0.3 0 0 0 0 0.2 0 0 0 0.5 0'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23g)'/%3E%3C/svg%3E");
    opacity: var(--drawing-video-tone);
    mix-blend-mode: multiply;
}

.feed_set[data-model="drawing"] .tv_picture canvas{
    image-rendering: auto;
}

/*
 * Turning on and off is drawn in hatching: off, it is drawn over the picture until the screen looks off again;
 * on, the same lines erase the off screen in reverse, showing the picture as it is underneath. A canvas over the picture does it (see feed-card.js).
 * Meanwhile the picture holds still for as long as the strokes take, so the set finishes turning on or off when they do.
 */
.feed_set .drawing_cover{
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    display: none;
}

.feed_set[data-model="drawing"] .drawing_cover{
    display: block;
}

.feed_set[data-model="drawing"]:is([data-power="turning-on"], [data-power="turning-off"]) .tv_picture{
    transform: none;
    animation: drawing_hold var(--drawing-power-time) linear forwards;
}

@keyframes drawing_hold{
    from{
        transform: none;
    }
    to{
        transform: none;
    }
}

/* The date is written on a scrap of paper in the corner, in the sticker's hand. */
.feed_set[data-model="drawing"] .tv_osd{
    top: 6px;
    right: 6px;
    padding: 2px 5px 1px;
    background: var(--paper);
    box-shadow: 0 0 0 1px var(--ink);
    font-family: var(--sticker-font), Noteworthy, "Marker Felt", "Ink Free", "Segoe Print", casual, "Comic Sans MS", cursive;
    font-weight: var(--sticker-weight);
    letter-spacing: 0;
    color: var(--ink);
    text-shadow: none;
    transform: rotate(-2deg);
}

/* The sticker, drawn too: pale yellow paper with an inked edge, flat on the set. */
.feed_set[data-model="drawing"] .tv_sticker{
    background:
        var(--drawing-sticker) 0 0 / 100% 100% no-repeat,
        hsl(var(--drawing-sticker-hue) var(--drawing-sticker-saturation) var(--drawing-sticker-lightness));
    box-shadow: none;
    color: var(--ink);
}

.feed_set[data-model="drawing"] .tv_name{
    display: flex;
    align-items: center;
    justify-content: center;
    height: var(--drawing-name-height);
    padding: 0;
    font-size: 15px;
    line-height: 1;
    letter-spacing: 0.06em;
    color: var(--ink);
}

.feed_set[data-model="drawing"] .tv_base{
    height: var(--drawing-base-height);
}

/* The grille: slots drawn across the chin's left side. */
.feed_set[data-model="drawing"] .tv_grille{
    top: 7px;
    bottom: 9px;
    left: var(--drawing-margin);
    width: calc(50% - var(--drawing-flap-width) / 2 - var(--drawing-margin) - 8px);
    background: var(--drawing-grille) 0 0 / 100% 100% no-repeat;
}

/* The flap: a drawn rectangle with a small mark, in the middle of the chin; pressed, it fills with hatching. */
.feed_set[data-model="drawing"] .tv_flap{
    left: calc(50% - var(--drawing-flap-width) / 2);
    top: 5px;
    bottom: 8px;
    width: var(--drawing-flap-width);
    background: var(--drawing-flap) 0 0 / 100% 100% no-repeat;
}

.feed_set[data-model="drawing"] .tv_flap:active{
    background:
        var(--drawing-flap) 0 0 / 100% 100% no-repeat,
        repeating-linear-gradient(45deg, color-mix(in srgb, var(--ink) 55%, transparent) 0 0.7px, transparent 0.7px 3px);
}

/* The power key: a drawn key with the power sign, its light a small circle beside it, filled green while the set is on. */
.feed_set[data-model="drawing"] .tv_power{
    padding: 0 calc(var(--drawing-margin) + 2px) 9px 0;
}

.feed_set[data-model="drawing"] .tv_key{
    width: 30px;
    height: 15px;
    background: var(--drawing-key) 0 0 / 100% 100% no-repeat;
    color: var(--ink);
}

.feed_set[data-model="drawing"] .tv_power:active .tv_key{
    background:
        var(--drawing-key) 0 0 / 100% 100% no-repeat,
        repeating-linear-gradient(45deg, color-mix(in srgb, var(--ink) 55%, transparent) 0 0.7px, transparent 0.7px 3px);
}

.feed_set[data-model="drawing"] .tv_key svg{
    width: 10px;
    height: 10px;
}

.feed_set[data-model="drawing"] .tv_led{
    right: calc(var(--drawing-margin) + 40px);
    bottom: 14px;
    border: 1px solid var(--ink);
    background: transparent;
}

/*
 * "Play": a handwritten sticker on the power key. It is part of the key's button, so pressing it presses the key.
 * The first press drops it: it falls fast out of the page, turning steadily (see feed-card.js).
 * Each set places it over its own key; its font, tilt and size are shared.
 * Its size follows its font: the text sets the width, and the space around the text is in em.
 * The font is Noteworthy or Marker Felt on a Mac or iPhone, Ink Free or Segoe Print on Windows, Coming Soon ("casual") on Android.
 */
.feed_set{
    --sticker-font: Noteworthy;
    --sticker-weight: 700;
    --sticker-set-size: 18px;
    --sticker-size: var(--sticker-set-size);
    --sticker-side: 0.7em;
    --sticker-turn: -5deg;
    --sticker-fall-acceleration: 8000; /* pixels a second, every second */
    --sticker-fall-spin: -90; /* degrees a second; below zero turns left */
}

.feed_set[data-model="tv"]{
    --tv-sticker-across: 7px;
    --tv-sticker-up: 6px;
    --sticker-across: var(--tv-sticker-across);
    --sticker-up: var(--tv-sticker-up);
}

.feed_set[data-model="monitor"]{
    --monitor-sticker-across: -2px;
    --monitor-sticker-up: 8px;
    --sticker-across: var(--monitor-sticker-across);
    --sticker-up: var(--monitor-sticker-up);
}

.feed_set .tv_sticker{
    position: absolute;
    right: var(--sticker-across);
    bottom: var(--sticker-up);
    z-index: 2;
    padding: 0.2em var(--sticker-side) 0.25em;
    background: linear-gradient(#fff6b8, #f9eb93);
    transform: rotate(var(--sticker-turn));
    box-shadow:
        0 1px 1px rgba(0, 0, 0, 0.12),
        1px 3px 4px -2px rgba(0, 0, 0, 0.25);
    font-family: var(--sticker-font), Noteworthy, "Marker Felt", "Ink Free", "Segoe Print", casual, "Comic Sans MS", cursive;
    font-weight: var(--sticker-weight);
    font-size: var(--sticker-size);
    line-height: 1.1;
    white-space: nowrap;
    color: #3a3a46;
}

/* Falling, the sticker leaves the card for the window, so it falls past the page's bottom edge without making the page longer. Its font and size are copied over by feed-card.js. */
.tv_sticker.falling{
    position: fixed;
    right: auto;
    bottom: auto;
    z-index: 1000;
    margin: 0;
    pointer-events: none;
    background: linear-gradient(#fff6b8, #f9eb93);
    box-shadow:
        0 1px 1px rgba(0, 0, 0, 0.12),
        1px 3px 4px -2px rgba(0, 0, 0, 0.25);
    line-height: 1.1;
    white-space: nowrap;
    color: #3a3a46;
}

/* The light glows green while the set is on, whichever set it is. */
.feed_set[data-model]:is([data-power="on"], [data-power="turning-on"]) .tv_led{
    background: #5dff7a;
    box-shadow:
        0 0 3px 1px rgba(93, 255, 122, 0.6),
        0 0 8px 2px rgba(93, 255, 122, 0.25);
}

/* Hover only where a pointer can hover, so a key doesn't stay lit after a tap on a phone. */
@media (hover: hover){
    .feed_set[data-model="tv"] .tv_power:hover .tv_key{
        background: linear-gradient(hsl(var(--plastic) calc(var(--cabinet) + 15%)), var(--tone-raised));
    }

    .feed_set[data-model="monitor"] .tv_power:hover .tv_key{
        background: linear-gradient(hsl(45 4% 88%), hsl(45 4% 76%));
    }
}
