/* ============================================
   monopole.boo — Styles
   A scroll-snap monograph on the magnetic monopole
   ============================================ */

/* --- CSS Custom Properties --- */
:root {
    --parchment: #f4e8d0;
    --ink: #2b1f14;
    --copper: #5a7f6e;
    --rose: #b8847a;
    --margin-gray: #8a7e72;
    --field-blue: #3d4a6b;
    --foxing: #d4c4a8;
}

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

html {
    scroll-behavior: auto;
}

body {
    font-family: 'Crimson Pro', Georgia, serif;
    font-size: clamp(1.05rem, 1.8vw, 1.25rem);
    line-height: 1.72;
    color: var(--ink);
    background-color: var(--parchment);
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='200' height='200'%3E%3Cdefs%3E%3C/defs%3E%3Ccircle cx='23' cy='14' r='0.6' fill='%23d4c4a8' opacity='0.3'/%3E%3Ccircle cx='187' cy='42' r='0.5' fill='%23d4c4a8' opacity='0.25'/%3E%3Ccircle cx='45' cy='78' r='0.7' fill='%23d4c4a8' opacity='0.3'/%3E%3Ccircle cx='134' cy='5' r='0.5' fill='%23d4c4a8' opacity='0.2'/%3E%3Ccircle cx='89' cy='33' r='0.6' fill='%23d4c4a8' opacity='0.3'/%3E%3Ccircle cx='167' cy='91' r='0.5' fill='%23d4c4a8' opacity='0.25'/%3E%3Ccircle cx='12' cy='145' r='0.7' fill='%23d4c4a8' opacity='0.3'/%3E%3Ccircle cx='78' cy='112' r='0.5' fill='%23d4c4a8' opacity='0.2'/%3E%3Ccircle cx='155' cy='134' r='0.6' fill='%23d4c4a8' opacity='0.3'/%3E%3Ccircle cx='34' cy='189' r='0.5' fill='%23d4c4a8' opacity='0.25'/%3E%3Ccircle cx='112' cy='167' r='0.7' fill='%23d4c4a8' opacity='0.2'/%3E%3Ccircle cx='190' cy='178' r='0.5' fill='%23d4c4a8' opacity='0.3'/%3E%3Ccircle cx='67' cy='56' r='0.4' fill='%23d4c4a8' opacity='0.25'/%3E%3Ccircle cx='145' cy='67' r='0.6' fill='%23d4c4a8' opacity='0.2'/%3E%3Ccircle cx='5' cy='98' r='0.5' fill='%23d4c4a8' opacity='0.3'/%3E%3Ccircle cx='98' cy='145' r='0.5' fill='%23d4c4a8' opacity='0.25'/%3E%3Ccircle cx='178' cy='12' r='0.4' fill='%23d4c4a8' opacity='0.3'/%3E%3Ccircle cx='56' cy='167' r='0.6' fill='%23d4c4a8' opacity='0.2'/%3E%3Ccircle cx='123' cy='89' r='0.5' fill='%23d4c4a8' opacity='0.3'/%3E%3Ccircle cx='34' cy='34' r='0.4' fill='%23d4c4a8' opacity='0.25'/%3E%3C/svg%3E");
    background-repeat: repeat;
    overflow: hidden;
}

/* --- Monograph Container (Scroll Snap) --- */
.monograph {
    height: 100vh;
    overflow-y: scroll;
    scroll-snap-type: y mandatory;
    -webkit-overflow-scrolling: touch;
}

/* --- Folio (Each Page) --- */
.folio {
    height: 100vh;
    scroll-snap-align: start;
    position: relative;
    display: flex;
    align-items: flex-start;
    justify-content: center;
    padding-top: 10vh;
    overflow: hidden;
}

.folio-inner {
    display: flex;
    max-width: 900px;
    width: 100%;
    padding: 0 2rem;
    position: relative;
}

/* --- Margin Column --- */
.margin-col {
    width: 160px;
    flex-shrink: 0;
    padding-right: 2rem;
    padding-top: 0.5rem;
    display: flex;
    flex-direction: column;
    gap: 1.2rem;
}

.annotation {
    font-family: 'IBM Plex Sans', sans-serif;
    font-weight: 400;
    font-size: 0.75rem;
    letter-spacing: 0.12em;
    font-variant: small-caps;
    color: var(--margin-gray);
    line-height: 1.4;
}

.eq-label {
    font-style: italic;
    font-variant: normal;
    font-size: 0.7rem;
    color: var(--field-blue);
}

.margin-diagram {
    opacity: 0.6;
    margin-top: 0.5rem;
}

/* --- Text Column --- */
.text-col {
    flex: 1;
    max-width: 680px;
    position: relative;
}

/* --- Typography --- */
h1.title {
    font-family: 'Playfair Display', Georgia, serif;
    font-weight: 700;
    font-size: clamp(2.8rem, 5.5vw, 5rem);
    letter-spacing: 0.02em;
    color: var(--ink);
    margin-bottom: 1.5rem;
    line-height: 1.1;
}

h2.folio-heading {
    font-family: 'Playfair Display', Georgia, serif;
    font-weight: 700;
    font-size: clamp(1.8rem, 3.5vw, 2.8rem);
    letter-spacing: 0.02em;
    color: var(--ink);
    margin-bottom: 1.5rem;
    line-height: 1.2;
}

.subtitle {
    font-family: 'Crimson Pro', Georgia, serif;
    font-style: italic;
    font-size: clamp(1rem, 1.6vw, 1.2rem);
    color: var(--margin-gray);
    margin-bottom: 3rem;
    max-width: 36em;
}

.subtitle .char {
    opacity: 0;
    display: inline-block;
}

.subtitle .char.space {
    width: 0.3em;
}

.subtitle.animated .char {
    animation: charFadeIn 200ms ease forwards;
}

@keyframes charFadeIn {
    from { opacity: 0; transform: translateY(4px); }
    to { opacity: 1; transform: translateY(0); }
}

.body-text p {
    max-width: 36em;
    margin-bottom: 1.2em;
    color: var(--ink);
}

.body-text p:first-child::first-letter {
    font-family: 'Playfair Display', Georgia, serif;
    font-size: 3.5em;
    float: left;
    line-height: 0.8;
    margin-right: 0.08em;
    margin-top: 0.05em;
    color: var(--copper);
}

.body-text em {
    font-style: italic;
}

/* --- Folio Counter --- */
.folio-counter {
    position: absolute;
    bottom: 2rem;
    right: 2.5rem;
}

.counter-text {
    font-family: 'IBM Plex Sans', sans-serif;
    font-weight: 300;
    font-size: 0.75rem;
    letter-spacing: 0.12em;
    font-variant: small-caps;
    color: var(--margin-gray);
}

.counter-text i {
    font-style: italic;
    font-family: 'Playfair Display', Georgia, serif;
    font-size: 0.85rem;
}

/* --- Botanical Illustrations --- */
.botanical {
    position: absolute;
    bottom: -5vh;
    right: -2rem;
    opacity: 0.85;
    pointer-events: none;
}

.folio-i .botanical {
    position: relative;
    bottom: auto;
    right: auto;
    margin-top: 2rem;
    display: flex;
    justify-content: center;
}

/* SVG Drawing Animation */
.draw-path {
    stroke-dasharray: 500;
    stroke-dashoffset: 500;
    transition: stroke-dashoffset 3s ease-in-out;
}

.folio.in-view .draw-path {
    stroke-dashoffset: 0;
}

/* Closing folio: undraw animation */
.undraw-path {
    stroke-dasharray: 500;
    stroke-dashoffset: 0;
    transition: stroke-dashoffset 4s ease-in-out;
}

.folio-closing.in-view.undrawing .undraw-path {
    stroke-dashoffset: 500;
}

/* --- Slide Reveal Animation --- */
.slide-reveal {
    opacity: 0;
    transform: translateY(40px);
    transition: opacity 900ms cubic-bezier(0.23, 1, 0.32, 1),
                transform 900ms cubic-bezier(0.23, 1, 0.32, 1);
}

.folio.in-view .slide-reveal {
    opacity: 1;
    transform: translateY(0);
}

/* --- Fade In --- */
.fade-in {
    opacity: 0;
    transition: opacity 600ms ease 200ms;
}

.folio.in-view .fade-in {
    opacity: 1;
}

/* --- Annotations fade --- */
.margin-col {
    opacity: 0;
    transition: opacity 500ms ease 400ms;
}

.folio.in-view .margin-col {
    opacity: 1;
}

/* --- Interstitial Plates --- */
.folio-plate {
    align-items: center;
    justify-content: center;
    padding-top: 0;
}

.plate-composition {
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
}

.plate-svg {
    max-width: 80%;
    max-height: 80vh;
}

.plate-caption {
    position: absolute;
    bottom: 4rem;
    left: 50%;
    transform: translateX(-50%);
    font-family: 'IBM Plex Sans', sans-serif;
    font-weight: 300;
    font-size: 0.72rem;
    letter-spacing: 0.1em;
    font-variant: small-caps;
    color: var(--margin-gray);
    text-align: center;
    max-width: 500px;
}

/* Pulse animation for field lines */
.pulse-line {
    animation: fieldPulse 6s ease-in-out infinite;
}

@keyframes fieldPulse {
    0%, 100% { stroke-opacity: 0.4; }
    50% { stroke-opacity: 0.8; }
}

/* --- Timeline (Folio VI) --- */
.timeline {
    position: relative;
    padding-left: 2rem;
    max-width: 36em;
}

.timeline-line {
    position: absolute;
    left: 0;
    top: 0;
    bottom: 0;
    width: 2px;
    background-color: var(--field-blue);
    opacity: 0.6;
}

.timeline-entry {
    position: relative;
    padding-left: 1.5rem;
    margin-bottom: 1.5rem;
    opacity: 0;
    transform: translateX(-20px);
    transition: opacity 500ms ease, transform 500ms ease;
}

.folio.in-view .timeline-entry {
    opacity: 1;
    transform: translateX(0);
}

.folio.in-view .timeline-entry[data-delay="1"] { transition-delay: 150ms; }
.folio.in-view .timeline-entry[data-delay="2"] { transition-delay: 300ms; }
.folio.in-view .timeline-entry[data-delay="3"] { transition-delay: 450ms; }
.folio.in-view .timeline-entry[data-delay="4"] { transition-delay: 600ms; }
.folio.in-view .timeline-entry[data-delay="5"] { transition-delay: 750ms; }
.folio.in-view .timeline-entry[data-delay="6"] { transition-delay: 900ms; }
.folio.in-view .timeline-entry[data-delay="7"] { transition-delay: 1050ms; }

.timeline-entry::before {
    content: '';
    position: absolute;
    left: -2rem;
    top: 0.5em;
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background-color: var(--field-blue);
    transform: translateX(-3px);
}

.timeline-final::before {
    background-color: transparent;
    border: 1.5px solid var(--field-blue);
}

.timeline-date {
    font-family: 'IBM Plex Sans', sans-serif;
    font-weight: 400;
    font-size: 0.78rem;
    letter-spacing: 0.1em;
    font-variant: small-caps;
    color: var(--field-blue);
    display: block;
    margin-bottom: 0.2rem;
}

.timeline-desc {
    font-family: 'Crimson Pro', Georgia, serif;
    font-size: 0.95rem;
    line-height: 1.6;
    color: var(--ink);
    display: block;
}

/* --- Closing Folio --- */
.closing-inner {
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    padding-top: 0;
    height: 100vh;
    display: flex;
}

.folio-closing {
    align-items: center;
    padding-top: 0;
}

.closing-quote {
    font-family: 'Playfair Display', Georgia, serif;
    font-weight: 400;
    font-style: italic;
    font-size: clamp(1.4rem, 2.8vw, 2.2rem);
    color: var(--ink);
    margin-bottom: 3rem;
    letter-spacing: 0.02em;
    opacity: 0;
    transition: opacity 1200ms ease 300ms;
}

.folio-closing.in-view .closing-quote {
    opacity: 1;
}

.botanical-compass-closing {
    position: relative;
    bottom: auto;
    right: auto;
    opacity: 1;
}

/* --- Responsive --- */
@media (max-width: 1024px) {
    .margin-col {
        display: none;
    }

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

@media (max-width: 640px) {
    .folio {
        padding-top: 6vh;
    }

    .folio-inner {
        padding: 0 1.2rem;
    }

    h1.title {
        font-size: clamp(2rem, 8vw, 3rem);
    }

    .botanical {
        right: -1rem;
        bottom: -2vh;
        transform: scale(0.7);
        transform-origin: bottom right;
    }

    .folio-i .botanical {
        transform: scale(0.8);
        transform-origin: center;
    }

    .plate-caption {
        bottom: 2rem;
        padding: 0 1rem;
    }
}
