/* ========================================================================
   Thinking Digits, cinema edition
   Loaded after css/td-gallery.css on pages whose body is "tdg tdc".
   Same grid and wall-label system as the gallery edition, turned down:
   black canvas, footage in the masthead and tiles, lighter sentence-case
   headlines, hairline rules at low contrast, rounded media, and motion
   (line rise on load, reveal on scroll, clips that play when in view).
   Motion is off under prefers-reduced-motion and when JS has not run.
   ======================================================================== */

:root {
    --g-bg: #08090b;
    --g-ink: #f3f2ee;
    --g-mute: #9b9fa7;
    --g-hair: rgba(243, 242, 238, 0.045);
    --g-rule: rgba(243, 242, 238, 0.16);
    --g-surface: #111317;
    --g-accent: #f2af63;
    --g-r: 14px;
    --g-bar: 64px;
    --c-ease: cubic-bezier(0.16, 1, 0.3, 1);
}

body.tdc { line-height: 1.5; }
.tdc :where(img, video) { border-radius: var(--g-r); background: var(--g-surface); }
.tdc video { display: block; width: 100%; object-fit: cover; }
.tdc :where(video) { height: auto; aspect-ratio: 16 / 9; }
.tdc ::selection { background: var(--g-accent); color: #08090b; }
.tdc :focus-visible { outline-color: var(--g-accent); border-radius: 4px; }

/* ---------- Top bar: glass instead of a ruled strip ---------- */
.tdc .g-bar { position: fixed; left: 0; right: 0; background: rgba(8, 9, 11, 0.55); -webkit-backdrop-filter: blur(18px) saturate(1.2); backdrop-filter: blur(18px) saturate(1.2); border-bottom-color: transparent; transition: border-color 0.4s; align-items: center; }
html.c-scrolled .tdc .g-bar { border-bottom-color: var(--g-rule); }
.tdc .g-bar__home { font-weight: 600; font-size: 16px; letter-spacing: -0.03em; text-transform: none; margin-right: 0; }
/* Lockup, top left: Carl Brunson logo (to the site home) / Thinking Digits (to the series) */
.c-lockup { margin-right: auto; display: flex; align-items: center; gap: 12px; }
.c-lockup__cb { height: 36px; color: var(--g-ink); transition: opacity 0.2s; }
.c-lockup__cb:hover { opacity: 0.65; }
.tdc .c-lockup .cb-logo { height: 14px; width: auto; }
.c-lockup__sep { color: var(--g-mute); font-size: 18px; font-weight: 300; line-height: 1; }
.tdc .g-bar__nav { gap: 4px; }
.tdc .g-bar__nav a, .tdc .g-bar__nav a:last-child { border: 0; height: 36px; padding-inline: 14px; border-radius: 999px; font-family: var(--g-sans); font-size: 14px; letter-spacing: -0.01em; text-transform: none; color: var(--g-mute); }
.tdc .g-bar__nav a:hover { background: rgba(243, 242, 238, 0.08); color: var(--g-ink); }
.tdc .g-bar__nav a[aria-current='page'] { background: rgba(243, 242, 238, 0.1); color: var(--g-ink); }
.tdc .site-nav-btn { top: 12px; right: 16px; border-radius: 50%; background: rgba(243, 242, 238, 0.12); color: var(--g-ink); }
.tdc main { padding-top: var(--g-bar); }

/* ---------- Type: lighter, sentence case ---------- */
.tdc .g-mast__title, .tdc .g-h2, .tdc .g-row__title, .tdc .g-feature__title, .tdc .g-next__t, .tdc .g-foot__mark { text-transform: none; font-weight: 500; }
.tdc .g-mast__title { font-size: clamp(56px, 12.4vw, 232px); line-height: 0.9; letter-spacing: -0.06em; }
.tdc .g-mast__title--page { font-size: clamp(52px, 10vw, 180px); }
.tdc .g-mast__title--ep { font-size: clamp(42px, 7.6vw, 140px); line-height: 0.94; letter-spacing: -0.052em; }
.tdc .g-h2 { font-size: clamp(34px, 5vw, 88px); line-height: 0.96; letter-spacing: -0.05em; }
.tdc .g-statement { font-weight: 400; line-height: 1.04; letter-spacing: -0.045em; }
.tdc .g-row__title { font-size: clamp(22px, 2.3vw, 38px); line-height: 1.02; letter-spacing: -0.04em; }
.tdc .g-feature__title { line-height: 0.98; }
.tdc .g-next__t { line-height: 0.98; }
.tdc .g-mast__lede { font-weight: 400; color: var(--g-ink); }
.tdc .g-label { letter-spacing: 0.08em; }
.tdc .g-prose { color: #c9ccd2; }
.tdc .g-link:hover { background: transparent; color: var(--g-accent); text-decoration: underline; }
.tdc .g-dot { border: 0; border-radius: 50%; box-shadow: 0 0 0 4px rgba(242, 175, 99, 0.18); }

/* ---------- Buttons: pills ---------- */
.tdc .g-actions { gap: 10px; }
.tdc .g-btn { min-height: 50px; padding: 0 22px; margin: 0; border-radius: 999px; border-color: var(--g-rule); background: transparent; color: var(--g-ink); font-weight: 500; gap: 14px; }
.tdc .g-btn--solid { background: var(--g-ink); border-color: var(--g-ink); color: #08090b; }
.tdc .g-btn:hover { background: var(--g-accent); border-color: var(--g-accent); color: #08090b; }

/* ---------- Hero with footage ---------- */
.c-hero { position: relative; min-height: min(100svh, 1100px); margin-top: calc(-1 * var(--g-bar)); display: flex; flex-direction: column; justify-content: flex-end; overflow: hidden; }
.c-hero__media { position: absolute; inset: 0; z-index: 0; }
.c-hero__media video { height: 100%; border-radius: 0; opacity: 0.72; }
.c-hero__wash { position: absolute; inset: 0; background: linear-gradient(180deg, rgba(8, 9, 11, 0.55) 0%, rgba(8, 9, 11, 0.1) 28%, rgba(8, 9, 11, 0.62) 68%, var(--g-bg) 100%); }
.c-hero .g-mast { position: relative; z-index: 1; width: 100%; padding-top: calc(var(--g-bar) + 48px); padding-bottom: clamp(28px, 4vw, 56px); }
.c-hero__top { grid-column: 1 / -1; display: flex; flex-wrap: wrap; gap: 8px 28px; color: #d6d8dc; }
.tdc .g-meta { border-top-color: var(--g-rule); }
.tdc .g-meta > div { border-bottom-color: var(--g-rule); padding-block: 11px; }
.tdc .g-meta dd { font-weight: 400; }

/* ---------- Reel: clips that play when in view ---------- */
.c-reel { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 10px; padding: 0 var(--g-pad) clamp(40px, 6vw, 96px); }
.c-reel figure { position: relative; overflow: hidden; border-radius: var(--g-r); background: var(--g-surface); aspect-ratio: 4 / 5; }
.c-reel figure:nth-child(even) { margin-top: clamp(16px, 3vw, 48px); }
.c-reel video, .c-reel img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; border-radius: 0; }
.c-reel figcaption { position: absolute; left: 12px; bottom: 10px; right: 12px; font-family: var(--g-mono); font-size: 10px; letter-spacing: 0.08em; text-transform: uppercase; color: rgba(243, 242, 238, 0.82); text-shadow: 0 1px 8px rgba(0, 0, 0, 0.8); }

/* ---------- Rooms ---------- */
.tdc .g-room { background: transparent; padding-block: clamp(22px, 2.6vw, 36px) clamp(56px, 8vw, 128px); }
.tdc .g-room__label .g-label:first-child { color: var(--g-accent); }

/* ---------- Now showing ---------- */
.tdc .g-feature { border-radius: calc(var(--g-r) + 6px); overflow: hidden; background: var(--g-surface); border-color: var(--g-rule); }
.tdc .g-feature__media { background: #050607; border-right-color: var(--g-rule); }
.tdc .g-feature__media video, .tdc .g-feature__media img { border-radius: 0; aspect-ratio: 16 / 9; }
.tdc .g-feature__go { border-top-color: var(--g-rule); font-weight: 500; }
.tdc a.g-feature:hover .g-feature__text { background: #191c21; color: var(--g-ink); }
.tdc a.g-feature:hover .g-feature__go { border-top-color: var(--g-rule); color: var(--g-accent); }
.tdc .g-feature__go span:last-child { transition: transform 0.4s var(--c-ease); }
.tdc a.g-feature:hover .g-feature__go span:last-child { transform: translateX(6px); }

/* ---------- Index rows ---------- */
.tdc .g-index { border-top-color: var(--g-rule); }
.tdc .g-row { background: transparent; padding-block: 20px; align-items: center; border-radius: 0; }
.tdc .g-row__thumb { position: relative; }
.tdc .g-row__thumb video, .tdc .g-row__thumb img { aspect-ratio: 16 / 9; border-radius: 10px; }
.tdc .g-row__no { color: var(--g-mute); padding-top: 0; }
.tdc .g-row--head { padding-block: 10px; }
.tdc .g-row--head .g-row__title { font: inherit; letter-spacing: inherit; }
.tdc a.g-row { transition: background-color 0.35s, padding 0.5s var(--c-ease); }
.tdc a.g-row:hover { background: rgba(243, 242, 238, 0.05); color: var(--g-ink); padding-inline: 14px; }
.tdc a.g-row:hover .g-row__line { color: #c9ccd2; }
.tdc a.g-row:hover .g-row__title { color: var(--g-accent); }
.tdc .g-row--soon .g-row__title { color: #7d818a; }
.tdc .g-row--soon .g-row__thumb :where(img, video) { filter: grayscale(0.6); opacity: 0.6; }

/* ---------- Faces ---------- */
.tdc .g-faces { gap: 10px; }
.tdc .g-face figcaption { background: transparent; }
.tdc .g-face { overflow: hidden; }
.tdc .g-face img { transition: transform 0.9s var(--c-ease), filter 0.6s; }
.tdc .g-face:hover img { transform: scale(1.03); filter: grayscale(1) contrast(1.05) brightness(1.12); }

/* ---------- Player, chapters, plates, sources ---------- */
.tdc .g-player { border-radius: calc(var(--g-r) + 6px); border-color: var(--g-rule); background: #050607; }
.tdc .g-player img, .tdc .g-player video { border-radius: 0; }
.tdc .g-player video { position: absolute; inset: 0; width: 100%; height: 100%; }
.tdc .g-player.is-playing video { display: none; }
.tdc .g-player__cta { left: 18px; bottom: 18px; border: 0; border-radius: 999px; background: var(--g-ink); color: #08090b; padding: 14px 22px 14px 18px; font-weight: 600; }
.tdc .g-player__tri { border-left-color: #08090b; }
.tdc .g-chapters, .tdc .g-sources { border-top-color: var(--g-rule); }
.tdc .g-chapters li, .tdc .g-sources li { background: transparent; }
.tdc .g-chapters li { padding-block: 14px; transition: padding 0.5s var(--c-ease), color 0.3s; }
.tdc .g-chapters li:hover { padding-left: 10px; color: var(--g-accent); }
.tdc .g-ch__n { font-weight: 500; }
.tdc .g-plates { gap: 10px; }
.tdc .g-plate figcaption { background: transparent; color: #c9ccd2; }
.tdc .g-plate video { aspect-ratio: 16 / 9; }
.tdc .g-plate--wide video { flex: 1; min-height: 0; height: 100%; aspect-ratio: auto; object-fit: contain; background: #05080a; }
.tdc .g-next { background: transparent; border-radius: 0; }
.tdc a.g-next:hover { background: rgba(243, 242, 238, 0.05); color: var(--g-ink); }

/* ---------- Footer ---------- */
.tdc .g-foot { background: transparent; color: var(--g-ink); border-top-color: var(--g-rule); }
.tdc .g-foot__col .g-label { color: var(--g-mute); }
.tdc .g-foot .g-link:hover { background: transparent; color: var(--g-accent); }
.tdc .g-foot__mark { font-size: clamp(56px, 12.4vw, 232px); line-height: 0.9; letter-spacing: -0.06em; color: transparent; -webkit-text-stroke: 1px rgba(243, 242, 238, 0.38); }
.tdc .g-foot__base { border-top-color: var(--g-rule); color: var(--g-mute); }

/* ---------- Motion (only when JS has added .c-js) ---------- */
@media (prefers-reduced-motion: no-preference) {
    .c-js .c-line { display: block; overflow: hidden; padding-bottom: 0.12em; margin-bottom: -0.12em; }
    .c-js .c-line > span { display: block; transform: translateY(105%); animation: c-rise 1.15s var(--c-ease) forwards; animation-delay: calc(var(--i, 0) * 90ms + 120ms); }
    .c-js [data-r] { opacity: 0; transform: translateY(22px); transition: opacity 0.9s var(--c-ease), transform 1.1s var(--c-ease); transition-delay: calc(var(--d, 0) * 70ms); }
    .c-js [data-r].is-in { opacity: 1; transform: none; }
    /* The clip sits on the child: a clipped target never reports as intersecting. */
    .c-js [data-r='clip'] { opacity: 1; transform: none; background: transparent; }
    .c-js [data-r='clip'] > :where(video, img) { clip-path: inset(0 0 100% 0); transform: scale(1.12); transition: clip-path 1.2s var(--c-ease), transform 1.6s var(--c-ease); transition-delay: calc(var(--d, 0) * 80ms); }
    .c-js [data-r='clip'] > figcaption { opacity: 0; transition: opacity 0.8s 0.6s; }
    .c-js [data-r='clip'].is-in > :where(video, img) { clip-path: inset(0 0 0 0); transform: none; }
    .c-js [data-r='clip'].is-in > figcaption { opacity: 1; }
    .c-js .c-hero__media video { animation: c-drift 24s ease-in-out infinite alternate; }
    @keyframes c-rise { to { transform: none; } }
    @keyframes c-drift { from { transform: scale(1.02); } to { transform: scale(1.1); } }
}

/* ---------- Narrow screens ---------- */
@media (max-width: 900px) {
    .c-reel { grid-template-columns: repeat(3, minmax(0, 1fr)); }
    .c-reel figure:nth-child(even) { margin-top: 0; }
    .c-reel figure:nth-child(3n + 2) { margin-top: 18px; }
    .tdc a.g-row:hover { padding-inline: 0; }
    .tdc .g-feature__media { border-bottom-color: var(--g-rule); }
    .tdc .g-plate--wide video { height: auto; aspect-ratio: 16 / 9; }
    .tdc .g-bar__nav a { padding-inline: 10px; font-size: 13px; }
}
@media (max-width: 520px) {
    .c-reel { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .c-reel figure:nth-child(3n + 2) { margin-top: 0; }
    .c-reel figure:nth-child(even) { margin-top: 18px; }
    .tdc .g-btn { flex: 1 1 100%; }
    .c-lockup { gap: 8px; }
    .tdc .c-lockup .cb-logo { height: 11px; }
    .c-lockup__sep { font-size: 15px; }
    .tdc .g-bar__nav { display: none; } /* phones: lockup and menu button only; the wordmark links to the series, and episodes are linked in the page and footer */
    .c-hero { min-height: 92svh; }
@media (max-width: 400px) {
    .c-lockup { gap: 6px; }
    .tdc .c-lockup .cb-logo { height: 10px; }
    .tdc .g-bar__home { font-size: 12px; }
}
}
