/* ========================================================================
   Thinking Digits, gallery edition
   A white-wall, brutalist alternative to css/thinking-digits.css.
   Rules: one 12-column grid with its column lines left visible, everything
   left-aligned, heavy grotesque headlines, monospaced wall labels, flush
   images, 1px black rules between rooms. No rounded corners, no shadows.
   Used by /thinking-digits/gallery/, /thinking-digits/episodes/ and each
   episode page.
   ======================================================================== */

@font-face { font-family: 'Geist Mono'; font-weight: 400; font-display: swap; src: url('../fonts/geistmono-400-latin.woff2') format('woff2'); }
@font-face { font-family: 'Inter'; font-style: normal; font-weight: 300 900; font-display: swap; src: url('../fonts/inter-var-latin.woff2') format('woff2'); unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; }
@font-face { font-family: 'Inter'; font-style: normal; font-weight: 300 900; font-display: swap; src: url('../fonts/inter-var-latin-ext.woff2') format('woff2'); unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF; }

:root {
    --g-bg: #f3f2ee;
    --g-ink: #08090b;
    --g-mute: #62656c;
    --g-hair: rgba(8, 9, 11, 0.12);
    --g-rule: var(--g-ink);
    --g-accent: #f2af63;
    --g-pad: clamp(16px, 2.2vw, 32px);
    --g-gap: clamp(12px, 1.4vw, 24px);
    --g-bar: 56px;
    --g-sans: 'Inter', -apple-system, BlinkMacSystemFont, 'Helvetica Neue', Arial, sans-serif;
    --g-mono: 'Geist Mono', ui-monospace, 'SF Mono', Menlo, Consolas, monospace;
}

*, *::before, *::after { box-sizing: border-box; }
html { background: var(--g-bg); scroll-padding-top: calc(var(--g-bar) + 16px); }
body.tdg {
    margin: 0;
    background: var(--g-bg);
    color: var(--g-ink);
    font-family: var(--g-sans);
    font-size: 16px;
    line-height: 1.45;
    -webkit-font-smoothing: antialiased;
    overflow-x: hidden;
}
.tdg :where(h1, h2, h3, p, ol, ul, dl, dd, figure) { margin: 0; }
.tdg :where(ol, ul) { padding: 0; list-style: none; }
.tdg :where(img, video, iframe) { display: block; max-width: 100%; }
.tdg :where(img) { height: auto; }
:where(.tdg) a { color: inherit; }
.tdg ::selection { background: var(--g-ink); color: var(--g-bg); }
.tdg :focus-visible { outline: 2px solid var(--g-ink); outline-offset: 3px; }

/* The grid's column lines stay on the wall behind everything. */
body.tdg::before {
    content: '';
    position: fixed; inset: 0 var(--g-pad); z-index: 0; pointer-events: none;
    background: repeating-linear-gradient(to right, var(--g-hair) 0 1px, transparent 1px calc(100% / 12));
    border-right: 1px solid var(--g-hair);
}
.tdg > main, .tdg > .g-foot { position: relative; z-index: 1; }

.g-skip { position: absolute; left: 16px; top: -60px; z-index: 2000; background: var(--g-ink); color: var(--g-bg); padding: 10px 14px; font-size: 14px; text-decoration: none; }
.g-skip:focus { top: 8px; }

/* ---------- Shared pieces ---------- */
.g-grid { display: grid; grid-template-columns: repeat(12, minmax(0, 1fr)); padding-inline: var(--g-pad); }
.g-label { font-family: var(--g-mono); font-size: 11px; line-height: 1.3; letter-spacing: 0.06em; text-transform: uppercase; }
.g-mute { color: var(--g-mute); }
.g-link { text-decoration: underline; text-decoration-thickness: 1px; text-underline-offset: 0.22em; }
.g-link:hover { background: var(--g-ink); color: var(--g-bg); text-decoration: none; }
.g-dot { display: inline-block; width: 8px; height: 8px; margin-right: 8px; background: var(--g-accent); border: 1px solid var(--g-rule); vertical-align: 0; }

/* ---------- Top bar ---------- */
.tdg .g-bar {
    position: sticky; top: 0; z-index: 900;
    display: flex; align-items: stretch; height: var(--g-bar);
    padding-inline: var(--g-pad); padding-right: calc(var(--g-pad) + 56px);
    background: var(--g-bg); border-bottom: 1px solid var(--g-rule);
}
.g-bar a { display: flex; align-items: center; text-decoration: none; }
.g-bar__home { font-weight: 800; font-size: 15px; letter-spacing: -0.03em; text-transform: uppercase; margin-right: auto; }
.g-bar__nav { display: flex; }
.g-bar__nav a { padding-inline: 14px; border-left: 1px solid var(--g-rule); font-family: var(--g-mono); font-size: 11px; letter-spacing: 0.06em; text-transform: uppercase; }
.g-bar__nav a:last-child { border-right: 1px solid var(--g-rule); }
.g-bar__nav a:hover, .g-bar__nav a[aria-current='page'] { background: var(--g-ink); color: var(--g-bg); }
.tdg .site-nav-btn { top: 8px; right: 14px; border-radius: 0; background: var(--g-ink); color: var(--g-bg); }
html.site-nav-open .tdg .site-nav-btn { background: #efefef; color: #000; }

/* ---------- Masthead ---------- */
.g-mast { padding-block: clamp(28px, 5vw, 72px) clamp(20px, 2.4vw, 36px); row-gap: clamp(28px, 4vw, 56px); }
.g-mast__title {
    grid-column: 1 / -1;
    font-size: clamp(60px, 15.6vw, 300px); font-weight: 800; line-height: 0.82; letter-spacing: -0.065em;
    text-transform: uppercase; margin-left: -0.045em;
}
.g-mast__title--page { font-size: clamp(52px, 11vw, 210px); }
.g-mast__title--ep { font-size: clamp(44px, 8.6vw, 164px); line-height: 0.86; letter-spacing: -0.058em; }
.g-mast__lede { grid-column: 1 / span 6; font-size: clamp(20px, 2.1vw, 34px); font-weight: 500; line-height: 1.12; letter-spacing: -0.03em; padding-right: var(--g-gap); }
.g-meta { grid-column: 8 / -1; border-top: 1px solid var(--g-rule); }
.g-meta > div { display: grid; grid-template-columns: minmax(0, 2fr) minmax(0, 3fr); gap: var(--g-gap); padding-block: 9px; border-bottom: 1px solid var(--g-rule); }
.g-meta dt { font-family: var(--g-mono); font-size: 11px; letter-spacing: 0.06em; text-transform: uppercase; color: var(--g-mute); padding-top: 2px; }
.g-meta dd { font-size: 15px; font-weight: 500; letter-spacing: -0.01em; }

/* ---------- Actions ---------- */
.g-actions { grid-column: 1 / -1; display: flex; flex-wrap: wrap; gap: 0; }
.g-btn {
    display: inline-flex; align-items: center; justify-content: space-between; gap: 28px;
    min-height: 52px; padding: 0 18px; border: 1px solid var(--g-rule); margin-right: -1px;
    font-size: 15px; font-weight: 600; letter-spacing: -0.01em; text-decoration: none;
    background: var(--g-bg); color: var(--g-ink);
}
.g-btn--solid { background: var(--g-ink); color: var(--g-bg); }
.g-btn:hover { background: var(--g-accent); color: var(--g-ink); }

/* ---------- Flush strip of plates ---------- */
.g-strip { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 4px; padding-inline: var(--g-pad); background: var(--g-bg); }
.g-strip img { width: 100%; aspect-ratio: 3 / 4; object-fit: cover; background: var(--g-ink); }

/* ---------- Rooms (sections) ---------- */
.g-room { border-top: 1px solid var(--g-rule); padding-block: clamp(20px, 2.4vw, 32px) clamp(48px, 7vw, 112px); row-gap: clamp(20px, 3vw, 44px); background: var(--g-bg); }
.g-room--wall { background: transparent; }
.g-room__label { grid-column: 1 / span 3; display: flex; flex-direction: column; gap: 6px; padding-right: var(--g-gap); }
.g-room__body { grid-column: 4 / -1; }
.g-room__full { grid-column: 1 / -1; }
.g-h2 { font-size: clamp(34px, 5.4vw, 96px); font-weight: 800; line-height: 0.9; letter-spacing: -0.055em; text-transform: uppercase; margin-left: -0.04em; }
.g-statement { font-size: clamp(28px, 4.4vw, 76px); font-weight: 700; line-height: 0.98; letter-spacing: -0.05em; max-width: 16ch; }
.g-prose { max-width: 62ch; font-size: clamp(16px, 1.25vw, 19px); line-height: 1.5; letter-spacing: -0.008em; }
.g-prose p + p { margin-top: 1em; }
.g-two { display: grid; grid-template-columns: minmax(0, 5fr) minmax(0, 4fr); gap: var(--g-gap); align-items: end; }

/* ---------- Now showing ---------- */
.g-feature { grid-column: 1 / -1; display: grid; grid-template-columns: repeat(12, minmax(0, 1fr)); border: 1px solid var(--g-rule); text-decoration: none; background: var(--g-bg); }
.g-feature__media { grid-column: 1 / span 8; background: var(--g-ink); border-right: 1px solid var(--g-rule); }
.g-feature__media { display: flex; align-items: center; }
.g-feature__media img { width: 100%; aspect-ratio: 16 / 9; object-fit: cover; }
.g-feature__text { grid-column: 9 / -1; display: flex; flex-direction: column; justify-content: space-between; gap: 24px; padding: clamp(16px, 1.6vw, 24px); }
.g-feature__title { font-size: clamp(28px, 3.4vw, 60px); font-weight: 800; line-height: 0.92; letter-spacing: -0.05em; text-transform: uppercase; }
.g-feature__line { font-size: 16px; line-height: 1.4; max-width: 34ch; }
.g-feature__go { display: flex; justify-content: space-between; align-items: center; padding-top: 12px; border-top: 1px solid var(--g-rule); font-weight: 600; }
a.g-feature:hover .g-feature__text { background: var(--g-ink); color: var(--g-bg); }
a.g-feature:hover .g-feature__go { border-top-color: var(--g-bg); }

/* ---------- Index table ---------- */
.g-index { grid-column: 1 / -1; border-top: 1px solid var(--g-rule); }
.g-row { display: grid; grid-template-columns: repeat(12, minmax(0, 1fr)); align-items: start; padding-block: 16px; border-bottom: 1px solid var(--g-rule); text-decoration: none; background: var(--g-bg); }
.g-row > * { padding-right: var(--g-gap); }
.g-row__no { grid-column: 1 / span 1; font-family: var(--g-mono); font-size: 12px; letter-spacing: 0.06em; padding-top: 6px; }
.g-row__thumb { grid-column: 2 / span 2; }
.g-row__thumb img { width: 100%; aspect-ratio: 16 / 9; object-fit: cover; background: var(--g-ink); }
.g-row__title { grid-column: 4 / span 4; font-size: clamp(22px, 2.5vw, 42px); font-weight: 800; line-height: 0.96; letter-spacing: -0.045em; text-transform: uppercase; }
.g-row__line { grid-column: 8 / span 3; font-size: 14px; line-height: 1.4; color: var(--g-mute); }
.g-row__meta { grid-column: 11 / -1; display: flex; flex-direction: column; gap: 4px; font-family: var(--g-mono); font-size: 11px; letter-spacing: 0.06em; text-transform: uppercase; padding-right: 0; }
.g-row--head { padding-block: 8px; font-family: var(--g-mono); font-size: 11px; letter-spacing: 0.06em; text-transform: uppercase; color: var(--g-mute); }
.g-row--head .g-row__title { font: inherit; letter-spacing: inherit; }
a.g-row:hover { background: var(--g-ink); color: var(--g-bg); }
a.g-row:hover .g-row__line { color: inherit; }
.g-row--soon .g-row__title { color: var(--g-mute); }
.g-row--soon .g-row__thumb img { filter: grayscale(1); opacity: 0.55; }

/* ---------- Faces catalogue ---------- */
.g-faces { grid-column: 1 / -1; display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 4px; }
.g-face img { width: 100%; aspect-ratio: 3 / 4; object-fit: cover; filter: grayscale(1) contrast(1.05); background: var(--g-ink); }
.g-face figcaption { display: grid; gap: 2px; padding: 8px 0 14px; background: var(--g-bg); }
.g-face__no { font-family: var(--g-mono); font-size: 10px; letter-spacing: 0.06em; color: var(--g-mute); }
.g-face__name { font-size: 14px; font-weight: 700; letter-spacing: -0.02em; line-height: 1.1; }
.g-face__field { font-size: 12px; color: var(--g-mute); line-height: 1.2; }

/* ---------- Player ---------- */
.g-player { grid-column: 1 / -1; position: relative; display: block; aspect-ratio: 16 / 9; background: var(--g-ink); border: 1px solid var(--g-rule); color: var(--g-bg); text-decoration: none; overflow: hidden; }
.g-player img, .g-player iframe { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; border: 0; }
.g-player__cta { position: absolute; left: 0; bottom: 0; display: flex; align-items: center; gap: 14px; padding: 14px 18px; background: var(--g-bg); color: var(--g-ink); font-weight: 700; font-size: clamp(15px, 1.4vw, 20px); letter-spacing: -0.02em; border-top: 1px solid var(--g-rule); border-right: 1px solid var(--g-rule); }
.g-player__tri { width: 0; height: 0; border-left: 14px solid var(--g-ink); border-block: 9px solid transparent; }
.g-player:hover .g-player__cta { background: var(--g-accent); }
.g-player.is-playing .g-player__cta, .g-player.is-playing img { display: none; }

/* ---------- Chapters ---------- */
.g-chapters { border-top: 1px solid var(--g-rule); counter-reset: ch; }
.g-chapters li { display: grid; grid-template-columns: 4.5em 3em minmax(0, 1fr); gap: var(--g-gap); align-items: baseline; padding-block: 11px; border-bottom: 1px solid var(--g-rule); background: var(--g-bg); }
.g-chapters li::before { counter-increment: ch; content: counter(ch, decimal-leading-zero); font-family: var(--g-mono); font-size: 11px; color: var(--g-mute); order: 2; }
.g-ch__t { font-family: var(--g-mono); font-size: 13px; order: 1; }
.g-ch__t a { text-decoration: underline; text-underline-offset: 0.2em; }
.g-ch__n { font-size: clamp(17px, 1.6vw, 24px); font-weight: 700; letter-spacing: -0.03em; line-height: 1.1; order: 3; }

/* ---------- Plates ---------- */
.g-plates { grid-column: 1 / -1; display: grid; grid-template-columns: repeat(12, minmax(0, 1fr)); gap: 4px; row-gap: 0; }
.g-plate { grid-column: span 4; }
.g-plate--wide { grid-column: span 8; }
.g-plate--half { grid-column: span 6; }
.g-plate--wide { grid-row: span 2; display: flex; flex-direction: column; }
.g-plate--wide img { flex: 1; min-height: 0; height: 100%; aspect-ratio: auto; }
.g-plate img { width: 100%; aspect-ratio: 16 / 9; object-fit: cover; background: var(--g-ink); }
.g-plate figcaption { display: grid; grid-template-columns: 2.6em minmax(0, 1fr); gap: 8px; padding: 9px 12px 22px 0; font-size: 13px; line-height: 1.35; background: var(--g-bg); }
.g-plate figcaption span { font-family: var(--g-mono); font-size: 11px; color: var(--g-mute); padding-top: 1px; }

/* ---------- Sources ---------- */
.g-sources { border-top: 1px solid var(--g-rule); counter-reset: src; }
.g-sources li { display: grid; grid-template-columns: 3em minmax(0, 1fr); gap: var(--g-gap); padding-block: 9px; border-bottom: 1px solid var(--g-hair); font-size: 14px; line-height: 1.4; background: var(--g-bg); overflow-wrap: anywhere; }
.g-sources li::before { counter-increment: src; content: counter(src, decimal-leading-zero); font-family: var(--g-mono); font-size: 11px; color: var(--g-mute); padding-top: 2px; }
.g-notes { margin-top: 28px; display: grid; gap: 8px; font-size: 14px; line-height: 1.45; max-width: 70ch; }
.g-notes h3 { font-family: var(--g-mono); font-size: 11px; font-weight: 400; letter-spacing: 0.06em; text-transform: uppercase; color: var(--g-mute); margin-top: 12px; }

/* ---------- Next / footer ---------- */
.g-next { grid-column: 1 / -1; display: grid; grid-template-columns: repeat(12, minmax(0, 1fr)); align-items: end; padding-block: 18px; border-block: 1px solid var(--g-rule); text-decoration: none; background: var(--g-bg); }
.g-next__k { grid-column: 1 / span 3; }
.g-next__t { grid-column: 4 / span 7; font-size: clamp(26px, 4vw, 68px); font-weight: 800; line-height: 0.92; letter-spacing: -0.05em; text-transform: uppercase; }
.g-next__d { grid-column: 11 / -1; text-align: left; }
a.g-next:hover { background: var(--g-ink); color: var(--g-bg); }

.g-foot { border-top: 1px solid var(--g-rule); padding-block: clamp(20px, 2.4vw, 32px) 20px; row-gap: clamp(32px, 5vw, 72px); background: var(--g-ink); color: var(--g-bg); }
.g-foot a { color: inherit; }
.g-foot .g-link:hover { background: var(--g-bg); color: var(--g-ink); }
.g-foot__mark { grid-column: 1 / -1; font-size: clamp(60px, 15.6vw, 300px); font-weight: 800; line-height: 0.82; letter-spacing: -0.065em; text-transform: uppercase; margin-left: -0.045em; }
.g-foot__col { grid-column: span 3; display: grid; gap: 6px; align-content: start; font-size: 14px; padding-right: var(--g-gap); }
.g-foot__col .g-label { color: rgba(243, 242, 238, 0.6); margin-bottom: 4px; }
.g-foot__base { grid-column: 1 / -1; display: flex; flex-wrap: wrap; justify-content: space-between; gap: 12px 32px; padding-top: 14px; border-top: 1px solid rgba(243, 242, 238, 0.3); font-family: var(--g-mono); font-size: 11px; letter-spacing: 0.04em; }
.g-credits summary { cursor: pointer; text-transform: uppercase; letter-spacing: 0.06em; }
.g-credits[open] { flex-basis: 100%; }
.g-credits p, .g-credits ul { margin-top: 10px; max-width: 90ch; font-family: var(--g-sans); font-size: 13px; line-height: 1.5; letter-spacing: 0; }
.g-credits li { margin-top: 2px; }

/* ---------- Narrow screens ---------- */
@media (max-width: 900px) {
    body.tdg::before { background: repeating-linear-gradient(to right, var(--g-hair) 0 1px, transparent 1px calc(100% / 4)); }
    .g-bar__nav a { padding-inline: 10px; }
    .g-bar__nav .g-hide-s { display: none; }
    .g-mast__lede, .g-meta, .g-room__label, .g-room__body { grid-column: 1 / -1; }
    .g-room__label { flex-direction: row; gap: 14px; }
    .g-two { grid-template-columns: 1fr; }
    .g-strip { grid-template-columns: repeat(3, minmax(0, 1fr)); }
    .g-feature__media, .g-feature__text { grid-column: 1 / -1; }
    .g-feature__media { border-right: 0; border-bottom: 1px solid var(--g-rule); }
    .g-row { row-gap: 10px; }
    .g-row__no { grid-column: 1 / span 2; }
    .g-row__thumb { grid-column: 3 / -1; }
    .g-row__title { grid-column: 3 / -1; }
    .g-row__line { grid-column: 3 / -1; }
    .g-row__meta { grid-column: 3 / -1; flex-direction: row; flex-wrap: wrap; gap: 4px 16px; }
    .g-row--head { display: none; }
    .g-faces { grid-template-columns: repeat(3, minmax(0, 1fr)); }
    .g-plate, .g-plate--wide, .g-plate--half { grid-column: 1 / -1; }
    .g-plate--wide { grid-row: auto; display: block; }
    .g-plate--wide img { height: auto; aspect-ratio: 16 / 9; }
    .g-next__k, .g-next__t, .g-next__d { grid-column: 1 / -1; }
    .g-next { row-gap: 10px; }
    .g-foot__col { grid-column: span 6; }
    .g-chapters li { grid-template-columns: 3.6em minmax(0, 1fr); }
    .g-chapters li::before { display: none; }
}
@media (max-width: 520px) {
    .g-bar__home { font-size: 13px; }
    .g-faces { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .g-foot__col { grid-column: 1 / -1; }
    .g-btn { flex: 1 1 100%; margin-right: 0; margin-bottom: -1px; }
}
@media (prefers-reduced-motion: no-preference) {
    .g-btn, .g-row, .g-next, .g-feature__text, .g-bar__nav a { transition: background-color 0.12s linear, color 0.12s linear; }
}
