/* ============================================================
   historygrapher.net — The Cartographer's Sanctum
   Colors: #3D3632, #5B7B6A, #D4C8B8, #F5F0E8, #6B4E3D, #C9A96E, #1C1917, #8B7355
   Fonts: Cormorant Garamond, Source Serif 4, Inter, Space Mono
   ============================================================ */

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

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

body {
    font-family: 'Source Serif 4', Georgia, serif;
    color: #1C1917;
    background-color: #F5F0E8;
    overflow-x: hidden;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

/* --- SVG Filters (hidden) --- */
.svg-filters {
    position: absolute;
    width: 0;
    height: 0;
    overflow: hidden;
}

/* --- Noise Overlay --- */
.noise-overlay {
    position: absolute;
    inset: 0;
    pointer-events: none;
    z-index: 1;
    opacity: 0.06;
    filter: url(#noise-filter);
    mix-blend-mode: soft-light;
    background: repeating-linear-gradient(
        0deg,
        transparent,
        transparent 2px,
        rgba(0,0,0,0.015) 2px,
        rgba(0,0,0,0.015) 4px
    );
}

/* --- Compass Rose (Fixed) --- */
.compass-rose {
    position: fixed;
    top: 30px;
    right: 30px;
    z-index: 100;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    opacity: 0.85;
    transition: opacity 0.3s ease;
}

.compass-rose:hover {
    opacity: 1;
}

.compass-depth-label {
    text-align: center;
}

.depth-text {
    font-family: 'Space Mono', monospace;
    font-size: 10px;
    letter-spacing: 0.15em;
    text-transform: uppercase;
    color: #C9A96E;
    opacity: 0.8;
}

/* --- Scroll Progress --- */
.scroll-progress {
    position: fixed;
    left: 0;
    top: 0;
    width: 3px;
    height: 100vh;
    z-index: 100;
    background: rgba(60, 54, 50, 0.15);
}

.scroll-progress-fill {
    width: 100%;
    height: 0%;
    background: linear-gradient(to bottom, #C9A96E, #6B4E3D, #5B7B6A, #3D3632, #1C1917);
    transition: height 0.1s ease-out;
}

/* --- Strata (Sections) --- */
.stratum {
    position: relative;
    min-height: 100vh;
    display: flex;
    align-items: flex-start;
    justify-content: center;
    padding: 80px 20px;
    overflow: hidden;
}

/* Stratum background gradation: light (present) to dark (deep time) */
.stratum-1 {
    background-color: #F5F0E8;
    color: #1C1917;
}

.stratum-2 {
    background-color: #D4C8B8;
    color: #1C1917;
}

.stratum-3 {
    background-color: #8B7355;
    color: #F5F0E8;
}

.stratum-4 {
    background-color: #3D3632;
    color: #D4C8B8;
}

.stratum-5 {
    background-color: #1C1917;
    color: #D4C8B8;
}

/* --- Scroll Column (Center Map Scroll) --- */
.scroll-column {
    width: 54%;
    max-width: 780px;
    position: relative;
    z-index: 2;
}

/* --- Annotation Gutters --- */
.annotation-gutter {
    position: absolute;
    top: 100px;
    width: 120px;
    z-index: 2;
    display: flex;
    flex-direction: column;
    gap: 16px;
    opacity: 0;
    transition: opacity 0.8s ease 0.3s;
}

.stratum.visible .annotation-gutter {
    opacity: 0.7;
}

.annotation-left {
    left: calc((100% - 54%) / 2 - 160px);
    text-align: right;
}

.annotation-right {
    right: calc((100% - 54%) / 2 - 160px);
    text-align: left;
}

.annotation-date {
    font-family: 'Space Mono', monospace;
    font-size: 11px;
    letter-spacing: 0.1em;
    color: inherit;
    opacity: 0.6;
}

.annotation-note {
    font-family: 'Inter', sans-serif;
    font-size: 10px;
    text-transform: uppercase;
    letter-spacing: 0.2em;
    color: inherit;
    opacity: 0.4;
}

.annotation-ref {
    font-family: 'Cormorant Garamond', serif;
    font-style: italic;
    font-size: 14px;
    color: #C9A96E;
    opacity: 0.6;
}

.annotation-footnote {
    font-family: 'Source Serif 4', serif;
    font-style: italic;
    font-size: 11px;
    color: inherit;
    opacity: 0.5;
    line-height: 1.5;
}

.annotation-compass-mini {
    font-size: 16px;
    color: #C9A96E;
    opacity: 0.3;
    margin-top: 8px;
}

/* --- Contour Dividers --- */
.contour-divider {
    position: absolute;
    left: 0;
    right: 0;
    z-index: 3;
    pointer-events: none;
}

.contour-top {
    top: 0;
}

.contour-bottom {
    bottom: 0;
}

.contour-divider svg {
    width: 100%;
    height: 60px;
    display: block;
}

/* --- Site Header --- */
.site-header {
    text-align: center;
    padding: 60px 0 40px;
}

.site-title {
    font-family: 'Cormorant Garamond', serif;
    font-weight: 600;
    font-size: 84px;
    font-variant-caps: all-small-caps;
    letter-spacing: 0.12em;
    line-height: 1.05;
    color: #1C1917;
    margin-bottom: 8px;
}

.title-accent {
    color: #C9A96E;
}

.site-subtitle {
    font-family: 'Inter', sans-serif;
    font-size: 13px;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.3em;
    color: #8B7355;
    margin-bottom: 24px;
}

.title-rule {
    display: flex;
    justify-content: center;
}

.title-rule svg {
    max-width: 100%;
    height: auto;
}

/* --- Stratum Content --- */
.stratum-content {
    opacity: 0;
    transform: translateY(30px);
    transition: opacity 0.8s ease, transform 0.8s ease;
}

.stratum.visible .stratum-content {
    opacity: 1;
    transform: translateY(0);
}

/* --- Typography --- */
.lead-text {
    font-family: 'Source Serif 4', Georgia, serif;
    font-size: 20px;
    line-height: 1.75;
    color: #3D3632;
    margin-bottom: 48px;
    text-indent: 2em;
}

.body-text {
    font-family: 'Source Serif 4', Georgia, serif;
    font-size: 18px;
    line-height: 1.75;
    margin-bottom: 36px;
    text-indent: 2em;
}

.stratum-3 .body-text,
.stratum-4 .body-text,
.stratum-5 .body-text {
    color: #D4C8B8;
}

/* --- Epoch Marker --- */
.epoch-marker {
    display: flex;
    align-items: center;
    gap: 24px;
    margin-bottom: 48px;
    padding-top: 20px;
}

.epoch-line {
    flex: 1;
    height: 1px;
    background: currentColor;
    opacity: 0.2;
}

.epoch-title {
    font-family: 'Cormorant Garamond', serif;
    font-weight: 600;
    font-size: 56px;
    font-variant-caps: all-small-caps;
    letter-spacing: 0.12em;
    line-height: 1.05;
    white-space: nowrap;
}

.stratum-1 .epoch-title,
.stratum-2 .epoch-title {
    color: #1C1917;
}

.stratum-3 .epoch-title {
    color: #F5F0E8;
}

.stratum-4 .epoch-title,
.stratum-5 .epoch-title {
    color: #C9A96E;
}

/* --- Expedition Cards --- */
.expedition-card {
    border: 1px solid rgba(201, 169, 110, 0.3);
    border-radius: 2px;
    padding: 28px 32px;
    margin-bottom: 32px;
    position: relative;
    background: rgba(255, 255, 255, 0.04);
    transition: border-color 0.4s ease, box-shadow 0.4s ease;
}

.expedition-card:hover {
    border-color: rgba(201, 169, 110, 0.6);
    box-shadow: 0 0 30px rgba(201, 169, 110, 0.08);
}

.stratum-1 .expedition-card {
    background: rgba(255, 255, 255, 0.5);
    border-color: rgba(201, 169, 110, 0.25);
}

.stratum-2 .expedition-card {
    background: rgba(255, 255, 255, 0.25);
    border-color: rgba(139, 115, 85, 0.3);
}

.stratum-3 .expedition-card {
    background: rgba(0, 0, 0, 0.15);
    border-color: rgba(201, 169, 110, 0.25);
}

.stratum-4 .expedition-card {
    background: rgba(0, 0, 0, 0.2);
    border-color: rgba(201, 169, 110, 0.2);
}

.stratum-5 .expedition-card,
.card-ancient {
    background: rgba(0, 0, 0, 0.3);
    border-color: rgba(91, 123, 106, 0.3);
}

.card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 16px;
}

.card-label {
    font-family: 'Inter', sans-serif;
    font-size: 10px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.2em;
    color: #C9A96E;
}

.card-date {
    font-family: 'Space Mono', monospace;
    font-size: 11px;
    opacity: 0.5;
}

.card-title {
    font-family: 'Cormorant Garamond', serif;
    font-weight: 600;
    font-size: 26px;
    line-height: 1.3;
    margin-bottom: 12px;
}

.stratum-1 .card-title,
.stratum-2 .card-title {
    color: #1C1917;
}

.stratum-3 .card-title,
.stratum-4 .card-title,
.stratum-5 .card-title {
    color: #F5F0E8;
}

.card-text {
    font-family: 'Source Serif 4', serif;
    font-size: 15px;
    line-height: 1.7;
    margin-bottom: 16px;
    opacity: 0.85;
}

.card-coordinates {
    display: flex;
    gap: 8px;
    align-items: center;
}

.coord {
    font-family: 'Space Mono', monospace;
    font-size: 11px;
    color: #C9A96E;
    opacity: 0.7;
}

.coord-separator {
    color: #C9A96E;
    opacity: 0.4;
}

/* --- Historical Quotes --- */
.historical-quote {
    border-left: 2px solid #C9A96E;
    padding: 24px 32px;
    margin: 36px 0;
    position: relative;
}

.historical-quote::before {
    content: '\201C';
    position: absolute;
    top: -10px;
    left: 12px;
    font-family: 'Cormorant Garamond', serif;
    font-size: 60px;
    color: #C9A96E;
    opacity: 0.2;
    line-height: 1;
}

.historical-quote p {
    font-family: 'Cormorant Garamond', serif;
    font-style: italic;
    font-size: 22px;
    line-height: 1.6;
    margin-bottom: 12px;
}

.stratum-1 .historical-quote p,
.stratum-2 .historical-quote p {
    color: #3D3632;
}

.stratum-3 .historical-quote p,
.stratum-4 .historical-quote p,
.stratum-5 .historical-quote p {
    color: #D4C8B8;
}

.historical-quote cite {
    font-family: 'Inter', sans-serif;
    font-size: 12px;
    font-style: normal;
    text-transform: uppercase;
    letter-spacing: 0.15em;
    opacity: 0.5;
}

/* --- Manuscript Block --- */
.manuscript-block {
    text-align: center;
    padding: 40px 24px;
    margin: 36px 0;
    border-top: 1px solid rgba(201, 169, 110, 0.2);
    border-bottom: 1px solid rgba(201, 169, 110, 0.2);
}

.manuscript-decoration {
    font-size: 24px;
    color: #C9A96E;
    opacity: 0.5;
    margin: 12px 0;
}

.manuscript-text {
    font-family: 'Cormorant Garamond', serif;
    font-style: italic;
    font-size: 20px;
    line-height: 1.7;
    max-width: 600px;
    margin: 0 auto;
}

.manuscript-ancient .manuscript-text {
    color: #5B7B6A;
}

.manuscript-ancient .manuscript-decoration {
    color: #5B7B6A;
    opacity: 0.4;
}

/* --- Timeline Segment --- */
.timeline-segment {
    position: relative;
    padding-left: 32px;
    margin: 40px 0;
    border-left: 1px solid rgba(201, 169, 110, 0.3);
}

.timeline-node {
    position: relative;
    padding: 12px 0 12px 24px;
    display: flex;
    align-items: baseline;
    gap: 16px;
}

.timeline-node::before {
    content: '';
    position: absolute;
    left: -36px;
    top: 50%;
    transform: translateY(-50%);
    width: 8px;
    height: 8px;
    border: 1px solid #C9A96E;
    border-radius: 50%;
    background: transparent;
    transition: background 0.3s ease;
}

.timeline-node:hover::before {
    background: #C9A96E;
}

.node-year {
    font-family: 'Space Mono', monospace;
    font-size: 13px;
    font-weight: 700;
    color: #C9A96E;
    min-width: 90px;
    flex-shrink: 0;
}

.node-event {
    font-family: 'Source Serif 4', serif;
    font-size: 15px;
    opacity: 0.8;
}

/* --- Footer --- */
.site-footer {
    text-align: center;
    padding: 80px 0 40px;
    margin-top: 60px;
}

.footer-rule {
    display: flex;
    justify-content: center;
    margin-bottom: 24px;
}

.footer-text {
    font-family: 'Cormorant Garamond', serif;
    font-variant-caps: all-small-caps;
    letter-spacing: 0.12em;
    font-size: 18px;
    color: #C9A96E;
    opacity: 0.6;
    margin-bottom: 8px;
}

.footer-colophon {
    font-family: 'Inter', sans-serif;
    font-size: 10px;
    text-transform: uppercase;
    letter-spacing: 0.2em;
    opacity: 0.3;
    color: #D4C8B8;
}

/* --- Gaslight Glow Effect (on cards in dark strata) --- */
.stratum-4 .expedition-card:hover,
.stratum-5 .expedition-card:hover {
    box-shadow: 
        0 0 40px rgba(201, 169, 110, 0.06),
        0 0 80px rgba(201, 169, 110, 0.03),
        inset 0 0 30px rgba(201, 169, 110, 0.02);
}

/* --- Parallax Depth Hint --- */
.stratum-1 .scroll-column { transform: translateZ(0); }
.stratum-2 .scroll-column { transform: translateZ(0); }
.stratum-3 .scroll-column { transform: translateZ(0); }
.stratum-4 .scroll-column { transform: translateZ(0); }
.stratum-5 .scroll-column { transform: translateZ(0); }

/* --- Fade-in Animation for strata --- */
@keyframes stratum-reveal {
    from {
        opacity: 0;
        transform: translateY(40px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* --- Side border decoration for strata transitions --- */
.stratum::before {
    content: '';
    position: absolute;
    left: 50%;
    top: 0;
    width: 1px;
    height: 100%;
    background: linear-gradient(
        to bottom,
        transparent,
        rgba(201, 169, 110, 0.1) 20%,
        rgba(201, 169, 110, 0.1) 80%,
        transparent
    );
    z-index: 1;
    pointer-events: none;
    transform: translateX(calc(27% + 390px));
}

.stratum::after {
    content: '';
    position: absolute;
    left: 50%;
    top: 0;
    width: 1px;
    height: 100%;
    background: linear-gradient(
        to bottom,
        transparent,
        rgba(201, 169, 110, 0.1) 20%,
        rgba(201, 169, 110, 0.1) 80%,
        transparent
    );
    z-index: 1;
    pointer-events: none;
    transform: translateX(calc(-27% - 390px));
}

/* --- Responsive --- */
@media (max-width: 1200px) {
    .annotation-gutter {
        display: none;
    }
    
    .scroll-column {
        width: 80%;
        max-width: 680px;
    }
    
    .stratum::before,
    .stratum::after {
        display: none;
    }
}

@media (max-width: 768px) {
    .scroll-column {
        width: 92%;
    }
    
    .site-title {
        font-size: 48px;
    }
    
    .epoch-title {
        font-size: 36px;
    }
    
    .lead-text {
        font-size: 17px;
    }
    
    .body-text {
        font-size: 16px;
    }
    
    .compass-rose {
        top: 16px;
        right: 16px;
    }
    
    .compass-rose svg {
        width: 44px;
        height: 44px;
    }
    
    .expedition-card {
        padding: 20px 24px;
    }
    
    .card-title {
        font-size: 22px;
    }
    
    .stratum {
        padding: 60px 16px;
    }
    
    .historical-quote {
        padding: 16px 20px;
    }
    
    .historical-quote p {
        font-size: 18px;
    }
}

@media (max-width: 480px) {
    .site-title {
        font-size: 36px;
        letter-spacing: 0.08em;
    }
    
    .epoch-title {
        font-size: 28px;
    }
    
    .title-rule svg {
        width: 250px;
    }
    
    .timeline-node {
        flex-direction: column;
        gap: 4px;
    }
    
    .node-year {
        min-width: auto;
    }
}
