/* ============================================================
   historygrapher.net — Styles
   Cartographer's study / archival-cartographic
   ============================================================ */

:root {
    --parchment-base: #F5E6C8;
    --aged-paper: #E8D5B0;
    --sepia-ink: #6B4226;
    --rubricated-red: #8B2500;
    --map-green: #5C6B4E;
    --compass-gold: #B8963E;
    --deep-vellum: #3D2B1F;
    --archive-shadow: #1E1108;
    --archive-dust: #D4C4A8;
}

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

html {
    scroll-behavior: smooth;
}

body {
    background: var(--parchment-base);
    color: var(--sepia-ink);
    font-family: 'EB Garamond', serif;
    font-size: clamp(1rem, 1.8vw, 1.2rem);
    line-height: 1.72;
    overflow-x: hidden;
}

.svg-defs { position: absolute; width: 0; height: 0; }

/* ---- Pin Navigation ---- */
.pin-nav {
    position: fixed;
    top: 24px;
    right: 24px;
    z-index: 100;
    display: flex;
    gap: 12px;
}

.map-pin {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    background: var(--compass-gold);
    border: 2px solid var(--deep-vellum);
    display: flex;
    align-items: center;
    justify-content: center;
    text-decoration: none;
    position: relative;
    transition: transform 0.2s ease;
    box-shadow: 0 2px 6px rgba(30,17,8,0.2);
}

.map-pin:hover {
    transform: scale(1.15);
}

.pin-label {
    position: absolute;
    top: 100%;
    left: 50%;
    transform: translateX(-50%);
    font-family: 'IM Fell English', serif;
    font-size: 0.7rem;
    color: var(--sepia-ink);
    white-space: nowrap;
    opacity: 0;
    transition: opacity 0.2s ease;
    margin-top: 4px;
}

.map-pin:hover .pin-label {
    opacity: 1;
}

/* ---- Desk Hero ---- */
.desk-hero {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--deep-vellum);
    position: relative;
    overflow: hidden;
    /* Cartographic grid */
    background-image:
        repeating-linear-gradient(0deg, rgba(107,66,38,0.06) 0px, transparent 1px, transparent 60px),
        repeating-linear-gradient(90deg, rgba(107,66,38,0.06) 0px, transparent 1px, transparent 60px);
}

.desk-surface {
    position: relative;
    text-align: center;
    z-index: 2;
}

.map-watermark {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 100%;
    height: 100%;
    pointer-events: none;
}

.compass-rose {
    width: clamp(120px, 20vw, 200px);
    height: auto;
    margin: 0 auto 32px;
    display: block;
    animation: slowSpin 120s linear infinite;
    cursor: pointer;
    transition: animation-duration 0.6s ease-in-out;
}

.compass-rose:hover {
    animation-duration: 8s;
}

@keyframes slowSpin {
    to { transform: rotate(360deg); }
}

.compass-label {
    font-family: 'IM Fell English', serif;
    font-size: 8px;
    fill: var(--compass-gold);
}

.journal-cover {
    position: relative;
}

.site-title {
    font-family: 'Playfair Display', serif;
    font-weight: 700;
    font-size: clamp(2.8rem, 7vw, 5.5rem);
    letter-spacing: 0.06em;
    color: var(--compass-gold);
    text-shadow: 0 2px 4px rgba(30,17,8,0.4);
    opacity: 0;
    transition: opacity 1s ease 0.8s;
}

.site-title.visible { opacity: 1; }

.site-epigraph {
    font-family: 'Playfair Display', serif;
    font-style: italic;
    font-weight: 400;
    font-size: 1.1rem;
    color: var(--aged-paper);
    margin-top: 16px;
    opacity: 0;
    transition: opacity 1s ease 1.6s;
}

.site-epigraph.visible { opacity: 1; }

/* ---- Section Headers ---- */
.section-header {
    text-align: center;
    margin-bottom: clamp(3rem, 8vh, 6rem);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 16px;
}

.section-heading {
    font-family: 'Playfair Display', serif;
    font-weight: 700;
    font-size: clamp(1.8rem, 4vw, 3rem);
    letter-spacing: 0.06em;
    color: var(--deep-vellum);
}

.fleuron {
    font-family: 'IM Fell English', serif;
    font-size: 2rem;
    color: var(--compass-gold);
    line-height: 1;
}

/* ---- Chronicle Section ---- */
.chronicle-section {
    padding: clamp(3rem, 8vh, 6rem) 24px;
    background: var(--parchment-base);
    /* Grid lines */
    background-image:
        repeating-linear-gradient(2deg, rgba(107,66,38,0.04) 0px, transparent 1px, transparent 60px),
        repeating-linear-gradient(92deg, rgba(107,66,38,0.04) 0px, transparent 1px, transparent 60px);
}

.timeline-container {
    position: relative;
    max-width: 960px;
    margin: 0 auto;
    padding: 40px 0;
}

.timeline-line {
    position: absolute;
    left: 50%;
    top: 0;
    width: 1px;
    height: 100%;
    background: var(--sepia-ink);
    transform: translateX(-50%);
    transform-origin: top center;
}

/* ---- Timeline Entries ---- */
.timeline-entry {
    position: relative;
    width: 45%;
    margin-bottom: 120px;
    opacity: 0;
    transition: opacity 0.6s ease-out, transform 0.6s ease-out;
}

.timeline-entry.visible {
    opacity: 1;
    transform: translateX(0) !important;
}

.left-entry {
    margin-right: auto;
    transform: translateX(-30px);
}

.right-entry {
    margin-left: auto;
    transform: translateX(30px);
}

.connector-line {
    position: absolute;
    top: 30px;
    height: 1px;
    background: var(--sepia-ink);
    stroke-dasharray: 200;
}

.left-entry .connector-line {
    right: -5%;
    width: 10%;
}

.right-entry .connector-line {
    left: -5%;
    width: 10%;
}

.parchment-card {
    background: var(--parchment-base);
    padding: 24px;
    clip-path: var(--torn-edge);
    background-image: repeating-radial-gradient(
        circle at 50% 50%,
        rgba(107,66,38,0.015) 0px,
        transparent 1px,
        transparent 3px
    );
}

.entry-date {
    font-family: 'Courier Prime', monospace;
    font-size: 0.85rem;
    letter-spacing: 0.04em;
    color: var(--compass-gold);
    margin-bottom: 8px;
}

/* Rubricated drop cap */
.drop-cap-text::first-letter {
    float: left;
    font-family: 'Playfair Display', serif;
    font-size: 4em;
    line-height: 0.8;
    color: var(--rubricated-red);
    margin-right: 0.08em;
    text-shadow: 1px 1px 0 rgba(107,66,38,0.15);
}

/* ---- Map Room ---- */
.map-room-section {
    padding: clamp(3rem, 8vh, 6rem) 24px;
    background: var(--aged-paper);
}

.map-scroll-container {
    display: flex;
    gap: 24px;
    overflow-x: auto;
    scroll-snap-type: x mandatory;
    padding: 24px 0;
    -webkit-overflow-scrolling: touch;
}

.map-plate {
    min-width: 85vw;
    scroll-snap-align: center;
    padding: 32px;
    flex-shrink: 0;
}

.plate-border {
    border: 3px solid var(--sepia-ink);
    padding: 24px;
    background: inherit;
}

.plate-title {
    font-family: 'Playfair Display', serif;
    font-weight: 700;
    font-size: 1.4rem;
    letter-spacing: 0.06em;
    color: var(--deep-vellum);
    margin-bottom: 16px;
    text-align: center;
}

.plate-map {
    width: 100%;
    max-width: 500px;
    height: auto;
    display: block;
    margin: 0 auto;
}

.map-text {
    font-family: 'IM Fell English', serif;
    font-size: 10px;
    fill: var(--sepia-ink);
}

.plate-caption {
    font-family: 'IM Fell English', serif;
    font-style: italic;
    font-size: 0.85rem;
    color: var(--sepia-ink);
    text-align: center;
    margin-top: 16px;
    opacity: 0.8;
}

/* ---- Archive Section ---- */
.archive-section {
    padding: clamp(3rem, 8vh, 6rem) 24px;
    background: var(--parchment-base);
}

.card-catalogue {
    display: grid;
    grid-template-columns: repeat(3, 280px);
    gap: 24px;
    justify-content: center;
    max-width: 960px;
    margin: 0 auto;
}

.index-card {
    width: 280px;
    background: var(--aged-paper);
    border-radius: 4px;
    padding: 20px;
    position: relative;
    box-shadow: 2px 2px 8px rgba(30,17,8,0.12);
    opacity: 0;
    transform: translateY(30px);
    transition: opacity 0.5s ease, transform 0.5s ease;
    transition-delay: calc(var(--card-index) * 80ms);
}

.index-card.visible {
    opacity: 1;
    transform: translateY(0);
}

.wax-seal-stamp {
    position: absolute;
    top: 12px;
    right: 12px;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: radial-gradient(circle at 40% 35%, rgba(160,60,20,0.8), var(--rubricated-red) 60%, var(--sepia-ink));
    box-shadow: 0 2px 4px rgba(30,17,8,0.3);
    display: flex;
    align-items: center;
    justify-content: center;
}

.wax-seal-stamp span {
    font-family: 'Playfair Display', serif;
    font-size: 0.65rem;
    font-weight: 700;
    color: var(--parchment-base);
}

.card-heading {
    font-family: 'Courier Prime', monospace;
    font-size: 0.85rem;
    font-weight: 400;
    color: var(--deep-vellum);
    text-transform: uppercase;
    letter-spacing: 0.04em;
    margin-bottom: 8px;
    padding-right: 36px;
}

.card-body {
    font-family: 'Courier Prime', monospace;
    font-size: 0.82rem;
    line-height: 1.6;
    color: var(--sepia-ink);
    margin-bottom: 8px;
}

.card-ref {
    font-family: 'IM Fell English', serif;
    font-size: 0.7rem;
    color: var(--compass-gold);
    opacity: 0.8;
}

/* ---- Colophon ---- */
.colophon-section {
    padding: clamp(3rem, 8vh, 6rem) 24px;
    background: var(--deep-vellum);
    text-align: center;
}

.colophon-inner {
    max-width: 500px;
    margin: 0 auto;
}

.printer-mark {
    width: 48px;
    height: auto;
    margin: 0 auto 24px;
    display: block;
}

.colophon-title {
    font-family: 'Playfair Display', serif;
    font-weight: 700;
    font-size: 1.5rem;
    letter-spacing: 0.06em;
    color: var(--compass-gold);
    margin-bottom: 8px;
}

.colophon-date {
    font-family: 'Courier Prime', monospace;
    font-size: 0.9rem;
    color: var(--aged-paper);
    letter-spacing: 0.1em;
    margin-bottom: 16px;
}

.colophon-note {
    font-family: 'EB Garamond', serif;
    font-size: 0.9rem;
    color: var(--aged-paper);
    line-height: 1.7;
    opacity: 0.8;
    margin-bottom: 24px;
}

.colophon-fleuron {
    display: block;
    opacity: 0.6;
}

/* ---- Responsive ---- */
@media (max-width: 768px) {
    .timeline-entry {
        width: 80%;
        margin-left: auto;
    }

    .left-entry {
        margin-left: auto;
        margin-right: 0;
    }

    .timeline-line {
        left: 16px;
    }

    .connector-line {
        display: none;
    }

    .card-catalogue {
        grid-template-columns: 1fr;
        justify-items: center;
    }

    .pin-nav {
        top: auto;
        bottom: 16px;
        right: 50%;
        transform: translateX(50%);
    }
}
