:root {
    --bg-primary: #1a120a;
    --bg-secondary: #2c1e0f;
    --text-primary: #f5efe0;
    --text-secondary: #d4c5a9;
    --accent-gold: #c9a84c;
    --accent-coral: #d4654a;
    --accent-teal: #3a8f85;
    --accent-magenta: #9b2d5e;
    --fish-speed: 60s;
    --scanline-opacity: 0.15;
    --glitch-intensity: 1;
}

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

html {
    scroll-behavior: smooth;
}

body {
    background-color: var(--bg-primary);
    color: var(--text-secondary);
    font-family: 'Cormorant Garamond', serif;
    font-weight: 400;
    font-size: clamp(17px, 1.8vw, 21px);
    line-height: 1.72;
    letter-spacing: 0.01em;
    overflow-x: hidden;
}

/* Scanline overlay */
body::after {
    content: '';
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: repeating-linear-gradient(
        0deg,
        transparent 0px,
        transparent 1px,
        rgba(26, 18, 10, 0.15) 1px,
        rgba(26, 18, 10, 0.15) 2px
    );
    pointer-events: none;
    z-index: 9999;
    opacity: var(--scanline-opacity);
    transition: opacity 200ms ease;
}

/* ============================================================
   PROGRESS INDICATOR
   ============================================================ */

.progress-track {
    position: fixed;
    top: 0;
    right: 12px;
    width: 2px;
    height: 100vh;
    background: rgba(201, 168, 76, 0.1);
    z-index: 1000;
}

.progress-bar {
    width: 2px;
    height: 0%;
    background: var(--accent-gold);
    transition: height 100ms linear;
}

.progress-diamond {
    position: absolute;
    left: -3px;
    width: 8px;
    height: 8px;
    background: var(--bg-primary);
    border: 1px solid var(--accent-gold);
    transform: rotate(45deg);
    transition: box-shadow 300ms ease;
}

.progress-diamond:hover {
    box-shadow: 0 0 12px rgba(201, 168, 76, 0.3);
}

/* ============================================================
   FOLIOS - BASE
   ============================================================ */

.folio {
    min-height: 100vh;
    width: 100%;
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: opacity 0.6s ease;
}

.folio.visible {
    opacity: 1;
}

.folio-title {
    opacity: 1;
}

/* Vignette on all folios */
.folio::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: radial-gradient(ellipse at center, transparent 60%, rgba(26, 18, 10, 0.4) 100%);
    pointer-events: none;
    z-index: 1;
}

.folio > * {
    position: relative;
    z-index: 2;
}

/* Folio background variations */
.folio-text {
    background: var(--bg-primary);
}

.folio-gallery {
    background: var(--bg-secondary);
    flex-direction: column;
}

.folio-detail {
    background: var(--bg-secondary);
}

.folio-archive {
    background: var(--bg-primary);
}

.folio-colophon {
    background: var(--bg-primary);
}

/* ============================================================
   EDITORIAL GRID
   ============================================================ */

.folio-grid {
    display: grid;
    grid-template-columns: minmax(40px, 8vw) 1fr minmax(40px, 8vw);
    grid-template-areas: "gutter column margin";
    width: 100%;
    max-width: 100%;
    padding: 8vh 0;
    align-items: start;
}

.folio-column {
    grid-area: column;
    max-width: 38ch;
}

.folio-margin {
    grid-area: margin;
    display: flex;
    align-items: flex-start;
    justify-content: center;
    padding-top: 33.33vh;
}

.margin-content {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 2rem;
}

.folio-content {
    text-align: center;
    position: relative;
}

/* ============================================================
   TYPOGRAPHY
   ============================================================ */

/* Title - Playfair Display Italic */
.title {
    font-family: 'Playfair Display', serif;
    font-weight: 700;
    font-style: italic;
    font-size: clamp(56px, 8vw, 120px);
    color: var(--text-primary);
    letter-spacing: 0.02em;
    line-height: 1.05;
    opacity: 0;
    text-shadow: 2px 0 var(--accent-teal), -2px 0 var(--accent-magenta), 0 0 8px rgba(201, 168, 76, 0.2);
}

.title.revealed {
    opacity: 0.6;
    transition: opacity 800ms ease;
}

/* Subtitle - Space Grotesk */
.subtitle {
    font-family: 'Space Grotesk', sans-serif;
    font-weight: 500;
    font-size: clamp(10px, 1vw, 13px);
    letter-spacing: 0.18em;
    color: var(--accent-gold);
    margin-top: 1.5rem;
    opacity: 0;
    text-transform: uppercase;
}

.subtitle.revealed {
    opacity: 0.6;
    transition: opacity 600ms ease 200ms;
}

/* Folio numbers - Space Grotesk */
.folio-number {
    font-family: 'Space Grotesk', sans-serif;
    font-weight: 500;
    font-size: clamp(10px, 1vw, 13px);
    letter-spacing: 0.18em;
    color: var(--accent-gold);
    text-transform: uppercase;
    display: block;
    margin-bottom: 1.5rem;
}

/* Folio headings - Playfair Display upright */
.folio-heading {
    font-family: 'Playfair Display', serif;
    font-weight: 700;
    font-size: clamp(36px, 5vw, 72px);
    color: var(--text-primary);
    letter-spacing: 0.02em;
    line-height: 1.05;
    margin-bottom: 2rem;
    text-shadow: 2px 0 var(--accent-teal), -2px 0 var(--accent-magenta), 0 0 8px rgba(201, 168, 76, 0.2);
}

/* Body text - Cormorant Garamond */
.body-text {
    color: var(--text-secondary);
    margin-bottom: 1.5rem;
    font-weight: 400;
}

/* Pull-quotes - Playfair Display Italic */
.pull-quote {
    font-family: 'Playfair Display', serif;
    font-weight: 700;
    font-style: italic;
    font-size: clamp(24px, 3vw, 40px);
    color: var(--text-primary);
    letter-spacing: 0.02em;
    line-height: 1.3;
    background-image: linear-gradient(90deg, transparent 0%, rgba(201, 168, 76, 0.08) 50%, transparent 100%);
    background-size: 200% 100%;
    background-position: 100% 0;
    animation: shimmer 8s linear infinite;
    padding: 1rem 0;
}

.pull-quote-small {
    font-size: clamp(18px, 2.2vw, 30px);
}

@keyframes shimmer {
    from { background-position: 100% 0; }
    to { background-position: -100% 0; }
}

/* ============================================================
   TITLE FOLIO - SCANLINE SWEEP
   ============================================================ */

.scanline-sweep {
    position: absolute;
    left: 0;
    top: 0;
    width: 100%;
    height: 1px;
    background: var(--accent-gold);
    opacity: 0;
    z-index: 10;
}

.scanline-sweep.active {
    opacity: 0.4;
    animation: sweepDown 800ms linear 400ms forwards;
}

@keyframes sweepDown {
    from { top: 0; }
    to { top: 100%; opacity: 0; }
}

/* ============================================================
   FISH ANIMATIONS
   ============================================================ */

/* Moorish Idol on title folio */
.fish-moorish-idol {
    position: absolute;
    bottom: 10vh;
    right: 8vw;
    width: 120px;
    height: 100px;
    opacity: 0;
    animation: fishDrift var(--fish-speed) linear infinite;
}

.fish-moorish-idol.revealed {
    opacity: 0.1;
    transition: opacity 1s ease;
}

@keyframes fishDrift {
    from { transform: translateY(10vh); }
    to { transform: translateY(-10vh); }
}

/* Margin drifting fish */
.fish-margin-drift {
    width: 100px;
    height: 84px;
    opacity: 0.15;
    animation: fishDriftMargin var(--fish-speed) linear infinite;
}

@keyframes fishDriftMargin {
    0% { transform: translateY(5vh); }
    50% { transform: translateY(-5vh); }
    100% { transform: translateY(5vh); }
}

/* Detail folio fish */
.fish-detail {
    width: 120px;
    height: 100px;
}

/* Seahorse - colophon */
.seahorse {
    margin-top: 3rem;
    width: 60px;
    height: 100px;
    animation: seahorsePulse 4s ease-in-out infinite;
}

@keyframes seahorsePulse {
    0%, 100% { opacity: 0.3; }
    50% { opacity: 0.5; }
}

/* ============================================================
   TRIPTYCH GALLERY
   ============================================================ */

.triptych {
    display: grid;
    grid-template-columns: 1.2fr 0.8fr 1fr;
    gap: 2rem;
    padding: 2rem 8vw;
    width: 100%;
}

.glitch-panel {
    background: var(--bg-secondary);
    border: 1px solid rgba(201, 168, 76, 0.1);
    padding: 2rem;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1rem;
}

.glitch-panel svg {
    width: 100%;
    max-width: 160px;
    height: auto;
}

/* Pixel displacement effect */
.panel-2 {
    transform: translateY(3px);
}

.panel-3 {
    transform: translate(-2px, 1px);
}

.panel-label {
    font-family: 'Space Grotesk', sans-serif;
    font-weight: 500;
    font-size: clamp(10px, 1vw, 13px);
    letter-spacing: 0.18em;
    color: var(--accent-gold);
}

/* ============================================================
   WAVE DIVIDER
   ============================================================ */

.wave-divider {
    width: 100%;
    height: 24px;
    margin: 2rem 0;
}

/* ============================================================
   ARCHIVE CATALOG
   ============================================================ */

.catalog {
    list-style: none;
    padding: 0;
}

.catalog-entry {
    display: flex;
    gap: 1rem;
    align-items: flex-start;
    margin-bottom: 2rem;
    padding-bottom: 2rem;
    border-bottom: 1px solid rgba(201, 168, 76, 0.08);
}

.catalog-entry:last-child {
    border-bottom: none;
}

.fish-bullet {
    width: 24px;
    height: 24px;
    flex-shrink: 0;
    margin-top: 4px;
}

.catalog-title {
    font-family: 'Space Grotesk', sans-serif;
    font-weight: 500;
    font-size: clamp(10px, 1vw, 13px);
    letter-spacing: 0.18em;
    color: var(--accent-gold);
    display: block;
    margin-bottom: 0.5rem;
}

.catalog-desc {
    font-family: 'Cormorant Garamond', serif;
    font-weight: 300;
    font-size: clamp(13px, 1.2vw, 15px);
    color: var(--text-secondary);
    line-height: 1.6;
}

/* ============================================================
   COLOPHON
   ============================================================ */

.folio-colophon .folio-content {
    max-width: 38ch;
}

.colophon-heading {
    font-style: italic;
}

.colophon-text {
    font-family: 'Cormorant Garamond', serif;
    font-weight: 400;
    font-size: clamp(17px, 1.8vw, 21px);
    color: var(--text-secondary);
    line-height: 1.72;
    margin-top: 2rem;
    margin-bottom: 2rem;
}

.colophon-dot {
    font-size: 2rem;
    color: var(--accent-gold);
    opacity: 0.6;
    margin-top: 2rem;
}

/* ============================================================
   GLITCH EFFECT
   ============================================================ */

.glitch-active {
    animation: glitchShift 100ms steps(1) 2;
}

@keyframes glitchShift {
    0% { transform: translateX(2px); }
    50% { transform: translateX(-2px); }
    100% { transform: translateX(0); }
}

/* ============================================================
   RESPONSIVE - MOBILE (below 768px)
   ============================================================ */

@media (max-width: 768px) {
    .folio-grid {
        grid-template-columns: 20px 1fr 20px;
        grid-template-areas:
            "gutter column gutter2"
            "gutter margin gutter2";
    }

    .folio-column {
        max-width: 90vw;
    }

    .folio-margin {
        padding-top: 2rem;
    }

    .triptych {
        grid-template-columns: 1fr;
        padding: 2rem 20px;
    }

    .panel-2, .panel-3 {
        transform: none;
    }

    /* Mobile progress: horizontal bar at bottom */
    .progress-track {
        top: auto;
        bottom: 0;
        left: 0;
        right: 0;
        width: 100%;
        height: 2px;
    }

    .progress-bar {
        width: 0%;
        height: 2px;
    }

    .progress-diamond {
        display: none;
    }

    .fish-moorish-idol {
        width: 80px;
        height: 67px;
        right: 20px;
    }

    .fish-margin-drift {
        width: 70px;
        height: 58px;
    }

    .pull-quote {
        font-size: clamp(20px, 5vw, 30px);
    }
}
