/* =============================================
   poststructural.art -- styles.css
   A palimpsest of competing signs
   ============================================= */

/* CSS Custom Properties */
:root {
    --bone-white: #E8E3DA;
    --graphite: #2B2B2B;
    --charcoal-black: #1A1A1A;
    --muted-crimson: #8B3A3A;
    --oxidized-copper: #5B8C7A;
    --faded-indigo: #4A4E6A;
    --parchment-gold: #C4A35A;
    --ash-gray: #9E9B93;

    --scroll-offset: 0;
}

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

html {
    scroll-behavior: smooth;
    overflow-x: hidden;
}

body {
    background-color: var(--bone-white);
    color: var(--charcoal-black);
    font-family: 'IBM Plex Mono', monospace;
    font-weight: 400;
    font-size: 14px;
    letter-spacing: 0.02em;
    line-height: 1.65;
    overflow-x: hidden;
    -webkit-font-smoothing: antialiased;
}

/* =============================================
   GLOBAL ELEMENTS
   ============================================= */

/* The Fold Line -- runs across each stratum */
.fold-line {
    position: absolute;
    left: 0;
    width: 100%;
    height: 0;
    border: none;
    border-top: 0.75px dashed var(--ash-gray);
    opacity: 0.3;
    z-index: 100;
    pointer-events: none;
    stroke-dasharray: 12 8;
}

/* Ghost Text -- bleeds between strata */
.ghost-text {
    position: absolute;
    font-family: 'Caveat', cursive;
    font-weight: 400;
    font-size: 16px;
    color: transparent;
    pointer-events: none;
    z-index: 200;
    max-width: 480px;
    line-height: 1.5;
}

.ghost-text-1 {
    bottom: 6%;
    left: 8%;
    color: var(--bone-white);
    opacity: 0.1;
}

.ghost-text-2 {
    top: 4%;
    right: 5%;
    color: var(--graphite);
    opacity: 0.09;
}

.ghost-text-3 {
    bottom: 8%;
    right: 6%;
    color: var(--charcoal-black);
    opacity: 0.08;
}

.ghost-text-4 {
    top: 5%;
    left: 4%;
    color: var(--graphite);
    opacity: 0.1;
}

.ghost-text-5 {
    bottom: 12%;
    left: 10%;
    color: var(--bone-white);
    opacity: 0.11;
}

/* Deconstructed Glyphs */
.deconstructed-glyph {
    position: absolute;
    pointer-events: none;
    mix-blend-mode: difference;
    z-index: 50;
    opacity: 0;
    transition: opacity 1.2s ease-out, transform 2s ease-out;
}

.deconstructed-glyph.visible {
    opacity: 1;
}

/* =============================================
   STRATUM 1: The Surface
   ============================================= */

.stratum {
    position: relative;
    overflow: hidden;
}

.stratum-1 {
    height: 100vh;
    background-color: var(--bone-white);
    display: flex;
    align-items: center;
    justify-content: center;
}

.surface-word {
    font-family: 'Playfair Display', serif;
    font-weight: 900;
    font-size: clamp(120px, 22vw, 280px);
    letter-spacing: -0.04em;
    line-height: 0.85;
    color: var(--charcoal-black);
    position: relative;
    z-index: 10;
    /* Crop by viewport edges */
    white-space: nowrap;
    margin-left: -5vw;
    overflow: visible;
    user-select: none;
}

.surface-word-fragment {
    opacity: 0.35;
    color: var(--faded-indigo);
}

.glyph-d {
    width: 250px;
    height: 340px;
    top: 12%;
    right: 8%;
}

/* =============================================
   STRATUM 2: The Marginal
   ============================================= */

.stratum-2 {
    min-height: 150vh;
    background: linear-gradient(
        to bottom,
        var(--bone-white) 0%,
        var(--bone-white) 40%,
        var(--graphite) 100%
    );
    padding: 8vh 3vw;
}

.marginal-grid {
    display: grid;
    grid-template-columns: repeat(12, 1fr);
    grid-template-rows: repeat(7, auto);
    gap: 20px;
    min-height: 130vh;
    position: relative;
}

.marginal-block {
    font-family: 'IBM Plex Mono', monospace;
    font-weight: 400;
    font-size: 13px;
    line-height: 1.65;
    letter-spacing: 0.02em;
    padding: 20px 24px;
    position: relative;
    transition: transform 0.1s linear;
}

/* Deliberate offsets -- slippage */
.block-1 {
    transform: translate(5px, -3px);
    color: var(--charcoal-black);
}

.block-2 {
    transform: translate(-4px, 7px);
    color: var(--charcoal-black);
}

.block-3 {
    transform: translate(8px, -6px);
    color: var(--ash-gray);
}

.block-4 {
    transform: translate(-3px, 4px);
    color: var(--bone-white);
}

.block-5 {
    transform: translate(6px, -8px);
    color: var(--ash-gray);
}

.block-6 {
    transform: translate(-7px, 3px);
    color: var(--bone-white);
}

.marginal-block .annotation {
    font-family: 'Caveat', cursive;
    font-size: 15px;
    color: var(--muted-crimson);
    margin-top: 12px;
    font-style: normal;
}

.glyph-a {
    width: 280px;
    height: 370px;
    bottom: 8%;
    left: 5%;
}

/* =============================================
   STRATUM 3: The Trace
   ============================================= */

.stratum-3 {
    min-height: 120vh;
    background-color: var(--charcoal-black);
    color: var(--bone-white);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 10vh 0;
}

.trace-column {
    max-width: 640px;
    width: 90%;
    position: relative;
    z-index: 10;
}

.trace-column p {
    font-family: 'IBM Plex Mono', monospace;
    font-weight: 300;
    font-size: 14px;
    line-height: 1.75;
    letter-spacing: 0.02em;
    margin-bottom: 2.5em;
    color: var(--bone-white);
    opacity: 0.92;
}

/* Erasure system */
.erasure-container {
    position: relative;
    display: inline;
}

.erasure-mark {
    position: absolute;
    top: -3px;
    left: -4px;
    right: -4px;
    bottom: -3px;
    background-color: var(--muted-crimson);
    opacity: 0.4;
    mix-blend-mode: multiply;
    cursor: crosshair;
    z-index: 20;
    transition: opacity 0.6s ease-out;
    animation: erasure-pulse 4s ease-in-out infinite;
}

.erasure-mark:hover {
    opacity: 0.08;
}

.erasure-text {
    position: relative;
    z-index: 10;
}

@keyframes erasure-pulse {
    0%, 100% { opacity: 0.3; }
    50% { opacity: 0.5; }
}

.glyph-e {
    width: 220px;
    height: 310px;
    top: 15%;
    right: 4%;
}

/* =============================================
   STRATUM 4: The Supplement
   ============================================= */

.stratum-4 {
    min-height: 100vh;
    background-color: var(--graphite);
    position: relative;
    padding: 6vh 4vw;
    overflow: hidden;
}

.supplement-field {
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
    position: relative;
    z-index: 10;
    align-content: flex-start;
}

.micro-text {
    font-family: 'IBM Plex Mono', monospace;
    font-weight: 300;
    font-size: 11px;
    line-height: 1.55;
    letter-spacing: 0.02em;
    color: var(--ash-gray);
    padding: 6px 10px;
    background: rgba(26, 26, 26, 0.3);
    border: 1px solid rgba(158, 155, 147, 0.08);
    flex: 0 0 auto;
    max-width: 320px;
    opacity: 0.85;
    transition: color 0.4s ease, border-color 0.4s ease;
}

.micro-text:hover {
    color: var(--parchment-gold);
    border-color: rgba(196, 163, 90, 0.2);
}

/* Large SVG glyphs in Stratum 4 */
.supplement-glyph-1 {
    width: 240px;
    height: 340px;
    top: 10%;
    left: 15%;
}

.supplement-glyph-2 {
    width: 220px;
    height: 320px;
    top: 30%;
    right: 10%;
}

.supplement-glyph-3 {
    width: 260px;
    height: 360px;
    bottom: 5%;
    left: 50%;
    transform: translateX(-50%);
}

/* =============================================
   STRATUM 5: The Sous Rature
   ============================================= */

.stratum-5 {
    height: 80vh;
    background-color: var(--charcoal-black);
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
}

.sous-rature-word {
    font-family: 'Playfair Display', serif;
    font-weight: 900;
    font-size: clamp(100px, 18vw, 240px);
    letter-spacing: -0.04em;
    line-height: 0.85;
    color: var(--bone-white);
    text-decoration: line-through;
    text-decoration-color: var(--bone-white);
    text-decoration-thickness: 2px;
    position: relative;
    z-index: 10;
    user-select: none;
    opacity: 0.9;
}

/* =============================================
   SCROLL-DRIVEN ANIMATIONS
   ============================================= */

/* Strata entrance animations */
.stratum {
    opacity: 1;
}

.marginal-block {
    opacity: 0;
    transform: translateY(30px);
    transition: opacity 0.8s ease-out, transform 0.8s ease-out;
}

.marginal-block.visible {
    opacity: 1;
}

/* Restore intended opacity values once visible */
.block-1.visible { opacity: 0.7; transform: translate(5px, -3px); }
.block-2.visible { opacity: 0.9; transform: translate(-4px, 7px); }
.block-3.visible { opacity: 0.5; transform: translate(8px, -6px); }
.block-4.visible { opacity: 1.0; transform: translate(-3px, 4px); }
.block-5.visible { opacity: 0.6; transform: translate(6px, -8px); }
.block-6.visible { opacity: 0.8; transform: translate(-7px, 3px); }

/* Text displacement in Stratum 2 using scroll offset */
.stratum-2 .block-1 { --parallax-factor: 0.03; }
.stratum-2 .block-2 { --parallax-factor: 0.05; }
.stratum-2 .block-3 { --parallax-factor: 0.02; }
.stratum-2 .block-4 { --parallax-factor: 0.04; }
.stratum-2 .block-5 { --parallax-factor: 0.01; }
.stratum-2 .block-6 { --parallax-factor: 0.06; }

/* =============================================
   RESPONSIVE -- minimal, preserving anti-design
   ============================================= */

@media (max-width: 768px) {
    .surface-word {
        font-size: clamp(80px, 18vw, 180px);
        margin-left: -3vw;
    }

    .marginal-grid {
        grid-template-columns: repeat(6, 1fr);
    }

    .marginal-block {
        padding: 14px 16px;
        font-size: 12px;
    }

    /* Reposition blocks for smaller grid */
    .block-1 { grid-column: 1 / 4 !important; }
    .block-2 { grid-column: 3 / 6 !important; }
    .block-3 { grid-column: 1 / 4 !important; }
    .block-4 { grid-column: 2 / 6 !important; }
    .block-5 { grid-column: 1 / 5 !important; }
    .block-6 { grid-column: 3 / 6 !important; }

    .trace-column {
        width: 92%;
        max-width: 100%;
    }

    .trace-column p {
        font-size: 13px;
    }

    .sous-rature-word {
        font-size: clamp(60px, 14vw, 160px);
    }

    .micro-text {
        font-size: 10px;
        max-width: 260px;
    }

    .deconstructed-glyph {
        transform: scale(0.6);
    }

    .ghost-text {
        font-size: 14px;
        max-width: 300px;
    }
}

@media (max-width: 480px) {
    .surface-word {
        font-size: 70px;
    }

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

    .block-1, .block-2, .block-3,
    .block-4, .block-5, .block-6 {
        grid-column: 1 / -1 !important;
    }

    .sous-rature-word {
        font-size: 50px;
    }
}

/* =============================================
   SELECTION STYLING
   ============================================= */

::selection {
    background: var(--muted-crimson);
    color: var(--bone-white);
}

::-moz-selection {
    background: var(--muted-crimson);
    color: var(--bone-white);
}
