/* ============================================================
   courts.studio v2 - Dark-Academia Archival Design
   ============================================================ */

/* -- CSS Custom Properties ----------------------------------- */
:root {
    --deep-chambers: #1a1118;
    --chamber-smoke: #2a2230;
    --burnished-brass: #b8945f;
    --parchment-light: #f5f0e8;
    --oxblood: #5a1a2a;
    --faded-ink: #3d3428;
    --clerks-gold: #d4af37;
    --dust-mote: #c4b89a;
    --foxing-brown: #8b7355;

    --font-headline: "Playfair Display", "Cormorant Garamond", Georgia, serif;
    --font-body: "Cormorant Garamond", Georgia, serif;
    --font-mono: "DM Mono", "Courier New", monospace;

    --spine-x: 50%;
    --block-max: 520px;
    --block-gap: 160px;
}

/* -- Reset --------------------------------------------------- */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    scroll-behavior: smooth;
}

body {
    background: var(--deep-chambers);
    background-image:
        radial-gradient(ellipse at 50% 0%, var(--chamber-smoke) 0%, var(--deep-chambers) 60%);
    color: var(--parchment-light);
    font-family: var(--font-body);
    font-size: clamp(17px, 1.2vw, 21px);
    line-height: 1.75;
    letter-spacing: 0.01em;
    overflow-x: hidden;
    min-height: 100vh;
    text-rendering: optimizeLegibility;
    -webkit-font-smoothing: antialiased;
}

/* =============================================================
   HERO SECTION
   ============================================================= */
.hero {
    position: relative;
    width: 100%;
    height: 100vh;
    min-height: 640px;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    background: var(--deep-chambers);
}

.hero-glow {
    position: absolute;
    top: 50%;
    left: 50%;
    width: 800px;
    height: 800px;
    transform: translate(-50%, -50%) scale(0);
    background: radial-gradient(
        circle,
        rgba(184, 148, 95, 0.10) 0%,
        rgba(184, 148, 95, 0.04) 30%,
        rgba(184, 148, 95, 0) 70%
    );
    border-radius: 50%;
    pointer-events: none;
    opacity: 0;
    transition: opacity 1400ms ease-out, transform 1400ms ease-out;
}

.hero-glow.lit {
    opacity: 1;
    transform: translate(-50%, -50%) scale(1);
}

.hero-inner {
    position: relative;
    z-index: 2;
    text-align: center;
    padding: 0 24px;
    max-width: 1100px;
}

.hero-title {
    font-family: var(--font-headline);
    font-weight: 700;
    font-size: clamp(48px, 9vw, 132px);
    letter-spacing: 0.04em;
    line-height: 1.05;
    color: var(--parchment-light);
    margin-bottom: 32px;
    user-select: none;
}

.hero-title .char {
    display: inline-block;
    opacity: 0;
    transform: translateY(8px);
    filter: blur(4px);
    transition: opacity 600ms ease-out, transform 600ms ease-out, filter 600ms ease-out;
    color: var(--parchment-light);
}

.hero-title .char.lit {
    opacity: 1;
    transform: translateY(0);
    filter: blur(0);
}

.hero-title .char.dot {
    color: var(--burnished-brass);
}

.hero-subtitle {
    font-family: var(--font-body);
    font-weight: 400;
    font-style: italic;
    font-size: clamp(17px, 1.4vw, 22px);
    color: var(--dust-mote);
    margin-bottom: 36px;
    opacity: 0;
    transform: translateY(8px);
    transition: opacity 1000ms ease-out 1500ms, transform 1000ms ease-out 1500ms;
    letter-spacing: 0.03em;
}

.hero-subtitle.lit {
    opacity: 1;
    transform: translateY(0);
}

.hero-rule {
    width: 0;
    height: 1px;
    background: linear-gradient(
        90deg,
        rgba(184, 148, 95, 0) 0%,
        var(--burnished-brass) 20%,
        var(--clerks-gold) 50%,
        var(--burnished-brass) 80%,
        rgba(184, 148, 95, 0) 100%
    );
    margin: 0 auto 32px auto;
    transition: width 1400ms cubic-bezier(0.5, 0, 0.2, 1) 1900ms;
    box-shadow: 0 0 12px rgba(212, 175, 55, 0.25);
}

.hero-rule.drawn {
    width: 60vw;
}

.hero-meta {
    font-family: var(--font-mono);
    font-size: 12px;
    color: var(--dust-mote);
    opacity: 0;
    transition: opacity 1200ms ease-out 2700ms;
    letter-spacing: 0.18em;
    text-transform: uppercase;
}

.hero-meta.lit {
    opacity: 0.7;
}

.hero-scroll-cue {
    position: absolute;
    bottom: 36px;
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
    opacity: 0;
    transition: opacity 1200ms ease-out 3200ms;
    z-index: 3;
}

.hero-scroll-cue.lit {
    opacity: 0.5;
}

.hero-scroll-cue span {
    font-family: var(--font-mono);
    font-size: 11px;
    color: var(--dust-mote);
    letter-spacing: 0.25em;
    text-transform: uppercase;
}

.hero-scroll-cue .cue-line {
    width: 1px;
    height: 40px;
    background: linear-gradient(180deg, var(--burnished-brass), transparent);
    animation: cue-pulse 2400ms ease-in-out infinite;
}

@keyframes cue-pulse {
    0%, 100% { opacity: 0.4; transform: scaleY(1); }
    50% { opacity: 1; transform: scaleY(1.3); }
}

/* =============================================================
   TIMELINE SPINE
   ============================================================= */
.timeline-wrap {
    position: relative;
    width: 100%;
    max-width: 1280px;
    margin: 0 auto;
    padding: 80px 24px 0 24px;
}

.timeline-spine {
    position: absolute;
    top: 0;
    left: 50%;
    transform: translateX(-50%);
    width: 2px;
    height: 100%;
    pointer-events: none;
}

.spine-line {
    width: 100%;
    height: 0;
    background: linear-gradient(
        180deg,
        rgba(184, 148, 95, 0) 0%,
        var(--burnished-brass) 6%,
        var(--burnished-brass) 94%,
        rgba(184, 148, 95, 0) 100%
    );
    background-size: 100% 200%;
    background-position: 0% 0%;
    animation: spine-shimmer 8s linear infinite;
    transition: height 1400ms cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 0 0 6px rgba(184, 148, 95, 0.3);
}

@keyframes spine-shimmer {
    0% { background-position: 0% 0%; }
    100% { background-position: 0% 200%; }
}

/* =============================================================
   CONTENT BLOCKS
   ============================================================= */
.block {
    position: relative;
    width: 100%;
    margin-bottom: var(--block-gap);
    display: flex;
    align-items: flex-start;
    min-height: 280px;
}

.block.left {
    justify-content: flex-end;
}

.block.left .panel {
    margin-right: calc(50% + 60px);
}

.block.right {
    justify-content: flex-start;
}

.block.right .panel {
    margin-left: calc(50% + 60px);
}

.block:nth-child(odd) .panel {
    transform: rotate(-0.3deg);
}

.block:nth-child(even) .panel {
    transform: rotate(0.3deg);
}

/* -- Timeline node ------------------------------------------- */
.node {
    position: absolute;
    top: 36px;
    left: 50%;
    width: 12px;
    height: 12px;
    margin-left: -6px;
    z-index: 5;
    cursor: pointer;
    transition: width 200ms ease-out, height 200ms ease-out, margin 200ms ease-out;
}

.node::before {
    content: "";
    position: absolute;
    inset: 0;
    border-radius: 50%;
    border: 1.5px solid var(--burnished-brass);
    background: var(--deep-chambers);
    transition: all 240ms ease-out;
    transform: scale(0);
}

.block.in-view .node::before {
    transform: scale(1);
}

.node:hover::before,
.node.active::before {
    width: 20px;
    height: 20px;
    inset: -4px;
    background: var(--clerks-gold);
    border-color: var(--clerks-gold);
    box-shadow: 0 0 16px rgba(212, 175, 55, 0.5);
}

.node .emblem {
    position: absolute;
    width: 56px;
    height: 56px;
    pointer-events: none;
    transition: transform 400ms cubic-bezier(0.34, 1.56, 0.64, 1);
}

/* Place emblem on the spine-side of the panel */
.block.left .node .emblem {
    left: -76px;
    top: -22px;
}

.block.right .node .emblem {
    left: 28px;
    top: -22px;
}

.emblem-path {
    stroke-dasharray: 400;
    stroke-dashoffset: 400;
    transition: stroke-dashoffset 1800ms ease-in-out;
}

.block.in-view .emblem-path {
    stroke-dashoffset: 0;
}

.node.active .emblem,
.node:hover .emblem {
    transform: scale(1.08);
}

/* -- Connector ----------------------------------------------- */
.connector {
    position: absolute;
    top: 42px;
    left: 50%;
    width: 60px;
    height: 1px;
    background: linear-gradient(90deg, var(--burnished-brass), var(--dust-mote));
    transform-origin: left center;
    transform: scaleX(0);
    transition: transform 800ms cubic-bezier(0.4, 0, 0.2, 1) 200ms;
    z-index: 3;
}

.block.left .connector {
    transform-origin: right center;
    margin-left: -60px;
}

.block.in-view .connector {
    transform: scaleX(1);
}

/* -- Panel --------------------------------------------------- */
.panel {
    position: relative;
    width: 100%;
    max-width: var(--block-max);
    background: var(--parchment-light);
    color: var(--faded-ink);
    border: 1px solid rgba(61, 52, 40, 0.55);
    padding: 42px 44px 36px 44px;
    box-shadow:
        0 10px 30px rgba(0, 0, 0, 0.45),
        0 2px 8px rgba(0, 0, 0, 0.3),
        inset 0 0 80px rgba(139, 115, 85, 0.06);
    opacity: 0;
    transition:
        opacity 700ms cubic-bezier(0.25, 0.46, 0.45, 0.94),
        transform 700ms cubic-bezier(0.25, 0.46, 0.45, 0.94),
        box-shadow 400ms ease-out,
        filter 600ms ease-out;
    will-change: transform, opacity, filter;
    overflow: hidden;
}

.block.left .panel {
    transform: translateX(-40px) rotate(-0.3deg);
}

.block.right .panel {
    transform: translateX(40px) rotate(0.3deg);
}

.block.in-view .panel {
    opacity: 1;
    transform: translateX(0) rotate(-0.3deg);
}

.block.right.in-view .panel {
    transform: translateX(0) rotate(0.3deg);
}

/* Blur-focus reading mode */
.panel.faded {
    filter: blur(1.5px);
    opacity: 0.7;
}

.panel.focused {
    filter: blur(0);
    opacity: 1;
}

/* Hover lamp glow */
.block:hover .panel,
.block.active .panel {
    box-shadow:
        0 4px 24px rgba(184, 148, 95, 0.18),
        0 12px 36px rgba(0, 0, 0, 0.5),
        inset 0 0 80px rgba(212, 175, 55, 0.05);
}

/* -- Paper noise overlay ------------------------------------- */
.paper-noise {
    position: absolute;
    inset: 0;
    pointer-events: none;
    background-image:
        radial-gradient(circle at 12% 20%, rgba(139, 115, 85, 0.06) 0%, transparent 30%),
        radial-gradient(circle at 88% 84%, rgba(139, 115, 85, 0.05) 0%, transparent 35%),
        repeating-linear-gradient(
            45deg,
            rgba(139, 115, 85, 0.012) 0,
            rgba(139, 115, 85, 0.012) 1px,
            transparent 1px,
            transparent 3px
        );
    mix-blend-mode: multiply;
    opacity: 0.7;
}

/* -- Foxing marks -------------------------------------------- */
.foxing {
    position: absolute;
    border-radius: 50%;
    background: rgba(139, 115, 85, 0.18);
    filter: blur(12px);
    pointer-events: none;
}

.foxing.fx-tl { top: -8px;  left: 12%;  width: 28px; height: 28px; opacity: 0.8; }
.foxing.fx-tr { top:  8px;  right: 8%;  width: 36px; height: 36px; opacity: 0.7; }
.foxing.fx-bl { bottom: 16px; left: 14%; width: 42px; height: 42px; opacity: 0.6; }
.foxing.fx-br { bottom: -10px; right: 18%; width: 32px; height: 32px; opacity: 0.75; }

/* -- Panel content ------------------------------------------- */
.panel-head {
    margin-bottom: 22px;
    border-bottom: 1px solid rgba(61, 52, 40, 0.25);
    padding-bottom: 18px;
}

.panel-meta {
    display: block;
    font-family: var(--font-mono);
    font-size: 11px;
    color: var(--faded-ink);
    opacity: 0.65;
    letter-spacing: 0.16em;
    text-transform: uppercase;
    margin-bottom: 14px;
}

.panel-title {
    font-family: var(--font-headline);
    font-weight: 700;
    font-size: clamp(28px, 3vw, 38px);
    line-height: 1.18;
    letter-spacing: 0.02em;
    color: var(--faded-ink);
}

.panel-body p {
    margin-bottom: 16px;
    font-size: clamp(17px, 1.15vw, 20px);
    line-height: 1.78;
}

.panel-body p:last-child {
    margin-bottom: 0;
}

.panel-body em {
    font-style: italic;
    font-weight: 600;
    color: var(--oxblood);
}

.panel-foot {
    margin-top: 24px;
    text-align: center;
}

.panel-folio {
    font-family: var(--font-headline);
    font-style: italic;
    font-size: 14px;
    color: var(--faded-ink);
    opacity: 0.55;
    letter-spacing: 0.1em;
}

/* =============================================================
   DIAGONAL DIVIDER
   ============================================================= */
.diagonal-divider {
    position: relative;
    width: 100vw;
    margin-left: calc(-50vw + 50%);
    height: 80px;
    margin-bottom: var(--block-gap);
    overflow: hidden;
}

.oxblood-strip {
    position: absolute;
    inset: 0;
    background: var(--oxblood);
    clip-path: polygon(0 50%, 100% 30%, 100% 70%, 0 90%);
    transform: scaleX(0);
    transform-origin: left center;
    transition: transform 1200ms cubic-bezier(0.6, 0, 0.2, 1);
}

.diagonal-divider.in-view .oxblood-strip {
    transform: scaleX(1);
}

/* =============================================================
   TERMINUS
   ============================================================= */
.terminus {
    position: relative;
    width: 100%;
    max-width: 720px;
    margin: 80px auto 160px auto;
    padding: 0 24px;
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
}

.terminus-node {
    width: 96px;
    height: 96px;
    margin-bottom: 48px;
    opacity: 0;
    transform: scale(0.6);
    transition: opacity 1000ms ease-out, transform 1000ms cubic-bezier(0.34, 1.56, 0.64, 1);
    filter: drop-shadow(0 0 18px rgba(184, 148, 95, 0.35));
}

.terminus.in-view .terminus-node {
    opacity: 1;
    transform: scale(1);
}

.terminus-emblem {
    width: 100%;
    height: 100%;
}

.colophon {
    color: var(--dust-mote);
    opacity: 0;
    transform: translateY(16px);
    transition: opacity 1200ms ease-out 400ms, transform 1200ms ease-out 400ms;
}

.terminus.in-view .colophon {
    opacity: 1;
    transform: translateY(0);
}

.colophon-text {
    font-family: var(--font-body);
    font-style: italic;
    font-size: clamp(17px, 1.2vw, 21px);
    line-height: 1.85;
    color: var(--parchment-light);
    margin-bottom: 28px;
    letter-spacing: 0.02em;
}

.colophon-text em {
    font-style: italic;
    color: var(--burnished-brass);
}

.colophon-imprint {
    font-family: var(--font-mono);
    font-size: 11px;
    color: var(--dust-mote);
    letter-spacing: 0.28em;
    text-transform: uppercase;
    opacity: 0.7;
}

/* =============================================================
   PAGE-TURN OVERLAY (diagonal reveal)
   ============================================================= */
.page-turn {
    position: fixed;
    inset: 0;
    background: var(--oxblood);
    pointer-events: none;
    z-index: 100;
    clip-path: polygon(0 0, 0 0, 0 0, 0 0);
    transition: clip-path 800ms cubic-bezier(0.65, 0, 0.35, 1);
}

.page-turn.sweep-in {
    clip-path: polygon(0 0, 100% 0, 100% 100%, 0 100%);
}

.page-turn.sweep-out {
    clip-path: polygon(100% 0, 100% 0, 100% 100%, 100% 100%);
}

/* =============================================================
   RESPONSIVE
   ============================================================= */
@media (max-width: 880px) {
    :root {
        --block-gap: 100px;
    }

    .timeline-spine {
        left: 36px;
        transform: none;
    }

    .block.left,
    .block.right {
        justify-content: flex-start;
    }

    .block.left .panel,
    .block.right .panel {
        margin-left: 80px;
        margin-right: 16px;
        max-width: none;
    }

    .node {
        left: 36px;
        margin-left: -6px;
    }

    .block.left .node .emblem,
    .block.right .node .emblem {
        left: 28px;
        top: -22px;
    }

    .connector,
    .block.left .connector {
        left: 36px;
        margin-left: 0;
        transform-origin: left center;
        width: 40px;
    }

    .panel {
        padding: 32px 28px 28px 28px;
    }

    .hero-title {
        font-size: clamp(40px, 14vw, 80px);
    }

    .terminus {
        margin-top: 60px;
        margin-bottom: 100px;
    }

    .diagonal-divider {
        height: 60px;
        margin-bottom: 80px;
    }
}

@media (max-width: 480px) {
    .hero-meta {
        font-size: 10px;
        letter-spacing: 0.14em;
    }

    .panel-title {
        font-size: clamp(24px, 7vw, 32px);
    }

    .panel-body p {
        font-size: 16px;
        line-height: 1.7;
    }
}
