/* ============================================================
   freedom.study -- Mid-Century Modern Design System
   Sutnar Grid / Film-Strip Scroll / Burnt Orange Palette
   ============================================================ */

:root {
    --co-burnt: #CC5500;
    --co-sienna: #8B3A00;
    --co-cream: #FAF3E8;
    --co-charcoal: #1C1C1E;
    --co-ink: #2B2B2B;
    --co-paper: #F5F0E6;
    --co-terracotta: #D4764E;
    --co-umber: #6B4226;
    --co-grid: #E8E2D6;
    --co-reg: #D0CABC;
    --font-display: 'Space Mono', monospace;
    --font-body: 'IBM Plex Mono', monospace;
    --font-accent: 'Cutive Mono', monospace;
}

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

html {
    font-size: 16px;
    scroll-behavior: smooth;
}

body {
    background: var(--co-cream);
    color: var(--co-ink);
    font-family: var(--font-body);
    font-weight: 400;
    line-height: 1.75;
    overflow: hidden;
}

/* ---- Scroll Container ---- */
.scroll-container {
    width: 100vw;
    height: 100vh;
    overflow-y: scroll;
    scroll-snap-type: y mandatory;
}

/* ---- Frame (viewport-height section) ---- */
.frame {
    position: relative;
    width: 100vw;
    height: 100vh;
    overflow: hidden;
    scroll-snap-align: start;
}

.frame--light {
    background: var(--co-cream);
}

.frame--cream {
    background: var(--co-paper);
}

.frame--dark {
    background: var(--co-charcoal);
}

/* ---- Sutnar Grid ---- */
.frame__grid {
    display: grid;
    grid-template-columns: 2fr 8fr 2fr;
    width: 100%;
    height: 100%;
}

.frame__margin {
    position: relative;
    display: flex;
    flex-direction: column;
    justify-content: space-around;
    align-items: center;
    padding: 2rem 0;
}

.frame__content {
    position: relative;
    display: flex;
    flex-direction: column;
    justify-content: center;
    padding: 3rem 2rem;
    overflow: hidden;
}

.frame__content--centered {
    display: flex;
    align-items: center;
    justify-content: center;
    text-align: center;
}

.frame__content--split {
    display: grid;
    grid-template-columns: 1.2fr 1fr;
    align-items: center;
    gap: 3rem;
}

.frame__content--split-reverse {
    display: grid;
    grid-template-columns: 1fr 1.2fr;
    align-items: center;
    gap: 3rem;
}

.frame__content--index {
    display: flex;
    flex-direction: column;
    justify-content: center;
    padding: 4rem 2rem;
}

/* ---- Registration Marks ---- */
.registration-mark {
    font-family: var(--font-accent);
    font-size: 14px;
    color: var(--co-reg);
    user-select: none;
    transition: transform 400ms ease-out;
}

.registration-mark--light {
    color: rgba(208, 202, 188, 0.4);
}

.registration-mark.pulse {
    animation: regPulse 400ms ease-out;
}

@keyframes regPulse {
    0% { transform: scale(1); }
    50% { transform: scale(1.3); }
    100% { transform: scale(1); }
}

/* ---- Trim Marks ---- */
.trim-marks {
    position: absolute;
    inset: 0;
    pointer-events: none;
}

.trim-mark {
    position: absolute;
    width: 20px;
    height: 20px;
}

.trim-mark::before,
.trim-mark::after {
    content: '';
    position: absolute;
    background: var(--co-reg);
}

.trim-mark::before {
    width: 1px;
    height: 20px;
}

.trim-mark::after {
    width: 20px;
    height: 1px;
}

.trim-mark--tl { top: 12px; left: 12px; }
.trim-mark--tl::before { top: 0; left: 0; }
.trim-mark--tl::after { top: 0; left: 0; }

.trim-mark--tr { top: 12px; right: 12px; }
.trim-mark--tr::before { top: 0; right: 0; }
.trim-mark--tr::after { top: 0; right: 0; }

.trim-mark--bl { bottom: 12px; left: 12px; }
.trim-mark--bl::before { bottom: 0; left: 0; }
.trim-mark--bl::after { bottom: 0; left: 0; }

.trim-mark--br { bottom: 12px; right: 12px; }
.trim-mark--br::before { bottom: 0; right: 0; }
.trim-mark--br::after { bottom: 0; right: 0; }

.trim-mark--on-dark::before,
.trim-mark--on-dark::after {
    background: rgba(208, 202, 188, 0.3);
}

/* ---- Typography ---- */
.heading {
    font-family: var(--font-display);
    font-weight: 700;
    font-size: clamp(28px, 4vw, 48px);
    letter-spacing: -0.02em;
    color: var(--co-ink);
    margin-bottom: 1.5em;
    text-align: left;
}

.heading--on-dark {
    color: var(--co-paper);
}

.body-text {
    font-family: var(--font-body);
    font-weight: 400;
    font-size: clamp(14px, 1.1vw, 18px);
    line-height: 1.75;
    color: var(--co-ink);
    text-align: left;
    max-width: 60ch;
}

.body-text--on-dark {
    color: var(--co-paper);
}

.hero-title {
    position: absolute;
    bottom: 4rem;
    left: 2rem;
    z-index: 2;
}

.hero-title__text {
    font-family: var(--font-display);
    font-weight: 700;
    font-size: clamp(36px, 6vw, 96px);
    letter-spacing: -0.02em;
    color: var(--co-ink);
    text-align: left;
}

.statement-text {
    font-family: var(--font-body);
    font-weight: 400;
    font-size: clamp(16px, 1.4vw, 22px);
    line-height: 1.75;
    color: var(--co-paper);
    max-width: 55ch;
    text-align: center;
}

/* ---- Geometric Shapes ---- */
.hero-circle {
    position: absolute;
    width: 80vw;
    height: 80vw;
    max-width: 80vh;
    max-height: 80vh;
    top: -10%;
    right: -15%;
    z-index: 1;
    transform: translateX(40px);
    transition: transform 500ms ease-out;
}

.hero-circle.entered {
    transform: translateX(0);
}

.closing-circle {
    position: absolute;
    width: 70vw;
    height: 70vw;
    max-width: 70vh;
    max-height: 70vh;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%) translateY(30px);
    transition: transform 500ms ease-out;
    z-index: 1;
}

.closing-circle.entered {
    transform: translate(-50%, -50%) translateY(0);
}

.closing-text {
    position: absolute;
    bottom: 4rem;
    left: 2rem;
    z-index: 2;
}

.shape {
    transition: transform 500ms ease-out;
}

.shape--triangle {
    width: 100%;
    max-width: 55vw;
    height: auto;
    transform: translateY(30px);
}

.shape--triangle.entered {
    transform: translateY(0);
}

.shape--halfcircle {
    width: 100%;
    max-width: 40vw;
    height: auto;
    justify-self: end;
    transform: translateX(30px);
}

.shape--halfcircle.entered {
    transform: translateX(0);
}

.shape--arc {
    width: 100%;
    max-width: 50vw;
    height: auto;
    transform: translateY(30px);
}

.shape--arc.entered {
    transform: translateY(0);
}

/* Shape hover nudge */
.shape-hover {
    transition: transform 300ms cubic-bezier(0.25, 0.46, 0.45, 0.94);
}

/* ---- Text Block ---- */
.text-block {
    z-index: 2;
    display: flex;
    flex-direction: column;
    justify-content: center;
}

.text-block--right {
    padding-left: 1rem;
}

.text-block--left {
    padding-right: 1rem;
}

/* ---- Dot Clusters ---- */
.dot-cluster {
    display: flex;
    flex-direction: column;
    gap: 6px;
    align-items: center;
}

.dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--co-burnt);
    opacity: 0;
    transform: scale(0);
    transition: opacity 200ms ease-out, transform 200ms ease-out;
}

.dot--light {
    background: var(--co-terracotta);
}

.dot.visible {
    opacity: 1;
    transform: scale(1);
}

/* ---- Grid Overlay ---- */
.grid-overlay {
    position: absolute;
    inset: 0;
    pointer-events: none;
    z-index: 0;
    background-image: radial-gradient(circle, var(--co-grid) 1px, transparent 1px);
    background-size: 48px 48px;
    opacity: 0.6;
}

/* ---- Index List ---- */
.index-list {
    list-style: none;
    padding: 0;
    margin-top: 1.5em;
}

.index-item {
    display: flex;
    align-items: center;
    gap: 1.2em;
    margin-bottom: 1.4em;
    font-family: var(--font-body);
    font-size: clamp(14px, 1.1vw, 18px);
    line-height: 1.75;
    color: var(--co-ink);
}

.index-marker {
    flex-shrink: 0;
    display: inline-block;
}

.index-marker--circle {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: var(--co-burnt);
}

.index-marker--triangle {
    width: 0;
    height: 0;
    border-left: 6px solid transparent;
    border-right: 6px solid transparent;
    border-bottom: 10px solid var(--co-sienna);
}

.index-marker--square {
    width: 10px;
    height: 10px;
    background: var(--co-umber);
    border-radius: 2px;
}

.index-line {
    position: absolute;
    left: 0;
    top: 15%;
    height: 70%;
    width: 2px;
}

/* ---- Frame Counter ---- */
.frame-counter {
    position: fixed;
    bottom: 1.5rem;
    right: 1.5rem;
    font-family: var(--font-accent);
    font-size: 13px;
    color: var(--co-reg);
    z-index: 100;
    display: flex;
    align-items: center;
    gap: 2px;
    user-select: none;
}

.frame-counter__current {
    display: inline-block;
    overflow: hidden;
    height: 1.2em;
    position: relative;
}

.frame-counter__separator {
    opacity: 0.7;
}

/* Counter on dark frames */
.frame-counter.on-dark {
    color: rgba(208, 202, 188, 0.5);
}

/* ---- Typewriter Cursor ---- */
.typewriter-cursor {
    display: inline-block;
    width: 0.55em;
    height: 1.15em;
    background: var(--co-burnt);
    vertical-align: text-bottom;
    margin-left: 2px;
    animation: blink 600ms step-end infinite;
}

.typewriter-cursor.fade-out {
    animation: none;
    opacity: 0;
    transition: opacity 300ms ease-out;
}

@keyframes blink {
    0%, 100% { opacity: 1; }
    50% { opacity: 0; }
}

/* ---- Link Hover Underline ---- */
.index-item {
    position: relative;
    cursor: default;
}

.index-text {
    position: relative;
    display: inline-block;
    transition: color 200ms ease;
}

.index-text::after {
    content: '';
    position: absolute;
    left: 0;
    bottom: -2px;
    width: 0;
    height: 1px;
    background: var(--co-burnt);
    transition: width 200ms ease;
}

.index-item:hover .index-text {
    color: var(--co-burnt);
}

.index-item:hover .index-text::after {
    width: 100%;
}

/* ---- Responsive (below 768px) ---- */
@media (max-width: 768px) {
    .frame__grid {
        grid-template-columns: 1fr;
    }

    .frame__margin {
        display: none;
    }

    .frame__content {
        padding: 2rem 1.5rem;
    }

    .frame__content--split,
    .frame__content--split-reverse {
        grid-template-columns: 1fr;
        gap: 2rem;
    }

    .hero-circle {
        width: 60vw;
        height: 60vw;
        right: -10%;
        top: 5%;
    }

    .closing-circle {
        width: 60vw;
        height: 60vw;
    }

    .hero-title {
        bottom: 2rem;
        left: 1.5rem;
    }

    .hero-title__text {
        font-size: clamp(28px, 10vw, 56px);
    }

    .shape--triangle {
        max-width: 80vw;
    }

    .shape--halfcircle {
        max-width: 60vw;
    }

    .shape--arc {
        max-width: 70vw;
    }

    .body-text {
        font-size: 14px;
    }

    .statement-text {
        font-size: 16px;
        padding: 0 0.5rem;
    }

    .closing-text {
        bottom: 2rem;
        left: 1.5rem;
    }

    .grid-overlay {
        background-size: 32px 32px;
    }

    .index-line {
        display: none;
    }
}
