/* monopole.boo — A Victorian field notebook of the phantom particle.
   Palette:
     #0d0b08  Midnight (primary dark)
     #1a1510  Shadow Deep
     #2a2218  Leather Brown (text on light)
     #6b5a3a  Faded Ink (metadata, muted)
     #c9a84c  Candlelight Gold (accent / flame)
     #d4c8a8  Manuscript Text (text on dark)
     #f0e8d8  Aged Parchment (light bg)
*/

:root {
    --midnight: #0d0b08;
    --shadow-deep: #1a1510;
    --leather: #2a2218;
    --faded-ink: #6b5a3a;
    --candle-gold: #c9a84c;
    --manuscript: #d4c8a8;
    --parchment: #f0e8d8;
    --column: 680px;
}

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

html, body {
    background: var(--midnight);
    color: var(--manuscript);
    font-family: "Crimson Text", Georgia, "Times New Roman", serif;
    font-size: 18px;
    line-height: 1.85;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    overflow-x: hidden;
}

body {
    background:
        radial-gradient(ellipse 1200px 600px at 50% -10%, rgba(201, 168, 76, 0.08), transparent 70%),
        radial-gradient(ellipse 800px 400px at 50% 110%, rgba(201, 168, 76, 0.06), transparent 70%),
        var(--midnight);
    min-height: 100vh;
    position: relative;
}

/* Cursor candleglow that follows the pointer like a hand-held taper. */
.cursor-glow {
    position: fixed;
    pointer-events: none;
    width: 360px;
    height: 360px;
    margin-left: -180px;
    margin-top: -180px;
    border-radius: 50%;
    background: radial-gradient(circle, rgba(201, 168, 76, 0.10) 0%, rgba(201, 168, 76, 0.04) 35%, transparent 70%);
    mix-blend-mode: screen;
    opacity: 0;
    transition: opacity 600ms ease-out;
    z-index: 1;
    left: 0;
    top: 0;
    transform: translate3d(-1000px, -1000px, 0);
}

.cursor-glow.is-visible {
    opacity: 1;
}

/* The manuscript: a single narrow column. */
.manuscript {
    position: relative;
    z-index: 2;
    max-width: var(--column);
    margin: 0 auto;
    padding: 0 24px;
}

/* ------------------------------------------------------------ HERO */

.hero {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    padding: 80px 0;
    position: relative;
}

.hero::before,
.hero::after {
    content: "";
    position: absolute;
    left: 50%;
    transform: translateX(-50%);
    width: min(220px, 60%);
    height: 1px;
    background: linear-gradient(90deg, transparent, var(--faded-ink), transparent);
    opacity: 0.55;
}

.hero::before { top: 18%; }
.hero::after  { bottom: 14%; }

.hero-eyebrow {
    font-family: "IM Fell English SC", "Crimson Text", serif;
    font-size: 0.95rem;
    letter-spacing: 0.18em;
    color: var(--faded-ink);
    text-transform: lowercase;
    margin-bottom: 28px;
}

.hero-title {
    font-family: "Fondamento", "Goudy Bookletter 1911", serif;
    font-weight: 400;
    font-style: italic;
    font-size: clamp(2.6rem, 8vw, 5.2rem);
    line-height: 1.05;
    color: var(--candle-gold);
    text-shadow:
        0 0 18px rgba(201, 168, 76, 0.35),
        0 0 42px rgba(201, 168, 76, 0.18);
    letter-spacing: 0.005em;
    margin: 0;
    padding: 0 8px;
}

.hero-title .hero-dot {
    display: inline-block;
    color: var(--manuscript);
    transform: translateY(-0.05em);
    margin: 0 0.04em;
}

.flicker-word {
    display: inline-block;
    will-change: opacity, filter;
    animation: flicker 3.1s steps(1, end) infinite;
}

.flicker-word[data-flicker="boo"] {
    animation-duration: 2.7s;
    animation-delay: -1.4s;
}

@keyframes flicker {
    0%, 100% { opacity: 1; filter: drop-shadow(0 0 14px rgba(201, 168, 76, 0.45)); }
    8%       { opacity: 0.92; }
    11%      { opacity: 1; }
    19%      { opacity: 0.86; filter: drop-shadow(0 0 6px rgba(201, 168, 76, 0.18)); }
    21%      { opacity: 1; }
    34%      { opacity: 0.95; }
    44%      { opacity: 0.85; filter: drop-shadow(0 0 4px rgba(201, 168, 76, 0.15)); }
    46%      { opacity: 1; }
    62%      { opacity: 0.9; }
    74%      { opacity: 0.86; }
    77%      { opacity: 1; }
    89%      { opacity: 0.92; }
    93%      { opacity: 0.85; filter: drop-shadow(0 0 5px rgba(201, 168, 76, 0.16)); }
    95%      { opacity: 1; }
}

.hero-subtitle {
    font-family: "Crimson Text", Georgia, serif;
    font-style: italic;
    color: var(--manuscript);
    font-size: 1.05rem;
    line-height: 1.65;
    margin-top: 32px;
    max-width: 520px;
    opacity: 0.85;
}

.hero-flame {
    margin: 48px 0 32px;
    position: relative;
    width: 8px;
    height: 16px;
}

.hero-meta {
    font-family: "IM Fell English SC", "Crimson Text", serif;
    font-size: 0.85rem;
    color: var(--faded-ink);
    letter-spacing: 0.18em;
    text-transform: lowercase;
}

/* ------------------------------------------------------ FLAME ICON */
/* Drawn in CSS per the design: a teardrop on a soft halo, swaying. */

.flame {
    position: relative;
    width: 8px;
    height: 16px;
    background: var(--candle-gold);
    border-radius: 50% 50% 50% 50% / 60% 60% 40% 40%;
    box-shadow:
        0 0 12px rgba(201, 168, 76, 0.4),
        0 0 28px rgba(201, 168, 76, 0.18),
        0 -4px 8px rgba(255, 200, 110, 0.25);
    transform-origin: 50% 100%;
    animation: sway 3.4s ease-in-out infinite;
}

.flame::before {
    /* Inner brighter core. */
    content: "";
    position: absolute;
    inset: 2px 1px 4px 1px;
    background: #fbe7a4;
    border-radius: 50% 50% 50% 50% / 60% 60% 40% 40%;
    opacity: 0.85;
    filter: blur(0.4px);
}

.flame::after {
    /* Wick. */
    content: "";
    position: absolute;
    bottom: -4px;
    left: 50%;
    transform: translateX(-50%);
    width: 1px;
    height: 4px;
    background: var(--leather);
    box-shadow: 0 1px 0 var(--shadow-deep);
}

.flame-glow {
    position: absolute;
    left: 50%;
    top: 50%;
    width: 60px;
    height: 60px;
    margin-left: -30px;
    margin-top: -30px;
    background: radial-gradient(circle, rgba(201, 168, 76, 0.35) 0%, rgba(201, 168, 76, 0.10) 40%, transparent 70%);
    border-radius: 50%;
    pointer-events: none;
    animation: glow-pulse 3.4s ease-in-out infinite;
}

@keyframes sway {
    0%, 100% { transform: rotate(-3deg) scaleY(1); }
    25%      { transform: rotate(2deg) scaleY(1.05); }
    50%      { transform: rotate(-1deg) scaleY(0.95); }
    75%      { transform: rotate(3deg) scaleY(1.04); }
}

@keyframes glow-pulse {
    0%, 100% { opacity: 0.85; transform: scale(1); }
    50%      { opacity: 1;    transform: scale(1.08); }
}

/* ----------------------------------------------------- DIVIDERS */

.divider {
    margin: 0 auto;
    padding: 56px 0;
    width: 8px;
    height: auto;
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
}

.divider .flame {
    transform-origin: 50% 100%;
}

/* Force the alternating chapter sections to bleed full-width while
   leaving the inner content constrained. */
.chapter {
    position: relative;
    margin: 0 calc(50% - 50vw);
    padding: 80px calc(50vw - var(--column) / 2 + 24px);
    box-shadow: inset 0 1px 0 rgba(0, 0, 0, 0.0);
}

@media (max-width: 760px) {
    .chapter {
        padding-left: 28px;
        padding-right: 28px;
    }
}

.chapter > * {
    max-width: var(--column);
    margin-left: auto;
    margin-right: auto;
}

.chapter--dark {
    background: var(--midnight);
    color: var(--manuscript);
}

.chapter--dark::before {
    /* faint vignette at top */
    content: "";
    position: absolute;
    inset: 0;
    background: radial-gradient(ellipse 80% 40% at 50% 0%, rgba(201, 168, 76, 0.05), transparent 70%);
    pointer-events: none;
}

.chapter--light {
    background: var(--parchment);
    color: var(--leather);
    /* Aged paper grain via SVG noise overlay at low opacity. */
    background-image:
        url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='160' height='160'><filter id='n'><feTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='2' stitchTiles='stitch'/><feColorMatrix values='0 0 0 0 0.16  0 0 0 0 0.13  0 0 0 0 0.09  0 0 0 0.6 0'/></filter><rect width='100%25' height='100%25' filter='url(%23n)' opacity='0.18'/></svg>");
    background-size: 160px 160px;
    background-blend-mode: multiply;
    box-shadow: inset 0 1px 0 rgba(42, 34, 24, 0.08), inset 0 -1px 0 rgba(42, 34, 24, 0.08);
}

.chapter--light .chapter-lede {
    color: var(--leather);
}

.chapter--light .chapter-title {
    color: var(--leather);
}

.chapter--light a,
.chapter--light em {
    color: var(--leather);
}

/* --------------------------------------- CHAPTER MARKER (numerals) */

.chapter-marker {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 18px;
    margin-bottom: 36px;
}

.chapter-marker .rule {
    flex: 1 1 0;
    height: 1px;
    background: linear-gradient(90deg, transparent, var(--faded-ink), transparent);
    max-width: 240px;
    opacity: 0.7;
}

.chapter--light .chapter-marker .rule {
    background: linear-gradient(90deg, transparent, rgba(42, 34, 24, 0.45), transparent);
}

.chapter-marker .numeral {
    font-family: "IM Fell English SC", "Crimson Text", serif;
    font-weight: 400;
    font-size: clamp(1.5rem, 3vw, 2.5rem);
    color: var(--candle-gold);
    letter-spacing: 0.08em;
    line-height: 1;
    padding: 0 4px;
    text-shadow: 0 0 14px rgba(201, 168, 76, 0.25);
}

.chapter--light .chapter-marker .numeral {
    color: var(--candle-gold);
    text-shadow: 0 1px 0 rgba(255, 245, 220, 0.5);
}

/* --------------------------------- CHAPTER HEADINGS / BODY COPY */

.chapter-title {
    font-family: "Fondamento", "Goudy Bookletter 1911", serif;
    font-weight: 400;
    font-style: italic;
    font-size: clamp(2rem, 5vw, 3.5rem);
    line-height: 1.15;
    color: var(--manuscript);
    text-align: center;
    margin-bottom: 30px;
    letter-spacing: 0.005em;
}

.chapter--dark .chapter-title {
    color: var(--manuscript);
}

.chapter-lede {
    font-family: "Crimson Text", Georgia, serif;
    font-style: italic;
    font-size: 1.18rem;
    line-height: 1.7;
    text-align: center;
    margin: 0 auto 32px;
    color: var(--manuscript);
    max-width: 560px;
}

.chapter p + p {
    margin-top: 1.1em;
}

.chapter p {
    text-align: justify;
    hyphens: auto;
}

.chapter em {
    font-style: italic;
    color: var(--candle-gold);
}

.chapter--light em {
    color: #8a6a1f;
}

/* Drop cap on the first paragraph after the lede in each chapter. */
.chapter .chapter-lede + p::first-letter {
    font-family: "Fondamento", "Goudy Bookletter 1911", serif;
    font-style: italic;
    font-size: 3.6em;
    line-height: 0.85;
    float: left;
    padding: 0.08em 0.12em 0 0;
    color: var(--candle-gold);
    text-shadow: 0 0 12px rgba(201, 168, 76, 0.25);
}

.chapter--light .chapter .chapter-lede + p::first-letter,
.chapter--light .chapter-lede + p::first-letter {
    color: #8a6a1f;
    text-shadow: none;
}

/* -------------------------------------------------- HAUNTING LIST */

.haunting-list {
    list-style: none;
    padding: 0;
    margin: 32px auto 0;
    max-width: var(--column);
}

.haunting-list li {
    padding: 28px 0 28px;
    border-top: 1px solid rgba(107, 90, 58, 0.35);
}

.haunting-list li:last-child {
    border-bottom: 1px solid rgba(107, 90, 58, 0.35);
}

.haunting-date {
    display: block;
    font-family: "IM Fell English SC", "Crimson Text", serif;
    font-size: 0.95rem;
    letter-spacing: 0.14em;
    color: var(--candle-gold);
    margin-bottom: 4px;
}

.haunting-place {
    display: block;
    font-family: "Crimson Text", Georgia, serif;
    font-style: italic;
    font-size: 0.95rem;
    color: var(--faded-ink);
    margin-bottom: 12px;
}

.haunting-list p {
    margin: 0;
    text-align: left;
}

/* ----------------------------------------------------- BESTIARY */

.bestiary {
    margin: 32px auto 0;
    max-width: var(--column);
}

.bestiary dt {
    font-family: "Fondamento", "Goudy Bookletter 1911", serif;
    font-style: italic;
    font-size: 1.45rem;
    line-height: 1.25;
    color: var(--candle-gold);
    margin-top: 28px;
    margin-bottom: 8px;
    text-shadow: 0 0 10px rgba(201, 168, 76, 0.18);
}

.bestiary dt:first-child {
    margin-top: 0;
}

.bestiary dd {
    margin-left: 0;
    padding-left: 18px;
    border-left: 1px solid rgba(201, 168, 76, 0.4);
    text-align: left;
    color: var(--manuscript);
}

.chapter--light .bestiary dt {
    color: #8a6a1f;
    text-shadow: none;
}

.chapter--light .bestiary dd {
    border-left-color: rgba(107, 90, 58, 0.5);
    color: var(--leather);
}

/* -------------------------------------------------- BLOCKQUOTE */

.quote {
    margin: 40px auto;
    padding: 24px 32px;
    border-left: 2px solid var(--candle-gold);
    background: rgba(201, 168, 76, 0.05);
    font-family: "Crimson Text", Georgia, serif;
    font-style: italic;
    font-size: 1.1rem;
    line-height: 1.6;
    max-width: 600px;
    text-align: left;
}

.chapter--light .quote {
    background: rgba(201, 168, 76, 0.1);
    border-left-color: #8a6a1f;
}

.quote footer {
    margin-top: 12px;
    font-family: "IM Fell English SC", "Crimson Text", serif;
    font-style: normal;
    font-size: 0.9rem;
    letter-spacing: 0.12em;
    color: var(--faded-ink);
    text-align: right;
}

.signature {
    margin-top: 36px;
    text-align: right;
    font-family: "Fondamento", "Goudy Bookletter 1911", serif;
    font-style: italic;
    color: var(--candle-gold);
    font-size: 1.15rem;
}

/* ----------------------------------------------------- COLOPHON */

.colophon {
    margin: 0 calc(50% - 50vw);
    padding: 80px 24px 100px;
    background: var(--shadow-deep);
    color: var(--faded-ink);
    text-align: center;
    border-top: 1px solid rgba(107, 90, 58, 0.3);
}

.colophon-flame {
    margin: 0 auto 32px;
    width: 8px;
    height: 16px;
    position: relative;
}

.colophon-text {
    font-family: "Crimson Text", Georgia, serif;
    font-size: 0.95rem;
    line-height: 1.7;
    color: var(--manuscript);
    max-width: 520px;
    margin: 0 auto 14px;
    opacity: 0.8;
}

.colophon-text strong {
    color: var(--candle-gold);
    font-weight: 600;
}

.colophon-fineprint {
    font-family: "IM Fell English SC", "Crimson Text", serif;
    font-size: 0.78rem;
    letter-spacing: 0.18em;
    color: var(--faded-ink);
    text-transform: lowercase;
}

/* -------------------------------------------------- REVEAL ON SCROLL */

.chapter,
.divider,
.colophon {
    opacity: 0;
    transform: translateY(24px);
    transition:
        opacity 1200ms cubic-bezier(0.22, 0.61, 0.36, 1),
        transform 1200ms cubic-bezier(0.22, 0.61, 0.36, 1);
}

.chapter.is-revealed,
.divider.is-revealed,
.colophon.is-revealed {
    opacity: 1;
    transform: translateY(0);
}

/* The hero is always immediately visible. */
.hero {
    opacity: 1;
    transform: none;
}

/* -------------------------------------------------- SMALL SCREENS */

@media (max-width: 480px) {
    html, body {
        font-size: 17px;
    }

    .hero {
        padding: 48px 0;
    }

    .chapter {
        padding-top: 56px;
        padding-bottom: 56px;
    }

    .chapter-marker .rule {
        max-width: 80px;
    }

    .quote {
        padding: 18px 20px;
    }

    .chapter p {
        text-align: left;
    }
}

/* Selection: a candlelit highlight. */
::selection {
    background: rgba(201, 168, 76, 0.35);
    color: var(--midnight);
}
