/* ==========================================================================
   monopole.quest — A Steampunk Expedition Journal
   Sepia Nostalgic Palette · Timeline Layout · Reveal-on-Scroll
   ========================================================================== */

:root {
    --parchment:    #E8D8C0;
    --aged-paper:   #D8C8A8;
    --brass-gold:   #B08830;
    --rust-accent:  #A06030;
    --dark-leather: #3A2818;
    --ink-sepia:    #5A4830;
    --faded-map:    #C8B890;

    --font-display: "Abril Fatface", "Lora", Georgia, serif;
    --font-body:    "Lora", Georgia, "Times New Roman", serif;
    --font-mono:    "Special Elite", "Courier New", monospace;

    --line-thickness: 3px;
    --rivet-size: 6px;
    --connector-length: 40px;
    --max-content: 1100px;
}

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

html { scroll-behavior: smooth; }

body {
    background: var(--parchment);
    color: var(--ink-sepia);
    font-family: var(--font-body);
    font-size: clamp(14px, 1vw, 17px);
    line-height: 1.75;
    overflow-x: hidden;
    position: relative;
    min-height: 100vh;
}

/* Aged paper grain — full-viewport overlay */
.paper-texture {
    position: fixed;
    inset: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    opacity: 0.08;
    mix-blend-mode: multiply;
    z-index: 1;
}

/* Subtle radial vignette giving the parchment its aged glow */
body::before {
    content: "";
    position: fixed;
    inset: 0;
    pointer-events: none;
    background:
        radial-gradient(ellipse at 50% 30%, rgba(232,216,192,0) 0%, rgba(180,140,90,0.18) 80%, rgba(90,72,48,0.32) 100%),
        radial-gradient(circle at 20% 80%, rgba(168,128,72,0.12), transparent 55%),
        radial-gradient(circle at 85% 15%, rgba(168,128,72,0.10), transparent 50%);
    z-index: 2;
}

/* ==========================================================================
   HERO / Opening Viewport
   ========================================================================== */

.hero {
    position: relative;
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 6vh 5vw;
    overflow: hidden;
    z-index: 3;
}

.compass-bg {
    position: absolute;
    top: 50%;
    left: 50%;
    width: min(90vmin, 820px);
    height: min(90vmin, 820px);
    transform: translate(-50%, -50%);
    opacity: 0.15;
    pointer-events: none;
    animation: compassDrift 60s linear infinite;
    z-index: 0;
}

@keyframes compassDrift {
    0%   { transform: translate(-50%, -50%) rotate(0deg); }
    100% { transform: translate(-50%, -50%) rotate(360deg); }
}

.corner-gear {
    position: absolute;
    width: 130px;
    height: 130px;
    opacity: 0.55;
    pointer-events: none;
    z-index: 1;
}

.corner-gear--tl {
    top: 4vh;
    left: 4vw;
    animation: gearSpin 20s linear infinite;
}

.corner-gear--tr {
    top: 4vh;
    right: 4vw;
    animation: gearSpin 20s linear infinite reverse;
}

@keyframes gearSpin {
    0%   { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

.hero-content {
    position: relative;
    z-index: 2;
    text-align: center;
    max-width: 880px;
}

.overline {
    font-family: var(--font-mono);
    font-size: 13px;
    letter-spacing: 0.22em;
    text-transform: uppercase;
    color: var(--brass-gold);
    margin-bottom: 1.6em;
    opacity: 0;
    animation: fadeIn 800ms 200ms ease-out forwards;
}

.logotype {
    font-family: var(--font-display);
    font-weight: 400;
    font-size: clamp(48px, 8vw, 112px);
    line-height: 1;
    color: var(--brass-gold);
    text-shadow:
        2px 2px 0 rgba(58,40,24,0.18),
        4px 4px 12px rgba(58,40,24,0.10);
    margin-bottom: 0.5em;
    letter-spacing: -0.01em;
    transform: scale(1.1);
    opacity: 0;
    animation: stamp 600ms 400ms cubic-bezier(0.2, 0.8, 0.2, 1) forwards;
}

.logotype .dot {
    color: var(--rust-accent);
    display: inline-block;
    transform: translateY(-0.05em);
}

@keyframes stamp {
    0%   { transform: scale(1.1); opacity: 0; }
    60%  { transform: scale(0.96); opacity: 1; }
    100% { transform: scale(1);    opacity: 1; }
}

.tagline {
    font-family: var(--font-body);
    font-style: italic;
    font-size: clamp(15px, 1.4vw, 19px);
    color: var(--dark-leather);
    max-width: 620px;
    margin: 0 auto 2.4em;
    line-height: 1.6;
    opacity: 0;
    animation: fadeIn 700ms 1100ms ease-out forwards;
}

.hero-meta {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 14px;
    flex-wrap: wrap;
    font-family: var(--font-mono);
    font-size: 13px;
    letter-spacing: 0.12em;
    color: var(--ink-sepia);
    margin-bottom: 5em;
    opacity: 0;
    animation: fadeIn 700ms 1300ms ease-out forwards;
}

.hero-meta .rule {
    width: 38px;
    height: 1px;
    background: var(--brass-gold);
}

.scroll-cue {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
    color: var(--brass-gold);
    font-family: var(--font-mono);
    font-size: 12px;
    letter-spacing: 0.18em;
    text-transform: uppercase;
    opacity: 0;
    animation: fadeIn 700ms 1700ms ease-out forwards, bobbing 2.4s 2400ms ease-in-out infinite;
}

.scroll-cue svg { width: 22px; height: 32px; }

@keyframes bobbing {
    0%, 100% { transform: translateY(0); }
    50%      { transform: translateY(8px); }
}

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

/* ==========================================================================
   CHAPTER HEADERS
   ========================================================================== */

.chapter {
    position: relative;
    padding: 8vh 5vw 4vh;
    text-align: center;
    z-index: 3;
}

.chapter-mark {
    max-width: var(--max-content);
    margin: 0 auto;
}

.chapter-gears {
    width: 200px;
    height: 100px;
    margin: 0 auto 1em;
    display: block;
}

.chapter-gears .gear-a { animation: gearSpin 24s linear infinite; transform-origin: 70px 50px; }
.chapter-gears .gear-b { animation: gearSpin 24s linear infinite reverse; transform-origin: 130px 50px; }

.chapter-title {
    font-family: var(--font-display);
    font-weight: 400;
    color: var(--dark-leather);
    font-size: clamp(28px, 4vw, 56px);
    line-height: 1.1;
    margin-bottom: 0.4em;
    letter-spacing: -0.005em;
}

.chapter-sub {
    font-family: var(--font-body);
    font-style: italic;
    font-size: clamp(14px, 1.1vw, 17px);
    color: var(--ink-sepia);
    max-width: 540px;
    margin: 0 auto;
}

/* ==========================================================================
   TIMELINE
   ========================================================================== */

.timeline {
    position: relative;
    max-width: var(--max-content);
    margin: 4vh auto 0;
    padding: 4vh 5vw 6vh;
    z-index: 3;
}

.timeline-line {
    position: absolute;
    top: 0;
    left: 50%;
    width: var(--line-thickness);
    height: 100%;
    background: linear-gradient(180deg,
        var(--brass-gold) 0%,
        #C89846 40%,
        var(--brass-gold) 100%);
    transform: translateX(-50%) scaleY(0);
    transform-origin: top center;
    box-shadow:
        0 0 0 1px rgba(176,136,48,0.25),
        0 0 8px rgba(176,136,48,0.30);
    border-radius: 2px;
    transition: transform 2s cubic-bezier(0.2, 0.6, 0.2, 1);
    z-index: 0;
}

.timeline-line.is-drawn {
    transform: translateX(-50%) scaleY(1);
}

/* Decorative caps on the timeline line */
.timeline-line::before,
.timeline-line::after {
    content: "";
    position: absolute;
    left: 50%;
    width: 14px;
    height: 14px;
    border-radius: 50%;
    background: var(--brass-gold);
    border: 2px solid var(--dark-leather);
    transform: translateX(-50%);
}
.timeline-line::before { top: -7px; }
.timeline-line::after  { bottom: -7px; }

/* Timeline entries */
.entry {
    position: relative;
    width: 48%;
    margin: 6vh 0;
    z-index: 1;
}

.entry[data-side="left"] {
    margin-right: 52%;
    text-align: right;
    --entry-dir: -40px;
    --connector-side-left: auto;
    --connector-side-right: -40px;
}

.entry[data-side="right"] {
    margin-left: 52%;
    margin-right: 0;
    text-align: left;
    --entry-dir: 40px;
    --connector-side-left: -40px;
    --connector-side-right: auto;
}

/* Connector — the brass arm joining the entry to the timeline */
.connector {
    position: absolute;
    top: 28px;
    height: var(--line-thickness);
    background: var(--brass-gold);
    width: 0;
    transition: width 350ms cubic-bezier(0.4, 0, 0.2, 1);
    z-index: -1;
}

.entry[data-side="left"] .connector {
    right: -40px;
    transform-origin: right center;
}
.entry[data-side="right"] .connector {
    left: -40px;
    transform-origin: left center;
}

.entry.is-revealed .connector {
    width: var(--connector-length);
}

/* Rivets at connector endpoints */
.connector::before,
.connector::after {
    content: "";
    position: absolute;
    top: 50%;
    width: var(--rivet-size);
    height: var(--rivet-size);
    border-radius: 50%;
    background: var(--brass-gold);
    border: 1px solid var(--dark-leather);
    transform: translateY(-50%);
    box-shadow: inset 0 1px 0 rgba(255,255,255,0.30);
}

.entry[data-side="left"] .connector::before  { right: -3px; }
.entry[data-side="left"] .connector::after   { left:  -3px; }
.entry[data-side="right"] .connector::before { left:  -3px; }
.entry[data-side="right"] .connector::after  { right: -3px; }

/* Entry panel — the journal page */
.entry-panel {
    background: var(--aged-paper);
    border: 1px solid rgba(58,40,24,0.18);
    border-radius: 3px;
    padding: 28px 32px;
    box-shadow:
        0 1px 0 rgba(255,255,255,0.40) inset,
        0 0 0 1px rgba(176,136,48,0.20),
        0 6px 18px rgba(58,40,24,0.16),
        0 18px 32px rgba(58,40,24,0.10);
    position: relative;
    opacity: 0;
    transform: translateX(var(--entry-dir));
    transition: opacity 500ms 200ms cubic-bezier(0.2, 0.6, 0.2, 1),
                transform 500ms 200ms cubic-bezier(0.2, 0.6, 0.2, 1);
}

.entry.is-revealed .entry-panel {
    opacity: 1;
    transform: translateX(0);
}

/* Decorative riveted corners on the journal panel */
.entry-panel::before,
.entry-panel::after {
    content: "";
    position: absolute;
    width: 5px;
    height: 5px;
    border-radius: 50%;
    background: var(--brass-gold);
    box-shadow:
        inset 0 1px 0 rgba(255,255,255,0.40),
        0 0 0 1px rgba(58,40,24,0.40);
}

.entry-panel::before { top: 8px; left: 8px; }
.entry-panel::after  { top: 8px; right: 8px; }

/* Subtle parchment texture on each panel */
.entry-panel {
    background-image:
        linear-gradient(180deg, rgba(232,216,192,0.4), transparent 60%),
        radial-gradient(circle at 20% 10%, rgba(160,96,48,0.08), transparent 40%),
        radial-gradient(circle at 80% 90%, rgba(160,96,48,0.06), transparent 50%);
    background-color: var(--aged-paper);
}

.entry-date {
    font-family: var(--font-mono);
    font-size: 13px;
    letter-spacing: 0.14em;
    color: var(--rust-accent);
    margin-bottom: 0.6em;
    text-transform: uppercase;
}

.entry-title {
    font-family: var(--font-display);
    font-weight: 400;
    font-size: clamp(22px, 2.4vw, 32px);
    line-height: 1.15;
    color: var(--dark-leather);
    margin-bottom: 0.4em;
    letter-spacing: -0.005em;
}

.entry-body {
    font-family: var(--font-body);
    font-size: clamp(14px, 1vw, 16px);
    color: var(--ink-sepia);
    line-height: 1.75;
    margin-bottom: 1em;
}

.entry-meta {
    font-family: var(--font-mono);
    font-size: 12px;
    letter-spacing: 0.10em;
    color: var(--brass-gold);
    border-top: 1px dashed rgba(176,136,48,0.45);
    padding-top: 0.6em;
}

/* Timeline Break (chapter divider with gears) */
.timeline-break {
    position: relative;
    margin: 10vh auto;
    text-align: center;
    width: 100%;
    z-index: 2;
}

.break-gears {
    display: block;
    margin: 0 auto;
    width: 220px;
    height: 110px;
    background: var(--parchment);
    padding: 6px 16px;
}

.break-gears .gear-a { animation: gearSpin 24s linear infinite; transform-origin: 80px 55px; }
.break-gears .gear-b { animation: gearSpin 24s linear infinite reverse; transform-origin: 150px 55px; }

.break-label {
    font-family: var(--font-display);
    font-weight: 400;
    font-size: clamp(20px, 2.2vw, 30px);
    color: var(--dark-leather);
    margin-top: 0.3em;
    background: var(--parchment);
    display: inline-block;
    padding: 0 18px;
    letter-spacing: 0.01em;
}

/* ==========================================================================
   CLOSING / Footer
   ========================================================================== */

.closing {
    position: relative;
    padding: 12vh 5vw;
    text-align: center;
    z-index: 3;
    overflow: hidden;
}

.closing-compass {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: min(80vmin, 580px);
    height: min(80vmin, 580px);
    opacity: 0.12;
    pointer-events: none;
    animation: compassDrift 80s linear infinite reverse;
    z-index: 0;
}

.closing-content {
    position: relative;
    z-index: 1;
    max-width: 720px;
    margin: 0 auto;
}

.closing-stamp {
    font-family: var(--font-mono);
    font-size: 13px;
    letter-spacing: 0.36em;
    color: var(--rust-accent);
    margin-bottom: 1.6em;
}

.closing-title {
    font-family: var(--font-display);
    font-weight: 400;
    font-size: clamp(32px, 4.5vw, 64px);
    line-height: 1.1;
    color: var(--dark-leather);
    margin-bottom: 0.8em;
}

.closing-body {
    font-family: var(--font-body);
    font-style: italic;
    font-size: clamp(15px, 1.3vw, 18px);
    color: var(--ink-sepia);
    margin-bottom: 2em;
}

.closing-sign {
    font-family: var(--font-body);
    font-style: italic;
    font-size: 15px;
    color: var(--ink-sepia);
    margin-bottom: 2em;
}

.signature {
    font-family: var(--font-display);
    font-style: normal;
    font-size: 28px;
    color: var(--brass-gold);
    display: inline-block;
    margin-top: 0.4em;
    border-bottom: 1px solid var(--brass-gold);
    padding-bottom: 4px;
    letter-spacing: 0.02em;
}

.closing-meta {
    font-family: var(--font-mono);
    font-size: 12px;
    letter-spacing: 0.18em;
    color: var(--brass-gold);
    text-transform: uppercase;
    margin-top: 3em;
}

/* ==========================================================================
   RESPONSIVE
   ========================================================================== */

@media (max-width: 760px) {
    .corner-gear { width: 90px; height: 90px; opacity: 0.4; }
    .timeline-line { left: 28px; }

    .entry,
    .entry[data-side="left"],
    .entry[data-side="right"] {
        width: calc(100% - 60px);
        margin-left: 60px;
        margin-right: 0;
        text-align: left;
        --entry-dir: 24px;
    }

    .entry[data-side="left"] .connector,
    .entry[data-side="right"] .connector {
        left: -32px;
        right: auto;
        transform-origin: left center;
    }

    .entry[data-side="left"] .connector::before,
    .entry[data-side="right"] .connector::before { left: -3px; right: auto; }
    .entry[data-side="left"] .connector::after,
    .entry[data-side="right"] .connector::after  { right: -3px; left: auto; }

    .entry.is-revealed .connector { width: 32px; }

    .hero-meta { gap: 8px; }
    .hero-meta .rule { width: 22px; }
}

@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}
