/* monopole.bar — Dark-Academia Scholarly Treatise */
/* Palette: monochrome scholar's desk with amber accent */

/* ===== CSS Custom Properties ===== */
:root {
    --bg-main: #1a1714;
    --bg-margin: #13110e;
    --text-primary: #d4cbb3;
    --text-secondary: #8a8070;
    --text-muted: #5c5548;
    --accent-gold: #c9953a;
    --divider: #3d362c;
    --hover-active: #e8d5a3;
    --font-display: 'Playfair Display', Georgia, 'Times New Roman', serif;
    --font-body: 'Cormorant Garamond', Garamond, 'Times New Roman', serif;
    --font-margin: 'IM Fell English', Georgia, serif;
}

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

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

body {
    background-color: var(--bg-main);
    color: var(--text-primary);
    font-family: var(--font-body);
    font-size: clamp(1.05rem, 1.3vw, 1.25rem);
    line-height: 1.95;
    letter-spacing: 0.01em;
    overflow-x: hidden;
}

/* ===== Page Wrapper — Open Book Layout ===== */
.page-wrapper {
    display: flex;
    min-height: 100vh;
    position: relative;
}

/* ===== Left Margin Column ===== */
.margin-column {
    position: fixed;
    left: 0;
    top: 0;
    width: 28%;
    height: 100vh;
    background-color: var(--bg-margin);
    z-index: 10;
    display: flex;
    overflow: hidden;
}

.margin-strip {
    width: 3px;
    height: 100%;
    background: linear-gradient(to bottom, transparent, var(--divider) 20%, var(--divider) 80%, transparent);
    position: absolute;
    right: 0;
    top: 0;
}

.margin-content {
    padding: 8rem 2rem 4rem 2.5rem;
    width: 100%;
    height: 100%;
    overflow-y: auto;
    scrollbar-width: none;
    -ms-overflow-style: none;
}

.margin-content::-webkit-scrollbar {
    display: none;
}

.margin-note {
    margin-bottom: 3rem;
    opacity: 0;
    transform: translateX(-10px);
    transition: opacity 0.8s ease, transform 0.8s ease;
}

.margin-note.visible {
    opacity: 1;
    transform: translateX(0);
}

.margin-ref {
    display: block;
    font-family: var(--font-margin);
    font-style: italic;
    font-size: 1.2rem;
    color: var(--accent-gold);
    margin-bottom: 0.3rem;
}

.margin-text {
    font-family: var(--font-margin);
    font-style: italic;
    font-size: clamp(0.75rem, 1vw, 0.9rem);
    line-height: 1.6;
    color: var(--text-secondary);
}

.margin-sub {
    font-size: clamp(0.65rem, 0.85vw, 0.8rem);
    color: var(--text-muted);
    margin-top: 0.2rem;
}

/* ===== Maxwell's Equations SVG ===== */
.maxwell-svg {
    width: 100%;
    max-width: 180px;
}

.equation-text {
    font-family: var(--font-margin);
    font-style: italic;
    font-size: 14px;
    fill: var(--text-secondary);
}

.equation-text.small-eq {
    font-size: 12px;
    fill: var(--text-muted);
}

.eq-highlight {
    fill: var(--text-primary);
    font-weight: 600;
}

.eq-accent {
    fill: var(--accent-gold);
}

/* ===== Glass SVG ===== */
.glass-svg {
    width: 80px;
    margin-top: 1rem;
}

.monopole-dot-glass {
    fill: var(--accent-gold);
    animation: pulse-glow 4s ease-in-out infinite;
}

/* ===== Right Content Zone ===== */
.content-zone {
    margin-left: 28%;
    width: 72%;
    padding: 0 clamp(3rem, 6vw, 8rem) 0 clamp(3rem, 4vw, 5rem);
}

/* ===== Sections ===== */
.section {
    padding: 8rem 0;
}

.section-opening {
    padding-top: 12rem;
}

.section-inner {
    max-width: 680px;
}

/* ===== Typography ===== */
.section-heading {
    font-family: var(--font-display);
    font-weight: 400;
    font-size: clamp(2.2rem, 5vw, 4rem);
    letter-spacing: 0.02em;
    color: var(--text-primary);
    margin-bottom: 0.5rem;
    text-transform: none;
}

.section-subtitle {
    font-family: var(--font-display);
    font-style: italic;
    font-weight: 400;
    font-size: clamp(1.1rem, 1.8vw, 1.4rem);
    color: var(--text-secondary);
    margin-bottom: 3rem;
}

.body-text {
    font-family: var(--font-body);
    font-weight: 400;
    font-size: clamp(1.05rem, 1.3vw, 1.25rem);
    line-height: 1.95;
    letter-spacing: 0.01em;
    color: var(--text-primary);
    margin-bottom: 2rem;
}

.body-text em {
    font-style: italic;
    color: var(--hover-active);
}

.opening-paragraph {
    font-family: var(--font-body);
    font-weight: 400;
    font-size: clamp(1.1rem, 1.4vw, 1.3rem);
    line-height: 2.1;
    margin-bottom: 2.5rem;
}

.diagram-caption {
    font-size: clamp(0.95rem, 1.1vw, 1.1rem);
    color: var(--text-secondary);
    font-style: italic;
    margin-top: 2rem;
}

.closing-line {
    margin-top: 1rem;
    font-style: italic;
    color: var(--hover-active);
}

/* ===== Drop Caps ===== */
.drop-cap {
    float: left;
    font-family: var(--font-display);
    font-style: italic;
    font-weight: 400;
    font-size: 4em;
    line-height: 0.8;
    padding-right: 0.12em;
    padding-top: 0.07em;
    color: var(--accent-gold);
    opacity: 0;
    transform: translateY(-30px);
}

.drop-cap.animate-in {
    animation: bounce-enter 600ms cubic-bezier(0.34, 1.56, 0.64, 1) forwards;
}

.drop-cap-section {
    float: left;
    font-family: var(--font-display);
    font-style: italic;
    font-weight: 400;
    font-size: 3.5em;
    line-height: 0.8;
    padding-right: 0.1em;
    padding-top: 0.05em;
    color: var(--accent-gold);
    opacity: 0;
    transform: translateY(-25px);
}

.drop-cap-section.animate-in {
    animation: bounce-enter 600ms cubic-bezier(0.34, 1.56, 0.64, 1) forwards;
}

@keyframes bounce-enter {
    0% {
        opacity: 0;
        transform: translateY(-30px);
    }
    60% {
        opacity: 1;
        transform: translateY(4px);
    }
    80% {
        transform: translateY(-2px);
    }
    100% {
        opacity: 1;
        transform: translateY(0);
    }
}

/* ===== Reveal Animation for Text ===== */
.reveal-text {
    opacity: 0;
    transition: opacity 0.9s ease;
}

.reveal-text.visible {
    opacity: 1;
}

/* ===== Ornamental Dividers ===== */
.ornamental-divider {
    text-align: center;
    padding: 3rem 0;
    margin: 2rem 0;
}

.ornamental-divider-small {
    padding: 1.5rem 0;
    margin: 0.5rem 0;
}

.ornament {
    font-size: 1.1rem;
    color: var(--divider);
    letter-spacing: 0.5em;
    display: inline-block;
}

/* ===== Field Diagram ===== */
.field-diagram-container {
    width: 100%;
    max-width: 800px;
    margin: 3rem auto;
}

.monopole-field-svg {
    width: 100%;
    height: auto;
}

.monopole-dot {
    fill: var(--accent-gold);
}

.monopole-glow {
    fill: var(--accent-gold);
    opacity: 0.3;
    animation: pulse-glow 4s ease-in-out infinite;
}

@keyframes pulse-glow {
    0%, 100% {
        opacity: 0.2;
        r: 12;
    }
    50% {
        opacity: 0.5;
        r: 18;
    }
}

.field-line {
    fill: none;
    stroke: var(--text-muted);
    stroke-width: 1.2;
    stroke-linecap: round;
    stroke-dasharray: 300;
    stroke-dashoffset: 300;
    transition: stroke-dashoffset 2s ease;
}

.field-line.drawn {
    stroke-dashoffset: 0;
}

/* Vary stroke widths to simulate hand pressure */
.field-line:nth-child(odd) {
    stroke-width: 1;
}
.field-line:nth-child(3n) {
    stroke-width: 1.4;
}
.field-line:nth-child(5n) {
    stroke-width: 0.8;
}

/* ===== Wildflower Watermark ===== */
.wildflower-container {
    position: relative;
}

.wildflower-silhouette {
    position: absolute;
    pointer-events: none;
    transition: opacity 0.6s ease;
}

.wildflower-1 {
    width: 200px;
    height: 280px;
    right: -40px;
    top: -20px;
    opacity: 0.05;
    background: var(--text-muted);
    clip-path: polygon(
        50% 0%, 55% 8%, 65% 5%, 60% 15%, 72% 12%, 63% 22%,
        75% 25%, 62% 30%, 70% 38%, 58% 35%, 60% 45%, 52% 38%,
        50% 50%, 48% 38%, 40% 45%, 42% 35%, 30% 38%, 38% 30%,
        25% 25%, 37% 22%, 28% 12%, 40% 15%, 35% 5%, 45% 8%
    );
}

.wildflower-container:hover .wildflower-1 {
    opacity: 0.12;
}

/* ===== Botanical Overlay ===== */
.botanical-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 1;
}

.botanical {
    position: absolute;
    opacity: 0.04;
    background: var(--text-muted);
    transition: opacity 0.6s ease;
}

.botanical-1 {
    width: 150px;
    height: 200px;
    top: 15%;
    left: 8%;
    clip-path: polygon(
        50% 0%, 60% 15%, 75% 10%, 65% 28%, 80% 35%,
        65% 40%, 70% 55%, 55% 48%, 50% 65%, 45% 48%,
        30% 55%, 35% 40%, 20% 35%, 35% 28%, 25% 10%, 40% 15%
    );
}

.botanical-2 {
    width: 120px;
    height: 180px;
    top: 55%;
    right: 5%;
    clip-path: polygon(
        50% 0%, 58% 20%, 70% 15%, 62% 35%, 78% 40%,
        60% 45%, 65% 60%, 50% 55%, 50% 75%, 45% 55%,
        35% 60%, 40% 45%, 22% 40%, 38% 35%, 30% 15%, 42% 20%
    );
}

.botanical-3 {
    width: 100px;
    height: 160px;
    bottom: 20%;
    left: 15%;
    clip-path: polygon(
        50% 5%, 55% 18%, 68% 12%, 60% 30%, 72% 38%,
        58% 42%, 62% 55%, 50% 50%, 50% 68%, 42% 50%,
        38% 55%, 42% 42%, 28% 38%, 40% 30%, 32% 12%, 45% 18%
    );
}

/* ===== Final Space ===== */
.final-space {
    height: 40vh;
}

/* ===== Margin Diagram Styles ===== */
.margin-diagram {
    display: block;
    margin-top: 0.5rem;
}

/* ===== Responsive ===== */
@media (max-width: 900px) {
    .margin-column {
        width: 48px;
        min-width: 48px;
    }

    .margin-content {
        display: none;
    }

    .margin-strip {
        right: 0;
    }

    .content-zone {
        margin-left: 48px;
        width: calc(100% - 48px);
        padding: 0 clamp(1.5rem, 4vw, 3rem);
    }
}

@media (max-width: 600px) {
    .margin-column {
        width: 8px;
        min-width: 8px;
    }

    .content-zone {
        margin-left: 8px;
        width: calc(100% - 8px);
        padding: 0 1.2rem;
    }

    .section-opening {
        padding-top: 6rem;
    }

    .section {
        padding: 4rem 0;
    }

    .drop-cap, .drop-cap-section {
        font-size: 3em;
    }
}

/* ===== Selection Color ===== */
::selection {
    background: var(--accent-gold);
    color: var(--bg-main);
}

::-moz-selection {
    background: var(--accent-gold);
    color: var(--bg-main);
}

/* ===== Scrollbar Styling (subtle) ===== */
::-webkit-scrollbar {
    width: 6px;
}

::-webkit-scrollbar-track {
    background: var(--bg-main);
}

::-webkit-scrollbar-thumb {
    background: var(--divider);
    border-radius: 3px;
}

::-webkit-scrollbar-thumb:hover {
    background: var(--text-muted);
}
