/* ============================================
   paraligm.com — Chrome Metallic / Grain
   ============================================ */

/* --- Custom Properties --- */
:root {
    --void: #0e0f13;
    --chrome: #7b8794;
    --bright-chrome: #c0c7cf;
    --oxidized: #4a6e5a;
    --specimen: #8b6f47;
    --grain: #1c1c1f;
    --structure: #3a3d42;
    --flare: #e8ecf0;

    --text-color: #c0c7cf;
    --accent-color: #7b8794;
    --oxidation: 0;
    --heading-weight: 700;
}

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

html {
    scroll-behavior: smooth;
}

body {
    background: var(--void);
    color: var(--text-color);
    font-family: 'Cormorant Garamond', Georgia, serif;
    font-size: clamp(1rem, 1.3vw, 1.15rem);
    font-weight: 400;
    line-height: 1.75;
    letter-spacing: 0.01em;
    overflow-x: hidden;
}

/* --- Grain Overlay --- */
#grain-overlay {
    position: fixed;
    top: -10px;
    left: -10px;
    width: calc(100vw + 20px);
    height: calc(100vh + 20px);
    pointer-events: none;
    z-index: 9999;
    mix-blend-mode: overlay;
    opacity: 0.08;
    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='100%25' height='100%25' filter='url(%23noise)'/%3E%3C/svg%3E");
    background-size: 256px 256px;
    will-change: transform;
    animation: grain 0.8s steps(8) infinite;
}

@keyframes grain {
    0%   { transform: translate(0, 0); }
    12%  { transform: translate(-1px, 1px); }
    25%  { transform: translate(1px, -1px); }
    37%  { transform: translate(-2px, 0); }
    50%  { transform: translate(1px, 2px); }
    62%  { transform: translate(-1px, -1px); }
    75%  { transform: translate(2px, 1px); }
    87%  { transform: translate(0, -2px); }
    100% { transform: translate(0, 0); }
}

/* --- Fixed Spine --- */
#spine {
    position: fixed;
    top: 0;
    left: 0;
    width: 8vw;
    height: 100vh;
    background: var(--grain);
    z-index: 100;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: space-between;
    padding: 3vh 0;
    border-right: 1px solid var(--structure);
    animation: spine-pulse 6s ease-in-out infinite;
}

@keyframes spine-pulse {
    0%, 100% { border-right-color: var(--structure); }
    33%      { border-right-color: var(--chrome); }
    66%      { border-right-color: var(--bright-chrome); }
}

.spine-domain {
    font-family: 'IBM Plex Mono', monospace;
    font-size: 0.65rem;
    font-weight: 300;
    letter-spacing: 0.3em;
    text-transform: uppercase;
    color: var(--chrome);
    writing-mode: vertical-rl;
    text-orientation: mixed;
    opacity: 0.7;
}

.spine-seed {
    opacity: 0.6;
    flex-shrink: 0;
}

/* --- Strata (Sections) --- */
.stratum {
    min-height: 100vh;
    margin-left: 8vw;
    width: 92vw;
    position: relative;
    display: flex;
    align-items: center;
}

.stratum-content {
    width: 100%;
    padding: 6vh 4vw;
}

/* --- Stratum 1: Hero --- */
.stratum-1 {
    display: flex;
    flex-direction: column;
    justify-content: flex-start;
    padding-top: 12vh;
    position: relative;
}

.stratum-1 .stratum-content {
    position: relative;
    z-index: 2;
}

.hero-statement {
    font-family: 'Space Grotesk', sans-serif;
    font-size: clamp(2.4rem, 5.5vw, 4.8rem);
    font-weight: 700;
    font-variation-settings: 'wght' var(--heading-weight);
    letter-spacing: -0.03em;
    line-height: 1.1;
    color: var(--bright-chrome);
    max-width: 60vw;
    opacity: 0;
    transform: translateY(12px);
    animation: hero-fade-in 1s cubic-bezier(0.22, 1, 0.36, 1) 0.4s forwards;
}

.hero-accent {
    color: var(--chrome);
    font-weight: 500;
}

@keyframes hero-fade-in {
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.hero-botanical {
    position: absolute;
    bottom: 0;
    right: -2vw;
    width: min(45vw, 500px);
    height: auto;
    z-index: 1;
    opacity: 0.35;
}

/* Chrome Reflection Band */
.chrome-band {
    position: absolute;
    bottom: 0;
    left: 0;
    width: 100%;
    height: 2px;
    background: linear-gradient(90deg, transparent 0%, #7b8794 15%, #c0c7cf 30%, #e8ecf0 50%, #c0c7cf 70%, #7b8794 85%, transparent 100%);
    background-size: 200% 100%;
    animation: chrome-sweep 8s ease-in-out infinite alternate;
    z-index: 3;
}

@keyframes chrome-sweep {
    0%   { background-position: 0% 0%; }
    100% { background-position: 100% 0%; }
}

/* --- Stratum 2: The Erosion --- */
.stratum-2 {
    flex-direction: column;
    align-items: flex-start;
    padding-left: 4vw;
    background-image:
        linear-gradient(rgba(123, 135, 148, 0.06) 1px, transparent 1px),
        linear-gradient(90deg, rgba(123, 135, 148, 0.06) 1px, transparent 1px);
    background-size: 40px 40px;
}

.ruled-line-h {
    width: 65vw;
    height: 0;
    border-top: 1px solid var(--structure);
    margin-bottom: 4vh;
    margin-left: 0;
}

.stratum-heading {
    font-family: 'Space Grotesk', sans-serif;
    font-size: clamp(1.4rem, 3vw, 2.4rem);
    font-weight: 500;
    letter-spacing: -0.01em;
    color: var(--bright-chrome);
    margin-bottom: 4vh;
}

.erosion-grid {
    max-width: 70vw;
}

.erosion-columns {
    display: flex;
    gap: 3vw;
}

.erosion-thesis {
    flex: 3;
    color: var(--chrome);
}

.erosion-gap {
    width: 2px;
    background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 2 100' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence baseFrequency='0.8' numOctaves='3'/%3E%3C/filter%3E%3Crect width='2' height='100' filter='url(%23n)' opacity='0.15'/%3E%3C/svg%3E");
    background-size: 2px 100px;
    flex-shrink: 0;
}

.erosion-antithesis {
    flex: 5;
    color: var(--chrome);
}

/* --- Stratum 3: The Specimen --- */
.stratum-3 {
    align-items: flex-start;
}

.specimen-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 4vw;
    align-items: start;
}

.specimen-illustration {
    display: flex;
    justify-content: center;
    align-items: center;
}

.seed-cross-section {
    width: min(50vw, 480px);
    height: auto;
}

.specimen-annotations {
    display: flex;
    flex-direction: column;
    gap: 3vh;
    padding-top: 6vh;
}

.annotation-box {
    position: relative;
    padding: 1.5rem 1.8rem;
}

.annotation-border {
    position: absolute;
    inset: 0;
    border: 1px solid transparent;
    pointer-events: none;
    transition: none;
}

.annotation-box.visible .annotation-border {
    border-color: var(--specimen);
    animation: border-draw 800ms cubic-bezier(0.22, 1, 0.36, 1) forwards;
}

@keyframes border-draw {
    0%   { clip-path: inset(0 100% 100% 0); }
    25%  { clip-path: inset(0 0 100% 0); }
    50%  { clip-path: inset(0 0 100% 0); }
    75%  { clip-path: inset(0 0 0 0); }
    100% { clip-path: inset(0 0 0 0); }
}

.annotation-text {
    opacity: 0;
    transition: opacity 400ms ease 800ms;
}

.annotation-box.visible .annotation-text {
    opacity: 1;
}

.annotation-label {
    font-family: 'IBM Plex Mono', monospace;
    font-size: 0.7rem;
    font-weight: 400;
    letter-spacing: 0.15em;
    text-transform: uppercase;
    color: var(--specimen);
    display: block;
    margin-bottom: 0.5rem;
}

.annotation-box p {
    font-family: 'Cormorant Garamond', Georgia, serif;
    font-weight: 300;
    font-size: 0.85rem;
    font-style: italic;
    color: var(--chrome);
    line-height: 1.7;
}

/* SVG annotation line animation */
.stratum-3.in-view .annotation-line {
    animation: draw-line 1.2s cubic-bezier(0.22, 1, 0.36, 1) forwards;
}

.stratum-3.in-view .annotation-line + circle {
    animation: dot-appear 0.3s ease 1s forwards;
}

@keyframes draw-line {
    to { stroke-dashoffset: 0; }
}

@keyframes dot-appear {
    to { opacity: 1; }
}

/* --- Stratum 4: The Residue --- */
.stratum-4 {
    display: flex;
    align-items: center;
    justify-content: flex-start;
}

.residue-content {
    max-width: 50vw;
    padding-left: 2vw;
}

.closing-statement {
    font-family: 'Space Grotesk', sans-serif;
    font-size: clamp(2.8rem, 6vw, 5.2rem);
    font-weight: 700;
    letter-spacing: -0.03em;
    line-height: 1.1;
    color: var(--flare);
    opacity: 0;
    transform: translateY(20px);
    transition: opacity 1.2s ease, transform 1.2s ease;
}

.stratum-4.in-view .closing-statement {
    opacity: 1;
    transform: translateY(0);
}

/* Intensified grain at bottom */
.stratum-4 {
    background: linear-gradient(180deg, var(--void) 0%, rgba(28, 28, 31, 0.5) 100%);
}

/* --- Responsive --- */
@media (max-width: 768px) {
    #spine {
        width: 12vw;
    }

    .stratum {
        margin-left: 12vw;
        width: 88vw;
    }

    .hero-statement {
        max-width: 80vw;
    }

    .erosion-columns {
        flex-direction: column;
    }

    .erosion-gap {
        width: 100%;
        height: 2px;
    }

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

    .residue-content {
        max-width: 80vw;
    }

    .hero-botanical {
        width: 60vw;
        opacity: 0.2;
    }
}
