/* Turnleaf, the November 2026 update: the homepage strip, the Codex band's opening book, and /updates/turnleaf.
   It builds on goldthread.css (plates, frames, kickers, links) and borrows its light from the Great Oak's
   turned season: forest night, ember and amber. */
:root {
    --tl-forest-0: #08130f;
    --tl-forest-1: #10251c;
    --tl-ember: #f08a3c;
    --tl-amber: #e9b45a;
    --tl-leaf: #9ad27e;
}

/* ---- The homepage strip ---- */
.tl-strip {
    position: relative;
    isolation: isolate;
    overflow: hidden;
    padding: 3.75rem clamp(1rem, 4vw, 3rem) 4.25rem;
    background:
        radial-gradient(55% 42% at 80% 12%, rgba(240, 138, 60, .17), transparent 72%),
        radial-gradient(48% 40% at 8% 70%, rgba(154, 210, 126, .08), transparent 70%),
        linear-gradient(180deg, var(--gt-night-0) 0%, var(--tl-forest-1) 46%, var(--tl-forest-0) 78%, var(--gt-night-0) 100%);
}

.tl-strip-head {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    align-items: end;
    gap: 1rem 2rem;
    margin-bottom: 1.6rem;
}

.tl-strip h2 {
    margin: .3rem 0 .45rem;
    color: #fff;
    font-family: Cinzel, Georgia, serif;
    font-size: clamp(1.9rem, 4vw, 3rem);
    font-weight: 700;
    letter-spacing: .01em;
    line-height: 1.08;
}

.tl-strip-head p:not(.gt-kicker) {
    max-width: 60ch;
    margin: 0;
    color: var(--gt-text);
    line-height: 1.6;
}

/* A few leaves fall through the strip's head: the Great Oak's season, in the page's own colours. */
.tl-leaves {
    position: absolute;
    inset: 0 0 auto;
    z-index: -1;
    height: min(720px, 70%);
    overflow: hidden;
    pointer-events: none;
}

.tl-leaves span {
    position: absolute;
    top: -2rem;
    width: 13px;
    height: 8px;
    border-radius: 0 100% 0 100%;
    background: var(--tl-ember);
    opacity: 0;
    animation: tl-fall 16s linear infinite;
}

.tl-leaves span:nth-child(1) { left: 6%; animation-delay: -2s; }
.tl-leaves span:nth-child(2) { left: 17%; animation-delay: -9s; animation-duration: 19s; background: var(--tl-amber); }
.tl-leaves span:nth-child(3) { left: 29%; animation-delay: -5s; animation-duration: 14s; background: var(--tl-leaf); width: 11px; height: 7px; }
.tl-leaves span:nth-child(4) { left: 43%; animation-delay: -12s; animation-duration: 21s; }
.tl-leaves span:nth-child(5) { left: 56%; animation-delay: -7s; background: var(--tl-amber); width: 15px; height: 9px; }
.tl-leaves span:nth-child(6) { left: 67%; animation-delay: -1s; animation-duration: 18s; }
.tl-leaves span:nth-child(7) { left: 78%; animation-delay: -14s; animation-duration: 15s; background: var(--tl-leaf); }
.tl-leaves span:nth-child(8) { left: 88%; animation-delay: -4s; animation-duration: 20s; background: var(--tl-amber); }
.tl-leaves span:nth-child(9) { left: 95%; animation-delay: -10s; animation-duration: 17s; width: 10px; height: 6px; }

@keyframes tl-fall {
    0% { transform: translate3d(0, 0, 0) rotate(0deg); opacity: 0; }
    8% { opacity: .7; }
    50% { transform: translate3d(-34px, 360px, 0) rotate(240deg); }
    88% { opacity: .55; }
    100% { transform: translate3d(-18px, 760px, 0) rotate(520deg); opacity: 0; }
}

/* ---- Plates: each clip at its own ratio ---- */
.tl-plate .gt-frame {
    background: #000;
    aspect-ratio: var(--gt-ratio, 16 / 9);
}

.tl-badge {
    position: absolute;
    top: .55rem;
    left: .55rem;
    z-index: 1;
    padding: .2rem .55rem;
    border: 1px solid rgba(255, 240, 184, .55);
    border-radius: 999px;
    background: rgba(11, 16, 32, .78);
    color: var(--gt-spark);
    font-size: .74rem;
    font-weight: 700;
    letter-spacing: .08em;
    text-transform: uppercase;
}

/* The cut fills the strip's width and is never taller than the window it plays in. */
.tl-reel { margin: 0 0 1.25rem; }

.tl-reel-plate {
    width: 100%;
    max-width: min(100%, max(22rem, calc((100vh - 7rem) * 1278 / 588)));
    max-width: min(100%, max(22rem, calc((100svh - 7rem) * 1278 / 588)));
    margin-inline: auto;
}

.tl-reel-plate figcaption b { font-size: 1.1rem; }

.tl-featured {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 1.1rem;
}

.tl-row {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: .9rem;
    margin-top: 1.1rem;
}

.tl-row .gt-plate { padding: .45rem .45rem .7rem; }
.tl-row .gt-plate figcaption b { font-size: .92rem; }
.tl-row .gt-plate figcaption span { font-size: .84rem; }

.tl-disclosure {
    max-width: 82ch;
    margin: 1.3rem 0 0;
    color: var(--gt-muted);
    font-size: .84rem;
    line-height: 1.55;
}

/* ---- The Codex band: the opening book beside its copy ---- */
.tl-codex-band {
    background:
        radial-gradient(50% 60% at 82% 30%, rgba(233, 180, 90, .10), transparent 70%),
        var(--gt-night-0);
}

.tl-book-lead {
    display: grid;
    grid-template-columns: minmax(0, .82fr) minmax(0, 1.5fr);
    align-items: center;
    gap: 1.4rem 2.2rem;
    margin-bottom: 1.6rem;
}

.tl-book-copy p:not(.gt-kicker) {
    max-width: 52ch;
    margin: 0 0 1rem;
    color: var(--gt-text);
    line-height: 1.65;
}

.tl-book-link {
    color: var(--gt-amber);
    font-weight: 700;
}

.tl-book-link:hover,
.tl-book-link:focus-visible { color: var(--gt-amber-hi); }

/* ---- /updates/turnleaf ---- */
.tl-page .tl-reel { margin: 1.4rem 0; }

.tl-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    align-items: start;
    gap: 1.2rem;
    margin-top: 1.25rem;
}

.tl-grid-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }

.tl-wide {
    grid-column: 1 / -1;
    width: 100%;
    max-width: 960px;
    justify-self: center;
}

.tl-subhead {
    margin: 1.8rem 0 .45rem;
    color: var(--gt-spark);
    font-family: Cinzel, Georgia, serif;
    font-size: 1.15rem;
    letter-spacing: .02em;
}

.tl-page .gt-note + .gt-list,
.tl-page .tl-grid + .gt-note { margin-top: 1.1rem; }

.tl-compare {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 1.2rem;
    margin-top: 1.25rem;
}

.tl-solis {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 1rem;
    margin-top: 1.25rem;
}

.tl-solis .gt-frame { aspect-ratio: 1278 / 588; }

.tl-page .gt-list li strong { color: var(--gt-spark); }

@media (max-width: 1100px) {
    .tl-grid-3 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 900px) {
    .tl-featured { grid-template-columns: 1fr 1fr; }
    .tl-featured .gt-plate:first-child { grid-column: 1 / -1; }
    .tl-book-lead { grid-template-columns: 1fr; }
}

@media (max-width: 767px) {
    .tl-strip { padding: 2.75rem 1rem 3rem; }
    .tl-strip-head { grid-template-columns: 1fr; }
    .tl-featured,
    .tl-row {
        display: flex;
        gap: .9rem;
        margin-inline: -1rem;
        padding: 0 1rem .5rem;
        overflow-x: auto;
        overscroll-behavior-x: contain;
        scroll-snap-type: x mandatory;
    }
    .tl-featured .gt-plate { flex: 0 0 86%; scroll-snap-align: center; }
    .tl-row .gt-plate { flex: 0 0 72%; scroll-snap-align: center; }
    .tl-grid,
    .tl-grid-3,
    .tl-compare,
    .tl-solis { grid-template-columns: 1fr; }
}

@media (prefers-reduced-motion: reduce) {
    .tl-leaves { display: none; }
}
