/* ======================================================
   opensource.day - Evolved Minimal Design
   Monochrome palette, broken-grid, variable-fluid typography
   ====================================================== */

/* === CSS Custom Properties === */
:root {
    --void-black: #0d0d0d;
    --text-white: #e8e4df;
    --seam-gray: #3a3a3a;
    --whisper-gray: #1a1a1a;
    --fog-gray: #6b6b6b;
    --bone-white: #c4bfb8;
    --accent-gray: #767676;
    --ash-gray: #2d2d2d;
    --pure-black: #000000;
    --font-display: 'Libre Franklin', sans-serif;
    --font-body: 'Source Serif 4', serif;
    --font-mono: 'JetBrains Mono', monospace;
    --font-cultural: 'Noto Sans', sans-serif;
}

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

html {
    scroll-behavior: smooth;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

body {
    background-color: var(--void-black);
    color: var(--text-white);
    font-family: var(--font-body);
    font-weight: 300;
    font-size: clamp(1rem, 1.2vw, 1.15rem);
    line-height: 1.75;
    overflow-x: hidden;
}

/* === The Seam === */
.seam {
    position: fixed;
    top: 0;
    left: 38%;
    width: 1px;
    height: 100vh;
    background-color: var(--seam-gray);
    z-index: 1;
    opacity: 0;
    transition: opacity 2s ease;
    pointer-events: none;
}

.seam.visible {
    opacity: 1;
}

/* === OPENING VOID (0-100vh) === */
.opening-void {
    position: relative;
    width: 100%;
    height: 100vh;
    display: flex;
    flex-direction: column;
    justify-content: center;
    overflow: hidden;
}

.domain-title {
    font-family: var(--font-display);
    font-weight: 100;
    font-size: clamp(4rem, 12vw, 9rem);
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: var(--text-white);
    margin-left: -5vw;
    width: 90vw;
    opacity: 0;
    transition: opacity 2s ease;
    line-height: 1.1;
}

.domain-title.fade-in {
    opacity: 1;
}

.subtitle {
    font-family: var(--font-body);
    font-weight: 300;
    font-size: clamp(0.9rem, 1.4vw, 1.2rem);
    color: var(--fog-gray);
    margin-left: 15vw;
    margin-top: 2rem;
    opacity: 0;
    transition: opacity 2s ease 0.5s;
}

.subtitle.fade-in {
    opacity: 1;
}

/* === COLLAGE STRIP (100vh-160vh) === */
.collage-strip {
    position: relative;
    width: 100%;
    height: 60vh;
    background-color: var(--ash-gray);
    overflow: hidden;
    margin-top: 0;
}

.collage-fragment {
    position: absolute;
    opacity: 0;
    transition: opacity 1.2s ease;
}

.collage-fragment.materialized {
    opacity: 1;
}

/* Code Snippet Fragments with torn edges */
.fragment-code {
    background: var(--whisper-gray);
    padding: 1rem 1.2rem;
}

.fragment-1 {
    top: 8%;
    left: 5%;
    transform: rotate(-1.5deg);
    clip-path: polygon(2% 0%, 98% 3%, 100% 97%, 3% 100%, 0% 4%);
}

.fragment-2 {
    top: 45%;
    left: 35%;
    transform: rotate(0.8deg);
    clip-path: polygon(0% 2%, 97% 0%, 100% 95%, 4% 100%, 1% 5%);
}

.fragment-3 {
    top: 15%;
    right: 8%;
    transform: rotate(-2deg);
    clip-path: polygon(3% 0%, 100% 2%, 98% 100%, 0% 97%, 2% 3%);
}

.code-snippet {
    font-family: var(--font-mono);
    font-size: 0.7rem;
    color: var(--fog-gray);
    line-height: 1.5;
    white-space: pre;
    overflow: hidden;
}

/* Commit Graph Fragments */
.fragment-graph {
    background: transparent;
}

.fragment-4 {
    top: 5%;
    left: 55%;
    width: 140px;
}

.fragment-7 {
    bottom: 10%;
    left: 20%;
    width: 120px;
}

.commit-graph {
    width: 100%;
    height: auto;
}

/* Cultural Glyphs */
.cultural-glyph {
    font-family: var(--font-cultural);
    font-weight: 300;
    color: var(--accent-gray);
    display: block;
}

.fragment-glyph {
    pointer-events: none;
}

.fragment-5 {
    top: 12%;
    left: 30%;
}
.fragment-5 .cultural-glyph { font-size: 4rem; }

.fragment-6 {
    bottom: 18%;
    right: 15%;
}
.fragment-6 .cultural-glyph { font-size: 5rem; }

.fragment-8 {
    top: 55%;
    left: 65%;
}
.fragment-8 .cultural-glyph { font-size: 3.5rem; }

.fragment-9 {
    bottom: 30%;
    left: 8%;
}
.fragment-9 .cultural-glyph { font-size: 3rem; }

.fragment-10 {
    top: 30%;
    right: 25%;
}
.fragment-10 .cultural-glyph { font-size: 4.5rem; }

/* Contributor Silhouettes */
.silhouette {
    width: 100%;
    height: auto;
}

.fragment-silhouette {
    opacity: 0;
}

.fragment-11 {
    top: 40%;
    left: 48%;
    width: 32px;
}

.fragment-12 {
    top: 20%;
    left: 78%;
    width: 24px;
}

.fragment-13 {
    bottom: 15%;
    left: 42%;
    width: 40px;
}

/* === BROKEN-GRID NARRATIVE (160vh-400vh) === */
.narrative {
    position: relative;
    padding: 15vh 0;
    min-height: 240vh;
}

.narrative-grid {
    display: grid;
    grid-template-columns: repeat(12, 1fr);
    gap: 0;
    width: 100%;
    max-width: 100vw;
    padding: 0 2vw;
}

.narrative-block {
    opacity: 0;
    transition: opacity 1.5s ease;
}

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

.narrative-headline {
    font-family: var(--font-display);
    font-weight: 100;
    font-size: clamp(2rem, 5vw, 4rem);
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: var(--text-white);
    margin-bottom: 1.5rem;
    line-height: 1.15;
    transition: font-weight 0.8s ease;
}

.narrative-body {
    font-family: var(--font-body);
    font-weight: 300;
    font-size: clamp(1rem, 1.2vw, 1.15rem);
    line-height: 1.75;
    color: var(--bone-white);
    max-width: 45ch;
}

/* Block 1: Columns 1-5, top of grid */
.block-1 {
    grid-column: 1 / 6;
    grid-row: 1;
    padding: 4vh 2vw;
    z-index: 2;
}

/* Block 2: Columns 6-11, overlapping Block 1 by 8vh */
.block-2 {
    grid-column: 6 / 12;
    grid-row: 1;
    padding: 4vh 2vw;
    margin-top: 20vh;
    z-index: 3;
}

/* Block 3: Columns 3-8, 25vh below Block 2 */
.block-3 {
    grid-column: 3 / 9;
    grid-row: 2;
    padding: 4vh 2vw;
    margin-top: 25vh;
    z-index: 2;
}

/* Empty Commit Koan */
.empty-commit {
    grid-column: 1 / -1;
    grid-row: 3;
    text-align: center;
    padding: 15vh 0;
    opacity: 0;
    transition: opacity 2s ease;
}

.empty-commit.visible {
    opacity: 1;
}

.empty-commit code {
    font-family: var(--font-mono);
    font-size: clamp(0.75rem, 1vw, 0.95rem);
    color: var(--fog-gray);
    letter-spacing: 0.05em;
}

/* Block 4: Columns 7-12, partially off-screen right */
.block-4 {
    grid-column: 7 / 13;
    grid-row: 4;
    padding: 4vh 2vw;
    margin-top: 8vh;
    z-index: 2;
    padding-right: 0;
    overflow: hidden;
}

/* === SKELETON MEDITATION (400vh-500vh) === */
.skeleton-meditation {
    position: relative;
    min-height: 100vh;
    padding: 15vh 5vw;
    display: flex;
    flex-direction: column;
    justify-content: center;
}

.still-building {
    font-family: var(--font-mono);
    font-size: clamp(0.8rem, 1vw, 0.95rem);
    color: var(--fog-gray);
    text-align: center;
    margin-bottom: 8vh;
    letter-spacing: 0.1em;
}

.skeleton-field {
    position: relative;
    width: 80%;
    max-width: 900px;
    margin: 0 auto;
    min-height: 50vh;
}

.skeleton-block {
    position: absolute;
    background: linear-gradient(90deg, var(--whisper-gray) 25%, var(--ash-gray) 50%, var(--whisper-gray) 75%);
    background-size: 200% 100%;
    animation: skeleton-pulse 3s ease-in-out infinite;
    border-radius: 4px;
}

@keyframes skeleton-pulse {
    0% { background-position: 200% 0; }
    100% { background-position: -200% 0; }
}

/* Irregular skeleton arrangement */
.skel-1 {
    top: 0;
    left: 5%;
    width: 45%;
    height: 18px;
}

.skel-2 {
    top: 8%;
    left: 15%;
    width: 65%;
    height: 14px;
    animation-delay: 0.4s;
}

.skel-3 {
    top: 20%;
    left: 0;
    width: 35%;
    height: 80px;
    animation-delay: 0.8s;
}

.skel-4 {
    top: 22%;
    left: 55%;
    width: 40%;
    height: 16px;
    animation-delay: 1.2s;
}

.skel-5 {
    top: 50%;
    left: 25%;
    width: 50%;
    height: 60px;
    animation-delay: 0.6s;
}

.skel-6 {
    top: 70%;
    left: 10%;
    width: 30%;
    height: 14px;
    animation-delay: 1.5s;
}

.skel-7 {
    top: 80%;
    left: 45%;
    width: 48%;
    height: 20px;
    animation-delay: 2s;
}

/* === Reduced Motion === */
@media (prefers-reduced-motion: reduce) {
    .domain-title,
    .subtitle,
    .collage-fragment,
    .narrative-block,
    .empty-commit,
    .seam {
        transition: none;
        opacity: 1;
    }
    
    .skeleton-block {
        animation: none;
        background: var(--ash-gray);
    }
    
    .narrative-headline {
        transition: none;
    }
}

/* === Responsive adjustments === */
@media (max-width: 768px) {
    .domain-title {
        font-size: clamp(2.5rem, 10vw, 5rem);
        margin-left: -2vw;
    }
    
    .subtitle {
        margin-left: 5vw;
    }
    
    .narrative-grid {
        grid-template-columns: repeat(6, 1fr);
    }
    
    .block-1 { grid-column: 1 / 6; }
    .block-2 { grid-column: 2 / 7; margin-top: 10vh; }
    .block-3 { grid-column: 1 / 6; }
    .block-4 { grid-column: 2 / 7; }
    
    .collage-strip {
        height: 80vh;
    }
    
    .fragment-code {
        max-width: 80vw;
    }
    
    .skeleton-field {
        width: 95%;
    }
}
