/* ============================================
   archetypos.dev — styles
   Anti-design typographic bestiary
   ============================================ */

:root {
    --bone-white: #F5F0EB;
    --ink-black: #0D0D0D;
    --deep-carbon: #1A1A1A;
    --chalk: #F0EDE8;
    --misprint-red: #E63946;
    --bruise-purple: #6B2D5B;
    --graphite: #4A4A4A;
    --vellum: #EDE7DF;

    --font-display: 'Bricolage Grotesque', sans-serif;
    --font-body: 'Libre Baskerville', serif;
    --font-mono: 'IBM Plex Mono', monospace;
    --font-accent: 'Instrument Serif', serif;

    --grid-gap: 2px;
}

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

html {
    scroll-snap-type: y proximity;
    overflow-x: hidden;
}

body {
    background: var(--bone-white);
    color: var(--deep-carbon);
    font-family: var(--font-body);
    font-size: 18px;
    line-height: 1.65;
    overflow-x: hidden;
}

.section {
    min-height: 100vh;
    scroll-snap-align: start;
    position: relative;
}

/* ============================================
   Typography
   ============================================ */

.archetype-label {
    display: block;
    font-family: var(--font-mono);
    font-size: 12px;
    line-height: 1.5;
    color: var(--graphite);
    text-transform: uppercase;
    letter-spacing: 0.1em;
    margin-bottom: 1.5rem;
}

.body-text {
    font-family: var(--font-body);
    font-size: 18px;
    line-height: 1.65;
    color: var(--deep-carbon);
    margin-bottom: 1rem;
}

.caption-text {
    font-family: var(--font-mono);
    font-size: 12px;
    line-height: 1.5;
    color: var(--graphite);
}

/* ============================================
   GLYPH WALL
   ============================================ */

#glyph-wall {
    background: var(--misprint-red);
    overflow: hidden;
}

.glyph-grid {
    display: grid;
    grid-template-columns: repeat(8, 1fr);
    grid-template-rows: repeat(6, 1fr);
    gap: var(--grid-gap);
    width: 100%;
    height: 100vh;
    background: var(--misprint-red);
}

.glyph-cell {
    background: var(--bone-white);
    display: flex;
    align-items: center;
    justify-content: center;
    font-family: var(--font-display);
    font-weight: 800;
    font-size: clamp(2rem, 8vw, 10rem);
    color: var(--deep-carbon);
    letter-spacing: -0.03em;
    cursor: default;
    overflow: hidden;
    opacity: 0;
    transform: translate(var(--tx, 0), var(--ty, 0)) rotate(var(--rot, 0deg));
    transition: opacity 400ms ease-out, transform 400ms ease-out, background-color 150ms ease, font-variation-settings 150ms ease;
    will-change: transform, opacity;
}

.glyph-cell.revealed {
    opacity: 1;
    transform: translate(0, 0) rotate(var(--rot, 0deg));
}

.glyph-cell:hover {
    background: var(--misprint-red);
    color: var(--bone-white);
    font-variation-settings: 'wght' 900;
}

.glyph-cell.dark {
    background: var(--ink-black);
    color: var(--chalk);
}

.glyph-cell.dark:hover {
    background: var(--misprint-red);
    color: var(--bone-white);
}

/* ============================================
   THE HERO
   ============================================ */

#hero-section {
    background: var(--bone-white);
    overflow: hidden;
}

.hero-layout {
    display: flex;
    align-items: flex-start;
    min-height: 100vh;
    position: relative;
}

.hero-giant-word {
    font-family: var(--font-display);
    font-weight: 800;
    font-size: 40vw;
    line-height: 0.85;
    letter-spacing: -0.03em;
    color: var(--deep-carbon);
    position: absolute;
    right: -5vw;
    top: 50%;
    transform: translateY(-50%);
    white-space: nowrap;
    user-select: none;
}

.hero-body-col {
    width: 280px;
    min-width: 280px;
    padding: 4rem 2rem 4rem 3rem;
    display: flex;
    flex-direction: column;
    justify-content: center;
    min-height: 100vh;
}

/* ============================================
   THE SHADOW
   ============================================ */

#shadow-section {
    background: var(--ink-black);
    overflow: hidden;
}

.shadow-layout {
    display: flex;
    align-items: flex-start;
    min-height: 100vh;
    position: relative;
}

.shadow-giant-glyph {
    font-family: var(--font-display);
    font-weight: 800;
    font-size: clamp(15rem, 35vw, 50rem);
    line-height: 0.85;
    letter-spacing: -0.03em;
    color: rgba(240, 237, 232, 0.06);
    position: absolute;
    right: 5vw;
    top: 50%;
    transform: translateY(-50%);
    user-select: none;
}

.shadow-body {
    width: 340px;
    min-width: 280px;
    padding: 4rem 2rem 4rem 3rem;
    display: flex;
    flex-direction: column;
    justify-content: center;
    min-height: 100vh;
    transform: scaleX(-1);
    transition: transform 600ms ease-out;
}

.shadow-body.revealed {
    transform: scaleX(1);
}

.shadow-label {
    color: var(--chalk);
}

.invert-text {
    color: var(--chalk);
}

#shadow-section .caption-text {
    color: var(--graphite);
}

/* ============================================
   THE TRICKSTER
   ============================================ */

#trickster-section {
    background: var(--misprint-red);
    padding: 0;
}

.trickster-grid {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    grid-template-rows: repeat(3, 1fr);
    gap: var(--grid-gap);
    width: 100%;
    min-height: 100vh;
    background: var(--misprint-red);
}

.trickster-cell {
    background: var(--bone-white);
    padding: 2rem;
    display: flex;
    flex-direction: column;
    justify-content: center;
    transition: grid-column 500ms ease, grid-row 500ms ease, transform 500ms ease;
}

.trickster-glyph {
    font-family: var(--font-display);
    font-weight: 800;
    font-size: clamp(4rem, 15vw, 20rem);
    letter-spacing: -0.03em;
    color: var(--deep-carbon);
    line-height: 0.85;
}

/* ============================================
   THE ORACLE
   ============================================ */

#oracle-section {
    background: var(--bone-white);
    overflow: hidden;
}

.oracle-container {
    position: relative;
    width: 100%;
    height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
}

.oracle-center-glyph {
    font-family: var(--font-display);
    font-weight: 800;
    font-size: clamp(6rem, 15vw, 20rem);
    color: var(--bruise-purple);
    letter-spacing: -0.03em;
    opacity: 0.12;
    position: absolute;
    user-select: none;
    z-index: 0;
}

.oracle-radial {
    position: relative;
    width: 100%;
    height: 100%;
}

.oracle-line {
    position: absolute;
    left: 50%;
    top: 50%;
    transform-origin: left center;
    transform: rotate(var(--angle)) translateX(60px);
    font-family: var(--font-accent);
    font-style: italic;
    font-size: clamp(1rem, 2vw, 1.5rem);
    color: var(--bruise-purple);
    white-space: nowrap;
    writing-mode: vertical-rl;
    z-index: 1;
}

.oracle-caption {
    position: absolute;
    bottom: 2rem;
    left: 3rem;
}

/* ============================================
   THE MAKER
   ============================================ */

#maker-section {
    background: var(--vellum);
    background-image: repeating-linear-gradient(
        to bottom,
        transparent,
        transparent 26px,
        rgba(74, 74, 74, 0.15) 26px,
        rgba(74, 74, 74, 0.15) 27px
    );
}

.maker-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: var(--grid-gap);
    width: 100%;
    min-height: 100vh;
    padding: 0;
    background: var(--misprint-red);
}

.maker-cell {
    background: var(--vellum);
    background-image: repeating-linear-gradient(
        to bottom,
        transparent,
        transparent 26px,
        rgba(74, 74, 74, 0.15) 26px,
        rgba(74, 74, 74, 0.15) 27px
    );
    padding: 2rem;
    display: flex;
    flex-direction: column;
    justify-content: center;
    font-variant-ligatures: discretionary-ligatures;
}

.maker-cell-wide {
    grid-column: span 2;
}

.maker-glyph {
    font-family: var(--font-display);
    font-weight: 800;
    font-size: clamp(6rem, 15vw, 18rem);
    letter-spacing: -0.03em;
    color: var(--deep-carbon);
    line-height: 0.85;
    opacity: 0.15;
}

.maker-code {
    font-family: var(--font-mono);
    font-size: 13px;
    line-height: 1.6;
    color: var(--graphite);
    white-space: pre;
    background: none;
    border: none;
}

.maker-caption {
    position: absolute;
    bottom: 2rem;
    left: 3rem;
}

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

#colophon {
    background: var(--ink-black);
    display: flex;
    align-items: center;
    justify-content: center;
}

.colophon-container {
    text-align: center;
    padding: 4rem 2rem;
    width: 100%;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    position: relative;
}

.colophon-word {
    font-family: var(--font-display);
    font-size: clamp(4rem, 15vw, 20rem);
    letter-spacing: -0.03em;
    color: var(--chalk);
    line-height: 0.85;
    animation: weightPulse 4s ease-in-out infinite;
}

@keyframes weightPulse {
    0%, 100% { font-variation-settings: 'wght' 200; }
    50% { font-variation-settings: 'wght' 800; }
}

.colophon-meta {
    position: absolute;
    bottom: 3rem;
    left: 3rem;
    text-align: left;
}

.colophon-meta .caption-text {
    color: var(--graphite);
    margin-bottom: 0.25rem;
}

/* ============================================
   RESPONSIVE
   ============================================ */

@media (max-width: 768px) {
    .glyph-grid {
        grid-template-columns: repeat(2, 1fr);
        grid-template-rows: auto;
    }

    .glyph-cell {
        font-size: clamp(3rem, 20vw, 8rem);
    }

    .hero-layout {
        flex-direction: column;
    }

    .hero-giant-word {
        position: relative;
        right: auto;
        top: auto;
        transform: none;
        font-size: clamp(4rem, 25vw, 12rem);
        padding: 2rem 1rem 0;
    }

    .hero-body-col {
        width: 100%;
        min-width: auto;
        min-height: auto;
        padding: 2rem 1.5rem;
    }

    .shadow-layout {
        flex-direction: column;
    }

    .shadow-body {
        width: 100%;
        min-width: auto;
        min-height: auto;
        padding: 2rem 1.5rem;
    }

    .shadow-giant-glyph {
        font-size: clamp(10rem, 50vw, 20rem);
        right: 2vw;
    }

    .trickster-grid {
        grid-template-columns: repeat(2, 1fr);
        grid-template-rows: auto;
    }

    .trickster-cell {
        grid-column: auto !important;
        grid-row: auto !important;
    }

    .oracle-line {
        position: static;
        transform: none;
        writing-mode: horizontal-tb;
        display: block;
        padding: 0.5rem 1.5rem;
        white-space: normal;
    }

    .oracle-radial {
        display: flex;
        flex-direction: column;
        justify-content: center;
        align-items: flex-start;
        height: auto;
        min-height: 100vh;
        padding: 2rem 0;
    }

    .oracle-center-glyph {
        position: relative;
        margin: 0 auto 2rem;
    }

    .oracle-container {
        flex-direction: column;
        height: auto;
        min-height: 100vh;
    }

    .maker-grid {
        grid-template-columns: repeat(2, 1fr);
    }

    .maker-cell-wide {
        grid-column: span 2;
    }

    .colophon-word {
        font-size: clamp(3rem, 15vw, 8rem);
    }

    .colophon-meta {
        position: relative;
        bottom: auto;
        left: auto;
        text-align: center;
        margin-top: 3rem;
    }
}

@media (prefers-reduced-motion: reduce) {
    .glyph-cell {
        opacity: 1;
        transform: none;
        transition: none;
    }

    .shadow-body {
        transform: scaleX(1);
        transition: none;
    }

    .colophon-word {
        animation: none;
        font-variation-settings: 'wght' 800;
    }
}
