/* Concerto for Orchestra — a listening companion.

   The look is a pasiak: the striped woollen cloth woven around Łowicz in
   Mazovia, the region whose folk tunes the Concerto is made from. The page
   is the dark wool ground (undyed linen in the light scheme); the only
   colour on it is the cloth itself and one thread of yellow. Newsreader for
   reading, IBM Plex Mono for times and labels.

   The cloth keeps its colours in both schemes: it is an object, not chrome. */

:root {
    --ground: #e6e2d8;
    --raised: #dcd7cb;
    --text:   #1c1620;
    --soft:   #5d5563;
    --hair:   #bdb6aa;
    --mark:   #a3154f;
    --wool:   #17121a;
    --ecru:   #f3ead8;
    color-scheme: light;
}
@media (prefers-color-scheme: dark) {
    :root {
        --ground: #17121a;
        --raised: #221b27;
        --text:   #f3ead8;
        --soft:   #b9aec0;
        --hair:   #4a4050;
        --mark:   #f6c21c;
        color-scheme: dark;
    }
}

body {
    background: var(--ground);
    color: var(--text);
    font-family: var(--serif);
    font-size: 18px;
    line-height: 1.5;
}
::selection { background: var(--mark); color: var(--ground); }

.wrap {
    max-width: 880px;
    margin: 0 auto;
    padding: calc(20px + env(safe-area-inset-top)) max(18px, env(safe-area-inset-right)) calc(80px + env(safe-area-inset-bottom)) max(18px, env(safe-area-inset-left));
}
.back { color: var(--soft); }
.back:hover, .back:focus-visible { color: var(--text); }

[hidden] { display: none !important; }
button, select, input { font: inherit; color: inherit; }
:focus-visible { outline: 2px solid var(--mark); outline-offset: 2px; }

/* ─── Head ─── */
.head { margin: 34px 0 26px; }
.eyebrow {
    font: 400 12px/1.4 var(--mono);
    letter-spacing: 0.14em;
    text-transform: uppercase;
    color: var(--mark);
}
.head h1 {
    font: 500 clamp(34px, 7vw, 54px)/1.05 var(--serif);
    letter-spacing: -0.01em;
    margin: 8px 0 6px;
    text-wrap: balance;
}
.by { font: 400 13px/1.5 var(--mono); color: var(--soft); }
.lede { max-width: 34em; margin-top: 16px; }

/* ─── The loom: movement names, cloth, time axis, clock. Stays in view. ─── */
.loom {
    position: sticky;
    top: 0;
    z-index: 20;
    background: var(--ground);
    padding: calc(8px + env(safe-area-inset-top)) 0 10px;
    border-bottom: 1px solid var(--hair);
}
.mvs { display: flex; margin-bottom: 4px; }
.mv {
    min-width: 0;
    padding: 4px 6px 4px 0;
    background: none;
    border: 0;
    text-align: left;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    font: 400 12px/1.3 var(--mono);
    color: var(--soft);
    cursor: pointer;
}
.mv b { font-weight: 500; color: var(--text); margin-right: 0.6em; }
.mv:hover span { color: var(--text); }

.cloth {
    position: relative;
    display: flex;
    height: clamp(76px, 15vw, 132px);
    background: var(--wool);
    border-top: 3px solid var(--ecru);
    border-bottom: 3px solid var(--ecru);
    box-shadow: 0 0 0 1px var(--hair);
}
.stripe {
    min-width: 0;
    padding: 0;
    border: 0;
    cursor: pointer;
    position: relative;
}
.stripe:focus-visible { outline-offset: -2px; outline-color: #fff; z-index: 3; }
/* The band being looked at is lifted out of the cloth by two white threads. */
.stripe.sel::after {
    content: "";
    position: absolute;
    inset: -7px 0;
    border-left: 2px solid #fff;
    border-right: 2px solid #fff;
    z-index: 3;
    pointer-events: none;
}
.seam, .veil, .shuttle { position: absolute; top: 0; bottom: 0; pointer-events: none; }
.seam { width: 3px; margin-left: -1.5px; background: var(--ecru); z-index: 2; }
/* Once the clock has run, what is still to come is unwoven: dimmed. */
.veil { right: 0; background: rgba(23, 18, 26, 0.62); display: none; z-index: 1; }
.shuttle { top: -9px; bottom: -9px; width: 3px; margin-left: -1.5px; background: #fff; box-shadow: 0 0 0 1px var(--wool); display: none; z-index: 4; }
.weaving .veil, .weaving .shuttle { display: block; }

.axis { position: relative; height: 18px; margin-top: 6px; font: 400 11px/18px var(--mono); color: var(--soft); font-variant-numeric: tabular-nums; }
.axis span { position: absolute; transform: translateX(-50%); }
.axis span:first-child { transform: none; }
.axis .end { transform: translateX(-100%); }
/* The last five-minute mark would run into the end time. */
.axis span:nth-last-child(2) { display: none; }

.status { display: flex; align-items: baseline; gap: 6px 14px; flex-wrap: wrap; margin-top: 6px; }
.go {
    align-self: center;
    min-width: 5.6em;
    padding: 7px 14px;
    background: var(--text);
    color: var(--ground);
    border: 0;
    font: 500 13px/1.2 var(--mono);
    cursor: pointer;
}
.clock { font: 500 22px/1 var(--mono); font-variant-numeric: tabular-nums; color: var(--mark); }
.clock small { font: 400 12px/1 var(--mono); color: var(--soft); }
.where { flex: 1 1 10em; min-width: 0; font: 400 13px/1.3 var(--mono); color: var(--soft); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.nudge { display: flex; gap: 6px; }
.btn-line {
    padding: 5px 10px;
    background: none;
    border: 1px solid var(--hair);
    font: 400 12px/1.3 var(--mono);
    color: var(--text);
    cursor: pointer;
}
.btn-line:hover { border-color: var(--text); }

/* ─── Now: the band under the shuttle, or the one tapped ─── */
.now { display: grid; grid-template-columns: 14px 1fr; gap: 0 18px; margin: 26px 0 0; }
.now .swatch { grid-row: 1 / span 6; align-self: stretch; }
.n-meta { display: flex; flex-wrap: wrap; gap: 2px 16px; font: 400 12px/1.5 var(--mono); color: var(--soft); font-variant-numeric: tabular-nums; }
.now h2 { font: 500 clamp(26px, 5vw, 34px)/1.12 var(--serif); margin: 4px 0 8px; text-wrap: balance; }
.n-listen { font-size: 20px; line-height: 1.42; max-width: 30em; }
.who { font: 400 13px/1.5 var(--mono); color: var(--soft); margin-top: 8px; max-width: 46em; }
.looking { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 14px; }

details > summary { cursor: pointer; list-style: none; }
details > summary::-webkit-details-marker { display: none; }
.deep { margin-top: 14px; }
.deep > summary, .fold > summary { font: 400 13px/1.4 var(--mono); color: var(--mark); }
.deep > summary::before, .fold > summary::before { content: "+ "; }
.deep[open] > summary::before, .fold[open] > summary::before { content: "– "; }
.prose p, .rbody p { max-width: 36em; margin-top: 10px; }
.prose p.who, .rbody p.who { margin-top: 10px; }
.tune b { font-weight: 500; color: var(--mark); }

/* ─── Setup ─── */
.setup { margin: 30px 0 0; padding: 16px 0 0; border-top: 1px solid var(--hair); display: grid; gap: 10px; }
.setup label, .glabel { font: 400 12px/1.4 var(--mono); letter-spacing: 0.08em; text-transform: uppercase; color: var(--soft); }
.setup select, .setup input {
    background: var(--raised);
    border: 1px solid var(--hair);
    padding: 8px 10px;
    font: 400 14px/1.3 var(--mono);
    border-radius: 0;
    max-width: 100%;
}
.setup select { width: 100%; max-width: 34em; }
.custom { display: flex; flex-wrap: wrap; gap: 10px 16px; }
.custom label { display: flex; align-items: center; gap: 8px; }
.custom input { width: 5.2em; }
.note { font-size: 15px; color: var(--soft); max-width: 40em; }

/* ─── The guide: every band in order ─── */
.movement { margin-top: 46px; }
.movement h2 { font: 500 28px/1.15 var(--serif); text-wrap: balance; }
.movement h2 b { font: 500 14px/1 var(--mono); color: var(--mark); margin-right: 0.3em; vertical-align: 0.35em; }
.tempo { font: 400 13px/1.5 var(--mono); color: var(--soft); margin-top: 2px; }
.gist { max-width: 34em; margin: 10px 0 14px; }
.row { border-top: 1px solid var(--hair); }
.row:last-child { border-bottom: 1px solid var(--hair); }
.row > summary {
    display: grid;
    grid-template-columns: 14px minmax(0, 15em) minmax(0, 1fr);
    gap: 2px 16px;
    padding: 12px 0;
    align-items: start;
}
.swatch { display: block; width: 14px; min-height: 100%; }
.row .swatch { grid-row: 1 / span 2; align-self: stretch; min-height: 2.6em; }
.rhead { display: flex; flex-direction: column; min-width: 0; }
.rhead b { font-weight: 500; }
.rtime { font: 400 12px/1.5 var(--mono); color: var(--soft); font-variant-numeric: tabular-nums; }
.rlisten { min-width: 0; }
.row.live > summary b { color: var(--mark); }
.row.live > summary b::after { content: " · now"; font: 400 12px var(--mono); }
.rbody { padding: 0 0 16px 30px; }
.rbody .btn-line { margin-top: 14px; }
@media (max-width: 620px) {
    .row > summary { grid-template-columns: 14px minmax(0, 1fr); }
    .rlisten { grid-column: 2; }
}

/* ─── Panels: what sits behind the cloth ─── */
.panels { margin-top: 56px; }
.panels > h2 { font: 400 12px/1.4 var(--mono); letter-spacing: 0.14em; text-transform: uppercase; color: var(--soft); margin-bottom: 8px; }
.fold { border-top: 1px solid var(--hair); padding: 12px 0; }
.fold:last-of-type { border-bottom: 1px solid var(--hair); }
.fold > summary { font-size: 14px; color: var(--text); }
.fold > summary::before { color: var(--mark); }
.fold h3 { font: 500 17px/1.3 var(--serif); margin-top: 18px; }
.fold ul { list-style: none; max-width: 36em; margin-top: 8px; }
.fold li { padding: 5px 0; border-top: 1px solid var(--hair); display: flex; gap: 12px; align-items: baseline; }
.fold li:first-child { border-top: 0; }
.fold li b { flex: 0 0 7.5em; font: 400 12px/1.5 var(--mono); color: var(--soft); }
.fold li i { flex: 0 0 26px; height: 12px; align-self: center; }
.fold a { text-decoration-color: var(--hair); text-underline-offset: 3px; }
.fold a:hover { text-decoration-color: var(--text); }
.small { font-size: 15px; color: var(--soft); }
table.recs { border-collapse: collapse; margin-top: 10px; font: 400 13px/1.4 var(--mono); font-variant-numeric: tabular-nums; }
.recs th, .recs td { text-align: right; padding: 5px 0 5px 18px; border-top: 1px solid var(--hair); font-weight: 400; white-space: nowrap; }
.recs th:first-child, .recs td:first-child { text-align: left; padding-left: 0; white-space: normal; }
.recs thead th { border-top: 0; color: var(--soft); }
.scroll { overflow-x: auto; }

.colophon { margin-top: 44px; font: 400 12px/1.6 var(--mono); color: var(--soft); max-width: 46em; }

@media (max-width: 480px) {
    body { font-size: 17px; }
    .mv span { display: none; }
    .n-listen { font-size: 18px; }
}
