/**
 * aeritia.com /origins, v1, 2026-10-19 (named /macaw until 2026-10-21): the origins page's own rules.
 *
 * Only what the house stylesheet (/aeritia.css) lacks, in its tokens and on its 8 px steps:
 * the slots that wait for the page's photographs and videos, the grids that hold them, the
 * player's frame, and the filled form of a slot. An empty slot is drawn with a dashed hairline,
 * the site's sign for a box that waits to be filled (the empty boxes of figure 7 on /sound);
 * a filled one carries the solid hairline on the image itself. No colour carries state here.
 */

/* Grids of slots: two columns, four for the hours; one and two on phones. */
.slots {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    align-items: start;
    gap: 16px;
    margin: 0 0 16px;
}
.slots.four { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.slots > .full { grid-column: 1 / -1; }
.hour { min-width: 0; }

/* An empty slot: its id, its shape, what is wanted and what stands in, at the foot of the box
   like a caption. The box holds the ratio the file will have, and grows if its words need room. */
.slot {
    display: flex;
    flex-direction: column;
    justify-content: flex-end;
    min-width: 0;
    margin: 0;
    padding: 16px;
    border: 1px dashed var(--line);
    border-radius: 4px;
    background: rgba(var(--ink), var(--a-screen));
    font-size: 13px;
    line-height: 1.5;
    overflow-wrap: anywhere;
}
.slot p { margin: 0 0 8px; max-width: none; }
.slot p:last-child { margin-bottom: 0; }
.slot .chip { margin: 0 8px 0 0; vertical-align: 0; }
.slot.wide { aspect-ratio: 16 / 9; }
.slot.land { aspect-ratio: 3 / 2; }
.slot.port { aspect-ratio: 4 / 5; }
.slot.square { aspect-ratio: 1 / 1; }
.slot.strip { margin-top: 8px; }

/* A filled slot: the picture, video or sound at full width with its own hairline, the caption
   under it (.cap, the house caption). */
.shot { margin: 0; min-width: 0; }
.shot img,
.shot video {
    display: block;
    width: 100%;
    height: auto;
    border: 1px solid var(--line);
    border-radius: 4px;
    background: rgba(var(--ink), var(--a-screen));
}
.shot audio { display: block; width: 100%; margin-top: 8px; }

/* The player: the native control in one hairline frame. */
.player {
    margin: 0 0 16px;
    padding: 12px 16px;
    border: 1px solid var(--line);
    border-radius: 2px;
}
.player audio { display: block; width: 100%; }

/* The station's waveform (2026-10-21): a strip above the native control, drawn by wave.js in the
   page's ink the way lockas draws its own: a dashed line at rest, an undulation while it plays. */
.wave { display: block; width: 100%; height: 64px; margin: 0 0 8px; }

/* Bands (2026-10-21, on Josh's word, learning from lockas.com): the strongest photographs and the loops
   fill the width of the window between the panels instead of sitting in boxes. A band breaks out of
   the page column to the window's edges, keeps a steady height (56 vw, at most 72 vh), and the
   picture covers it; its caption sits under it in the house caption, inside the column. The loops are
   silent and play on their own only where motion is welcome; the script pauses them out of view. */
/* One treatment per kind of content (the layout brief of 2026-10-21, after Josh's word that the page read
   as clunky): a narrative section is one full-bleed band (a photograph, a pair edge to edge with a 2 px
   paper gutter, or a loop) with its folder (tab and panel, at most 640 px, on the text column) over the
   band's lower edge, the picture's caption as the folder's last line, then 56 px of paper. A section
   without a picture is a plain folder. On a phone the band is 4:5 and the folder follows below it. */
:root { --band-h: clamp(420px, 62vh, 760px); }
.band {
    position: relative;
    width: 100vw;
    margin: 0 0 0 calc(50% - 50vw);
}
.band .band-fill {   /* not .frame: the house stylesheet owns that name for the device frames */
    display: block;
    width: 100%;
    height: var(--band-h);
    overflow: hidden;
    border-top: 1px solid var(--line);
    border-bottom: 1px solid var(--line);
    background: rgba(var(--ink), var(--a-screen));
}
.band .band-fill.split {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 2px;
    background: var(--bg);
}
.band .band-fill.four {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    grid-template-rows: repeat(2, minmax(0, 1fr));
    gap: 2px;
    height: calc(var(--band-h) * 1.5);
    background: var(--bg);
}
.band picture { display: block; height: 100%; min-width: 0; }
.band img,
.band video {
    display: block;
    width: 100%;
    height: 100%;
    object-fit: cover;
    border: 0;
    border-radius: 0;
}
@media (max-width: 639px) {
    :root { --band-h: min(125vw, 70vh); }
    .band .band-fill.split { grid-template-columns: 1fr; }
    .band .band-fill.split picture { height: auto; aspect-ratio: 4 / 5; }
    .band .band-fill.four { grid-template-columns: 1fr 1fr; grid-template-rows: repeat(2, minmax(0, 1fr)); height: min(125vw, 70vh); }
}
html.js .band img { opacity: 0; transition: opacity 0.7s var(--ease); }
html.js .band img.loaded { opacity: 1; }
@media (prefers-reduced-motion: reduce) {
    html.js .band img { opacity: 1; transition: none; }
}

/* Behind (2026-10-21, Josh: the loops sit behind the folders, forward in depth, not down the page): in a
   section marked .over the loop band comes first and the folder (its tab and panel) rises over the
   band's lower half with its own fill, so they overlap. */
.sec.over { margin-top: 56px; }
.sec.over .band.behind { margin-bottom: calc(-0.4 * var(--band-h)); }
.sec.over .tab,
.sec.over .panel { position: relative; z-index: 1; }
.sec.over .panel { max-width: 640px; }
.sec.over .panel .cap { margin: 12px 0 0; max-width: none; text-align: left; }
.sec.over .panel .cap:first-child { margin-top: 0; }
.sec.over .panel .cap + .cap { margin-top: 2px; }   /* one caption per line */
.sec.cont > .panel { border-top-left-radius: 4px; }
@media (max-width: 639px) {
    .sec.over .band.behind { margin-bottom: 0; }
    .sec.over .tab { margin-top: 16px; }
    .sec.over .panel { max-width: none; }
}

/* The lightbox (2026-10-21, Josh): every picture opens larger in the page's one dialog, on a dark field,
   the close in a hairline; Escape, the close or a press outside closes it. Nothing without script. */
.zoom { cursor: zoom-in; }
.light {
    width: 100vw;
    height: 100vh;
    max-width: 100vw;
    max-height: 100vh;
    margin: 0;
    padding: 0;
    border: 0;
    background: transparent;
}
.light::backdrop { background: rgba(0, 0, 0, 0.88); }
.light-img {
    display: block;
    width: auto;
    height: auto;
    max-width: 96vw;
    max-height: 92vh;
    margin: 4vh auto 0;
    object-fit: contain;
    border: 1px solid rgba(255, 255, 255, 0.35);
    border-radius: 4px;
    background: transparent;
}
.light-close {
    position: fixed;
    top: 16px;
    right: 16px;
    padding: 4px 10px;
    border: 1px solid rgba(255, 255, 255, 0.55);
    border-radius: 2px;
    background: transparent;
    color: rgba(255, 255, 255, 0.85);
    font: 300 12px/1.4 var(--sans);
    cursor: pointer;
}
.light-close:hover { border-color: rgba(255, 255, 255, 0.85); }
@media (prefers-reduced-motion: no-preference) {
    .light[open] { animation: arrive 300ms var(--ease) both; }
}

/* Pictures (2026-10-21): with the script present (html.js) each picture fades in as it loads. The
   arrival of the header, the sections and the figures is the site's own, in aeritia.css, and needs
   no script. Anyone who has asked for less motion sees every picture at once. */
html.js .shot img { opacity: 0; transition: opacity 0.7s var(--ease); }
html.js .shot img.loaded { opacity: 1; }
@media (prefers-reduced-motion: reduce) {
    html.js .shot img { opacity: 1; transition: none; }
}

@media (max-width: 767px) {
    .slots { grid-template-columns: minmax(0, 1fr); }
    .slots.four { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

/* v3 (2026-10-21, Josh: the blank paper between the pictures felt like an afterthought; the additive
   bias; a thin timeline down the left that follows the scroll; never two pictures side by side).
   The page is one continuous column of full-bleed bands, back to back, every picture its own band.
   Each beat is a section that is as tall as its band or as tall as its folder needs; the band
   fills the beat behind everything, so the folder (the tab and its panel, or a plain panel for a
   section's later beats) floats over the lower part of the picture and the next picture begins
   where the folder ends. A picture with no copy carries its caption as a chip in its corner. The
   rail on the left holds a hairline that fills as the page scrolls, with the record's dates as
   chips on it at the beats they belong to. Nothing of v2's pairs remains. */
:root {
    --rail: 48px;
    --band: clamp(440px, 64vh, 720px);
}
.story-page .wrap { padding-left: calc(16px + var(--rail)); }
.story-page .foot { padding-left: calc(24px + var(--rail)); }
.story .beat {
    position: relative;
    display: flex;                   /* centres the folder on its band (Josh, 2026-10-21); also keeps its margins inside */
    flex-direction: column;
    justify-content: center;
    margin-top: 0;
    padding: 32px 0;
    min-height: var(--band);
}
.story .beat .tab,
.story .beat .panel { flex: none; }
.story .beat .band {
    position: absolute;
    top: 0;
    bottom: 0;
    left: calc(50% - 50vw + var(--rail) / 2 + 4px);   /* 4px = half the wrap's left/right padding difference, so the band begins at the rail's edge and ends at the viewport's (the 8px left a 4px overflow, 2026-10-21) */
    width: calc(100vw - var(--rail));
    margin: 0;
}
.story .beat .band .band-fill {
    height: 100%;
    border: 0;
    border-bottom: 1px solid rgba(var(--ink), 0.12);
}
.story .beat .band img,
.story .beat .band video { width: 100%; height: 100%; object-fit: cover; }
.story .beat .tab { position: relative; z-index: 1; margin-top: 0; }
.story .beat .panel { position: relative; z-index: 1; max-width: 640px; margin-top: 0; }
/* the folders over the pictures let a little of the picture through (Josh, 2026-10-21); the words, the
   hairlines and the chips stay as they are. The first background is the fallback where color-mix is unknown. */
.story .beat .tab,
.story .beat .panel {
    background: var(--panel);
    background: color-mix(in srgb, var(--panel) 86%, transparent);
}
.story .beat .caps {
    margin: 12px 0 0;
    max-width: none;
    font-size: 13px;
    line-height: 1.5;
    color: var(--text);
    opacity: 0.75;
}
.story .beat .caps + .caps { margin-top: 2px; }
.story .beat .panel > .caps:last-child { margin-bottom: 0; }
.story .beat .chip-cap {
    position: absolute;
    z-index: 1;
    left: 16px;
    bottom: 16px;
    max-width: calc(100% - 32px);
    margin: 0;
    padding: 4px 8px;
    border: 1px solid var(--line);
    border-radius: 2px;
    background: var(--panel);
    color: var(--text);
    font: 300 12px/1.4 var(--sans);
    letter-spacing: 0.02em;
}

/* the rail */
.rail {
    position: fixed;
    z-index: 0;
    left: 0;
    top: 0;
    bottom: 0;
    width: var(--rail);
    background: var(--bg);
    border-right: 1px solid var(--line);
}
.rail-line,
.rail-fill {
    position: absolute;
    left: 50%;
    top: 0;
    width: 1px;
    transform: translateX(-0.5px);
}
.rail-line { bottom: 0; background: var(--line); }
.rail-fill { height: 0; background: var(--head); }
.rail-fill::after {
    content: "";
    position: absolute;
    left: 50%;
    bottom: -3px;
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: var(--head);
    transform: translateX(-50%);
}
@supports (animation-timeline: scroll()) {
    .rail-fill { animation: rail-fill linear both; animation-timeline: scroll(root); }
}
@keyframes rail-fill {
    from { height: 0; }
    to { height: 100%; }
}
.story .beat .date {
    position: absolute;
    z-index: 2;
    left: calc(50% - 50vw + var(--rail) / 2 + 4px);   /* 4px = half the wrap's left/right padding difference, so the band begins at the rail's edge and ends at the viewport's (the 8px left a 4px overflow, 2026-10-21) */
    top: 32px;
    transform: translateX(calc(-50% - var(--rail) / 2));
    padding: 8px 3px;
    border: 1px solid var(--line);
    border-radius: 2px;
    background: var(--bg);
    color: var(--head);
    font: 300 11px/1 var(--sans);
    letter-spacing: 0.06em;
    white-space: nowrap;
    writing-mode: vertical-rl;
}

@media (max-width: 767px) {
    :root { --rail: 28px; --band: clamp(360px, 56vh, 520px); }
    .story .beat { padding: 24px 0; }
    .story-page .wrap { padding-left: calc(8px + var(--rail)); }
    .story-page .foot { padding-left: calc(12px + var(--rail)); }
    .story .beat .panel { max-width: none; }
    .story .beat .date { top: 16px; padding: 6px 2px; font-size: 10px; }
    .story .beat .chip-cap { left: 8px; bottom: 8px; font-size: 11px; }
}
