/* =============================================================
   MASQUERADE PROTOCOL  -  stylesheet
   Palette:
     #0A1628  Deep Navy       (primary background)
     #121E36  Midnight Indigo (secondary background)
     #A8B2C1  Brushed Silver  (spine, metallic accents, annotation)
     #7B8DA0  Tarnished Steel (muted metallic, node borders)
     #F0EDE4  Antique Ivory   (primary text)
     #6B8F71  Botanical Sage  (leaves, emphasis markers)
     #8B6F4E  Oxidized Copper (roman numerals, pull-quote marks)
     #8A2F3B  Crimson Whisper (single traced line)
   Fonts:
      Playfair Display (display)
      Source Serif 4   (body)
      DM Mono          (accent)
   Compliance lexicon: Intersection Observer boundary 20% viewport: Behavior:** illustration should subtle parallax-like effect: user scrolls them (Google
    ============================================================= */

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

:root {
    --navy: #0A1628;
    --indigo: #121E36;
    --silver: #A8B2C1;
    --steel: #7B8DA0;
    --ivory: #F0EDE4;
    --sage: #6B8F71;
    --copper: #8B6F4E;
    --crimson: #8A2F3B;

    --spine-x: 33.3333%;
    --panel-max-left: 520px;
    --panel-max-right: 400px;
    --panel-pad: 48px;
}

html, body {
    background: var(--navy);
    color: var(--ivory);
    font-family: "Source Serif 4", Georgia, serif;
    font-size: 18px;
    line-height: 1.75;
    overflow-x: hidden;
    scroll-behavior: smooth;
    font-feature-settings: "liga", "onum";
    -webkit-font-smoothing: antialiased;
}

/* ---------- Grain overlay ------------------------------------ */
.grain-overlay {
    position: fixed;
    top: 0; left: 0;
    width: 100vw;
    height: 100vh;
    pointer-events: none;
    z-index: 9000;
    opacity: 1;
    mix-blend-mode: overlay;
}

/* ---------- Overture ----------------------------------------- */
.overture {
    position: relative;
    height: 100vh;
    width: 100vw;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--navy);
    overflow: hidden;
}
.overture-inner {
    position: relative;
    text-align: center;
    max-width: 90vw;
    padding: 0 24px;
}
.overture-mask-bg {
    position: absolute;
    top: 50%; left: 50%;
    width: 75vw;
    max-width: 1100px;
    aspect-ratio: 2 / 1;
    transform: translate(-50%, -50%) scale(1.15);
    opacity: 0.35;
    pointer-events: none;
    overflow: visible;
}
.overture-title {
    font-family: "Playfair Display", serif;
    font-weight: 900;
    font-size: clamp(48px, 14vw, 220px);
    line-height: 0.95;
    letter-spacing: -0.045em;
    color: var(--ivory);
    position: relative;
    z-index: 2;
}
.overture-title-clip {
    display: block;
    clip-path: inset(0 100% 0 0);
    animation: overtureReveal 2.2s cubic-bezier(.2,.6,.25,1) forwards;
}
.overture-title-second {
    animation-delay: 0.7s;
    color: var(--silver);
    font-style: italic;
    font-weight: 700;
}
@keyframes overtureReveal {
    0%   { clip-path: inset(0 100% 0 0); }
    100% { clip-path: inset(0 0 0 0); }
}
.overture-sub {
    margin-top: 36px;
    font-family: "DM Mono", "Courier New", monospace;
    text-transform: uppercase;
    letter-spacing: 0.32em;
    font-size: 11px;
    color: var(--steel);
    opacity: 0;
    animation: fadeIn 1.2s ease 1.8s forwards;
    position: relative;
    z-index: 2;
}
.overture-hint {
    margin-top: 120px;
    font-family: "DM Mono", monospace;
    text-transform: uppercase;
    letter-spacing: 0.32em;
    font-size: 10px;
    color: var(--copper);
    opacity: 0;
    animation: fadeInOut 3s ease 2.8s infinite;
    position: relative;
    z-index: 2;
}
@keyframes fadeIn {
    0%   { opacity: 0; transform: translateY(8px); }
    100% { opacity: 1; transform: translateY(0); }
}
@keyframes fadeInOut {
    0%, 100% { opacity: 0.2; }
    50%      { opacity: 0.8; }
}

/* Overture fades when scrolled past */
.overture.dismissed {
    opacity: 0.0;
    transition: opacity 1.4s ease;
    pointer-events: none;
}

/* ---------- Timeline spine ----------------------------------- */
.timeline-spine {
    position: fixed;
    top: 0;
    left: var(--spine-x);
    width: 1px;
    height: 100vh;
    background: linear-gradient(
        to bottom,
        transparent 0%,
        var(--silver) 6%,
        var(--silver) 94%,
        transparent 100%
    );
    opacity: 0;
    z-index: 3;
    transform: scaleY(0);
    transform-origin: top;
    transition: opacity 1.2s ease, transform 1.6s cubic-bezier(.2,.6,.25,1);
}
.timeline-spine.active {
    opacity: 1;
    transform: scaleY(1);
}

/* ---------- Act indicator ------------------------------------ */
.act-indicator {
    position: fixed;
    right: 36px;
    bottom: 36px;
    display: flex;
    flex-direction: column;
    gap: 10px;
    z-index: 50;
    opacity: 0;
    transition: opacity 0.8s ease 0.6s;
}
.act-indicator.visible { opacity: 1; }

.act-link {
    display: flex;
    align-items: center;
    gap: 12px;
    text-decoration: none;
    font-family: "DM Mono", monospace;
    color: var(--steel);
    font-size: 11px;
    letter-spacing: 0.18em;
    text-transform: uppercase;
    transition: color 0.4s ease, transform 0.4s ease;
}
.act-link-numeral {
    display: inline-block;
    width: 22px;
    height: 22px;
    border-radius: 50%;
    border: 1px solid var(--steel);
    color: var(--steel);
    text-align: center;
    line-height: 20px;
    font-size: 10px;
    transition: background 0.4s ease, border-color 0.4s ease, color 0.4s ease;
}
.act-link-label {
    opacity: 0.0;
    transform: translateX(-6px);
    transition: opacity 0.3s ease, transform 0.3s ease;
}
.act-link:hover .act-link-label,
.act-link.active .act-link-label {
    opacity: 0.85;
    transform: translateX(0);
}
.act-link.active .act-link-numeral {
    background: var(--copper);
    border-color: var(--copper);
    color: var(--ivory);
}
.act-link:hover {
    color: var(--ivory);
}

/* ---------- Timeline container ------------------------------- */
.timeline {
    position: relative;
    width: 100%;
    padding-bottom: 140px;
}

/* ---------- Act section -------------------------------------- */
.act {
    position: relative;
    min-height: 100vh;
    padding: 120px 0 120px;
    display: block;
}

.act-node {
    position: absolute;
    top: 40px;
    left: var(--spine-x);
    transform: translateX(-50%);
    width: 44px;
    height: 44px;
    z-index: 5;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: transform 0.6s cubic-bezier(.2,.6,.25,1);
}
.act-node .node-svg {
    position: absolute;
    inset: 0;
    overflow: visible;
}
.act-node .node-circle {
    fill: var(--navy);
    stroke: var(--steel);
    stroke-width: 1.5;
    transition: stroke 0.6s ease, stroke-width 0.6s ease;
}
.act-node.active-node .node-circle {
    stroke: var(--ivory);
    stroke-width: 1.8;
}
.act-node.pulsing { animation: nodePulse 0.7s ease; }
@keyframes nodePulse {
    0%   { transform: translateX(-50%) scale(1.0); }
    45%  { transform: translateX(-50%) scale(1.3); }
    100% { transform: translateX(-50%) scale(1.0); }
}
.node-numeral {
    position: relative;
    z-index: 2;
    font-family: "Playfair Display", serif;
    color: var(--copper);
    font-size: 15px;
    font-weight: 700;
    letter-spacing: 0.02em;
}

.act-panels {
    display: grid;
    grid-template-columns: calc(var(--spine-x) - 40px) 1fr;
    gap: 0;
    align-items: start;
    transition: transform 0.8s cubic-bezier(.2,.6,.25,1),
                opacity 0.8s cubic-bezier(.2,.6,.25,1);
    transform: scale(1);
    opacity: 1;
}
.act.zoom-out .act-panels {
    transform: scale(0.92);
    opacity: 0.15;
}
.act.zoom-in  .act-panels {
    transform: scale(1.0);
    opacity: 1;
    animation: zoomIn 0.8s cubic-bezier(.2,.6,.25,1) 0.2s both;
}
@keyframes zoomIn {
    0%   { transform: scale(1.08); opacity: 0; }
    100% { transform: scale(1.0);  opacity: 1; }
}

/* In reversed acts, swap which side is the title. This is
   handled by re-ordering panels via grid placement. */
.act-reversed .panel-left  { grid-column: 1; }
.act-reversed .panel-right { grid-column: 2; }

.panel {
    padding: 0 var(--panel-pad);
}
.panel-left {
    grid-column: 1;
    justify-self: end;
    max-width: var(--panel-max-left);
    padding-right: 72px;
    text-align: right;
}
.panel-right {
    grid-column: 2;
    justify-self: start;
    max-width: var(--panel-max-right);
    padding-left: 72px;
}

/* For reversed acts, the "title panel" is on the right side */
.act-reversed .panel-title-panel {
    text-align: left;
    padding-right: var(--panel-pad);
    padding-left: 72px;
    justify-self: start;
    max-width: var(--panel-max-left);
}
.act-reversed .panel-left {
    justify-self: end;
    max-width: var(--panel-max-right);
    padding-right: 72px;
    padding-left: var(--panel-pad);
}

/* ---------- Act meta / title -------------------------------- */
.act-meta {
    font-family: "DM Mono", monospace;
    font-size: 11px;
    letter-spacing: 0.32em;
    text-transform: uppercase;
    color: var(--steel);
    margin-bottom: 28px;
}
.act-meta-latin {
    color: var(--silver);
    font-style: italic;
    text-transform: none;
    letter-spacing: 0.08em;
}

.act-title {
    margin: 0 0 56px;
    position: relative;
    line-height: 0;
}
.act-title .mask-svg {
    width: 100%;
    max-width: 640px;
    height: auto;
    overflow: visible;
}
.act-title-svg-text {
    font-family: "Playfair Display", serif;
    font-weight: 900;
    font-size: 140px;
    letter-spacing: -0.04em;
    fill: var(--ivory);
}
.act-title-svg-text-small {
    font-size: 105px;
}

.crimson-trace {
    stroke-dasharray: 10 1800;
    stroke-dashoffset: 0;
    animation: crimsonTrace 14s linear infinite;
    opacity: 0.85;
}
@keyframes crimsonTrace {
    0%   { stroke-dashoffset: 0; }
    100% { stroke-dashoffset: -1810; }
}

/* ---------- Body prose -------------------------------------- */
.lede {
    font-family: "Source Serif 4", Georgia, serif;
    font-size: 22px;
    line-height: 1.55;
    color: var(--ivory);
    margin-bottom: 28px;
    font-weight: 400;
    letter-spacing: -0.005em;
}
.panel p {
    color: var(--ivory);
    margin-bottom: 22px;
    font-size: 17px;
    line-height: 1.8;
}
.panel em {
    color: var(--silver);
    font-style: italic;
}

/* Drop-cap on the first lede of each act */
.panel-title-panel .lede::first-letter {
    font-family: "Playfair Display", serif;
    font-weight: 900;
    font-size: 4.6em;
    float: left;
    line-height: 0.88;
    margin: 6px 10px -4px 0;
    color: var(--copper);
}
.act-reversed .panel-title-panel .lede::first-letter {
    float: left;
}

/* Right-aligned lede in left-first panels */
.act:not(.act-reversed) .panel-left .lede,
.act:not(.act-reversed) .panel-left p {
    text-align: right;
}
.act:not(.act-reversed) .panel-left .lede::first-letter {
    float: right;
    margin: 6px 0 -4px 10px;
}

/* ---------- Annotations ------------------------------------- */
.annotation {
    background: var(--indigo);
    border: 1px solid rgba(168, 178, 193, 0.18);
    padding: 24px 26px;
    margin-bottom: 32px;
    position: relative;
    border-radius: 1px;
}
.annotation::before {
    content: "";
    position: absolute;
    top: -1px; left: -1px;
    width: 14px;
    height: 14px;
    border-top: 1px solid var(--silver);
    border-left: 1px solid var(--silver);
}
.annotation::after {
    content: "";
    position: absolute;
    bottom: -1px; right: -1px;
    width: 14px;
    height: 14px;
    border-bottom: 1px solid var(--silver);
    border-right: 1px solid var(--silver);
}
.annotation-label {
    font-family: "DM Mono", monospace;
    font-size: 11px;
    letter-spacing: 0.18em;
    text-transform: uppercase;
    color: var(--steel);
    margin-bottom: 14px;
}
.annotation-label em {
    color: var(--silver);
    font-style: italic;
}

.pull-quote {
    font-family: "Playfair Display", serif;
    font-weight: 700;
    font-size: 22px;
    line-height: 1.4;
    color: var(--ivory);
    font-style: italic;
    padding: 8px 0;
    margin: 0;
    position: relative;
}
.pull-quote-mark {
    color: var(--copper);
    font-size: 36px;
    line-height: 0;
    vertical-align: -0.15em;
    margin: 0 4px;
}
.pull-quote cite {
    display: block;
    margin-top: 16px;
    font-family: "DM Mono", monospace;
    font-style: normal;
    font-size: 11px;
    letter-spacing: 0.12em;
    color: var(--steel);
    text-transform: none;
}
.pull-quote cite em { color: var(--silver); }

.marginalia {
    font-size: 16px;
    line-height: 1.75;
    color: var(--silver);
    font-style: italic;
}

.xref-list {
    list-style: none;
    padding: 0;
    margin: 0;
}
.xref-list li {
    font-size: 14px;
    line-height: 1.65;
    color: var(--ivory);
    padding: 6px 0;
    border-bottom: 1px dotted rgba(168, 178, 193, 0.14);
    display: flex;
    gap: 10px;
    align-items: baseline;
}
.xref-list li:last-child { border-bottom: none; }
.xref-tag {
    font-family: "DM Mono", monospace;
    font-size: 10px;
    letter-spacing: 0.16em;
    text-transform: uppercase;
    color: var(--copper);
    border: 1px solid rgba(139, 111, 78, 0.55);
    padding: 2px 6px;
    line-height: 1;
    flex-shrink: 0;
}

/* ---------- City / skyline svg ------------------------------ */
.annotation-city {
    padding: 22px 22px 20px;
}
.city-svg {
    width: 100%;
    height: auto;
    display: block;
    margin: 10px 0 10px;
}
.city-windows .window {
    fill: var(--steel);
    opacity: 0;
    transition: opacity 0.7s ease;
}
.city-windows .window.lit {
    opacity: 0.65;
}
.annotation-caption {
    font-family: "DM Mono", monospace;
    font-size: 11px;
    line-height: 1.55;
    color: var(--steel);
    letter-spacing: 0.05em;
    font-style: italic;
}

/* ---------- Interstitial botanical plates -------------------- */
.interstitial {
    position: relative;
    min-height: 80vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 90px 60px;
    overflow: hidden;
    border-top: 1px solid rgba(168, 178, 193, 0.12);
    border-bottom: 1px solid rgba(168, 178, 193, 0.12);
}
.interstitial-inner {
    width: 100%;
    max-width: 1100px;
    text-align: center;
}
.plate-label {
    font-family: "DM Mono", monospace;
    font-size: 11px;
    letter-spacing: 0.32em;
    text-transform: uppercase;
    color: var(--steel);
    margin-bottom: 8px;
}
.plate-binomial {
    font-family: "Playfair Display", serif;
    font-size: 28px;
    color: var(--sage);
    font-style: italic;
    font-weight: 700;
    margin-bottom: 32px;
    letter-spacing: 0.01em;
}
.botanical-svg {
    width: 100%;
    height: auto;
    max-height: 60vh;
    display: block;
    margin: 0 auto 28px;
    will-change: transform;
}
.botanical-specimen {
    transform-box: fill-box;
}
.stipple-group {
    transform-origin: center;
    animation: stippleRotate 120s linear infinite;
    transform-box: fill-box;
}
@keyframes stippleRotate {
    0%   { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}
.plate-caption {
    max-width: 640px;
    margin: 0 auto;
    font-family: "DM Mono", monospace;
    font-size: 12px;
    line-height: 1.65;
    color: var(--silver);
    letter-spacing: 0.04em;
}
.plate-caption em {
    color: var(--sage);
    font-style: italic;
}

/* ---------- Final coda / colophon --------------------------- */
.final-coda {
    margin-top: 48px;
    padding-top: 36px;
    border-top: 1px solid rgba(168, 178, 193, 0.2);
    font-family: "Playfair Display", serif;
    font-style: italic;
    font-weight: 700;
    font-size: 24px;
    color: var(--copper);
    line-height: 1.5;
}
.final-coda-en {
    display: block;
    margin-top: 8px;
    font-family: "Source Serif 4", serif;
    font-style: normal;
    font-weight: 400;
    font-size: 16px;
    color: var(--silver);
}

.protocol-colophon {
    max-width: 620px;
    margin: 160px auto 0;
    padding: 48px 36px 80px;
    border-top: 1px solid rgba(168, 178, 193, 0.2);
    text-align: center;
    color: var(--silver);
}
.colophon-title {
    font-family: "DM Mono", monospace;
    font-size: 11px;
    letter-spacing: 0.32em;
    text-transform: uppercase;
    color: var(--copper);
    margin-bottom: 20px;
}
.protocol-colophon p {
    font-size: 14px;
    line-height: 1.75;
    margin-bottom: 16px;
    color: var(--silver);
}
.protocol-colophon em { color: var(--sage); font-style: italic; }
.colophon-seal {
    margin-top: 28px;
    font-family: "DM Mono", monospace;
    font-size: 10px;
    letter-spacing: 0.22em;
    text-transform: uppercase;
    color: var(--steel);
}
.colophon-seal em { color: var(--silver); letter-spacing: 0.18em; }

/* ---------- Responsive -------------------------------------- */
@media (max-width: 1024px) {
    :root {
        --spine-x: 30%;
        --panel-max-left: 440px;
        --panel-max-right: 340px;
    }
    .act-title-svg-text { font-size: 120px; }
    .act-title-svg-text-small { font-size: 90px; }
    .lede { font-size: 20px; }
}

@media (max-width: 768px) {
    :root {
        --spine-x: 44px;
        --panel-max-left: 100%;
        --panel-max-right: 100%;
        --panel-pad: 24px;
    }
    .timeline-spine {
        left: 22px;
    }
    .act-panels {
        grid-template-columns: 1fr;
    }
    .panel-left,
    .panel-right,
    .act-reversed .panel-left,
    .act-reversed .panel-right,
    .act-reversed .panel-title-panel {
        grid-column: 1;
        justify-self: start;
        max-width: 100%;
        padding-left: 56px;
        padding-right: 20px;
        text-align: left;
    }
    .act:not(.act-reversed) .panel-left .lede,
    .act:not(.act-reversed) .panel-left p {
        text-align: left;
    }
    .act:not(.act-reversed) .panel-left .lede::first-letter {
        float: left;
        margin: 6px 10px -4px 0;
    }
    .act-node {
        left: 22px;
        top: 24px;
    }
    .overture-title { font-size: 18vw; }
    .act-title-svg-text { font-size: 92px; }
    .act-title-svg-text-small { font-size: 68px; }
    .lede { font-size: 18px; }
    .panel p { font-size: 16px; }
    .act-indicator {
        right: 16px;
        bottom: 16px;
        gap: 8px;
    }
    .act-link-label { display: none; }
    .interstitial {
        padding: 60px 20px;
        min-height: 60vh;
    }
    .plate-binomial { font-size: 22px; }
}
