/* historical.day - Illuminated Manuscript Codex */
/* Colors: #D4C5A0, #8B6914, #2A1F3D, #C9A84C, #2C1810, #1B1040, #F5ECD7, #6B4423 */
/* Fonts: Cormorant Garamond (display), Inter (body), IM Fell English (drop caps) */

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

html {
    scroll-behavior: smooth;
}

body {
    background-color: #1B1040;
    color: #F5ECD7;
    font-family: 'Inter', sans-serif;
    font-size: 16px;
    line-height: 1.6;
    overflow-x: hidden;
}

/* Parchment texture overlay */
#parchment-texture {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    pointer-events: none;
    z-index: 0;
    background:
        repeating-linear-gradient(
            0deg,
            transparent,
            transparent 2px,
            rgba(245, 236, 215, 0.008) 2px,
            rgba(245, 236, 215, 0.008) 4px
        );
    mix-blend-mode: overlay;
}

/* Sections */
.section {
    position: relative;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    z-index: 1;
}

/* === COVER SECTION === */
#cover {
    gap: 28px;
    padding: 40px 20px;
}

#cover-line {
    width: 60%;
    max-width: 500px;
    height: 2px;
    overflow: visible;
}

#cover-line line {
    transition: stroke-dashoffset 1.5s ease-in-out;
}

#cover-line.active line {
    stroke-dashoffset: 0;
}

#cover-title {
    font-family: 'Cormorant Garamond', serif;
    font-weight: 700;
    font-size: 48px;
    line-height: 1.15;
    color: #C9A84C;
    text-align: center;
    letter-spacing: 1px;
}

.title-word {
    display: inline-block;
    opacity: 0;
    transition: opacity 0.4s ease;
}

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

.title-dot {
    color: #8B6914;
    opacity: 0;
    transition: opacity 0.3s ease;
}

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

#cover-subtitle {
    font-family: 'Cormorant Garamond', serif;
    font-weight: 300;
    font-style: italic;
    font-size: 18px;
    color: #D4C5A0;
    text-align: center;
    opacity: 0;
    transition: opacity 0.8s ease;
}

#cover-subtitle.visible {
    opacity: 1;
}

#scroll-hint {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    opacity: 0;
    transition: opacity 0.6s ease;
    animation: hintPulse 2.5s ease-in-out infinite;
}

#scroll-hint.visible {
    opacity: 1;
}

.scroll-hint-text {
    font-family: 'Inter', sans-serif;
    font-size: 11px;
    letter-spacing: 3px;
    text-transform: uppercase;
    color: #8B6914;
}

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

/* === TIMELINE CONTAINER === */
#timeline-container {
    position: relative;
    max-width: 1200px;
    margin: 0 auto;
    padding: 80px 20px;
    z-index: 1;
}

#timeline-spine {
    position: absolute;
    left: 50%;
    top: 0;
    bottom: 0;
    width: 4px;
    transform: translateX(-50%);
}

#spine-svg {
    width: 100%;
    height: 100%;
}

/* === TIMELINE EVENTS === */
.timeline-event {
    position: relative;
    display: flex;
    align-items: flex-start;
    margin-bottom: 120px;
    opacity: 0;
    transform: translateY(40px);
    transition: opacity 0.8s ease, transform 0.8s ease;
}

.timeline-event.revealed {
    opacity: 1;
    transform: translateY(0);
}

.event-left {
    flex-direction: row;
    padding-right: calc(50% + 40px);
    justify-content: flex-end;
}

.event-right {
    flex-direction: row-reverse;
    padding-left: calc(50% + 40px);
    justify-content: flex-end;
}

.event-node {
    position: absolute;
    left: 50%;
    top: 20px;
    transform: translateX(-50%);
    z-index: 3;
}

/* === EVENT PANEL === */
.event-panel {
    background: rgba(42, 31, 61, 0.6);
    border: 1px solid rgba(139, 105, 20, 0.3);
    padding: 32px;
    max-width: 440px;
    display: flex;
    gap: 20px;
    position: relative;
}

.event-panel::before {
    content: '';
    position: absolute;
    top: -1px;
    left: -1px;
    right: -1px;
    bottom: -1px;
    border: 1px solid rgba(201, 168, 76, 0.1);
    pointer-events: none;
    margin: -4px;
}

/* Drop Cap */
.drop-cap-container {
    position: relative;
    width: 72px;
    height: 72px;
    flex-shrink: 0;
}

.drop-cap {
    font-family: 'IM Fell English', serif;
    font-size: 52px;
    color: #C9A84C;
    line-height: 72px;
    text-align: center;
    display: block;
    width: 72px;
    height: 72px;
}

.drop-cap-border {
    position: absolute;
    top: 0;
    left: 0;
    width: 72px;
    height: 72px;
}

.drop-cap-border rect {
    transition: stroke-dashoffset 1.8s ease-in-out;
}

.timeline-event.revealed .drop-cap-border rect {
    stroke-dashoffset: 0;
}

/* Event Content */
.event-content {
    flex: 1;
}

.event-date {
    font-family: 'Inter', sans-serif;
    font-size: 11px;
    font-weight: 500;
    letter-spacing: 3px;
    text-transform: uppercase;
    color: #8B6914;
    display: block;
    margin-bottom: 8px;
}

.event-title {
    font-family: 'Cormorant Garamond', serif;
    font-weight: 600;
    font-size: 32px;
    line-height: 1.2;
    color: #C9A84C;
    margin-bottom: 12px;
}

.event-body {
    font-family: 'Inter', sans-serif;
    font-size: 14px;
    line-height: 1.75;
    color: #D4C5A0;
    margin-bottom: 16px;
}

.event-marginalia {
    font-family: 'Cormorant Garamond', serif;
    font-weight: 300;
    font-style: italic;
    font-size: 14px;
    color: #6B4423;
    display: block;
    padding-top: 12px;
    border-top: 1px solid rgba(139, 105, 20, 0.2);
}

/* === COLOPHON === */
#colophon {
    padding: 80px 20px;
    gap: 24px;
    min-height: 50vh;
}

.colophon-ornament {
    margin-bottom: 8px;
}

.colophon-text {
    font-family: 'Cormorant Garamond', serif;
    font-weight: 300;
    font-style: italic;
    font-size: 20px;
    color: #D4C5A0;
    text-align: center;
}

.colophon-domain {
    font-family: 'Cormorant Garamond', serif;
    font-weight: 700;
    font-size: 16px;
    color: #C9A84C;
    letter-spacing: 2px;
    text-align: center;
}

/* === RESPONSIVE === */
@media (max-width: 768px) {
    #timeline-spine {
        left: 20px;
    }

    .event-node {
        left: 20px;
    }

    .event-left,
    .event-right {
        flex-direction: row;
        padding-right: 0;
        padding-left: 60px;
        justify-content: flex-start;
    }

    .event-panel {
        flex-direction: column;
        max-width: 100%;
    }

    #cover-title {
        font-size: 36px;
    }

    .event-title {
        font-size: 24px;
    }
}

@media (min-width: 1200px) {
    #cover-title {
        font-size: 64px;
    }
}

/* Background color for #2C1810 usage in hover states */
.event-panel:hover {
    background: rgba(44, 24, 16, 0.15);
    border-color: rgba(201, 168, 76, 0.4);
    transition: background 0.4s ease, border-color 0.4s ease;
}
