/* ============================================
   continuum.quest -- Styles
   Cinematic Photography Archive
   ============================================ */

:root {
    --c-darkroom: #1A120B;
    --c-mahogany: #2C1F14;
    --c-copper: #D4A574;
    --c-ivory: #F5E6D3;
    --c-brass: #C4956A;
    --c-umber: #8B7355;
    --c-parchment: #E8D5C4;
    --c-archive: #3D2B1A;
    --f-display: 'Bebas Neue', sans-serif;
    --f-secondary: 'Oswald', sans-serif;
    --f-body: 'Source Serif 4', serif;
    --f-meta: 'IBM Plex Mono', monospace;
    --border-animate-duration: 0.8s;
    --border-animate-easing: cubic-bezier(0.25, 0.1, 0.25, 1.0);
}

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

html {
    scroll-behavior: smooth;
    background-color: var(--c-darkroom);
}

body {
    font-family: var(--f-body);
    background-color: var(--c-darkroom);
    color: var(--c-parchment);
    overflow-x: hidden;
    -webkit-font-smoothing: antialiased;
}

/* ============================================
   Grain Overlay
   ============================================ */

.grain-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 1000;
    opacity: 0.03;
    mix-blend-mode: overlay;
    background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 256 256' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='noise'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='256' height='256' filter='url(%23noise)' opacity='1'/%3E%3C/svg%3E");
    background-repeat: repeat;
    background-size: 256px 256px;
}

/* ============================================
   12-Column Grid with Atmospheric Margins
   ============================================ */

.frame-section {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
}

.safe-frame {
    width: 100%;
    max-width: 100%;
    padding: 0 calc(100vw * 2 / 12);
    position: relative;
}

/* ============================================
   Vertical Navigation (Left Margin)
   ============================================ */

.vertical-nav {
    position: fixed;
    left: calc(100vw * 0.5 / 12);
    top: 50%;
    transform: translateY(-50%);
    z-index: 100;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 12px;
}

.nav-letter {
    font-family: var(--f-display);
    font-size: 11px;
    letter-spacing: 0.4em;
    color: var(--c-umber);
    text-decoration: none;
    writing-mode: vertical-lr;
    text-orientation: mixed;
    transition: color 0.4s var(--border-animate-easing);
    display: block;
    width: 11px;
    text-align: center;
}

.nav-letter:hover,
.nav-letter.active {
    color: var(--c-copper);
}

/* ============================================
   Constellation Navigation (Right Margin)
   ============================================ */

.constellation-nav {
    position: fixed;
    right: calc(100vw * 0.5 / 12);
    top: 50%;
    transform: translateY(-50%);
    z-index: 100;
    opacity: 0.6;
}

.constellation-dot {
    transition: opacity 0.4s var(--border-animate-easing);
}

.constellation-dot.active {
    opacity: 1;
    filter: drop-shadow(0 0 4px rgba(196, 149, 106, 0.5));
}

/* ============================================
   Opening Frame
   ============================================ */

.opening-frame {
    min-height: 100vh;
    background-color: var(--c-darkroom);
}

.continuum-title {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 0.05em;
    position: relative;
}

.title-letter {
    font-family: var(--f-display);
    font-size: clamp(80px, 15vw, 200px);
    color: var(--c-ivory);
    letter-spacing: 0.15em;
    line-height: 0.85;
    opacity: 0;
    transition: opacity 0.6s var(--border-animate-easing);
}

.title-letter.visible {
    opacity: 1;
}

.title-letter.ghost {
    opacity: 0.08;
    transition: opacity 1.5s var(--border-animate-easing);
}

/* ============================================
   Archive Entry
   ============================================ */

.archive-entry {
    min-height: 100vh;
    background-color: var(--c-darkroom);
}

.archive-image-wrapper {
    width: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
}

.archive-image {
    width: 100%;
    aspect-ratio: 2.39 / 1;
    position: relative;
    overflow: hidden;
    border: 1px solid var(--c-archive);
    box-shadow: inset 0 0 30px rgba(26, 18, 11, 0.5);
    filter: sepia(0.35) contrast(1.1) brightness(0.9) saturate(0.7);
}

.archive-image-svg {
    width: 100%;
    height: 100%;
    display: block;
}

.image-vignette {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    box-shadow: inset 0 0 60px rgba(26, 18, 11, 0.7);
    pointer-events: none;
}

.archive-caption {
    margin-top: 2rem;
    text-align: center;
}

.archive-caption .body-text {
    font-family: var(--f-body);
    font-size: 18px;
    line-height: 1.65;
    color: var(--c-parchment);
    font-style: italic;
    max-width: 600px;
    margin: 0 auto;
}

/* ============================================
   Portfolio Grid (Continuum Grid)
   ============================================ */

.portfolio-section {
    min-height: auto;
    padding: 4rem 0;
}

.continuum-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 2px;
    width: 100%;
}

/* Module 1: hero top-left */
.module-1 .hero-cell {
    grid-column: 1 / 3;
    grid-row: 1 / 3;
}
.module-1 .accent-cell:nth-child(2) {
    grid-column: 3;
    grid-row: 1;
}
.module-1 .accent-cell:nth-child(3) {
    grid-column: 3;
    grid-row: 2;
}
.module-1 .breath-cell {
    grid-column: 1 / 4;
    grid-row: 3;
}

/* Module 2: hero top-right */
.module-2 .accent-cell:nth-child(1) {
    grid-column: 1;
    grid-row: 1;
}
.module-2 .accent-cell:nth-child(2) {
    grid-column: 1;
    grid-row: 2;
}
.module-2 .hero-cell {
    grid-column: 2 / 4;
    grid-row: 1 / 3;
}
.module-2 .breath-cell {
    grid-column: 1 / 4;
    grid-row: 3;
}

/* Module 3: hero bottom-right */
.module-3 .accent-cell:nth-child(1) {
    grid-column: 1;
    grid-row: 1;
}
.module-3 .accent-cell:nth-child(2) {
    grid-column: 2;
    grid-row: 1;
}
.module-3 .breath-cell:nth-child(3) {
    grid-column: 1 / 4;
    grid-row: 2;
}
.module-3 .hero-cell {
    grid-column: 2 / 4;
    grid-row: 3 / 5;
}
.module-3 .accent-cell:nth-child(5) {
    grid-column: 1;
    grid-row: 3;
}

/* Module 4: hero bottom-left */
.module-4 .accent-cell:nth-child(1) {
    grid-column: 1;
    grid-row: 1;
}
.module-4 .accent-cell:nth-child(2) {
    grid-column: 2;
    grid-row: 1;
}
.module-4 .breath-cell:nth-child(3) {
    grid-column: 1 / 4;
    grid-row: 2;
}
.module-4 .hero-cell {
    grid-column: 1 / 3;
    grid-row: 3 / 5;
}
.module-4 .accent-cell:nth-child(5) {
    grid-column: 3;
    grid-row: 3;
}

/* ============================================
   Grid Cell Shared Styles
   ============================================ */

.grid-cell {
    position: relative;
    overflow: hidden;
    background-color: var(--c-mahogany);
}

.grid-cell .circuit-border {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 2;
}

.circuit-path {
    stroke: var(--c-archive);
    stroke-width: 1;
    fill: none;
    stroke-dasharray: 1000;
    stroke-dashoffset: 1000;
    transition: stroke-dashoffset var(--border-animate-duration) var(--border-animate-easing),
                stroke 0.4s var(--border-animate-easing);
}

.cell-animate.in-view .circuit-path {
    stroke-dashoffset: 0;
    stroke: var(--c-copper);
}

.cell-animate:hover .circuit-path {
    stroke: var(--c-brass);
}

.cell-animate:hover {
    box-shadow: 0 0 8px rgba(212, 165, 116, 0.2);
}

.circuit-border circle {
    transition: stroke 0.4s var(--border-animate-easing);
}

.cell-animate.in-view .circuit-border circle {
    stroke: var(--c-copper);
}

.cell-animate:hover .circuit-border circle {
    stroke: var(--c-brass);
}

/* Cell Content */
.cell-content {
    position: relative;
    z-index: 1;
    padding: 1.5rem;
    opacity: 0;
    transition: opacity 0.6s var(--border-animate-easing) 0.3s;
    height: 100%;
    display: flex;
    flex-direction: column;
    justify-content: flex-end;
}

.cell-animate.in-view .cell-content {
    opacity: 1;
}

/* Hero Cell */
.hero-cell {
    min-height: 350px;
}

.cell-image {
    width: 100%;
    aspect-ratio: 4 / 3;
    overflow: hidden;
    border: 1px solid var(--c-archive);
    box-shadow: inset 0 0 30px rgba(26, 18, 11, 0.5);
    filter: sepia(0.35) contrast(1.1) brightness(0.9) saturate(0.7);
    margin-bottom: 1rem;
}

.cell-image svg {
    width: 100%;
    height: 100%;
    display: block;
}

.cell-headline {
    font-family: var(--f-secondary);
    font-weight: 300;
    font-size: clamp(24px, 3vw, 42px);
    color: var(--c-brass);
    margin-bottom: 0.5rem;
    letter-spacing: 0.02em;
}

.cell-meta {
    font-family: var(--f-meta);
    font-size: 11px;
    letter-spacing: 0.08em;
    color: var(--c-umber);
}

/* Accent Cell */
.accent-cell {
    min-height: 160px;
}

.accent-cell .cell-content {
    justify-content: center;
    align-items: flex-start;
    gap: 0.5rem;
}

.accent-label {
    font-family: var(--f-meta);
    font-size: 11px;
    letter-spacing: 0.08em;
    color: var(--c-umber);
    text-transform: uppercase;
}

.accent-number {
    font-family: var(--f-display);
    font-size: clamp(48px, 5vw, 72px);
    color: var(--c-ivory);
    line-height: 0.85;
    letter-spacing: 0.15em;
}

.accent-detail {
    font-family: var(--f-meta);
    font-size: 11px;
    letter-spacing: 0.08em;
    color: var(--c-umber);
    line-height: 1.6;
}

/* Breath Cell */
.breath-cell {
    min-height: 80px;
    background-color: transparent;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 2rem;
}

.breath-cell .cell-content {
    display: none;
}

.breath-border {
    width: 100%;
    height: 1px;
    background: linear-gradient(to right, transparent, var(--c-copper), transparent);
    opacity: 0;
    transition: opacity 0.8s var(--border-animate-easing);
    margin-bottom: 1rem;
}

.breath-cell.in-view .breath-border {
    opacity: 1;
}

.breath-text {
    font-family: var(--f-body);
    font-size: 16px;
    color: var(--c-umber);
    text-align: center;
    font-style: italic;
    opacity: 0;
    transition: opacity 0.6s var(--border-animate-easing) 0.4s;
}

.breath-cell.in-view .breath-text {
    opacity: 1;
}

/* ============================================
   Interstitial Reel Changes
   ============================================ */

.interstitial {
    min-height: 100vh;
    background-color: var(--c-darkroom);
}

.interstitial-content {
    width: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
}

.interstitial-rule {
    width: 100%;
    position: relative;
    margin-bottom: 3rem;
}

.rule-line {
    height: 1px;
    background-color: var(--c-copper);
    width: 0%;
    transition: width 1.5s var(--border-animate-easing);
}

.interstitial.in-view .rule-line {
    width: 100%;
}

.tick-marks {
    display: flex;
    justify-content: space-between;
    width: 100%;
    margin-top: 8px;
}

.tick {
    display: block;
    width: 1px;
    height: 4px;
    background-color: var(--c-umber);
}

.interstitial-word {
    font-family: var(--f-display);
    font-size: clamp(100px, 14vw, 180px);
    color: var(--c-ivory);
    letter-spacing: 0.15em;
    line-height: 0.85;
    opacity: 0.15;
    text-align: center;
}

/* ============================================
   Aperture Section
   ============================================ */

.aperture-section {
    min-height: 40vh;
    background-color: var(--c-darkroom);
}

.aperture-motif {
    display: flex;
    justify-content: center;
    align-items: center;
}

.aperture-svg {
    width: 120px;
    height: 120px;
    opacity: 0.5;
}

/* ============================================
   Closing Frame
   ============================================ */

.closing-frame {
    min-height: 100vh;
    background-color: var(--c-darkroom);
}

.quest-title {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 0.05em;
}

.quest-letter {
    font-family: var(--f-display);
    font-size: clamp(80px, 15vw, 200px);
    color: var(--c-ivory);
    letter-spacing: 0.15em;
    line-height: 0.85;
    opacity: 0;
    transition: opacity 0.6s var(--border-animate-easing);
}

.quest-letter.visible {
    opacity: 1;
}

.quest-letter.ghost {
    opacity: 0.08;
    transition: opacity 1.5s var(--border-animate-easing);
}

/* ============================================
   Responsive Adjustments
   ============================================ */

@media (max-width: 900px) {
    .safe-frame {
        padding: 0 calc(100vw * 1 / 12);
    }

    .vertical-nav {
        left: 8px;
    }

    .constellation-nav {
        right: 8px;
    }

    .continuum-grid {
        grid-template-columns: 1fr 1fr;
    }

    /* Module 1 responsive */
    .module-1 .hero-cell {
        grid-column: 1 / 3;
        grid-row: 1;
    }
    .module-1 .accent-cell:nth-child(2) {
        grid-column: 1;
        grid-row: 2;
    }
    .module-1 .accent-cell:nth-child(3) {
        grid-column: 2;
        grid-row: 2;
    }
    .module-1 .breath-cell {
        grid-column: 1 / 3;
        grid-row: 3;
    }

    /* Module 2 responsive */
    .module-2 .hero-cell {
        grid-column: 1 / 3;
        grid-row: 1;
    }
    .module-2 .accent-cell:nth-child(1) {
        grid-column: 1;
        grid-row: 2;
    }
    .module-2 .accent-cell:nth-child(2) {
        grid-column: 2;
        grid-row: 2;
    }
    .module-2 .breath-cell {
        grid-column: 1 / 3;
        grid-row: 3;
    }

    /* Module 3 responsive */
    .module-3 .hero-cell {
        grid-column: 1 / 3;
        grid-row: 3;
    }
    .module-3 .accent-cell:nth-child(1) {
        grid-column: 1;
        grid-row: 1;
    }
    .module-3 .accent-cell:nth-child(2) {
        grid-column: 2;
        grid-row: 1;
    }
    .module-3 .breath-cell:nth-child(3) {
        grid-column: 1 / 3;
        grid-row: 2;
    }
    .module-3 .accent-cell:nth-child(5) {
        grid-column: 1 / 3;
        grid-row: 4;
    }

    /* Module 4 responsive */
    .module-4 .hero-cell {
        grid-column: 1 / 3;
        grid-row: 3;
    }
    .module-4 .accent-cell:nth-child(1) {
        grid-column: 1;
        grid-row: 1;
    }
    .module-4 .accent-cell:nth-child(2) {
        grid-column: 2;
        grid-row: 1;
    }
    .module-4 .breath-cell:nth-child(3) {
        grid-column: 1 / 3;
        grid-row: 2;
    }
    .module-4 .accent-cell:nth-child(5) {
        grid-column: 1 / 3;
        grid-row: 4;
    }

    .hero-cell {
        min-height: 280px;
    }

    .accent-cell {
        min-height: 120px;
    }
}

@media (max-width: 600px) {
    .safe-frame {
        padding: 0 1rem;
    }

    .vertical-nav {
        display: none;
    }

    .constellation-nav {
        display: none;
    }

    .continuum-grid {
        grid-template-columns: 1fr;
    }

    .module-1 .hero-cell,
    .module-2 .hero-cell,
    .module-3 .hero-cell,
    .module-4 .hero-cell {
        grid-column: 1;
        grid-row: auto;
    }

    .module-1 .accent-cell:nth-child(2),
    .module-1 .accent-cell:nth-child(3),
    .module-2 .accent-cell:nth-child(1),
    .module-2 .accent-cell:nth-child(2),
    .module-3 .accent-cell:nth-child(1),
    .module-3 .accent-cell:nth-child(2),
    .module-3 .accent-cell:nth-child(5),
    .module-4 .accent-cell:nth-child(1),
    .module-4 .accent-cell:nth-child(2),
    .module-4 .accent-cell:nth-child(5) {
        grid-column: 1;
        grid-row: auto;
    }

    .module-1 .breath-cell,
    .module-2 .breath-cell,
    .module-3 .breath-cell:nth-child(3),
    .module-4 .breath-cell:nth-child(3) {
        grid-column: 1;
        grid-row: auto;
    }

    .interstitial-word {
        font-size: clamp(60px, 12vw, 120px);
    }
}
