/* xity.bar - Swiss Precision x Geological Depth */

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

:root {
    --marble-white: #F5F0EB;
    --quarry-slate: #2C2926;
    --oxidized-copper: #5C7C6B;
    --calcite-gold: #C4A265;
    --veined-gray: #9E9589;
    --deep-basalt: #1A1816;
    --warm-calcium: #E8E0D8;
    --patina-green: #3D5A4C;
    --sidebar-width: 280px;
}

html {
    scroll-behavior: smooth;
}

body {
    background-color: var(--marble-white);
    color: var(--quarry-slate);
    font-family: 'Libre Baskerville', serif;
    font-weight: 400;
    font-size: clamp(1rem, 1.1vw, 1.125rem);
    line-height: 1.75;
    letter-spacing: 0.01em;
    overflow-x: hidden;
}

/* ===== SIDEBAR ===== */
.sidebar {
    position: fixed;
    top: 0;
    left: 0;
    width: var(--sidebar-width);
    height: 100vh;
    z-index: 100;
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 48px 0;
    border-right: 1px solid var(--oxidized-copper);
    background:
        linear-gradient(135deg, rgba(245,240,235,0.15) 0%, rgba(232,224,216,0.1) 50%, rgba(245,240,235,0.15) 100%),
        radial-gradient(ellipse at 30% 40%, rgba(158,149,137,0.2) 0%, transparent 50%),
        linear-gradient(160deg, transparent 40%, rgba(196,162,101,0.1) 45%, transparent 50%),
        linear-gradient(180deg, var(--deep-basalt) 0%, var(--quarry-slate) 100%);
}

.sidebar-wordmark {
    font-family: 'Jost', sans-serif;
    font-weight: 700;
    font-size: 1.8rem;
    letter-spacing: 0.12em;
    color: var(--calcite-gold);
    writing-mode: vertical-rl;
    text-orientation: mixed;
    transform: rotate(180deg);
    margin-bottom: auto;
}

.sidebar-nav {
    display: flex;
    flex-direction: column;
    gap: 32px;
    margin-bottom: auto;
}

.nav-link {
    font-family: 'Jost', sans-serif;
    font-weight: 500;
    font-size: 0.85rem;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: var(--marble-white);
    text-decoration: none;
    position: relative;
    background-image: linear-gradient(var(--oxidized-copper), var(--oxidized-copper));
    background-size: 0% 2px;
    background-position: left bottom;
    background-repeat: no-repeat;
    transition: background-size 0.4s cubic-bezier(0.25, 0.46, 0.45, 0.94), color 0.3s ease;
    padding-bottom: 4px;
}

.nav-link:hover {
    background-size: 100% 2px;
    color: var(--calcite-gold);
}

.nav-link.active {
    background-image: linear-gradient(var(--calcite-gold), var(--calcite-gold));
    background-size: 100% 3px;
    color: var(--calcite-gold);
}

.sidebar-blob {
    width: 200px;
    height: auto;
    margin-top: 32px;
    opacity: 0.5;
}

/* ===== MOBILE BAR ===== */
.mobile-bar {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    height: 64px;
    background:
        linear-gradient(135deg, rgba(245,240,235,0.12) 0%, rgba(232,224,216,0.08) 100%),
        linear-gradient(180deg, var(--deep-basalt) 0%, var(--quarry-slate) 100%);
    z-index: 100;
    align-items: center;
    justify-content: space-between;
    padding: 0 24px;
    border-bottom: 1px solid var(--oxidized-copper);
}

.mobile-wordmark {
    font-family: 'Jost', sans-serif;
    font-weight: 700;
    font-size: 1.1rem;
    letter-spacing: 0.08em;
    color: var(--calcite-gold);
}

.hamburger {
    background: none;
    border: none;
    cursor: pointer;
    display: flex;
    flex-direction: column;
    gap: 5px;
    padding: 8px;
}

.hamburger span {
    display: block;
    width: 24px;
    height: 2px;
    background: var(--marble-white);
    transition: transform 0.3s ease, opacity 0.3s ease;
}

.mobile-nav-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(26, 24, 22, 0.95);
    z-index: 99;
    align-items: center;
    justify-content: center;
}

.mobile-nav-overlay.open {
    display: flex;
}

.mobile-nav {
    display: flex;
    flex-direction: column;
    gap: 32px;
    text-align: center;
}

.mobile-nav .nav-link {
    font-size: 1.2rem;
}

/* ===== MAIN CONTENT ===== */
.content {
    margin-left: var(--sidebar-width);
}

/* ===== GRID CONTAINER ===== */
.grid-container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 48px;
}

/* ===== SCENES ===== */
.scene {
    position: relative;
}

/* Scene 1: Threshold */
.scene-threshold {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    justify-content: center;
    background:
        linear-gradient(135deg, var(--marble-white) 0%, var(--warm-calcium) 50%, var(--marble-white) 100%),
        radial-gradient(ellipse at 30% 40%, rgba(158,149,137,0.3) 0%, transparent 50%),
        linear-gradient(160deg, transparent 40%, rgba(196,162,101,0.15) 45%, transparent 50%);
    padding: 0 48px;
}

.hero-title {
    font-family: 'Jost', sans-serif;
    font-weight: 500;
    font-size: clamp(3rem, 7vw, 6rem);
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: var(--quarry-slate);
    line-height: 1.15;
    opacity: 0;
    transform: translateY(20px);
    transition: opacity 0.6s ease, transform 0.6s ease;
}

.hero-title.revealed {
    opacity: 1;
    transform: translateY(0);
}

.hero-rule {
    width: 0;
    height: 2px;
    background: var(--oxidized-copper);
    margin: 32px 0;
    transition: width 2s cubic-bezier(0.25, 0.46, 0.45, 0.94);
}

.hero-rule.revealed {
    width: 200px;
}

.hero-subtitle {
    font-family: 'Libre Baskerville', serif;
    font-weight: 400;
    font-size: clamp(1rem, 1.5vw, 1.2rem);
    color: var(--veined-gray);
    max-width: 600px;
    opacity: 0;
    transform: translateY(20px);
    transition: opacity 0.6s ease 0.4s, transform 0.6s ease 0.4s;
}

.hero-subtitle.revealed {
    opacity: 1;
    transform: translateY(0);
}

.blob-accent {
    position: absolute;
}

.blob-threshold {
    bottom: 5%;
    right: 5%;
    width: 200px;
    height: 200px;
}

.blob-deep {
    position: relative;
    width: 240px;
    height: 240px;
    margin: 60px auto 0;
}

[data-pulse] svg {
    animation: blobPulse 6s ease-in-out infinite alternate;
}

@keyframes blobPulse {
    0% { transform: scale(1.0); }
    100% { transform: scale(1.03); }
}

/* Scene 2: Grid Revelation */
.scene-grid {
    min-height: 100vh;
    padding: 120px 0;
    position: relative;
}

.grid-flash {
    position: absolute;
    inset: 0;
    pointer-events: none;
    opacity: 0;
    background-image:
        repeating-linear-gradient(90deg, transparent, transparent calc(12.5% - 12px), var(--warm-calcium) calc(12.5% - 12px), var(--warm-calcium) calc(12.5% + 12px), transparent calc(12.5% + 12px));
}

.grid-flash.flash {
    animation: gridFlashAnim 1.2s ease forwards;
}

@keyframes gridFlashAnim {
    0% { opacity: 0; }
    40% { opacity: 0.4; }
    100% { opacity: 0; }
}

.section-number {
    font-family: 'IBM Plex Mono', monospace;
    font-weight: 400;
    font-size: 3rem;
    color: var(--warm-calcium);
    letter-spacing: 0.08em;
    text-transform: uppercase;
    padding: 0 48px;
    margin-bottom: 32px;
    opacity: 0;
    transform: translateY(20px);
    transition: opacity 0.5s ease, transform 0.5s ease, color 0.3s ease;
}

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

.section-number:hover {
    color: var(--calcite-gold);
}

.section-number-light {
    color: rgba(245, 240, 235, 0.2);
}

.section-number-light.revealed {
    color: rgba(245, 240, 235, 0.2);
}

.section-number-light:hover {
    color: var(--calcite-gold);
}

.grid-block {
    margin-bottom: 64px;
    opacity: 0;
    transform: translateY(20px);
    transition: opacity 0.5s ease, transform 0.5s ease;
    transition-delay: var(--stagger-delay, 0ms);
}

.grid-block.revealed {
    opacity: 1;
    transform: translateY(0);
}

.grid-block h2,
.strata-content h2,
.deep-content h2 {
    font-family: 'Jost', sans-serif;
    font-weight: 700;
    font-size: clamp(1.4rem, 2.5vw, 2.2rem);
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: var(--quarry-slate);
    line-height: 1.15;
    margin-bottom: 16px;
    position: relative;
    display: inline-block;
    background-image: linear-gradient(var(--oxidized-copper), var(--oxidized-copper));
    background-size: 0% 2px;
    background-position: left bottom;
    background-repeat: no-repeat;
    padding-bottom: 6px;
    transition: background-size 0.6s cubic-bezier(0.25, 0.46, 0.45, 0.94);
}

.grid-block.revealed h2,
.strata-content.revealed h2,
.deep-content.revealed h2 {
    background-size: 100% 2px;
}

.grid-block p,
.strata-content p,
.deep-content p {
    max-width: 640px;
}

/* Scene 3: Strata */
.scene-strata {
    position: relative;
}

.blob-divider {
    width: 100%;
    line-height: 0;
    margin: -1px 0;
}

.blob-divider svg {
    width: 100%;
    height: 80px;
    display: block;
}

.strata-band {
    padding: 80px 0;
    position: relative;
}

.marble-band {
    background:
        linear-gradient(135deg, var(--marble-white) 0%, var(--warm-calcium) 50%, var(--marble-white) 100%),
        radial-gradient(ellipse at 30% 40%, rgba(158,149,137,0.3) 0%, transparent 50%),
        linear-gradient(160deg, transparent 40%, rgba(196,162,101,0.15) 45%, transparent 50%),
        radial-gradient(ellipse at 70% 80%, rgba(92,124,107,0.2) 0%, transparent 40%);
}

.clean-band {
    background: var(--marble-white);
}

.strata-content {
    opacity: 0;
    transform: translateY(20px);
    transition: opacity 0.5s ease, transform 0.5s ease;
}

.strata-content.revealed {
    opacity: 1;
    transform: translateY(0);
}

/* Scene 4: Deep Vein */
.scene-deep {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    justify-content: center;
    padding: 120px 0;
    background:
        radial-gradient(ellipse at 50% 50%, rgba(158,149,137,0.08) 0%, transparent 50%),
        linear-gradient(160deg, transparent 40%, rgba(196,162,101,0.06) 45%, transparent 50%),
        linear-gradient(180deg, var(--deep-basalt) 0%, #1A1816 100%);
    color: var(--marble-white);
}

.deep-content {
    opacity: 0;
    transform: translateY(20px);
    transition: opacity 0.5s ease, transform 0.5s ease;
}

.deep-content.revealed {
    opacity: 1;
    transform: translateY(0);
}

.deep-content h2 {
    color: var(--marble-white);
    background-image: linear-gradient(var(--calcite-gold), var(--calcite-gold));
}

.deep-content p {
    color: rgba(245, 240, 235, 0.85);
}

/* Scene 5: Foundation */
.scene-foundation {
    min-height: 50vh;
    display: flex;
    flex-direction: column;
    justify-content: center;
    padding: 80px 0;
    background: var(--marble-white);
}

.foundation-content {
    text-align: left;
    opacity: 0;
    transform: translateY(20px);
    transition: opacity 0.5s ease, transform 0.5s ease;
}

.foundation-content.revealed {
    opacity: 1;
    transform: translateY(0);
}

.foundation-statement {
    font-family: 'Jost', sans-serif;
    font-weight: 500;
    font-size: clamp(1.4rem, 2.5vw, 2rem);
    letter-spacing: 0.04em;
    color: var(--quarry-slate);
    max-width: 700px;
    line-height: 1.4;
}

.foundation-rule {
    width: 0;
    height: 2px;
    background: var(--oxidized-copper);
    margin: 32px 0;
    transition: width 1.5s cubic-bezier(0.25, 0.46, 0.45, 0.94);
}

.foundation-rule.revealed {
    width: 120px;
}

.foundation-meta {
    display: flex;
    gap: 32px;
    flex-wrap: wrap;
}

.meta-label {
    font-family: 'IBM Plex Mono', monospace;
    font-weight: 400;
    font-size: 0.8rem;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--veined-gray);
}

/* ===== RESPONSIVE ===== */
@media (max-width: 768px) {
    .sidebar {
        display: none;
    }

    .mobile-bar {
        display: flex;
    }

    .content {
        margin-left: 0;
        padding-top: 64px;
    }

    .scene-threshold {
        padding: 0 24px;
    }

    .grid-container {
        padding: 0 24px;
    }

    .section-number {
        padding: 0 24px;
    }

    .blob-threshold {
        width: 120px;
        height: 120px;
        bottom: 10%;
        right: 5%;
    }
}
