/* === RESET & BASE === */
*, *::before, *::after { margin: 0; padding: 0; box-sizing: border-box; }

:root {
    --deep-void: #0A0A0A;
    --obsidian: #1A1A1A;
    --old-gold: #D4A843;
    --parchment: #E8DCC8;
    --bronze: #8C7E6A;
    --aero-glow: #3D8B7A;
    --prism-edge: #B8860B;
    --panel-mid: #252525;
}

html {
    scroll-behavior: smooth;
    background: var(--deep-void);
}

body {
    font-family: 'Source Serif 4', Georgia, serif;
    color: var(--parchment);
    background: var(--deep-void);
    overflow-x: hidden;
    line-height: 1.85;
}

/* === TYPOGRAPHY === */
.caveat-display {
    font-family: 'Caveat', cursive;
    color: var(--old-gold);
    letter-spacing: 0.02em;
    font-weight: 700;
}

.caveat-subtitle {
    font-family: 'Caveat', cursive;
    color: var(--old-gold);
    font-style: italic;
    font-size: clamp(1.1rem, 2vw, 1.6rem);
    opacity: 0;
    transition: opacity 0.8s ease;
}

/* === SPREADS === */
.spread {
    min-height: 100vh;
    width: 100%;
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
}

/* === HERO / APERTURE === */
#aperture {
    flex-direction: column;
    background: var(--deep-void);
    background-image: radial-gradient(ellipse at 30% 50%, rgba(212, 168, 67, 0.12) 0%, transparent 70%);
}

#hero-title {
    font-size: clamp(4rem, 12vw, 10rem);
    opacity: 0;
    position: relative;
    z-index: 2;
}

#hero-title span {
    display: inline-block;
    opacity: 0;
    transform: translateY(8px);
    transition: opacity 0.4s ease, transform 0.4s ease;
}

#hero-title span.visible {
    opacity: 1;
    transform: translateY(0);
}

.hero-content {
    text-align: center;
    position: relative;
    z-index: 2;
}

.hero-line {
    width: 1px;
    height: 0;
    background: var(--old-gold);
    margin: 2rem auto 0;
    transition: height 1.5s ease;
}

.hero-line.extended {
    height: 80px;
}

/* === BLOBS === */
.blob {
    position: absolute;
    border-radius: 40% 60% 55% 45% / 55% 40% 65% 35%;
    background: radial-gradient(circle, rgba(61, 139, 122, 0.15) 0%, rgba(212, 168, 67, 0.08) 50%, transparent 100%);
    filter: blur(60px);
    z-index: 0;
    pointer-events: none;
}

.blob-hero {
    width: 50vw;
    height: 50vw;
    max-width: 600px;
    max-height: 600px;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    opacity: 0;
    animation: blobMorph1 24s ease-in-out infinite, blobDrift1 20s ease-in-out infinite;
}

.blob-hero.visible {
    opacity: 0.1;
    transition: opacity 1.5s ease;
}

.blob-section {
    width: 300px;
    height: 300px;
    bottom: -50px;
    right: -50px;
    opacity: 0.08;
    animation: blobMorph2 28s ease-in-out infinite, blobDrift2 22s ease-in-out infinite;
}

@keyframes blobMorph1 {
    0%   { border-radius: 40% 60% 55% 45% / 55% 40% 65% 35%; }
    25%  { border-radius: 55% 45% 60% 40% / 40% 60% 35% 65%; }
    50%  { border-radius: 45% 55% 40% 60% / 60% 35% 55% 45%; }
    75%  { border-radius: 60% 40% 45% 55% / 35% 65% 40% 60%; }
    100% { border-radius: 40% 60% 55% 45% / 55% 40% 65% 35%; }
}

@keyframes blobMorph2 {
    0%   { border-radius: 55% 45% 50% 50% / 50% 55% 45% 50%; }
    33%  { border-radius: 45% 55% 60% 40% / 55% 45% 50% 50%; }
    66%  { border-radius: 50% 50% 45% 55% / 40% 60% 55% 45%; }
    100% { border-radius: 55% 45% 50% 50% / 50% 55% 45% 50%; }
}

@keyframes blobDrift1 {
    0%, 100% { transform: translate(-50%, -50%) translate(0, 0); }
    50%      { transform: translate(-50%, -50%) translate(3vw, -2vw); }
}

@keyframes blobDrift2 {
    0%, 100% { transform: translate(0, 0); }
    50%      { transform: translate(-5vw, 3vw); }
}

/* === MARGINALIA GUTTERS === */
.marginalia-gutter {
    height: 60px;
    overflow: hidden;
    display: flex;
    align-items: center;
    position: relative;
    background: var(--deep-void);
}

.marginalia-track {
    white-space: nowrap;
    animation: marginalia-scroll 40s linear infinite;
}

.marginalia-track span {
    font-family: 'Caveat', cursive;
    font-size: 0.75rem;
    color: var(--old-gold);
    opacity: 0.3;
    letter-spacing: 0.05em;
}

@keyframes marginalia-scroll {
    from { transform: translateX(0); }
    to   { transform: translateX(-50%); }
}

/* === CONCEPT SPREADS === */
.concept-spread {
    background: var(--deep-void);
}

.spread-grid {
    display: grid;
    grid-template-columns: 55% 45%;
    width: 100%;
    min-height: 100vh;
    align-items: center;
}

.spread-grid.reverse {
    grid-template-columns: 45% 55%;
}

.spread-visual {
    padding: 4vw;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
}

.spread-text {
    padding: 8vw;
}

.concept-title {
    font-size: clamp(2.5rem, 5vw, 4.5rem);
    margin-bottom: 1.5rem;
    opacity: 0;
    transform: translateY(20px);
    transition: opacity 0.6s ease, transform 0.6s ease;
}

.concept-title.animate-in {
    opacity: 1;
    transform: translateY(0);
}

.concept-body {
    font-size: clamp(1rem, 1.3vw, 1.2rem);
    line-height: 1.85;
    max-width: 38em;
    margin-bottom: 1.2em;
    color: var(--parchment);
    opacity: 0;
    transform: translateY(15px);
    transition: opacity 0.5s ease, transform 0.5s ease;
}

.concept-body.animate-in {
    opacity: 1;
    transform: translateY(0);
}

/* === GLOSSY PANELS (Frutiger Aero) === */
.glossy-panel {
    background: linear-gradient(135deg, #1A1A1A 0%, #252525 45%, #1A1A1A 100%);
    backdrop-filter: blur(12px);
    border-radius: 16px;
    border: 1px solid rgba(212, 168, 67, 0.12);
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.06), 0 0 30px rgba(212, 168, 67, 0.08);
    padding: 2rem;
    position: relative;
    overflow: hidden;
    width: 100%;
    aspect-ratio: 4 / 3;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transform: translateX(-40px);
    transition: opacity 0.6s ease, transform 0.6s ease, box-shadow 0.4s ease;
}

.reverse .spread-visual .glossy-panel {
    transform: translateX(40px);
}

.glossy-panel.animate-in {
    opacity: 1;
    transform: translateX(0);
}

.glossy-panel:hover {
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.1), 0 0 40px rgba(212, 168, 67, 0.15);
    border-color: rgba(212, 168, 67, 0.2);
}

/* === GRID OVERLAY === */
.grid-overlay {
    position: absolute;
    inset: 0;
    background-image:
        repeating-linear-gradient(0deg, rgba(212, 168, 67, 0.06) 0 1px, transparent 1px 80px),
        repeating-linear-gradient(90deg, rgba(212, 168, 67, 0.06) 0 1px, transparent 1px 80px);
    opacity: 0;
    transition: opacity 0.8s ease;
    z-index: 0;
    pointer-events: none;
}

.grid-overlay.animate-in {
    opacity: 1;
}

/* === SVG DIAGRAMS === */
.diagram {
    width: 100%;
    height: 100%;
    position: relative;
    z-index: 1;
}

.diagram-line {
    stroke: var(--old-gold);
    stroke-width: 2;
    fill: none;
    stroke-dasharray: 500;
    stroke-dashoffset: 500;
    transition: stroke-dashoffset 2s ease;
}

.diagram-line.animate-in {
    stroke-dashoffset: 0;
}

.diagram-line-thin {
    stroke: var(--old-gold);
    stroke-width: 1;
    fill: none;
    opacity: 0.4;
    stroke-dasharray: 500;
    stroke-dashoffset: 500;
    transition: stroke-dashoffset 2s ease;
}

.diagram-line-thin.animate-in {
    stroke-dashoffset: 0;
}

.diagram-ring {
    stroke: var(--old-gold);
    stroke-width: 1.5;
    fill: none;
    opacity: 0.5;
    stroke-dasharray: 1000;
    stroke-dashoffset: 1000;
    transition: stroke-dashoffset 2.5s ease;
}

.diagram-ring.animate-in {
    stroke-dashoffset: 0;
}

.diagram-node {
    fill: var(--old-gold);
    opacity: 0;
    transition: opacity 0.6s ease 1.5s;
}

.diagram-node.animate-in {
    opacity: 1;
}

.diagram-label {
    font-family: 'Caveat', cursive;
    font-size: 14px;
    fill: var(--old-gold);
    opacity: 0;
    transition: opacity 0.6s ease 1.8s;
}

.diagram-label.animate-in {
    opacity: 1;
}

.diagram-label-title {
    font-size: 18px;
}

.diagram-cell {
    opacity: 0;
    transition: opacity 0.5s ease 1.5s;
}

.diagram-cell.animate-in {
    opacity: 1;
}

.diagram-cell.high {
    fill: rgba(212, 168, 67, 0.3);
}

.diagram-cell.med {
    fill: rgba(212, 168, 67, 0.15);
}

.diagram-cell.low {
    fill: rgba(140, 126, 106, 0.15);
}

/* === INDEX SECTION === */
#index {
    flex-direction: column;
    padding: 8vh 4vw;
    min-height: 100vh;
}

.index-title {
    font-size: clamp(2.5rem, 5vw, 4.5rem);
    margin-bottom: 4rem;
    text-align: center;
}

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

.index-card {
    background: linear-gradient(135deg, #1A1A1A, #0D0D0D);
    border-radius: 16px;
    border: 1px solid rgba(212, 168, 67, 0.1);
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.04), 0 4px 20px rgba(0, 0, 0, 0.3);
    padding: 2rem;
    opacity: 0;
    transform: translateY(30px);
    transition: opacity 0.5s ease, transform 0.5s ease, box-shadow 0.3s ease, border-color 0.3s ease;
}

.index-card.animate-in {
    opacity: 1;
    transform: translateY(0);
}

.index-card:hover {
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.08), 0 4px 30px rgba(212, 168, 67, 0.1);
    border-color: rgba(212, 168, 67, 0.2);
}

.card-title {
    font-family: 'Caveat', cursive;
    color: var(--old-gold);
    font-size: 1.6rem;
    margin-bottom: 0.5rem;
    letter-spacing: 0.02em;
}

.card-desc {
    font-family: 'DM Sans', sans-serif;
    font-size: clamp(0.7rem, 1vw, 0.85rem);
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: var(--bronze);
    font-weight: 400;
    line-height: 1.6;
}

/* === LOGIC SYMBOLS === */
.logic-symbols {
    position: fixed;
    inset: 0;
    pointer-events: none;
    z-index: 1;
}

.logic-sym {
    position: absolute;
    font-family: 'Caveat', cursive;
    font-size: 2.5rem;
    color: var(--bronze);
    opacity: 0.15;
}

/* === MOBILE === */
@media (max-width: 768px) {
    .spread-grid,
    .spread-grid.reverse {
        grid-template-columns: 1fr;
    }

    .spread-grid .spread-visual {
        order: -1;
    }

    .spread-text {
        padding: 6vw;
    }

    .glossy-panel {
        aspect-ratio: 4 / 3;
    }

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

    .blob-section {
        width: 180px;
        height: 180px;
    }

    .marginalia-gutter {
        display: none;
    }

    .logic-symbols {
        display: none;
    }
}

@media (max-width: 768px) and (orientation: landscape) {
    .marginalia-gutter {
        display: flex;
    }
}
