/* ============================================
   mysterious.boo — Brutalist Noir
   ============================================ */

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

:root {
    --deep-void: #0d0f1a;
    --concrete-light: #b8b0a4;
    --near-black: #08090e;
    --midnight-blue: #3a4a8a;
    --amber-signal: #c47a2e;
    --warm-stone: #e8e2d8;
    --weathered: #8a8478;
    --rust: #7b5c5a;
}

html {
    scroll-behavior: smooth;
}

body {
    background: var(--near-black);
    color: var(--concrete-light);
    font-family: 'Nunito Sans', sans-serif;
    font-weight: 300;
    overflow-x: hidden;
    cursor: default;
}

/* --- Typography Classes --- */
.varela { font-family: 'Varela Round', sans-serif; }
.nunito { font-family: 'Nunito Sans', sans-serif; }
.caveat { font-family: 'Caveat', cursive; }
.jetbrains { font-family: 'JetBrains Mono', monospace; }

/* --- Diagonal Section Base --- */
.diagonal-section {
    position: relative;
    min-height: 100vh;
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
}

.diagonal-section::before {
    content: '';
    position: absolute;
    top: -10%;
    left: -5%;
    right: -5%;
    bottom: -10%;
    z-index: 0;
}

.diagonal-section::after {
    content: '';
    position: absolute;
    bottom: -2px;
    left: 0;
    right: 0;
    height: 80px;
    background: linear-gradient(to bottom, transparent, var(--near-black));
    z-index: 2;
}

/* --- Concrete Texture Overlay --- */
.concrete-texture {
    position: absolute;
    inset: 0;
    background-image:
        repeating-linear-gradient(
            90deg,
            transparent,
            transparent 2px,
            rgba(184, 176, 164, 0.02) 2px,
            rgba(184, 176, 164, 0.02) 4px
        ),
        repeating-linear-gradient(
            0deg,
            transparent,
            transparent 3px,
            rgba(138, 132, 120, 0.015) 3px,
            rgba(138, 132, 120, 0.015) 6px
        );
    z-index: 1;
    pointer-events: none;
}

/* --- Hero Section --- */
.hero-section {
    background: linear-gradient(165deg, var(--deep-void) 0%, var(--near-black) 50%, #0a0b14 100%);
    clip-path: polygon(0 0, 100% 0, 100% 88%, 0 100%);
    min-height: 100vh;
    flex-direction: column;
}

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

.domain-title {
    font-family: 'Varela Round', sans-serif;
    font-size: clamp(4rem, 12vw, 10rem);
    font-weight: 400;
    letter-spacing: 0.04em;
    color: var(--warm-stone);
    text-shadow:
        0 0 60px rgba(196, 122, 46, 0.15),
        0 0 120px rgba(58, 74, 138, 0.08);
    opacity: 0;
    transform: translateY(30px);
    animation: titleReveal 2s ease-out 0.5s forwards;
}

.hero-whisper {
    font-size: clamp(1.2rem, 3vw, 2rem);
    color: var(--weathered);
    margin-top: 1rem;
    opacity: 0;
    animation: fadeUp 1.5s ease-out 1.5s forwards;
}

.scroll-indicator {
    position: absolute;
    bottom: 12%;
    z-index: 5;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.5rem;
    opacity: 0;
    animation: fadeUp 1s ease-out 2.5s forwards;
}

.scroll-indicator span {
    font-size: 0.7rem;
    letter-spacing: 0.3em;
    text-transform: uppercase;
    color: var(--weathered);
}

.scroll-indicator svg {
    animation: bobDown 2s ease-in-out infinite;
}

/* --- Drift Section --- */
.drift-section {
    background: linear-gradient(170deg, var(--near-black) 0%, var(--deep-void) 100%);
    clip-path: polygon(0 8%, 100% 0, 100% 90%, 0 100%);
    margin-top: -8vh;
    padding: 12vh 2rem;
}

.drift-section .section-content {
    max-width: 700px;
    position: relative;
    z-index: 5;
}

.fragment {
    font-size: clamp(1rem, 2vw, 1.25rem);
    line-height: 1.9;
    color: var(--concrete-light);
    opacity: 0;
    transform: translateY(40px);
    transition: opacity 1s ease, transform 1s ease;
}

.fragment.revealed {
    opacity: 1;
    transform: translateY(0);
}

.glyph-row {
    display: flex;
    gap: 2rem;
    margin-top: 3rem;
    justify-content: center;
}

.inline-glyph {
    width: 60px;
    height: 60px;
    opacity: 0.5;
    transition: opacity 0.6s;
}

.inline-glyph:hover {
    opacity: 1;
}

/* --- Signal Section --- */
.signal-section {
    background: linear-gradient(175deg, #0a0b14 0%, var(--deep-void) 50%, var(--near-black) 100%);
    clip-path: polygon(0 6%, 100% 0, 100% 92%, 0 100%);
    margin-top: -6vh;
    padding: 14vh 2rem;
    flex-direction: column;
    gap: 3rem;
}

.section-heading {
    font-size: clamp(2rem, 5vw, 3.5rem);
    font-weight: 400;
    color: var(--warm-stone);
    letter-spacing: 0.02em;
    position: relative;
    z-index: 5;
    opacity: 0;
    transform: translateY(30px);
    transition: opacity 1s ease, transform 1s ease;
}

.section-heading.revealed {
    opacity: 1;
    transform: translateY(0);
}

.section-content {
    position: relative;
    z-index: 5;
    max-width: 800px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 2.5rem;
}

.code-fragment {
    background: rgba(13, 15, 26, 0.8);
    border-left: 3px solid var(--amber-signal);
    padding: 1.5rem 2rem;
    display: flex;
    flex-direction: column;
    gap: 0.3rem;
    width: 100%;
    max-width: 500px;
}

.code-line {
    font-size: 0.85rem;
    color: var(--weathered);
    opacity: 0;
    transform: translateX(-20px);
    transition: opacity 0.5s ease, transform 0.5s ease;
}

.code-line.revealed {
    opacity: 1;
    transform: translateX(0);
}

/* --- Archive Section --- */
.archive-section {
    background: linear-gradient(168deg, var(--near-black) 0%, #0d0e18 50%, var(--deep-void) 100%);
    clip-path: polygon(0 5%, 100% 0, 100% 93%, 0 100%);
    margin-top: -5vh;
    padding: 14vh 2rem;
    flex-direction: column;
    gap: 3rem;
}

.grid-fragments {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 2rem;
    max-width: 900px;
    width: 100%;
}

.grid-card {
    background: rgba(13, 15, 26, 0.6);
    border: 1px solid rgba(138, 132, 120, 0.15);
    padding: 2rem;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1.5rem;
    opacity: 0;
    transform: translateY(40px) rotate(-1deg);
    transition: opacity 0.8s ease, transform 0.8s ease, border-color 0.4s;
}

.grid-card.revealed {
    opacity: 1;
    transform: translateY(0) rotate(0deg);
}

.grid-card:hover {
    border-color: var(--amber-signal);
}

.card-sigil {
    width: 80px;
    height: 80px;
}

.grid-card .caveat {
    font-size: 1.15rem;
    color: var(--concrete-light);
    text-align: center;
    line-height: 1.6;
}

/* --- Void Section --- */
.void-section {
    background: radial-gradient(ellipse at center, var(--deep-void) 0%, var(--near-black) 70%);
    clip-path: polygon(0 7%, 100% 0, 100% 100%, 0 100%);
    margin-top: -7vh;
    padding: 14vh 2rem 8vh;
    flex-direction: column;
    gap: 2rem;
    min-height: 80vh;
}

.void-text {
    font-size: clamp(1.5rem, 4vw, 2.5rem);
    color: var(--warm-stone);
    text-align: center;
    position: relative;
    z-index: 5;
    opacity: 0;
    transition: opacity 1.5s ease;
}

.void-text.revealed {
    opacity: 1;
}

.void-subtext {
    font-size: clamp(1rem, 2vw, 1.3rem);
    color: var(--weathered);
    text-align: center;
    position: relative;
    z-index: 5;
    opacity: 0;
    transition: opacity 1.5s ease 0.5s;
}

.void-subtext.revealed {
    opacity: 0.7;
}

.void-sigil-cluster {
    position: relative;
    z-index: 5;
    margin: 2rem 0;
}

.void-sigil {
    width: 120px;
    height: 120px;
    animation: slowSpin 30s linear infinite;
}

.void-code {
    font-size: 0.75rem;
    letter-spacing: 0.2em;
    color: var(--rust);
    text-align: center;
    position: relative;
    z-index: 5;
    margin-top: 2rem;
}

/* --- Sigils (floating) --- */
.sigil {
    position: absolute;
    z-index: 3;
    opacity: 0.08;
    transition: opacity 2s ease;
    pointer-events: none;
}

.sigil-manhole {
    width: 200px;
    height: 200px;
    top: 15%;
    left: 8%;
    border: 2px solid var(--amber-signal);
    border-radius: 50%;
}

.sigil-manhole::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 0;
    right: 0;
    height: 2px;
    background: var(--amber-signal);
}

.sigil-fireescape {
    width: 100px;
    height: 160px;
    top: 25%;
    right: 12%;
    background: repeating-linear-gradient(
        0deg,
        transparent,
        transparent 18px,
        var(--midnight-blue) 18px,
        var(--midnight-blue) 20px
    );
}

.sigil-building {
    width: 120px;
    height: 120px;
    top: 20%;
    right: 15%;
    border: 1.5px solid var(--weathered);
}

.sigil-building::after {
    content: '';
    position: absolute;
    inset: 20%;
    border: 1.5px solid var(--weathered);
}

.sigil-spiral {
    width: 150px;
    height: 150px;
    top: 10%;
    left: 10%;
    border: 1.5px solid var(--rust);
    border-radius: 50%;
    border-top-color: transparent;
    border-right-color: transparent;
}

.sigil-intersection {
    width: 100px;
    height: 100px;
    top: 15%;
    right: 10%;
}

.sigil-intersection::before,
.sigil-intersection::after {
    content: '';
    position: absolute;
    background: var(--midnight-blue);
}

.sigil-intersection::before {
    top: 0;
    left: 50%;
    width: 2px;
    height: 100%;
    transform: rotate(45deg);
}

.sigil-intersection::after {
    top: 0;
    left: 50%;
    width: 2px;
    height: 100%;
    transform: rotate(-45deg);
}

/* --- Grain Canvas --- */
#grain-canvas {
    position: fixed;
    inset: 0;
    z-index: 1000;
    pointer-events: none;
    opacity: 0.04;
    mix-blend-mode: overlay;
}

/* --- Animations --- */
@keyframes titleReveal {
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes fadeUp {
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes bobDown {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(8px); }
}

@keyframes slowSpin {
    to { transform: rotate(360deg); }
}

/* --- Responsive --- */
@media (max-width: 600px) {
    .grid-fragments {
        grid-template-columns: 1fr;
    }

    .code-fragment {
        padding: 1rem 1.2rem;
    }

    .sigil {
        display: none;
    }
}
