/* Palette: #b8849c #d4764e used in SVG gradients and here for reference */
/* === Reset & Base === */
*, *::before, *::after {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    scroll-behavior: smooth;
}

body {
    font-family: 'Source Serif 4', Georgia, serif;
    font-size: clamp(1.05rem, 1.2vw, 1.2rem);
    line-height: 1.75;
    color: #3b2e24;
    background-color: #f5e6d3;
}

/* === Marble Texture Mixin (via background) === */
.marble-bg {
    background-image:
        radial-gradient(ellipse at 20% 50%, rgba(232, 213, 192, 0.6) 0%, transparent 50%),
        radial-gradient(ellipse at 80% 20%, rgba(232, 213, 192, 0.4) 0%, transparent 40%),
        radial-gradient(ellipse at 50% 80%, rgba(237, 224, 208, 0.5) 0%, transparent 45%),
        radial-gradient(ellipse at 70% 60%, rgba(232, 213, 192, 0.3) 0%, transparent 35%);
}

/* === Navigation === */
#nav-bar {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    height: 3rem;
    z-index: 100;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 2rem;
    background: #f5e6d3cc;
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    transition: box-shadow 0.3s ease;
}

#nav-bar.scrolled {
    box-shadow: 0 2px 12px rgba(42, 31, 26, 0.12);
}

.nav-domain {
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.85rem;
    color: #3b2e24;
    letter-spacing: 0.05em;
}

.nav-links {
    display: flex;
    align-items: center;
    gap: 0;
}

.nav-links a {
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.8rem;
    color: #8a6e58;
    text-decoration: none;
    padding: 0 0.75rem;
    border-right: 1px solid #e8d5c0;
    transition: color 0.3s ease, transform 0.4s ease;
}

.nav-links a:last-child {
    border-right: none;
}

.nav-links a:hover {
    color: #c45a3c;
    transform: perspective(800px) rotateY(2deg) rotateX(-1deg);
}

.nav-hamburger {
    display: none;
    background: none;
    border: none;
    cursor: pointer;
    width: 24px;
    height: 20px;
    position: relative;
}

.nav-hamburger span {
    display: block;
    width: 100%;
    height: 2px;
    background: #3b2e24;
    position: absolute;
    left: 0;
    transition: transform 0.3s ease, opacity 0.3s ease;
}

.nav-hamburger span:nth-child(1) { top: 0; }
.nav-hamburger span:nth-child(2) { top: 9px; }
.nav-hamburger span:nth-child(3) { top: 18px; }

/* === Hero / The Pedestal === */
.hero {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    perspective: 1200px;
    background-color: #f5e6d3;
    background-image:
        radial-gradient(ellipse at 30% 40%, rgba(232, 213, 192, 0.7) 0%, transparent 50%),
        radial-gradient(ellipse at 70% 30%, rgba(232, 213, 192, 0.5) 0%, transparent 40%),
        radial-gradient(ellipse at 50% 70%, rgba(237, 224, 208, 0.6) 0%, transparent 45%),
        radial-gradient(ellipse at 20% 80%, rgba(232, 213, 192, 0.3) 0%, transparent 35%),
        radial-gradient(ellipse at 80% 70%, rgba(245, 230, 211, 0.4) 0%, transparent 50%);
}

.hero-inner {
    text-align: center;
    transform: rotateX(1.5deg);
}

.hero-title {
    font-family: 'Cormorant Garamond', serif;
    font-weight: 700;
    font-size: clamp(3rem, 10vw, 7rem);
    letter-spacing: 0.06em;
    color: #3b2e24;
    margin-bottom: 0.25rem;
}

.hero-subtitle {
    display: block;
    font-family: 'JetBrains Mono', monospace;
    font-size: 1rem;
    letter-spacing: 0.3em;
    color: #8a6e58;
    margin-bottom: 3rem;
}

.hero-field-svg {
    max-width: 80vw;
    height: auto;
}

.monopole-center {
    filter: drop-shadow(0 0 12px #d4869a) drop-shadow(0 0 4px #c45a3c);
}

.field-lines-group {
    animation: spin 60s linear infinite;
    transform-origin: 240px 240px;
}

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

.field-line {
    fill: none;
    stroke: url(#fieldGrad);
}

/* === Chapter Dividers === */
.chapter-divider {
    width: 100%;
    padding: 1rem 0;
}

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

/* === Chapters === */
.chapter {
    min-height: 80vh;
    display: flex;
    align-items: flex-start;
    justify-content: center;
    padding: 6rem 2rem;
}

.chapter:nth-child(even) {
    background-color: #ede0d0;
}

.chapter-content {
    max-width: 52rem;
    width: 100%;
    position: relative;
}

.chapter-icon {
    margin-bottom: 1rem;
}

.chapter-label {
    font-family: 'Cormorant SC', serif;
    font-weight: 600;
    font-size: 0.85rem;
    letter-spacing: 0.12em;
    color: #8a6e58;
    display: block;
    margin-bottom: 0.5rem;
}

.chapter-number {
    font-family: 'Cormorant Garamond', serif;
    font-weight: 600;
    font-size: clamp(4rem, 8vw, 6rem);
    color: rgba(196, 90, 60, 0.15);
    position: absolute;
    top: -0.5rem;
    right: 0;
    line-height: 1;
    pointer-events: none;
    z-index: 0;
}

.chapter-title {
    font-family: 'Cormorant Garamond', serif;
    font-weight: 700;
    font-size: clamp(2.5rem, 6vw, 4.5rem);
    letter-spacing: 0.04em;
    color: #3b2e24;
    margin-bottom: 2rem;
    position: relative;
    z-index: 1;
}

.chapter-content p {
    margin-bottom: 1.5rem;
}

.chapter-content code {
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.9em;
    color: #6b4f3a;
    background: rgba(237, 224, 208, 0.5);
    padding: 0.1em 0.3em;
    border-radius: 3px;
}

/* === Pull Quotes === */
.pull-quote {
    margin: 2.5rem 0;
    padding: 2rem 2rem 2rem 2.5rem;
    border-left: 3px solid #c45a3c;
    background-color: rgba(237, 224, 208, 0.4);
    background-image:
        radial-gradient(ellipse at 30% 50%, rgba(232, 213, 192, 0.3) 0%, transparent 50%),
        radial-gradient(ellipse at 70% 30%, rgba(232, 213, 192, 0.2) 0%, transparent 40%);
    position: relative;
    transition: transform 0.4s ease-out, box-shadow 0.4s ease-out;
}

.pull-quote:hover {
    transform: perspective(800px) rotateY(2deg) rotateX(-1deg);
    box-shadow: 4px 4px 12px rgba(42, 31, 26, 0.15);
}

.pull-quote p {
    font-size: clamp(1.15rem, 1.4vw, 1.35rem);
    font-style: italic;
    color: #3b2e24;
    margin-bottom: 0;
}

.pull-quote cite {
    display: block;
    margin-top: 1rem;
    font-family: 'Cormorant SC', serif;
    font-weight: 600;
    font-size: 0.85rem;
    letter-spacing: 0.08em;
    color: #8a6e58;
    font-style: normal;
}

/* === Dirac Quote (special treatment) === */
.dirac-quote {
    border: 2px solid #c45a3c;
    border-left-width: 3px;
    padding: 2.5rem;
    position: relative;
}

.dirac-quote::before,
.dirac-quote::after {
    content: '';
    position: absolute;
    width: 16px;
    height: 16px;
    border-color: #c9954a;
    border-style: solid;
}

.dirac-quote::before {
    top: 8px;
    left: 8px;
    border-width: 2px 0 0 2px;
}

.dirac-quote::after {
    bottom: 8px;
    right: 8px;
    border-width: 0 2px 2px 0;
}

/* === Equation Panels === */
.equation-panel {
    margin: 2rem 0;
    padding: 1.5rem 2rem;
    background: #ede0d0;
    border-left: 2px solid #c45a3c;
}

.equation-panel code {
    font-family: 'JetBrains Mono', monospace;
    font-size: 1.1rem;
    letter-spacing: 0.02em;
    color: #3b2e24;
    display: block;
    margin-bottom: 0.75rem;
    background: none;
    padding: 0;
}

.equation-note {
    font-family: 'Source Serif 4', serif;
    font-size: 0.85rem;
    color: #8a6e58;
    font-style: italic;
}

/* === Footer / The Archive === */
#footer {
    background: #2a1f1a;
    padding: 3rem 2rem;
    text-align: center;
}

.footer-inner {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.5rem;
}

.footer-domain {
    font-family: 'Cormorant SC', serif;
    font-weight: 600;
    font-size: 1rem;
    letter-spacing: 0.15em;
    color: #e8d5c0;
}

.footer-tagline {
    font-family: 'Cormorant SC', serif;
    font-weight: 600;
    font-size: 0.8rem;
    letter-spacing: 0.12em;
    color: #8a6e58;
}

.footer-year {
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.75rem;
    color: #6b4f3a;
}

/* === Reveal Animation === */
.reveal {
    opacity: 0;
    transform: translateY(40px) rotateX(2deg);
    transition: opacity 0.8s ease-out, transform 1s cubic-bezier(0.16, 1, 0.3, 1);
}

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

/* === Mobile === */
@media (max-width: 768px) {
    .nav-links {
        display: none;
        position: absolute;
        top: 3rem;
        left: 0;
        right: 0;
        background: #f5e6d3ee;
        backdrop-filter: blur(8px);
        flex-direction: column;
        padding: 1rem 0;
    }

    .nav-links.open {
        display: flex;
    }

    .nav-links a {
        border-right: none;
        border-bottom: 1px solid #e8d5c0;
        padding: 0.75rem 2rem;
        width: 100%;
        text-align: left;
    }

    .nav-links a:last-child {
        border-bottom: none;
    }

    .nav-hamburger {
        display: block;
    }

    .hero-inner {
        transform: none;
    }

    .pull-quote:hover {
        transform: none;
        box-shadow: none;
    }

    .chapter {
        padding: 4rem 1.5rem;
    }

    .chapter-number {
        font-size: clamp(3rem, 6vw, 4rem);
    }
}

@media (hover: none) {
    .nav-links a:hover {
        transform: none;
    }

    .pull-quote:hover {
        transform: none;
        box-shadow: none;
    }
}
