/* ============================================
   historygrapher.net - Forensic Minimalism
   Cool-gray monochromatic palette
   IBM Plex Mono throughout
   ============================================ */

/* --- Palette --- */
:root {
    --archive-white: #f7f8fa;
    --linen-gray: #eef0f3;
    --fog: #d1d5db;
    --slate: #9ca3af;
    --graphite: #374151;
    --charcoal: #1f2937;
    --ink: #111827;
    --steel: #6b7280;
    --pewter: #9ca3af;
    --light-surface: #f3f4f6;
    --column-width: 680px;
    --datum-offset: 24px;
}

/* --- Reset & Base --- */
*, *::before, *::after {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    font-size: 16px;
    scroll-behavior: smooth;
}

body {
    font-family: 'IBM Plex Mono', monospace;
    font-weight: 400;
    font-size: 1rem;
    line-height: 1.75;
    letter-spacing: 0.01em;
    color: var(--graphite);
    background-color: var(--archive-white);
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    overflow-x: hidden;
}

/* --- Grid Underlay (graph paper) --- */
.grid-underlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 0;
    background-image:
        linear-gradient(rgba(209, 213, 219, 0.25) 1px, transparent 1px),
        linear-gradient(90deg, rgba(209, 213, 219, 0.25) 1px, transparent 1px);
    background-size: 48px 48px;
    opacity: 0;
}

@media (min-width: 1200px) {
    .grid-underlay {
        opacity: 1;
    }
}

/* --- Datum Line (vertical spine) --- */
.datum-line {
    position: fixed;
    top: 0;
    left: calc(50% - var(--column-width) / 2 - var(--datum-offset));
    width: 1px;
    height: 100%;
    background-color: var(--fog);
    z-index: 2;
    opacity: 0;
    mask-image: linear-gradient(to bottom, black, transparent);
    -webkit-mask-image: linear-gradient(to bottom, black, transparent);
    mask-position: 0 -100%;
    -webkit-mask-position: 0 -100%;
    mask-size: 100% 200%;
    -webkit-mask-size: 100% 200%;
    transition: none;
}

.datum-line.revealed {
    opacity: 1;
    animation: datumReveal 1200ms cubic-bezier(0.25, 0.1, 0.25, 1) forwards;
}

@keyframes datumReveal {
    0% {
        mask-position: 0 -100%;
        -webkit-mask-position: 0 -100%;
    }
    100% {
        mask-position: 0 0;
        -webkit-mask-position: 0 0;
    }
}

/* --- Inscription Header (100vh hero) --- */
.inscription-header {
    position: relative;
    width: 100%;
    height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 3;
    background-color: var(--archive-white);
}

.inscription-content {
    text-align: center;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 16px;
}

.site-title {
    font-family: 'IBM Plex Mono', monospace;
    font-size: clamp(1.4rem, 3vw, 2.2rem);
    font-weight: 400;
    letter-spacing: 0.12em;
    text-transform: lowercase;
    color: var(--charcoal);
    opacity: 0;
    transition: opacity 800ms cubic-bezier(0.25, 0.1, 0.25, 1);
}

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

.site-descriptor {
    font-family: 'IBM Plex Mono', monospace;
    font-size: 0.8125rem;
    font-weight: 400;
    letter-spacing: 0.06em;
    color: var(--slate);
    opacity: 0;
    transition: opacity 600ms cubic-bezier(0.25, 0.1, 0.25, 1);
}

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

.scroll-chevron {
    margin-top: 24px;
    opacity: 0;
    transition: opacity 400ms cubic-bezier(0.25, 0.1, 0.25, 1);
}

.scroll-chevron.visible {
    opacity: 1;
    animation: chevronBounce 2s ease-in-out infinite;
}

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

/* --- Sticky Navigation --- */
.sticky-nav {
    position: sticky;
    top: 0;
    z-index: 100;
    background-color: rgba(243, 244, 246, 0.9);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    opacity: 0;
    pointer-events: none;
    transition: opacity 300ms cubic-bezier(0.25, 0.1, 0.25, 1);
    border-bottom: 1px solid var(--fog);
}

.sticky-nav.visible {
    opacity: 1;
    pointer-events: auto;
}

.nav-inner {
    max-width: var(--column-width);
    margin: 0 auto;
    padding: 16px 24px;
    display: flex;
    gap: 32px;
    align-items: center;
}

.nav-link {
    font-family: 'IBM Plex Mono', monospace;
    font-size: 0.875rem;
    font-weight: 500;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    text-decoration: none;
    color: var(--slate);
    transition: color 200ms ease;
}

.nav-link:hover {
    color: var(--steel);
}

.nav-link.active {
    color: var(--charcoal);
}

/* --- Ledger Column (main content) --- */
.ledger-column {
    position: relative;
    max-width: var(--column-width);
    margin: 0 auto;
    padding: 0 24px 80px;
    z-index: 3;
}

/* --- Timeline Nodes --- */
.timeline-nodes {
    position: fixed;
    left: calc(50% - var(--column-width) / 2 - var(--datum-offset));
    top: 50%;
    transform: translate(-50%, -50%);
    z-index: 5;
    display: flex;
    flex-direction: column;
    gap: 40px;
    opacity: 0;
    transition: opacity 600ms ease;
}

.timeline-nodes.visible {
    opacity: 1;
}

.timeline-node {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    border: 2px solid var(--pewter);
    background-color: var(--archive-white);
    transition: background-color 400ms ease;
    position: relative;
}

.timeline-node.filled {
    background-color: var(--graphite);
}

/* --- Ledger Entries --- */
.ledger-entry {
    padding: 64px 0;
    position: relative;
}

.ledger-rule {
    border: none;
    border-top: 1px solid #c8cdd3;
    margin: 0;
}

/* --- Section Heading Row --- */
.section-heading-row {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 16px;
    position: relative;
}

.section-marker {
    flex-shrink: 0;
    display: block;
}

.connector-line {
    width: 24px;
    height: 1px;
    background-color: var(--fog);
    flex-shrink: 0;
}

.section-heading {
    font-family: 'IBM Plex Mono', monospace;
    font-size: clamp(1.1rem, 2vw, 1.5rem);
    font-weight: 500;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--charcoal);
    margin-top: 0;
    margin-bottom: 0;
}

/* --- Section Body --- */
.section-body {
    padding-left: 0;
}

.section-body p {
    margin-bottom: 16px;
    color: var(--graphite);
}

.section-body p:last-child {
    margin-bottom: 0;
}

.section-body .caption {
    font-size: 0.8125rem;
    font-weight: 400;
    letter-spacing: 0.06em;
    color: var(--slate);
    margin-top: 24px;
}

/* --- Entry Blocks (data entries) --- */
.entry-block {
    display: flex;
    flex-wrap: wrap;
    gap: 8px 16px;
    padding: 16px 0;
    border-bottom: 1px solid var(--fog);
    align-items: baseline;
}

.entry-block:last-of-type {
    border-bottom: none;
}

.entry-date {
    font-family: 'IBM Plex Mono', monospace;
    font-size: 0.8125rem;
    font-weight: 500;
    letter-spacing: 0.06em;
    color: var(--charcoal);
    min-width: 100px;
}

.entry-title {
    font-family: 'IBM Plex Mono', monospace;
    font-size: 1rem;
    font-weight: 400;
    color: var(--graphite);
    flex: 1;
    min-width: 200px;
}

.entry-ref {
    font-family: 'IBM Plex Mono', monospace;
    font-size: 0.8125rem;
    font-weight: 400;
    letter-spacing: 0.06em;
    color: var(--slate);
    width: 100%;
}

/* --- Fade Reveal --- */
.fade-reveal {
    opacity: 0;
    transition: opacity 600ms cubic-bezier(0.25, 0.1, 0.25, 1);
}

.fade-reveal.revealed {
    opacity: 1;
}

/* --- Graph Motif --- */
.graph-motif {
    margin-top: 64px;
    padding: 24px 0;
    opacity: 0;
    transition: opacity 600ms cubic-bezier(0.25, 0.1, 0.25, 1);
}

.graph-motif.revealed {
    opacity: 0.5;
}

.graph-motif svg {
    display: block;
    width: 100%;
    height: 120px;
}

/* --- Footer --- */
.site-footer {
    margin-top: 64px;
    padding: 48px 0 24px;
    border-top: 1px solid #c8cdd3;
    text-align: center;
}

.site-footer .caption {
    font-size: 0.8125rem;
    font-weight: 400;
    letter-spacing: 0.06em;
    color: var(--slate);
    margin-bottom: 8px;
}

.site-footer .caption:last-child {
    margin-bottom: 0;
}

/* --- Responsive --- */
@media (max-width: 768px) {
    .ledger-column {
        padding: 0 16px 64px;
    }

    .nav-inner {
        padding: 12px 16px;
        gap: 16px;
        flex-wrap: wrap;
    }

    .nav-link {
        font-size: 0.75rem;
    }

    .datum-line {
        left: 16px;
    }

    .timeline-nodes {
        left: 16px;
    }

    .entry-block {
        flex-direction: column;
        gap: 4px;
    }

    .entry-date {
        min-width: unset;
    }

    .entry-title {
        min-width: unset;
    }
}

@media (max-width: 480px) {
    .nav-inner {
        gap: 12px;
    }

    .grid-underlay {
        display: none;
    }
}

/* --- No shadows deeper than specified --- */
/* box-shadow: 0 1px 2px rgba(17, 24, 39, 0.04) available if needed */
