/* === historical.day - Fairycore Urban Historiography === */

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

:root {
    --enchanted-teal: #5b9a8b;
    --deep-moss: #2d5a4a;
    --blush-coral: #e8a87c;
    --mint-cream: #f0f7f4;
    --warm-parchment: #f8f5f0;
    --charcoal-moss: #3a4a44;
    --muted-sage: #7a9a8e;
    --periwinkle-mist: #a8b5d6;
    --sea-glass: #b8d4c8;
    --midnight-canopy: #1a2f28;
    --light-mint: #d4eee2;
    --soft-mint: #c8ddd5;
    --blush-warm: #fdf0e6;
}

html { scroll-behavior: smooth; }

body {
    font-family: "Nunito Sans", sans-serif;
    font-weight: 400;
    font-size: clamp(1rem, 1.1vw, 1.125rem);
    line-height: 1.72;
    color: var(--charcoal-moss);
    background: var(--warm-parchment);
    overflow-x: hidden;
}

/* === Site Layout === */
.site-wrapper {
    display: flex;
    min-height: 100vh;
}

/* === Sidebar === */
.enchanted-sidebar {
    width: 280px;
    min-width: 280px;
    position: sticky;
    top: 0;
    height: 100vh;
    overflow-y: auto;
    background: var(--mint-cream);
    border-right: 1px solid var(--soft-mint);
    z-index: 10;
    display: flex;
    flex-direction: column;
    padding: 40px 20px 20px;
    background-image: url("data:image/svg+xml,%3Csvg xmlns=%27http://www.w3.org/2000/svg%27 width=%2760%27 height=%2780%27%3E%3Cpath d=%27M30 0 C32 10,28 20,30 30 C32 40,28 50,30 60 C32 70,28 75,30 80%27 fill=%27none%27 stroke=%27%23d4eee2%27 stroke-width=%270.5%27 opacity=%270.08%27/%3E%3C/svg%3E");
}

.sidebar-title {
    text-align: center;
    margin-bottom: 40px;
}

.sidebar-title-text {
    font-family: "Cormorant Garamond", serif;
    font-weight: 300;
    font-size: 1.8rem;
    color: var(--deep-moss);
    letter-spacing: 0.02em;
}

/* === Vine Navigation === */
.vine-nav {
    position: relative;
    flex: 1;
}

.vine-svg {
    position: absolute;
    left: 10px;
    top: 0;
    width: 40px;
    height: 100%;
    max-height: 400px;
}

.vine-path {
    stroke-dasharray: 2000;
    stroke-dashoffset: 2000;
    animation: drawVine 3s ease-out forwards;
}

@keyframes drawVine {
    to { stroke-dashoffset: 0; }
}

.vine-leaf {
    opacity: 0;
    animation: fadeLeaf 0.5s ease-out forwards;
}
.vine-leaf[data-era="ancient"] { animation-delay: 3.2s; }
.vine-leaf[data-era="medieval"] { animation-delay: 3.4s; }
.vine-leaf[data-era="early-modern"] { animation-delay: 3.6s; }
.vine-leaf[data-era="industrial"] { animation-delay: 3.8s; }
.vine-leaf[data-era="contemporary"] { animation-delay: 4.0s; }

@keyframes fadeLeaf {
    from { opacity: 0; transform: scale(0.5); }
    to { opacity: 1; transform: scale(1); }
}

.vine-leaf.active path { fill: var(--enchanted-teal); }

/* === Nav Links === */
.nav-links {
    list-style: none;
    padding-left: 50px;
    display: flex;
    flex-direction: column;
    gap: 48px;
}

.nav-link {
    display: flex;
    align-items: center;
    gap: 10px;
    text-decoration: none;
    color: var(--charcoal-moss);
    font-family: "Nunito Sans", sans-serif;
    font-weight: 600;
    font-size: 0.9rem;
    transition: color 0.3s ease, transform 0.3s ease;
    position: relative;
}

.leaf-icon {
    width: 12px;
    height: 12px;
    color: var(--soft-mint);
    transition: color 0.3s ease, transform 0.3s ease;
}

.nav-link:hover .leaf-icon {
    transform: rotate(15deg);
    color: var(--enchanted-teal);
}

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

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

.nav-link.active .leaf-icon {
    color: var(--enchanted-teal);
    filter: drop-shadow(0 0 6px rgba(91, 154, 139, 0.3));
}

.nav-link.active::before {
    content: "";
    position: absolute;
    left: -15px;
    top: 50%;
    transform: translateY(-50%);
    width: 30px;
    height: 30px;
    border-radius: 50%;
    background: radial-gradient(circle at center, rgba(91, 154, 139, 0.08) 0%, transparent 70%);
    pointer-events: none;
}

/* === Sidebar Climbing Vine === */
.sidebar-climbing-vine {
    margin-top: auto;
    padding-top: 20px;
    opacity: 0.6;
}

.sidebar-climbing-vine svg { width: 60px; height: 200px; }

.climbing-vine-path {
    stroke-dasharray: 600;
    stroke-dashoffset: 600;
    animation: drawClimb 20s linear infinite;
}

@keyframes drawClimb {
    0% { stroke-dashoffset: 600; }
    50% { stroke-dashoffset: 0; }
    100% { stroke-dashoffset: -600; }
}

/* === Main Content === */
.chronicle-main {
    flex: 1;
    overflow-y: auto;
    position: relative;
}

/* === Fairy Lights === */
.fairy-lights {
    position: fixed;
    top: 0;
    left: 280px;
    right: 0;
    height: 4px;
    display: flex;
    justify-content: space-around;
    align-items: center;
    z-index: 5;
    pointer-events: none;
}

.fairy-dot {
    width: 3px;
    height: 3px;
    border-radius: 50%;
    background: var(--periwinkle-mist);
    opacity: 0.4;
    animation: twinkle 4s ease-in-out infinite alternate;
}

.fairy-dot:nth-child(2n) { animation-delay: 0.5s; }
.fairy-dot:nth-child(3n) { animation-delay: 1.2s; }
.fairy-dot:nth-child(5n) { animation-delay: 2.1s; }
.fairy-dot:nth-child(7n) { animation-delay: 0.8s; }

@keyframes twinkle {
    from { opacity: 0.25; }
    to { opacity: 0.5; }
}

/* === Hero Section === */
.hero-section {
    min-height: 80vh;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    text-align: center;
    padding: 80px 60px;
    position: relative;
    background: linear-gradient(160deg, #f0f7f4 0%, #f8f5f0 40%, #fdf0e6 100%);
    overflow: hidden;
}

.hero-content { position: relative; z-index: 2; max-width: 700px; }

.hero-title {
    font-family: "Playfair Display", serif;
    font-weight: 700;
    font-size: clamp(2rem, 5vw, 4.5rem);
    color: var(--deep-moss);
    letter-spacing: -0.02em;
    line-height: 1.15;
    margin-bottom: 24px;
}

.hero-subtitle {
    font-family: "Playfair Display", serif;
    font-weight: 400;
    font-style: italic;
    font-size: clamp(1rem, 2vw, 1.3rem);
    color: var(--muted-sage);
    line-height: 1.6;
}

.hero-skyline {
    position: absolute;
    bottom: 0;
    left: 0;
    width: 100%;
    height: 200px;
    z-index: 1;
}

/* === Drop Cap === */
.drop-cap {
    font-family: "Cormorant Garamond", serif;
    font-weight: 300;
    font-size: 4.5rem;
    float: left;
    margin-right: 12px;
    line-height: 0.85;
    color: var(--enchanted-teal);
    margin-top: 0.05em;
}

/* === Era Sections === */
.era-section {
    min-height: 100vh;
    padding: 100px 0 80px;
    position: relative;
}

.era-odd { background: var(--warm-parchment); }
.era-even { background: var(--mint-cream); }

.era-even {
    clip-path: polygon(0 3vh, 100% 0, 100% calc(100% - 3vh), 0 100%);
    margin-top: -3vh;
    padding-top: calc(3vh + 100px);
    padding-bottom: calc(3vh + 80px);
}

/* === Era Background Skyline === */
.era-bg-skyline {
    position: absolute;
    bottom: 0;
    left: 0;
    width: 100%;
    height: 300px;
    pointer-events: none;
    z-index: 0;
}

.era-bg-skyline svg { width: 100%; height: 100%; }

/* === Timeline Marker === */
.timeline-marker {
    position: absolute;
    left: 20px;
    top: 120px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    z-index: 2;
}

.timeline-marker svg {
    width: 24px;
    height: 24px;
}

.marker-label {
    font-family: "IBM Plex Mono", monospace;
    font-size: 0.7rem;
    color: var(--muted-sage);
    letter-spacing: 0.04em;
    text-transform: uppercase;
    writing-mode: vertical-lr;
    text-orientation: mixed;
}

/* === Era Header === */
.era-header {
    text-align: center;
    padding: 0 60px 60px;
    position: relative;
    z-index: 2;
}

.era-title {
    font-family: "Playfair Display", serif;
    font-weight: 700;
    font-size: clamp(2rem, 5vw, 4.5rem);
    color: var(--deep-moss);
    letter-spacing: -0.02em;
    line-height: 1.15;
    margin-bottom: 16px;
}

.era-subtitle {
    font-family: "Playfair Display", serif;
    font-weight: 400;
    font-style: italic;
    font-size: clamp(0.95rem, 1.5vw, 1.2rem);
    color: var(--muted-sage);
}

/* === City Blocks === */
.city-block {
    position: relative;
    border: 1px solid var(--soft-mint);
    border-radius: 6px;
    background: linear-gradient(135deg, #faf9f6 0%, #f0f7f4 100%);
    padding: 48px 40px;
    margin-bottom: 0;
    z-index: 2;
    opacity: 0;
    transform: translateY(30px);
    transition: opacity 0.7s cubic-bezier(0.16, 1, 0.3, 1), transform 0.7s cubic-bezier(0.16, 1, 0.3, 1);
}

.city-block.visible {
    opacity: 1;
    transform: translateY(0);
}

.stagger-left {
    margin-left: 60px;
    margin-right: 120px;
}

.stagger-right {
    margin-left: 120px;
    margin-right: 60px;
}

/* === Block Corners === */
.block-corner {
    position: absolute;
    width: 30px;
    height: 30px;
    pointer-events: none;
}

.block-corner svg { width: 100%; height: 100%; }
.block-corner-tl { top: 8px; left: 8px; }
.block-corner-br { bottom: 8px; right: 8px; }

/* === Block Content === */
.block-heading {
    font-family: "Playfair Display", serif;
    font-weight: 700;
    font-size: clamp(1.2rem, 2.5vw, 1.6rem);
    color: var(--deep-moss);
    margin-bottom: 16px;
    letter-spacing: -0.01em;
    transition: opacity 0.7s cubic-bezier(0.16, 1, 0.3, 1);
    transition-delay: 0ms;
}

.block-text {
    font-family: "Nunito Sans", sans-serif;
    font-weight: 400;
    font-size: clamp(1rem, 1.1vw, 1.125rem);
    line-height: 1.72;
    color: var(--charcoal-moss);
    margin-bottom: 20px;
    transition: opacity 0.7s cubic-bezier(0.16, 1, 0.3, 1);
    transition-delay: 100ms;
}

.block-meta {
    display: block;
    font-family: "IBM Plex Mono", monospace;
    font-weight: 400;
    font-size: 0.85rem;
    letter-spacing: 0.04em;
    color: var(--muted-sage);
    transition: opacity 0.7s cubic-bezier(0.16, 1, 0.3, 1);
    transition-delay: 200ms;
}

/* === Diamond Separator === */
.diamond-separator {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 12px;
    padding: 40px 0;
    z-index: 2;
    position: relative;
}

.diamond {
    display: block;
    width: 6px;
    height: 6px;
    background: var(--sea-glass);
    transform: rotate(45deg);
    opacity: 0;
}

.diamond-separator.visible .diamond {
    animation: fadeStagger 0.5s ease-out forwards;
}

.diamond-separator.visible .diamond:nth-child(1) { animation-delay: 0ms; }
.diamond-separator.visible .diamond:nth-child(2) { animation-delay: 100ms; }
.diamond-separator.visible .diamond:nth-child(3) { animation-delay: 200ms; }
.diamond-separator.visible .diamond:nth-child(4) { animation-delay: 300ms; }
.diamond-separator.visible .diamond:nth-child(5) { animation-delay: 400ms; }

@keyframes fadeStagger {
    from { opacity: 0; transform: rotate(45deg) scale(0.5); }
    to { opacity: 1; transform: rotate(45deg) scale(1); }
}

/* === Footer === */
.enchanted-footer {
    background: var(--midnight-canopy);
    padding: 60px 40px;
    text-align: center;
}

.footer-content { max-width: 600px; margin: 0 auto; }

.footer-text {
    font-family: "Cormorant Garamond", serif;
    font-weight: 300;
    font-size: 1.2rem;
    color: var(--soft-mint);
    margin-bottom: 20px;
}

.footer-vine svg { width: 200px; height: 20px; }

/* === Mobile Bottom Nav === */
.mobile-nav {
    display: none;
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    height: 60px;
    background: var(--mint-cream);
    border-top: 1px solid var(--soft-mint);
    z-index: 100;
    justify-content: space-around;
    align-items: center;
}

.mobile-nav-link {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    color: var(--soft-mint);
    transition: color 0.3s ease;
}

.mobile-nav-link.active { color: var(--enchanted-teal); }
.mobile-leaf { width: 20px; height: 20px; }

/* === Responsive: Tablet === */
@media (max-width: 1024px) {
    .enchanted-sidebar { width: 200px; min-width: 200px; padding: 30px 15px 15px; }
    .fairy-lights { left: 200px; }
    .stagger-left { margin-left: 40px; margin-right: 80px; }
    .stagger-right { margin-left: 80px; margin-right: 40px; }
    .nav-links { gap: 36px; padding-left: 40px; }
    .sidebar-title-text { font-size: 1.4rem; }
    .era-header { padding: 0 40px 40px; }
    .city-block { padding: 36px 28px; }
}

/* === Responsive: Mobile === */
@media (max-width: 768px) {
    .enchanted-sidebar { display: none; }
    .mobile-nav { display: flex; }
    .fairy-lights { left: 0; }
    .chronicle-main { padding-bottom: 60px; }
    .stagger-left { margin-left: 20px; margin-right: 40px; }
    .stagger-right { margin-left: 40px; margin-right: 20px; }
    .era-even {
        clip-path: polygon(0 1.5vh, 100% 0, 100% calc(100% - 1.5vh), 0 100%);
        margin-top: -1.5vh;
        padding-top: calc(1.5vh + 80px);
        padding-bottom: calc(1.5vh + 60px);
    }
    .era-header { padding: 0 20px 30px; }
    .city-block { padding: 28px 20px; }
    .hero-section { padding: 60px 30px; min-height: 60vh; }
    .timeline-marker { display: none; }
    .drop-cap { font-size: 3rem; }
    .era-section { padding: 80px 0 60px; }
}

/* === Scrollbar Styling === */
.enchanted-sidebar::-webkit-scrollbar { width: 4px; }
.enchanted-sidebar::-webkit-scrollbar-track { background: transparent; }
.enchanted-sidebar::-webkit-scrollbar-thumb { background: var(--soft-mint); border-radius: 2px; }

/* === Selection Color === */
::selection { background: var(--light-mint); color: var(--deep-moss); }
