/* ============================================================
   relativity.quest — Forest-Green Editorial Physics Monograph
   ============================================================ */

/* --- CSS Custom Properties --- */
:root {
    --deep-forest: #1b3a2d;
    --evergreen: #2d5e47;
    --sage-mist: #7a9a8a;
    --bone-white: #f5f0e8;
    --warm-marble: #e8e0d4;
    --patina-bronze: #4a6b5a;
    --aged-gold: #b8a47c;
    --near-black: #2c2c2c;
}

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

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

body {
    background-color: var(--bone-white);
    color: var(--near-black);
    font-family: 'Cormorant Garamond', Georgia, serif;
    font-weight: 400;
    line-height: 1.72;
    letter-spacing: 0.01em;
    overflow-x: hidden;
    -webkit-font-smoothing: antialiased;
}

/* --- Typography --- */
.display-title {
    font-family: 'Playfair Display', Georgia, serif;
    font-weight: 900;
    font-size: clamp(3.5rem, 10vw, 9rem);
    letter-spacing: -0.04em;
    line-height: 0.88;
    color: var(--deep-forest);
}

.field-subtitle {
    font-family: 'Cormorant Garamond', Georgia, serif;
    font-weight: 400;
    font-size: clamp(1rem, 1.3vw, 1.15rem);
    line-height: 1.72;
    color: var(--near-black);
    margin-top: 2rem;
    max-width: 28ch;
}

.block-label {
    font-family: 'DM Sans', 'Helvetica Neue', sans-serif;
    font-weight: 500;
    font-size: clamp(0.75rem, 1vw, 0.9rem);
    letter-spacing: 0.12em;
    text-transform: uppercase;
    line-height: 1.4;
    color: var(--patina-bronze);
    display: block;
    margin-bottom: 0.5rem;
}

.block-headline {
    font-family: 'Playfair Display', Georgia, serif;
    font-weight: 900;
    font-size: clamp(1.5rem, 3vw, 2.2rem);
    letter-spacing: -0.02em;
    line-height: 0.95;
    color: var(--deep-forest);
    margin-bottom: 1rem;
}

.block-body {
    font-family: 'Cormorant Garamond', Georgia, serif;
    font-weight: 400;
    font-size: clamp(1rem, 1.3vw, 1.15rem);
    line-height: 1.72;
    color: var(--near-black);
}

.cell-caption {
    font-family: 'Space Grotesk', 'Courier New', monospace;
    font-weight: 400;
    font-size: clamp(0.7rem, 0.9vw, 0.85rem);
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: var(--sage-mist);
    position: absolute;
    bottom: 16px;
    left: 16px;
    z-index: 4;
}

.singularity-quote {
    font-family: 'Playfair Display', Georgia, serif;
    font-weight: 900;
    font-size: clamp(2.5rem, 6vw, 5rem);
    letter-spacing: -0.03em;
    line-height: 1.1;
    color: var(--bone-white);
    text-align: center;
    position: relative;
    z-index: 2;
    border: none;
    padding: 0;
}

.quote-line {
    display: block;
}

.quote-line + .quote-line {
    margin-top: 0.5em;
}

.horizon-text {
    font-family: 'Cormorant Garamond', Georgia, serif;
    font-weight: 400;
    font-size: clamp(1rem, 1.3vw, 1.15rem);
    line-height: 1.72;
    color: var(--bone-white);
}

.footer-domain {
    font-family: 'Space Grotesk', 'Courier New', monospace;
    font-weight: 400;
    font-size: 0.85rem;
    letter-spacing: 0.2em;
    text-transform: uppercase;
    color: var(--sage-mist);
    display: block;
}

.footer-year {
    font-family: 'Space Grotesk', 'Courier New', monospace;
    font-weight: 400;
    font-size: 0.85rem;
    letter-spacing: 0.2em;
    text-transform: uppercase;
    color: var(--sage-mist);
    display: block;
    margin-top: 0.5rem;
}

/* --- Duotone Image Treatment --- */
.duotone {
    position: relative;
    overflow: hidden;
    width: 100%;
    height: 100%;
}

.duotone-img {
    width: 100%;
    height: 100%;
    background-size: cover;
    background-position: center;
    filter: grayscale(100%) contrast(1.1);
}

.duotone::before {
    content: '';
    position: absolute;
    inset: 0;
    background: var(--deep-forest);
    mix-blend-mode: multiply;
    z-index: 1;
    pointer-events: none;
}

.duotone::after {
    content: '';
    position: absolute;
    inset: 0;
    background: var(--bone-white);
    mix-blend-mode: screen;
    opacity: 0.3;
    z-index: 2;
    pointer-events: none;
}

/* --- Marble Vein SVGs --- */
.marble-vein {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    z-index: 0;
    pointer-events: none;
}

.marble-vein path {
    stroke: var(--warm-marble);
    stroke-width: 1px;
    fill: none;
    opacity: 0.6;
}

/* --- Entablature Dividers --- */
.entablature {
    position: relative;
    width: 100%;
    max-width: 1440px;
    margin: 0 auto;
    padding: 0 clamp(24px, 4vw, 80px);
    height: 12px;
}

.entablature::before {
    content: '';
    position: absolute;
    left: clamp(24px, 4vw, 80px);
    right: clamp(24px, 4vw, 80px);
    top: 0;
    height: 1px;
    background: var(--patina-bronze);
}

.entablature::after {
    content: '';
    position: absolute;
    left: clamp(24px, 4vw, 80px);
    right: clamp(24px, 4vw, 80px);
    top: 5px;
    height: 2px;
    background: var(--sage-mist);
}

/* Third entablature line via box-shadow trick */
.entablature {
    box-shadow: inset 0 -1px 0 0 var(--warm-marble);
}

/* --- Fluted Border (Column Fluting) --- */
.fluted-border {
    position: absolute;
    left: 0;
    top: 0;
    bottom: 0;
    width: 8px;
    background: repeating-linear-gradient(
        90deg,
        var(--warm-marble) 0px,
        var(--bone-white) 1px,
        var(--warm-marble) 2px,
        transparent 2px,
        transparent 6px
    );
    z-index: 3;
}

/* ============================================================
   ZONE 1 — THE FIELD (Opening)
   ============================================================ */
#zone-field {
    position: relative;
    min-height: 100vh;
    display: flex;
    align-items: center;
    overflow: hidden;
    background: var(--bone-white);
}

.field-content {
    display: grid;
    grid-template-columns: 60% 5% 35%;
    width: 100%;
    max-width: 1440px;
    margin: 0 auto;
    padding: 120px clamp(24px, 4vw, 80px);
    min-height: 100vh;
    align-items: center;
    position: relative;
    z-index: 1;
}

.field-text {
    position: sticky;
    top: 30vh;
    align-self: start;
    padding-top: 15vh;
}

.field-image {
    height: 75vh;
    min-height: 400px;
    overflow: hidden;
}

.field-image .duotone {
    height: 100%;
}

.hero-architectural {
    background: linear-gradient(
        135deg,
        var(--deep-forest) 0%,
        var(--evergreen) 30%,
        var(--patina-bronze) 60%,
        var(--sage-mist) 100%
    );
}

/* Hero image CSS art - spiral staircase abstraction */
.hero-architectural::before {
    content: '';
    position: absolute;
    width: 200%;
    height: 200%;
    top: -50%;
    left: -50%;
    background:
        radial-gradient(ellipse at 60% 40%, transparent 20%, var(--deep-forest) 20.5%, transparent 21%),
        radial-gradient(ellipse at 60% 40%, transparent 30%, var(--evergreen) 30.5%, transparent 31%),
        radial-gradient(ellipse at 60% 40%, transparent 40%, var(--patina-bronze) 40.5%, transparent 41%),
        radial-gradient(ellipse at 60% 40%, transparent 50%, var(--sage-mist) 50.5%, transparent 51%),
        radial-gradient(ellipse at 60% 40%, transparent 60%, var(--warm-marble) 60.5%, transparent 61%);
    z-index: 0;
}

/* ============================================================
   ZONE 2 — THE CURVATURE (Portfolio Grid)
   ============================================================ */
#zone-curvature {
    position: relative;
    padding: 120px 0;
    background: var(--bone-white);
    overflow: hidden;
}

.curvature-grid {
    display: grid;
    grid-template-columns: 1fr 1fr 1fr;
    grid-template-rows: auto auto;
    gap: 2px;
    max-width: 1440px;
    margin: 0 auto;
    padding: 0 clamp(24px, 4vw, 80px);
    position: relative;
    z-index: 1;
}

.grid-cell {
    position: relative;
    overflow: hidden;
    opacity: 0;
    transform: scale(0.92);
    transition: opacity 600ms cubic-bezier(0.25, 0.46, 0.45, 0.94),
                transform 600ms cubic-bezier(0.25, 0.46, 0.45, 0.94);
    cursor: pointer;
}

.grid-cell.visible {
    opacity: 1;
    transform: scale(1);
}

.cell-tall {
    aspect-ratio: 3/4;
}

.cell-square {
    aspect-ratio: 1/1;
}

.cell-wide {
    aspect-ratio: 16/9;
}

/* Grid cell images - generated patterns */
.img-geodesic {
    background: linear-gradient(160deg, var(--deep-forest), var(--evergreen) 40%, var(--patina-bronze));
}

.img-frame {
    background: linear-gradient(45deg, var(--patina-bronze), var(--sage-mist) 50%, var(--deep-forest));
}

.img-lightcone {
    background: linear-gradient(200deg, var(--evergreen), var(--warm-marble) 40%, var(--deep-forest));
}

.img-tensor {
    background: linear-gradient(120deg, var(--sage-mist), var(--deep-forest) 60%, var(--evergreen));
}

.img-metric {
    background: linear-gradient(80deg, var(--deep-forest), var(--patina-bronze) 50%, var(--sage-mist));
}

.img-curvature {
    background: linear-gradient(300deg, var(--evergreen), var(--deep-forest) 40%, var(--sage-mist));
}

/* Hover warmth effect */
.grid-cell:hover .duotone::before {
    background: var(--evergreen);
    transition: background 400ms ease;
}

.grid-cell .duotone::before {
    transition: background 400ms ease;
}

/* Cell ripple on click */
.cell-ripple {
    position: absolute;
    border-radius: 50%;
    border: 1px solid var(--sage-mist);
    background: transparent;
    pointer-events: none;
    z-index: 5;
    animation: cellRippleExpand 2.4s cubic-bezier(0.0, 0.0, 0.2, 1) forwards;
}

@keyframes cellRippleExpand {
    0% {
        width: 0;
        height: 0;
        opacity: 0.6;
    }
    100% {
        width: 300px;
        height: 300px;
        opacity: 0;
    }
}

/* Grid gap rhythm */
.curvature-grid {
    column-gap: 2px;
    row-gap: 48px;
}

/* ============================================================
   ZONE 3 — THE SINGULARITY (Central Statement)
   ============================================================ */
#zone-singularity {
    position: relative;
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--deep-forest);
    overflow: hidden;
}

.geodesic-grid {
    position: absolute;
    inset: 0;
    background-image:
        linear-gradient(var(--warm-marble) 1px, transparent 1px),
        linear-gradient(90deg, var(--warm-marble) 1px, transparent 1px);
    background-size: 80px 80px;
    opacity: 0.08;
    transform: perspective(800px) rotateX(45deg);
    transform-origin: center 120%;
}

.singularity-content {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    padding: 0 clamp(24px, 4vw, 80px);
}

.ripple-container {
    position: absolute;
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    pointer-events: none;
}

.ripple-ring {
    position: absolute;
    border-radius: 50%;
    border: 1px solid var(--evergreen);
    background: transparent;
    width: 0;
    height: 0;
    animation: singularityRipple 4.8s cubic-bezier(0.0, 0.0, 0.2, 1) infinite;
}

@keyframes singularityRipple {
    0% {
        width: 0;
        height: 0;
        opacity: 0.4;
    }
    100% {
        width: 50vw;
        height: 50vw;
        opacity: 0;
    }
}

/* Background transition zones */
#zone-singularity {
    background: var(--deep-forest);
}

/* ============================================================
   ZONE 4 — THE DILATION (Timeline)
   ============================================================ */
#zone-dilation {
    position: relative;
    padding: 120px 0;
    background: var(--bone-white);
    overflow: hidden;
}

.timeline-container {
    position: relative;
    max-width: 1440px;
    margin: 0 auto;
    padding: 80px clamp(24px, 4vw, 80px);
}

.timeline-axis {
    position: absolute;
    left: 50%;
    top: 0;
    width: 1px;
    height: 0;
    background: var(--patina-bronze);
    transform: translateX(-50%);
    transition: height 0.1s linear;
}

.timeline-block {
    position: relative;
    width: 40%;
    margin-bottom: 80px;
    opacity: 0;
    transition: opacity 800ms ease, transform 800ms ease;
}

.block-left {
    margin-right: auto;
    margin-left: 2%;
    text-align: right;
    transform: translateX(-40px);
}

.block-right {
    margin-left: auto;
    margin-right: 2%;
    text-align: left;
    transform: translateX(40px);
}

.timeline-block.visible {
    opacity: 1;
    transform: translateX(0);
}

.block-circle {
    width: 120px;
    height: 120px;
    border-radius: 50%;
    overflow: hidden;
    margin-top: 1.5rem;
    display: inline-block;
}

.block-circle .duotone-img {
    border-radius: 50%;
}

.vein-timeline {
    z-index: 0;
}

/* ============================================================
   ZONE 5 — THE HORIZON (Closing)
   ============================================================ */
#zone-horizon {
    position: relative;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    background: var(--deep-forest);
    padding: 120px clamp(24px, 4vw, 80px);
}

.horizon-columns {
    display: grid;
    grid-template-columns: 1fr 1fr 1fr 1fr;
    gap: 48px;
    max-width: 1440px;
    width: 100%;
    margin-bottom: 120px;
}

.horizon-col {
    padding: 0 8px;
}

.horizon-footer {
    text-align: center;
}

.footer-domain.pulse {
    animation: domainPulse 3s ease-in-out infinite;
}

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

/* ============================================================
   SCROLL BACKGROUND TRANSITION
   ============================================================ */
.bg-transition-enter {
    position: relative;
}

.bg-transition-enter::before {
    content: '';
    position: fixed;
    inset: 0;
    background: var(--deep-forest);
    opacity: 0;
    pointer-events: none;
    z-index: 0;
    transition: opacity 300ms ease;
}

/* ============================================================
   ANIMATIONS
   ============================================================ */
@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(30px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* ============================================================
   RESPONSIVE
   ============================================================ */
@media (max-width: 1024px) {
    .field-content {
        grid-template-columns: 1fr;
        gap: 48px;
    }

    .field-text {
        position: relative;
        top: auto;
        padding-top: 0;
    }

    .field-image {
        height: 50vh;
    }

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

    .timeline-block {
        width: 60%;
    }

    .block-left {
        margin-left: 5%;
    }

    .block-right {
        margin-right: 5%;
    }

    .horizon-columns {
        grid-template-columns: 1fr 1fr;
        gap: 32px;
    }
}

@media (max-width: 640px) {
    .field-content {
        padding: 80px 24px;
    }

    .curvature-grid {
        grid-template-columns: 1fr;
        row-gap: 24px;
    }

    .cell-tall,
    .cell-square,
    .cell-wide {
        aspect-ratio: 4/3;
    }

    .timeline-block {
        width: 80%;
    }

    .block-left {
        text-align: left;
        margin-left: 15%;
    }

    .block-right {
        margin-left: 5%;
        margin-right: auto;
    }

    .timeline-axis {
        left: 8%;
    }

    .horizon-columns {
        grid-template-columns: 1fr;
        gap: 24px;
    }

    .singularity-quote {
        font-size: clamp(1.8rem, 5vw, 3rem);
    }
}
