/* ============================================================
   HISTORYGRAPHER.COM - STYLES
   Watercolor + Art Deco Design System
   ============================================================ */

/* ============================================================
   RESET & GLOBAL STYLES
   ============================================================ */

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

html {
    scroll-behavior: smooth;
    scroll-snap-type: y proximity;
    scroll-snap-stop: always;
}

body {
    font-family: 'Lora', serif;
    background-color: #FAF7F2;
    color: #3A3440;
    overflow-x: hidden;
    position: relative;
    --color-primary-bg: #FAF7F2;
    --color-dark-bg: #2E2240;
    --color-dusty-rose: #D4A5A5;
    --color-soft-lavender: #B8A9D1;
    --color-pale-sage: #B5C7A3;
    --color-golden-hour: #E8D5A3;
    --color-tarnished-gold: #C9B97A;
    --color-charcoal: #3A3440;
    --color-faded-script: #8A8492;
    --color-drafting-blue: #C8BFD4;
    --color-parchment: #F5F0E6;
}

/* ============================================================
   FONT DEFINITIONS
   ============================================================ */

/* Google Fonts: Poiret One, Josefin Sans, Lora */
/* Poiret One - Display/Headings (Art Deco geometric decorative) */
/* Josefin Sans - Secondary Display (Geometric Scandinavian vintage) */
/* Lora - Body Text (Warm serif for prose) */

/* ============================================================
   TYPOGRAPHY
   ============================================================ */

h1, h2, .deco-heading {
    font-family: 'Poiret One', sans-serif;
    text-transform: uppercase;
    letter-spacing: 0.15em;
    font-weight: 400;
    color: #3A3440;
}

h1 {
    font-size: clamp(3rem, 10vw, 7rem);
    letter-spacing: 0.15em;
    line-height: 1;
}

h2 {
    font-size: clamp(1.5rem, 5vw, 3.5rem);
    letter-spacing: 0.08em;
}

.label, .card-date {
    font-family: 'Josefin Sans', sans-serif;
    font-weight: 600;
    letter-spacing: 0.05em;
    font-size: clamp(0.75rem, 1.5vw, 1rem);
}

.card-date {
    font-size: clamp(1rem, 2vw, 1.5rem);
    color: #C9B97A;
}

body > p, .card-text, .colophon-text {
    font-family: 'Lora', serif;
    font-size: clamp(1rem, 1.8vw, 1.2rem);
    line-height: 1.7;
    letter-spacing: 0.01em;
}

/* ============================================================
   BACKGROUND GRID (Cartographer's Grid)
   ============================================================ */

body::before {
    content: '';
    position: fixed;
    top: 0;
    left: 0;
    width: 200%;
    height: 200%;
    background-image:
        linear-gradient(0deg, transparent 24%, rgba(200, 191, 212, 0.15) 25%, rgba(200, 191, 212, 0.15) 26%, transparent 27%, transparent 74%, rgba(200, 191, 212, 0.15) 75%, rgba(200, 191, 212, 0.15) 76%, transparent 77%, transparent),
        linear-gradient(90deg, transparent 24%, rgba(200, 191, 212, 0.15) 25%, rgba(200, 191, 212, 0.15) 26%, transparent 27%, transparent 74%, rgba(200, 191, 212, 0.15) 75%, rgba(200, 191, 212, 0.15) 76%, transparent 77%, transparent);
    background-size: 60px 60px;
    background-position: 0 0;
    transform: rotate(2deg);
    pointer-events: none;
    z-index: 1;
}

/* ============================================================
   CHAPTER STRUCTURE
   ============================================================ */

.chapter {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    scroll-snap-align: start;
    scroll-snap-stop: always;
    overflow: hidden;
}

/* ============================================================
   CHAPTER I: THE BLANK PAGE (HERO)
   ============================================================ */

.chapter-1 {
    background-color: #FAF7F2;
    flex-direction: column;
    gap: 2rem;
}

.hero-content {
    text-align: center;
    z-index: 10;
}

.hero-content h1 {
    margin-bottom: 1.5rem;
    color: #3A3440;
}

.hero-subtitle {
    font-family: 'Josefin Sans', sans-serif;
    font-weight: 300;
    font-size: clamp(0.9rem, 1.5vw, 1.1rem);
    letter-spacing: 0.08em;
    color: #8A8492;
    margin-top: 1.5rem;
}

.watercolor-rule {
    width: 400px;
    height: 3px;
    background: linear-gradient(to right, transparent, #D4A5A5, transparent);
    margin: 0 auto;
    filter: url(#watercolor-wash);
    opacity: 0.8;
}

.chevron-down {
    position: absolute;
    bottom: 4rem;
    left: 50%;
    transform: translateX(-50%);
    animation: chevron-pulse 3s ease-in-out infinite;
    z-index: 10;
}

@keyframes chevron-pulse {
    0%, 100% {
        opacity: 0.3;
    }
    50% {
        opacity: 0.7;
    }
}

.chevron-down svg {
    width: 60px;
    height: 40px;
}

/* ============================================================
   CHAPTER II: THE TIMELINE RIVER
   ============================================================ */

.chapter-2 {
    background-color: #FAF7F2;
}

.timeline-container {
    width: 100%;
    height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10;
}

.timeline-river {
    width: 100%;
    height: 100%;
    max-width: 100%;
}

.river-stroke {
    stroke-dasharray: 1000;
    stroke-dashoffset: 1000;
    animation: river-draw 3s ease-out forwards;
}

@keyframes river-draw {
    from {
        stroke-dashoffset: 1000;
    }
    to {
        stroke-dashoffset: 0;
    }
}

.river-fill {
    animation: river-fill-fade 3s ease-out forwards;
}

@keyframes river-fill-fade {
    from {
        opacity: 0;
    }
    to {
        opacity: 0.7;
    }
}

.medallion {
    cursor: pointer;
    transition: transform 0.4s cubic-bezier(0.25, 0.46, 0.45, 0.94);
}

.medallion:hover {
    transform: scale(1.15);
}

/* ============================================================
   CHAPTER III: THE ARCHIVE
   ============================================================ */

.chapter-3 {
    background-color: #F5F0E6;
    padding: 4rem 2rem;
    flex-direction: column;
}

.archive-title {
    text-align: center;
    margin-bottom: 4rem;
    color: #3A3440;
    z-index: 10;
}

.archive-container {
    position: relative;
    width: 100%;
    max-width: 1200px;
    height: 600px;
    margin: 0 auto;
    z-index: 10;
}

.archive-card {
    position: absolute;
    width: 280px;
    background-color: #FAF7F2;
    border-radius: 2px;
    box-shadow: 0 4px 20px rgba(58, 52, 64, 0.08);
    padding: 1.5rem;
    opacity: 0;
    transition: opacity 0.3s ease-out;
}

.archive-card.card-1 {
    left: 5%;
    top: 10%;
    clip-path: polygon(
        0 5px, 5px 0, calc(100% - 5px) 0, 100% 5px,
        100% calc(100% - 5px), calc(100% - 3px) 100%, 3px 100%,
        0 calc(100% - 3px)
    );
    background: linear-gradient(135deg, #FAF7F2 0%, rgba(212, 165, 165, 0.08) 100%);
}

.archive-card.card-2 {
    right: 8%;
    top: 5%;
    clip-path: polygon(
        2px 0, 100% 4px, 100% 100%, 5px 98%, 0 95px, 0 0
    );
    background: linear-gradient(135deg, #FAF7F2 0%, rgba(184, 169, 209, 0.08) 100%);
}

.archive-card.card-3 {
    left: 15%;
    bottom: 20%;
    clip-path: polygon(
        0 0, calc(100% - 3px) 0, 100% 3px, 100% 100%, 4px 98%, 0 95%
    );
    background: linear-gradient(135deg, #FAF7F2 0%, rgba(181, 199, 163, 0.08) 100%);
}

.archive-card.card-4 {
    right: 12%;
    bottom: 15%;
    clip-path: polygon(
        3px 0, 100% 2px, 100% calc(100% - 4px), 98% 100%, 0 100%, 0 5px
    );
    background: linear-gradient(135deg, #FAF7F2 0%, rgba(212, 165, 165, 0.08) 100%);
}

.archive-card.card-5 {
    left: 50%;
    top: 25%;
    transform: translateX(-50%);
    clip-path: polygon(
        0 3px, 2px 0, 100% 0, 100% 97%, 98% 100%, 0 100%
    );
    background: linear-gradient(135deg, #FAF7F2 0%, rgba(184, 169, 209, 0.08) 100%);
}

.archive-card.card-6 {
    left: 60%;
    bottom: 25%;
    clip-path: polygon(
        0 0, 100% 3px, 100% 100%, 3px 98%, 0 95%
    );
    background: linear-gradient(135deg, #FAF7F2 0%, rgba(181, 199, 163, 0.08) 100%);
}

.card-skeleton {
    position: absolute;
    inset: 0;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.4), transparent);
    background-size: 200% 100%;
    animation: skeleton-shimmer 1.5s infinite;
    border-radius: 2px;
}

@keyframes skeleton-shimmer {
    0% {
        background-position: -200% 0;
    }
    100% {
        background-position: 200% 0;
    }
}

.archive-card.loading .card-skeleton {
    display: block;
    background-color: rgba(200, 191, 212, 0.3);
}

.archive-card.loading .card-content {
    display: none;
}

.archive-card.loaded .card-skeleton {
    display: none;
}

.archive-card.loaded .card-content {
    display: block;
}

.card-content {
    position: relative;
    z-index: 2;
}

.card-date {
    margin-bottom: 0.5rem;
    display: block;
}

.card-text {
    font-size: 0.95rem;
    line-height: 1.6;
    color: #3A3440;
}

/* ============================================================
   CHAPTER IV: THE INSCRIPTION
   ============================================================ */

.chapter-4 {
    background-color: #2E2240;
    position: relative;
    overflow: hidden;
}

.inscription-container {
    position: relative;
    width: 100%;
    height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10;
}

.inscription-bg {
    position: absolute;
    width: 100%;
    height: 100%;
    top: 0;
    left: 0;
    z-index: 1;
}

.inscription-text {
    position: relative;
    z-index: 10;
    text-align: center;
    max-width: 80vw;
}

.inscription-quote {
    opacity: 0;
    transition: opacity 0.3s ease-out;
}

.inscription-quote.loaded {
    opacity: 1;
}

.inscription-quote p {
    font-family: 'Poiret One', sans-serif;
    font-size: clamp(2rem, 5vw, 4rem);
    color: #F5F0E6;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    line-height: 1.3;
    margin-bottom: 2rem;
}

.inscription-quote footer {
    font-family: 'Josefin Sans', sans-serif;
    font-size: clamp(0.9rem, 1.5vw, 1.1rem);
    font-weight: 300;
    color: #C8BFD4;
    letter-spacing: 0.05em;
}

/* ============================================================
   CHAPTER V: THE COLOPHON
   ============================================================ */

.chapter-5 {
    background-color: #FAF7F2;
    flex-direction: column;
    gap: 1.5rem;
    opacity: 1;
    transition: opacity 1s ease-out 2s;
}

.colophon-container {
    text-align: center;
    z-index: 10;
}

.colophon-title {
    margin-bottom: 1rem;
    color: #3A3440;
    opacity: 0.8;
}

.colophon-text {
    font-size: clamp(1rem, 1.5vw, 1.2rem);
    color: #3A3440;
    margin-bottom: 1rem;
}

.colophon-subtitle {
    font-family: 'Josefin Sans', sans-serif;
    font-weight: 300;
    font-size: clamp(0.85rem, 1.2vw, 1rem);
    color: #8A8492;
    letter-spacing: 0.05em;
}

/* Grid fade effect at bottom of chapter 5 */
.chapter-5::before {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    height: 100px;
    background: linear-gradient(to bottom, transparent, #FAF7F2);
    pointer-events: none;
    z-index: 20;
}

/* ============================================================
   SCROLL PROGRESS INDICATOR
   ============================================================ */

.scroll-progress {
    position: fixed;
    left: 0;
    top: 0;
    width: 2px;
    height: 100vh;
    background-color: rgba(184, 169, 209, 0.2);
    z-index: 100;
}

.progress-bar {
    position: absolute;
    left: 0;
    top: 0;
    width: 100%;
    height: 0%;
    background-color: #B8A9D1;
    transition: height 0.2s ease-out;
}

.progress-marker {
    position: absolute;
    left: 50%;
    top: 0%;
    width: 8px;
    height: 8px;
    background-color: #C9B97A;
    border-radius: 50%;
    transform: translate(-50%, -50%);
    transition: top 0.2s ease-out;
    box-shadow: 0 0 4px rgba(201, 185, 122, 0.4);
}

/* ============================================================
   SKELETON LOADING ELEMENT
   ============================================================ */

.skeleton-element {
    position: relative;
}

.skeleton-element.loading {
    min-height: 200px;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.4), transparent);
    background-size: 200% 100%;
    animation: skeleton-shimmer 1.5s infinite;
    border-radius: 2px;
}

.skeleton-element.loading p,
.skeleton-element.loading footer {
    visibility: hidden;
}

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

@media (max-width: 1024px) {
    .archive-container {
        height: 800px;
    }

    .archive-card {
        width: 240px;
    }
}

@media (max-width: 768px) {
    .archive-container {
        height: auto;
        display: flex;
        flex-direction: column;
        align-items: center;
        gap: 2rem;
        padding: 2rem 0;
    }

    .archive-card {
        position: static;
        width: 90%;
        max-width: 280px;
        opacity: 1 !important;
    }

    body::before {
        background-size: 30px 30px;
    }

    .scroll-progress {
        width: 1px;
    }

    .progress-marker {
        width: 6px;
        height: 6px;
    }
}

/* ============================================================
   COLOR PALETTE REFERENCE
   ============================================================ */

/* Ensure all colors from DESIGN.md are referenced */
.color-pale-sage { color: #B5C7A3; }
.color-golden-hour { color: #E8D5A3; }
.color-poiret-one { font-family: 'Poiret One', sans-serif; }
.color-josefin-sans { font-family: 'Josefin Sans', sans-serif; }
.color-lora { font-family: 'Lora', serif; }

/* ============================================================
   UTILITY CLASSES
   ============================================================ */

.text-center {
    text-align: center;
}

.opacity-fade {
    opacity: 0;
    transition: opacity 0.5s ease-out;
}

.opacity-fade.visible {
    opacity: 1;
}
