:root {
    --bg-primary: #FAF8F3;
    --bg-sidebar: #F7F5F0;
    --text-primary: #3A3832;
    --text-secondary: #5A564E;
    --text-tertiary: #9B9689;
    --border-color: #E0DCD4;
    --accent-primary: #7D8B6A;
    --accent-hover: #5C6B4E;
    --accent-warm: #C2A68C;
    --divider-center: #C4BFB3;
    --font-heading: 'Libre Baskerville', Georgia, serif;
    --font-body: 'Source Sans 3', 'Source Sans Pro', sans-serif;
    --font-mono: 'DM Mono', monospace;
}

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

html {
    font-size: 16px;
    scroll-behavior: smooth;
}

body {
    background-color: var(--bg-primary);
    color: var(--text-primary);
    font-family: var(--font-body);
    min-height: 100vh;
    display: flex;
    position: relative;
}

/* Subliminal dot grid at 3% opacity */
body::before {
    content: '';
    position: fixed;
    top: 0;
    left: 64px;
    right: 0;
    bottom: 0;
    background-image: radial-gradient(circle, var(--divider-center) 1px, transparent 1px);
    background-size: 24px 24px;
    opacity: 0.03;
    z-index: 0;
    pointer-events: none;
}

/* ==================== SIDEBAR ==================== */

.sidebar {
    position: fixed;
    left: 0;
    top: 0;
    bottom: 0;
    width: 64px;
    background-color: var(--bg-sidebar);
    border-right: 1px solid var(--border-color);
    z-index: 10;
    transition: width 600ms ease-out;
    overflow: hidden;
}

.sidebar:hover {
    width: 200px;
}

.sidebar-inner {
    display: flex;
    flex-direction: column;
    align-items: center;
    height: 100%;
    padding: 2.5rem 0;
    position: relative;
}

.sidebar-icon-container {
    width: 32px;
    height: 32px;
    margin-bottom: 2rem;
    flex-shrink: 0;
}

.sidebar-rotating-icon {
    width: 32px;
    height: 32px;
    animation: sidebarIconRotate 20s linear infinite;
}

@keyframes sidebarIconRotate {
    from { transform: rotate(0deg); }
    to { transform: rotate(360deg); }
}

.sidebar-wordmark {
    font-family: var(--font-mono);
    font-size: 11px;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: var(--text-tertiary);
    writing-mode: vertical-rl;
    transform: rotate(180deg);
    flex-shrink: 0;
    margin-bottom: auto;
}

.sidebar-nav {
    display: flex;
    flex-direction: column;
    gap: 1.25rem;
    align-items: center;
    flex-shrink: 0;
    padding: 1rem 0;
}

.sidebar-nav-labels {
    position: absolute;
    left: 64px;
    top: 0;
    bottom: 0;
    display: flex;
    flex-direction: column;
    justify-content: flex-end;
    padding-bottom: 2.5rem;
    padding-left: 1rem;
    opacity: 0;
    transition: opacity 400ms ease-out 200ms;
    pointer-events: none;
}

.sidebar:hover .sidebar-nav-labels {
    opacity: 1;
    pointer-events: auto;
}

.nav-label {
    font-family: var(--font-mono);
    font-size: 10px;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    color: var(--text-tertiary);
    height: calc(6px + 1.25rem);
    display: flex;
    align-items: center;
    white-space: nowrap;
    cursor: pointer;
    transition: color 300ms ease;
}

.nav-label:hover {
    color: var(--accent-primary);
}

.nav-label.active {
    color: var(--accent-primary);
}

.nav-dot {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background-color: var(--text-tertiary);
    cursor: pointer;
    transition: background-color 400ms ease, transform 300ms ease, opacity 300ms ease;
    flex-shrink: 0;
}

.nav-dot:hover {
    transform: scale(1.4);
}

.nav-dot.active {
    background-color: var(--accent-primary);
    animation: dotPulse 2000ms ease-in-out infinite alternate;
}

@keyframes dotPulse {
    0% {
        transform: scale(1);
        opacity: 0.5;
    }
    100% {
        transform: scale(1.2);
        opacity: 1;
    }
}

/* ==================== CONTENT ==================== */

.content {
    margin-left: 64px;
    flex: 1;
    position: relative;
    z-index: 1;
}

.section {
    max-width: 720px;
    margin: 0 auto;
    padding: 80px 2rem;
    position: relative;
}

.section-end-space {
    height: 120px;
}

/* Circuit trace animation */
.circuit-trace {
    position: absolute;
    left: -64px;
    top: 100px;
    width: 64px;
    height: 1px;
    background-color: var(--border-color);
    transform: scaleX(0);
    transform-origin: left;
    opacity: 0;
}

.circuit-trace.animate {
    animation: circuitDraw 800ms ease-in-out forwards, circuitFade 400ms ease-out 800ms forwards;
}

@keyframes circuitDraw {
    from {
        transform: scaleX(0);
        opacity: 1;
    }
    to {
        transform: scaleX(1);
        opacity: 1;
    }
}

@keyframes circuitFade {
    from { opacity: 1; }
    to { opacity: 0; }
}

/* ==================== ICON BLOCKS ==================== */

.icon-block {
    display: flex;
    justify-content: center;
    margin-bottom: 2rem;
}

.section-icon {
    width: 80px;
    height: 80px;
    color: var(--border-color);
    transition: color 800ms ease;
}

.section.in-view .section-icon {
    color: var(--text-tertiary);
}

/* Wave Pulse icon specific animation */
.wave-pulse-icon .wave-line {
    opacity: 1;
    transition: opacity 600ms ease;
}

.wave-pulse-icon .wave-shape {
    opacity: 0;
    transition: opacity 600ms ease;
}

.section.in-view .wave-pulse-icon .wave-line {
    opacity: 0;
}

.section.in-view .wave-pulse-icon .wave-shape {
    opacity: 1;
    transition: opacity 1500ms ease 300ms;
}

/* Spiral icon draw animation */
.spiral-icon .spiral-path {
    stroke-dasharray: 300;
    stroke-dashoffset: 300;
    transition: stroke-dashoffset 2000ms ease-out;
}

.section.in-view .spiral-icon .spiral-path {
    stroke-dashoffset: 0;
}

/* Ring Breath continuous rotation */
.ring-breath-icon .ring-arc-1 {
    transform-origin: 40px 40px;
    animation: ringCW 8s linear infinite;
}

.ring-breath-icon .ring-arc-2 {
    transform-origin: 40px 40px;
    animation: ringCCW 8s linear infinite;
}

.ring-breath-icon .ring-arc-3 {
    transform-origin: 40px 40px;
    animation: ringCW 8s linear infinite;
}

.ring-breath-icon .ring-arc-4 {
    transform-origin: 40px 40px;
    animation: ringCCW 8s linear infinite;
}

@keyframes ringCW {
    0% { transform: rotate(0deg); }
    50% { transform: rotate(5deg); }
    100% { transform: rotate(0deg); }
}

@keyframes ringCCW {
    0% { transform: rotate(0deg); }
    50% { transform: rotate(-5deg); }
    100% { transform: rotate(0deg); }
}

/* ==================== TYPOGRAPHY ==================== */

.section-heading {
    font-family: var(--font-heading);
    font-weight: 400;
    font-size: 2rem;
    color: var(--text-primary);
    letter-spacing: 0.04em;
    line-height: 1.3;
    margin-bottom: 1.5rem;
}

.body-text {
    font-family: var(--font-body);
    font-weight: 400;
    font-size: 17px;
    line-height: 1.75;
    color: var(--text-secondary);
    max-width: 65ch;
    margin-bottom: 1.5rem;
    letter-spacing: 0.01em;
}

.footnote-zone {
    padding-left: 16px;
    margin-top: 0.5rem;
}

.footnote {
    font-family: var(--font-body);
    font-weight: 300;
    font-size: 14px;
    color: var(--text-tertiary);
    font-style: italic;
    line-height: 1.6;
}

/* ==================== DIVIDERS ==================== */

.section-divider {
    width: 200px;
    height: 1px;
    margin: 0 auto;
    background: linear-gradient(to right, transparent, var(--divider-center) 30%, var(--divider-center) 70%, transparent);
}

/* ==================== FADE REVEAL ==================== */

.fade-reveal {
    opacity: 0;
    transform: translateY(20px);
    transition: opacity 1200ms ease-out, transform 1200ms ease-out;
}

.fade-reveal.visible {
    opacity: 1;
    transform: translateY(0);
}

/* Staggered entry for children within section */
.section .icon-block.fade-reveal {
    transition-delay: 0ms;
}

.section .section-heading.fade-reveal {
    transition-delay: 150ms;
}

.section .body-text.fade-reveal:nth-of-type(1) {
    transition-delay: 300ms;
}

.section .body-text.fade-reveal:nth-of-type(2) {
    transition-delay: 400ms;
}

.section .footnote-zone.fade-reveal {
    transition-delay: 450ms;
}

/* ==================== ACCENT LINKS (if any) ==================== */

a {
    color: var(--accent-primary);
    text-decoration: none;
    transition: color 300ms ease;
}

a:hover {
    color: var(--accent-hover);
}

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

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

    body::before {
        left: 0;
    }

    .content {
        margin-left: 0;
    }

    .section {
        padding: 60px 1.5rem;
    }

    .circuit-trace {
        display: none;
    }

    .section-heading {
        font-size: 1.6rem;
    }
}

@media (max-width: 480px) {
    .section {
        padding: 48px 1.25rem;
    }

    .body-text {
        font-size: 15px;
    }

    .section-heading {
        font-size: 1.35rem;
    }

    .section-icon {
        width: 64px;
        height: 64px;
    }
}
