/* ============================================================
   monopole.wiki — the encyclopedia of the particle of one
   A private collector's vitrine for the rarest object in physics.
   Palette: muted-vintage (tobacco / bone / brass / verdigris)
   Type: Sora (display) · Space Grotesk (instrument labels) · Spectral (body)
   ============================================================ */

:root {
    /* Palette */
    --bone-vellum:   #EFE7D6; /* primary page ground */
    --aged-linen:    #E3D7BE; /* alternating band */
    --tobacco-ink:   #2B2620; /* primary text — warm charcoal-brown */
    --tarnished-brass:#9C7B3E; /* hairlines, plate frames, glyph stroke, ticks */
    --polished-brass:#C9A24B; /* hover/active accent, spinning glyph */
    --faded-verdigris:#5E7A6E; /* leaf-organic dividers */
    --oxide-crimson: #7A2E22; /* rare emphasis — the wax seal */

    /* Type */
    --f-display: 'Sora', system-ui, sans-serif;
    --f-label:   'Space Grotesk', 'Sora', monospace;
    --f-body:    'Spectral', Georgia, serif;

    /* Motion — bounce-enter */
    --overshoot: cubic-bezier(0.34, 1.56, 0.64, 1);
    --crisp:     cubic-bezier(0.22, 0.61, 0.36, 1);
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
    margin: 0;
    background: var(--bone-vellum);
    color: var(--tobacco-ink);
    font-family: var(--f-body);
    font-size: 20px;
    line-height: 1.7;
    -webkit-font-smoothing: antialiased;
    text-rendering: optimizeLegibility;
    overflow-x: hidden;
}

::selection { background: rgba(201,162,75,0.35); color: var(--tobacco-ink); }

/* Subtle paper grain overlay */
.grain {
    position: fixed;
    inset: 0;
    width: 100vw;
    height: 100vh;
    pointer-events: none;
    z-index: 9999;
    opacity: 0.55;
    mix-blend-mode: multiply;
}

/* ------------------------------------------------------------
   Document scaffold
   ------------------------------------------------------------ */
.document { width: 100%; }

.hairline {
    border: 0;
    height: 1px;
    margin: 0;
    background: var(--tarnished-brass);
    opacity: 0.55;
}

/* Full-bleed bands of differing tints */
.band {
    width: 100%;
    padding: clamp(3.5rem, 8vw, 7rem) clamp(1.25rem, 5vw, 4.5rem);
    position: relative;
}
.band--vellum   { background: var(--bone-vellum); }
.band--linen    { background: var(--aged-linen); }

/* ------------------------------------------------------------
   (1) Masthead
   ------------------------------------------------------------ */
.band--masthead {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background:
        radial-gradient(ellipse at 50% 38%, rgba(201,162,75,0.10), transparent 60%),
        var(--bone-vellum);
    padding-top: clamp(4rem, 9vw, 8rem);
    padding-bottom: clamp(4rem, 9vw, 8rem);
}
.masthead__inner {
    position: relative;
    max-width: 1100px;
    width: 100%;
    text-align: center;
}
.masthead__glyph {
    width: clamp(160px, 24vw, 300px);
    height: clamp(160px, 24vw, 300px);
    display: block;
    margin: 0 auto clamp(1.5rem, 4vw, 3rem);
    position: relative;
    top: -0.4rem;
    transform: translateY(60px) scale(0.86);
    opacity: 0;
    transition: transform 0.95s var(--overshoot), opacity 0.7s ease;
    overflow: visible;
}
.masthead__glyph.is-in { transform: translateY(0) scale(1); opacity: 1; }
.masthead__glyph-pulse { animation: glyphPulse 3.6s ease-in-out infinite; transform-origin: 120px 120px; }
@keyframes glyphPulse {
    0%, 100% { opacity: 0.25; transform: scaleY(0.7); }
    50%      { opacity: 0.9;  transform: scaleY(1.05); }
}

.masthead__kicker {
    font-family: var(--f-label);
    font-size: clamp(0.72rem, 1.5vw, 0.95rem);
    letter-spacing: 0.32em;
    text-transform: uppercase;
    color: var(--tarnished-brass);
    margin: 0 0 clamp(0.8rem, 2vw, 1.4rem);
}
.masthead__title {
    font-family: var(--f-display);
    font-weight: 800;
    font-size: clamp(3.5rem, 12vw, 11rem);
    letter-spacing: -0.02em;
    line-height: 0.95;
    margin: 0 0 clamp(1.2rem, 3vw, 2rem);
    color: var(--tobacco-ink);
}
.masthead__sub {
    font-family: var(--f-body);
    font-style: italic;
    font-weight: 400;
    font-size: clamp(1.05rem, 2.3vw, 1.5rem);
    line-height: 1.6;
    max-width: 36ch;
    margin: 0 auto clamp(2rem, 5vw, 3.4rem);
    color: var(--tobacco-ink);
}
.masthead__scrollcue {
    display: inline-flex;
    align-items: center;
    gap: 0.9rem;
    font-family: var(--f-label);
    font-size: 0.72rem;
    letter-spacing: 0.28em;
    text-transform: uppercase;
    color: var(--tarnished-brass);
}
.masthead__rule {
    display: inline-block;
    width: 90px;
    height: 1px;
    background: var(--tarnished-brass);
    position: relative;
    overflow: hidden;
}
.masthead__rule::after {
    content: "";
    position: absolute;
    left: -40%;
    top: 0;
    width: 40%;
    height: 100%;
    background: var(--polished-brass);
    animation: railSweep 2.8s ease-in-out infinite;
}
@keyframes railSweep {
    0%   { left: -40%; }
    60%  { left: 100%; }
    100% { left: 100%; }
}

/* ------------------------------------------------------------
   The asymmetric appraisal spread (CSS Grid two-track)
   ------------------------------------------------------------ */
.spread {
    display: grid;
    grid-template-columns: minmax(0, var(--split-left, 30fr)) minmax(0, var(--split-right, 70fr));
    column-gap: clamp(1.5rem, 4vw, 4rem);
    align-items: start;
}

/* ---- The Provenance Rail (left, sticky) ---- */
.rail { position: relative; }
.rail__sticky {
    position: sticky;
    top: clamp(2rem, 8vh, 5rem);
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 0.55rem;
    padding-right: 0.5rem;
}
.rail__sigil {
    font-family: var(--f-label);
    font-size: clamp(1.6rem, 3vw, 2.4rem);
    color: var(--tarnished-brass);
    line-height: 1;
}
.rail__num {
    font-family: var(--f-label);
    font-weight: 700;
    font-size: clamp(1.8rem, 4vw, 3.2rem);
    letter-spacing: 0.02em;
    color: var(--tobacco-ink);
    line-height: 1;
}
.rail__title {
    font-family: var(--f-label);
    font-size: clamp(0.7rem, 1.4vw, 0.92rem);
    letter-spacing: 0.18em;
    text-transform: uppercase;
    color: var(--tarnished-brass);
    max-width: 16ch;
}
/* Tick scale ornament — vernier-caliper feel */
.rail__ticks {
    margin-top: 0.9rem;
    width: 46px;
    height: clamp(120px, 28vh, 260px);
    background-image:
        linear-gradient(to right, var(--tarnished-brass) 1px, transparent 1px);
    background-size: 100% 100%;
    position: relative;
}
.rail__ticks::before {
    content: "";
    position: absolute;
    left: 0; top: 0; bottom: 0;
    width: 100%;
    background-image: repeating-linear-gradient(
        to bottom,
        var(--tarnished-brass) 0, var(--tarnished-brass) 1px,
        transparent 1px, transparent 11px
    );
    background-position: left top;
}
.rail__ticks::after {
    content: "";
    position: absolute;
    left: 0; top: 0; bottom: 0;
    width: 60%;
    background-image: repeating-linear-gradient(
        to bottom,
        var(--tarnished-brass) 0, var(--tarnished-brass) 1.4px,
        transparent 1.4px, transparent 55px
    );
}
.rail__glyph {
    margin-top: 1.1rem;
    width: clamp(40px, 6vw, 64px);
    height: clamp(40px, 6vw, 64px);
    transform-origin: 50% 50%;
    will-change: transform;
}

/* ---- The Display Field (right, irregular) ---- */
.field {
    max-width: 70ch;
    padding-bottom: 0.5rem;
}
.field p {
    margin: 0 0 1.5rem;
    color: var(--tobacco-ink);
}
.field p strong { font-weight: 500; }
.field p em { font-style: italic; }

/* Section titles — all-caps Sora 600, hover underline draws L→R */
.section-title {
    font-family: var(--f-display);
    font-weight: 600;
    font-size: clamp(1.6rem, 4vw, 2.8rem);
    letter-spacing: 0.04em;
    text-transform: uppercase;
    line-height: 1.15;
    margin: 0 0 clamp(1.6rem, 3.5vw, 2.6rem);
    color: var(--tobacco-ink);
    position: relative;
    display: inline-block;
    padding-bottom: 0.35rem;
}
.section-title::after {
    content: "";
    position: absolute;
    left: 0; bottom: 0;
    height: 2px;
    width: 100%;
    background: var(--tarnished-brass);
    transform: scaleX(0);
    transform-origin: left center;
    transition: transform 0.45s var(--crisp);
}
.section-title:hover::after { transform: scaleX(1); }

/* The Abstract — a single dense italic-serif paragraph */
.band--abstract { background: var(--bone-vellum); }
.abstract__lead {
    font-style: italic;
    font-weight: 400;
    font-size: clamp(1.2rem, 2.6vw, 1.7rem);
    line-height: 1.7;
    color: var(--tobacco-ink);
    max-width: 62ch;
    margin: 0;
}
.abstract__lead strong { font-style: italic; font-weight: 500; }
.abstract__lead .seal,
.field .seal {
    color: var(--oxide-crimson);
    font-style: italic;
    font-weight: 500;
    /* the wax seal — appears at most twice on the whole page */
}

/* ------------------------------------------------------------
   Geometric-abstract field diagrams (SVG, brass on bone)
   ------------------------------------------------------------ */
.diagram {
    margin: clamp(2rem, 5vw, 3.4rem) 0;
    /* break the margin asymmetrically — bleed slightly right */
    margin-right: clamp(-2rem, -4vw, 0rem);
    max-width: 640px;
}
.diagram--apparatus { max-width: 680px; }
.diagram svg {
    width: 100%;
    height: auto;
    display: block;
    background: var(--bone-vellum);
}
.diagram figcaption {
    font-family: var(--f-label);
    font-size: 0.78rem;
    letter-spacing: 0.06em;
    line-height: 1.5;
    color: var(--tarnished-brass);
    margin-top: 0.9rem;
    max-width: 56ch;
    padding-left: 0.1rem;
}
/* stroke-draw on entry */
.diagram .draw {
    stroke-dasharray: 1000;
    stroke-dashoffset: 1000;
    transition: stroke-dashoffset 1.2s var(--crisp);
}
.diagram.is-in .draw { stroke-dashoffset: 0; }

/* ------------------------------------------------------------
   Pull-quotes — break the margin asymmetrically
   ------------------------------------------------------------ */
.pullquote {
    font-family: var(--f-display);
    font-weight: 500;
    font-size: clamp(1.25rem, 3vw, 1.9rem);
    line-height: 1.4;
    color: var(--tobacco-ink);
    margin: clamp(2.2rem, 5vw, 3.4rem) 0;
    padding: clamp(1.2rem, 3vw, 2rem) 0 clamp(1.2rem, 3vw, 2rem) clamp(1.4rem, 3vw, 2.2rem);
    border-left: 2px solid var(--tarnished-brass);
}
.pullquote--right {
    /* inset with a wide white gutter on one side; bleed off the right */
    margin-right: clamp(-3rem, -6vw, 0rem);
    margin-left: clamp(0rem, 4vw, 3rem);
}
.pullquote--left {
    margin-left: clamp(-1.5rem, -3vw, 0rem);
    margin-right: clamp(0rem, 5vw, 4rem);
}
.pullquote cite {
    display: block;
    margin-top: 1rem;
    font-family: var(--f-label);
    font-style: normal;
    font-weight: 400;
    font-size: 0.78rem;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    color: var(--tarnished-brass);
}

/* ------------------------------------------------------------
   Framed equation plates — thin brass rule, bone mat, museum label
   ------------------------------------------------------------ */
.plate {
    margin: clamp(2.4rem, 6vw, 4rem) auto;
    max-width: 560px;
    /* inset with a wide white gutter on one side only */
    margin-left: clamp(0rem, 6vw, 5rem);
    margin-right: clamp(0rem, 2vw, 1rem);
}
.plate__frame {
    border: 1.5px solid var(--tarnished-brass);
    padding: clamp(0.5rem, 1.5vw, 0.85rem);
    background: var(--bone-vellum);
}
.plate__mat {
    border: 1px solid rgba(156,123,62,0.35);
    background:
        radial-gradient(ellipse at 50% 40%, rgba(201,162,75,0.08), transparent 70%),
        var(--bone-vellum);
    padding: clamp(2rem, 6vw, 3.8rem) clamp(1rem, 4vw, 2.5rem);
    display: flex;
    align-items: center;
    justify-content: center;
}
.plate__formula {
    font-family: var(--f-display);
    font-weight: 500;
    font-size: clamp(1.5rem, 4vw, 2.6rem);
    color: var(--tobacco-ink);
    display: inline-flex;
    align-items: center;
    gap: 0.55em;
    line-height: 1;
    letter-spacing: 0.01em;
}
.plate__formula .eq { color: var(--tarnished-brass); }
.plate__formula .cond,
.plate__formula .num { font-size: 0.62em; color: var(--tobacco-ink); }
.plate__formula .comma { margin-left: -0.2em; margin-right: 0.1em; }
.plate__formula sub { font-size: 0.5em; vertical-align: baseline; position: relative; bottom: -0.18em; }
.plate__formula sup { font-size: 0.5em; }
.plate__formula .sym { letter-spacing: 0.02em; }
.frac {
    display: inline-flex;
    flex-direction: column;
    align-items: center;
    vertical-align: middle;
    line-height: 1;
}
.frac__top, .frac__bot { padding: 0.06em 0.25em; }
.frac__bar {
    width: 100%;
    height: 1.5px;
    background: var(--tobacco-ink);
    margin: 0.06em 0;
}
.plate__caption {
    font-family: var(--f-label);
    font-variant: small-caps;
    text-transform: lowercase;
    letter-spacing: 0.14em;
    font-size: 0.82rem;
    color: var(--tarnished-brass);
    text-align: center;
    margin-top: 1rem;
}

/* ------------------------------------------------------------
   Section dividers — the "Dirac frond" (leaf-organic)
   ------------------------------------------------------------ */
.divider {
    width: 100%;
    background: var(--bone-vellum);
    padding: clamp(2rem, 5vw, 3.6rem) clamp(1rem, 4vw, 3rem);
    display: flex;
    justify-content: center;
    overflow: hidden;
}
.divider--flip .divider__leaf { transform: scaleX(-1); }
.divider__leaf {
    width: min(620px, 92vw);
    height: auto;
    display: block;
    transform: translateY(46px) scale(0.92);
    opacity: 0;
    transition: transform 0.9s var(--overshoot), opacity 0.7s ease;
}
.divider--flip .divider__leaf { transform: translateY(46px) scale(0.92) scaleX(-1); }
.divider.is-in .divider__leaf { transform: translateY(0) scale(1); opacity: 1; }
.divider--flip.is-in .divider__leaf { transform: translateY(0) scale(1) scaleX(-1); opacity: 1; }
.divider__vein {
    stroke-dasharray: 1200;
    stroke-dashoffset: 1200;
    transition: stroke-dashoffset 1.4s var(--crisp) 0.2s;
}
.divider.is-in .divider__vein { stroke-dashoffset: 0; }

/* ------------------------------------------------------------
   (9) Colophon plate
   ------------------------------------------------------------ */
.band--colophon {
    background: var(--aged-linen);
    padding-top: clamp(4rem, 9vw, 7rem);
    padding-bottom: clamp(4rem, 9vw, 7rem);
}
.colophon__plate {
    max-width: 520px;
    margin-left: clamp(0rem, 6vw, 5rem); /* off to the left */
    border: 1.5px solid var(--tarnished-brass);
    background: var(--bone-vellum);
    padding: clamp(2rem, 5vw, 3.4rem);
}
.colophon__glyph {
    width: clamp(56px, 8vw, 84px);
    height: clamp(56px, 8vw, 84px);
    display: block;
    margin-bottom: 1.2rem;
}
.colophon__title {
    font-family: var(--f-display);
    font-weight: 700;
    font-size: clamp(1.4rem, 3.5vw, 2rem);
    letter-spacing: 0.01em;
    margin: 0 0 0.3rem;
    color: var(--tobacco-ink);
}
.colophon__line {
    font-family: var(--f-label);
    font-size: 0.78rem;
    letter-spacing: 0.18em;
    text-transform: uppercase;
    color: var(--tarnished-brass);
    margin: 0 0 1.6rem;
}
.colophon__meta {
    margin: 0 0 1.6rem;
    display: grid;
    gap: 0.85rem;
}
.colophon__meta dt {
    font-family: var(--f-label);
    font-size: 0.68rem;
    letter-spacing: 0.16em;
    text-transform: uppercase;
    color: var(--tarnished-brass);
    margin-bottom: 0.15rem;
}
.colophon__meta dd {
    margin: 0;
    font-family: var(--f-body);
    font-size: 0.98rem;
    line-height: 1.55;
    color: var(--tobacco-ink);
}
.colophon__foot {
    font-family: var(--f-body);
    font-style: italic;
    font-size: 0.92rem;
    line-height: 1.6;
    color: var(--tobacco-ink);
    margin: 0;
    padding-top: 1.2rem;
    border-top: 1px solid rgba(156,123,62,0.4);
}

/* ------------------------------------------------------------
   Bounce-enter — the headline gesture
   ------------------------------------------------------------ */
.bounce {
    transform: translateY(42px) scale(0.985);
    opacity: 0;
    transition:
        transform 0.85s var(--overshoot),
        opacity 0.6s ease;
    will-change: transform, opacity;
}
.bounce.is-in {
    transform: translateY(0) scale(1);
    opacity: 1;
}

/* ------------------------------------------------------------
   Links — Tarnished → Polished Brass on hover (crisp, never bouncy)
   ------------------------------------------------------------ */
a {
    color: var(--tarnished-brass);
    text-decoration: none;
    border-bottom: 1px solid rgba(156,123,62,0.5);
    transition: color 0.12s ease, border-color 0.12s ease;
}
a:hover { color: var(--polished-brass); border-color: var(--polished-brass); }

/* ------------------------------------------------------------
   Mobile sticky top-bar (rail collapses on small screens)
   ------------------------------------------------------------ */
.mobile-rail {
    display: none;
    position: fixed;
    top: 0; left: 0; right: 0;
    z-index: 200;
    align-items: center;
    gap: 0.7rem;
    padding: 0.55rem clamp(0.9rem, 4vw, 1.4rem);
    background: rgba(239,231,214,0.94);
    backdrop-filter: blur(6px);
    border-bottom: 1px solid var(--tarnished-brass);
}
.mobile-rail__num {
    font-family: var(--f-label);
    font-weight: 700;
    font-size: 0.95rem;
    color: var(--tobacco-ink);
}
.mobile-rail__glyph {
    width: 26px; height: 26px;
    transform-origin: 50% 50%;
    will-change: transform;
}
.mobile-rail__label {
    font-family: var(--f-label);
    font-size: 0.7rem;
    letter-spacing: 0.16em;
    text-transform: uppercase;
    color: var(--tarnished-brass);
    margin-left: auto;
    max-width: 14ch;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* ------------------------------------------------------------
   Responsive — two-track collapses to single column
   ------------------------------------------------------------ */
@media (max-width: 860px) {
    body { font-size: 18px; }
    .mobile-rail { display: flex; }
    .band { padding-top: clamp(3rem, 9vw, 5rem); }
    .band--masthead { padding-top: 5rem; }
    .spread {
        display: block;
    }
    .rail {
        margin-bottom: 1.8rem;
        padding-bottom: 1.4rem;
        border-bottom: 1px solid rgba(156,123,62,0.4);
    }
    .rail__sticky {
        position: static;
        flex-direction: row;
        align-items: baseline;
        flex-wrap: wrap;
        gap: 0.6rem 0.9rem;
    }
    .rail__ticks { display: none; }
    .rail__glyph { display: none; }
    .field, .abstract__lead { max-width: 100%; }
    .diagram, .plate, .pullquote--right, .pullquote--left {
        margin-left: 0;
        margin-right: 0;
    }
    .colophon__plate { margin-left: 0; }
}

@media (max-width: 480px) {
    .masthead__title { font-size: clamp(2.8rem, 18vw, 4.5rem); }
    .plate__mat { padding: 1.6rem 0.8rem; }
}

/* Reduced-motion fallback */
@media (prefers-reduced-motion: reduce) {
    .bounce, .masthead__glyph, .divider__leaf,
    .diagram .draw, .divider__vein {
        transition: opacity 0.3s ease !important;
        transform: none !important;
        stroke-dashoffset: 0 !important;
        opacity: 1;
    }
    .masthead__glyph-pulse, .masthead__rule::after { animation: none; }
}
