/* ============================================
   historic.day - Styles
   Glitch archaeology magazine-spread layout
   ============================================ */

/* --- Palette Reference ---
   #E4E8EC  Paper gray
   #D0D4D8  Deeper gray
   #2A2E32  Dark text
   #8A8E94  Mid gray
   #7090B0  Watercolor blue
   #C0A080  Watercolor amber
   #E04040  Glitch red
   #4060A0  Pulse accent
   #B0B4B8  Fold line / dividers
   ----------------------------- */

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

html {
    scroll-behavior: smooth;
    overflow-x: hidden;
}

body {
    font-family: 'Crimson Pro', Georgia, serif;
    background-color: #E4E8EC;
    color: #2A2E32;
    overflow-x: hidden;
    -webkit-font-smoothing: antialiased;
}

/* --- Typography --- */
.section-label {
    display: block;
    font-family: 'DM Sans', sans-serif;
    font-weight: 500;
    font-size: 13px;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    color: #8A8E94;
    margin-bottom: 12px;
}

.label-text {
    font-family: 'DM Sans', sans-serif;
    font-weight: 500;
    font-size: 13px;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    color: #8A8E94;
}

/* --- Glitch Overlay (initial burst) --- */
.glitch-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 9999;
}

.glitch-overlay .glitch-burst-line {
    position: absolute;
    left: 0;
    width: 100%;
    height: 2px;
    background-color: #E04040;
    transform: translateX(0);
    opacity: 0;
}

/* --- Glitch Lines (per section) --- */
.glitch-lines {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 10;
    overflow: hidden;
}

.glitch-line {
    position: absolute;
    left: 0;
    width: 100%;
    height: 2px;
    background-color: #8A8E94;
    opacity: 0;
    transform: translateX(0);
}

/* --- Logotype --- */
.logotype {
    position: absolute;
    top: 28px;
    left: 36px;
    z-index: 20;
}

.logotype-text {
    font-family: 'DM Sans', sans-serif;
    font-weight: 500;
    font-size: 15px;
    letter-spacing: 0.04em;
    color: #2A2E32;
    position: relative;
}

.logotype-glow {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 100%;
    height: 100%;
    border-radius: 50%;
    box-shadow: 0 0 20px 8px rgba(64, 96, 160, 0.15);
    animation: logotypePulse 4s ease-in-out infinite;
}

@keyframes logotypePulse {
    0%, 100% { opacity: 0.4; transform: translate(-50%, -50%) scale(1); }
    50% { opacity: 0.8; transform: translate(-50%, -50%) scale(1.3); }
}

/* --- Floating Documentary Fragments --- */
.floating-fragments {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 5;
    overflow: hidden;
}

.fragment {
    position: absolute;
    opacity: 0.25;
    background-color: #8A8E94;
}

.frag-rect {
    width: 14px;
    height: 10px;
}

.frag-tri {
    width: 0;
    height: 0;
    background: none;
    border-left: 7px solid transparent;
    border-right: 7px solid transparent;
    border-bottom: 12px solid #8A8E94;
    opacity: 0.2;
}

.frag-sm {
    transform: scale(0.6);
}

.frag-md {
    transform: scale(1.4);
}

/* Fragment positions and animations */
.floating-fragments .fragment:nth-child(1) {
    top: 15%;
    left: 8%;
    animation: fragmentDrift1 28s linear infinite;
}
.floating-fragments .fragment:nth-child(2) {
    top: 40%;
    left: 75%;
    animation: fragmentDrift2 35s linear infinite;
}
.floating-fragments .fragment:nth-child(3) {
    top: 70%;
    left: 20%;
    animation: fragmentDrift3 32s linear infinite;
}
.floating-fragments .fragment:nth-child(4) {
    top: 25%;
    left: 90%;
    animation: fragmentDrift4 26s linear infinite;
}
.floating-fragments .fragment:nth-child(5) {
    top: 60%;
    left: 50%;
    animation: fragmentDrift1 30s linear infinite reverse;
}
.floating-fragments .fragment:nth-child(6) {
    top: 85%;
    left: 65%;
    animation: fragmentDrift2 24s linear infinite reverse;
}

@keyframes fragmentDrift1 {
    0% { transform: translate(0, 0) rotate(0deg); }
    25% { transform: translate(30px, -20px) rotate(45deg); }
    50% { transform: translate(-15px, -40px) rotate(90deg); }
    75% { transform: translate(20px, -10px) rotate(135deg); }
    100% { transform: translate(0, 0) rotate(180deg); }
}

@keyframes fragmentDrift2 {
    0% { transform: translate(0, 0) rotate(0deg); }
    25% { transform: translate(-25px, 15px) rotate(-30deg); }
    50% { transform: translate(10px, 30px) rotate(-60deg); }
    75% { transform: translate(-20px, 5px) rotate(-90deg); }
    100% { transform: translate(0, 0) rotate(-120deg); }
}

@keyframes fragmentDrift3 {
    0% { transform: translate(0, 0) rotate(10deg); }
    33% { transform: translate(20px, -25px) rotate(70deg); }
    66% { transform: translate(-10px, 15px) rotate(130deg); }
    100% { transform: translate(0, 0) rotate(190deg); }
}

@keyframes fragmentDrift4 {
    0% { transform: translate(0, 0) rotate(-15deg); }
    50% { transform: translate(-30px, 20px) rotate(60deg); }
    100% { transform: translate(0, 0) rotate(135deg); }
}

/* --- Hero Section (Opening Viewport) --- */
.hero {
    position: relative;
    width: 100%;
    height: 100vh;
    min-height: 600px;
    background-color: #E4E8EC;
    display: flex;
    overflow: hidden;
}

.hero-left {
    width: 60%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    z-index: 2;
}

.date-display {
    position: relative;
    text-align: center;
    opacity: 0;
    transition: opacity 0.8s ease;
}

.date-display.revealed {
    opacity: 1;
}

.date-month {
    font-family: 'Crimson Pro', serif;
    font-weight: 600;
    font-size: clamp(24px, 3vw, 42px);
    color: #8A8E94;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    margin-bottom: -10px;
}

.date-numeral {
    font-family: 'Crimson Pro', serif;
    font-weight: 700;
    font-size: clamp(48px, 10vw, 140px);
    color: #2A2E32;
    line-height: 1;
    position: relative;
}

.date-year {
    font-family: 'Crimson Pro', serif;
    font-weight: 600;
    font-size: clamp(20px, 2.5vw, 36px);
    color: #4060A0;
    letter-spacing: 0.08em;
    margin-top: -5px;
}

/* Pulse-attention ring on date */
.pulse-ring {
    position: absolute;
    top: 50%;
    left: 50%;
    width: 120%;
    height: 120%;
    border: 2px solid #4060A0;
    border-radius: 50%;
    transform: translate(-50%, -50%) scale(1);
    opacity: 0.5;
    animation: pulseAttention 3s ease-out infinite;
    pointer-events: none;
}

.pulse-ring-2 {
    animation-delay: 1.5s;
}

@keyframes pulseAttention {
    0% {
        transform: translate(-50%, -50%) scale(1);
        opacity: 0.5;
    }
    100% {
        transform: translate(-50%, -50%) scale(1.5);
        opacity: 0;
    }
}

/* Hero right panel */
.hero-right {
    width: 40%;
    height: 100%;
    position: relative;
    z-index: 2;
    display: flex;
    flex-direction: column;
    justify-content: center;
    padding: 60px 40px;
}

.hero-event-hint {
    position: relative;
    z-index: 3;
}

.event-title {
    font-family: 'Crimson Pro', serif;
    font-weight: 600;
    font-size: clamp(28px, 3vw, 48px);
    color: #2A2E32;
    margin-bottom: 16px;
    line-height: 1.15;
}

.event-subtitle {
    font-family: 'Crimson Pro', serif;
    font-weight: 400;
    font-size: clamp(15px, 1.1vw, 17px);
    color: #8A8E94;
    line-height: 1.85;
    max-width: 400px;
}

/* --- Watercolor Wash --- */
.watercolor-wash {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 1;
    overflow: hidden;
}

.watercolor-layer {
    position: absolute;
    border-radius: 50%;
    filter: blur(60px);
    opacity: 0;
    transition: opacity 1.2s ease-in;
}

.watercolor-wash.active .watercolor-layer {
    opacity: 1;
}

.wc-layer-1 {
    width: 140%;
    height: 80%;
    top: -20%;
    right: -40%;
    background: radial-gradient(ellipse at center, rgba(112, 144, 176, 0.2) 0%, transparent 70%);
}

.wc-layer-2 {
    width: 100%;
    height: 100%;
    bottom: -10%;
    right: -20%;
    background: radial-gradient(ellipse at 30% 70%, rgba(192, 160, 128, 0.15) 0%, transparent 60%);
}

.wc-layer-3 {
    width: 80%;
    height: 60%;
    top: 20%;
    right: 10%;
    background: radial-gradient(ellipse at center, rgba(112, 144, 176, 0.12) 0%, transparent 50%);
}

/* Spread watercolor layers */
.wc-layer-4 {
    width: 120%;
    height: 100%;
    top: -10%;
    left: -10%;
    background: radial-gradient(ellipse at 40% 30%, rgba(192, 160, 128, 0.2) 0%, transparent 65%);
}

.wc-layer-5 {
    width: 100%;
    height: 120%;
    top: -10%;
    left: 20%;
    background: radial-gradient(ellipse at 60% 60%, rgba(112, 144, 176, 0.18) 0%, transparent 55%);
}

.wc-layer-6 {
    width: 80%;
    height: 80%;
    bottom: 0;
    right: 0;
    background: radial-gradient(ellipse at center, rgba(192, 160, 128, 0.12) 0%, transparent 50%);
}

/* Watercolor glitch effect on hover */
.watercolor-wash.glitch-active .watercolor-layer {
    transition: transform 0.2s ease;
}

.watercolor-wash.glitch-active .wc-layer-1 {
    transform: translate(8px, -5px);
}

.watercolor-wash.glitch-active .wc-layer-2 {
    transform: translate(-6px, 4px);
}

.watercolor-wash.glitch-active .wc-layer-3 {
    transform: translate(5px, 7px);
}

/* --- Magazine Spread Section --- */
.magazine-spread {
    position: relative;
    width: 100%;
    min-height: 100vh;
    display: flex;
    background-color: #E4E8EC;
    overflow: hidden;
}

.spread-left {
    width: 50%;
    padding: 80px 60px 80px 60px;
    display: flex;
    align-items: center;
    position: relative;
    z-index: 2;
}

.spread-content {
    max-width: 520px;
    margin-left: auto;
    margin-right: 40px;
}

.spread-title {
    font-family: 'Crimson Pro', serif;
    font-weight: 600;
    font-size: clamp(28px, 3vw, 44px);
    color: #2A2E32;
    margin-bottom: 28px;
    line-height: 1.15;
}

.narrative-text p {
    font-family: 'Crimson Pro', serif;
    font-weight: 400;
    font-size: clamp(15px, 1.1vw, 17px);
    line-height: 1.85;
    color: #2A2E32;
    margin-bottom: 20px;
}

.narrative-text .quote-text {
    font-style: italic;
    color: #4060A0;
    border-left: 3px solid #C0A080;
    padding-left: 20px;
    margin: 28px 0;
}

/* Watercolor underline on hover for narrative text */
.narrative-text p {
    position: relative;
    background-image: linear-gradient(to right, rgba(112, 144, 176, 0.3), rgba(192, 160, 128, 0.3));
    background-size: 0% 3px;
    background-position: 0 100%;
    background-repeat: no-repeat;
    transition: background-size 0.4s ease;
    padding-bottom: 2px;
}

.narrative-text p:hover {
    background-size: 100% 3px;
}

/* Fold line */
.fold-line {
    position: absolute;
    top: 0;
    left: 50%;
    transform: translateX(-50%);
    width: 1px;
    height: 100%;
    background-color: #B0B4B8;
    z-index: 15;
}

.fold-line::before,
.fold-line::after {
    content: '';
    position: absolute;
    top: 0;
    height: 100%;
    width: 3px;
}

.fold-line::before {
    right: 1px;
    background: linear-gradient(to left, rgba(42, 46, 50, 0.04), transparent);
}

.fold-line::after {
    left: 1px;
    background: linear-gradient(to right, rgba(42, 46, 50, 0.04), transparent);
}

/* Spread right panel */
.spread-right {
    width: 50%;
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    z-index: 2;
}

.spread-right-content {
    position: relative;
    z-index: 3;
    text-align: center;
}

.artifact-label {
    font-family: 'DM Sans', sans-serif;
    font-weight: 500;
    font-size: 13px;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    color: #8A8E94;
    margin-bottom: 20px;
}

.artifact-frame {
    width: 300px;
    height: 400px;
    position: relative;
}

.artifact-svg {
    width: 100%;
    height: 100%;
}

/* --- Timeline Section --- */
.timeline-section {
    position: relative;
    padding: 80px 36px 80px;
    background-color: #D0D4D8;
    overflow: hidden;
}

.timeline-heading {
    font-family: 'Crimson Pro', serif;
    font-weight: 600;
    font-size: clamp(24px, 2.5vw, 36px);
    color: #2A2E32;
    margin-bottom: 40px;
}

.timeline-strip {
    display: flex;
    gap: 24px;
    overflow-x: auto;
    padding-bottom: 20px;
    scroll-snap-type: x mandatory;
    -webkit-overflow-scrolling: touch;
}

.timeline-strip::-webkit-scrollbar {
    height: 4px;
}

.timeline-strip::-webkit-scrollbar-track {
    background: #B0B4B8;
    border-radius: 2px;
}

.timeline-strip::-webkit-scrollbar-thumb {
    background: #8A8E94;
    border-radius: 2px;
}

.timeline-card {
    flex: 0 0 260px;
    min-height: 240px;
    background-color: #E4E8EC;
    padding: 28px 24px;
    position: relative;
    overflow: hidden;
    scroll-snap-align: start;
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.timeline-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 8px 24px rgba(42, 46, 50, 0.08);
}

.timeline-card.active {
    border-left: 3px solid #E04040;
}

.card-watercolor {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 0;
}

.card-wc-1 {
    background: radial-gradient(ellipse at 80% 20%, rgba(112, 144, 176, 0.12) 0%, transparent 60%);
}

.card-wc-2 {
    background: radial-gradient(ellipse at 20% 80%, rgba(192, 160, 128, 0.12) 0%, transparent 60%);
}

.card-glitch-corner {
    position: absolute;
    top: 0;
    right: 0;
    width: 40px;
    height: 40px;
    overflow: hidden;
    z-index: 1;
    opacity: 0;
    transition: opacity 0.15s;
}

.timeline-card:hover .card-glitch-corner {
    opacity: 1;
}

.card-glitch-corner::before {
    content: '';
    position: absolute;
    top: 4px;
    right: -2px;
    width: 30px;
    height: 2px;
    background: #E04040;
    transform: translateX(3px);
}

.card-glitch-corner::after {
    content: '';
    position: absolute;
    top: 10px;
    right: 0;
    width: 20px;
    height: 1px;
    background: #8A8E94;
    transform: translateX(-2px);
}

.card-year {
    display: block;
    font-family: 'DM Sans', sans-serif;
    font-weight: 500;
    font-size: 13px;
    letter-spacing: 0.04em;
    color: #4060A0;
    margin-bottom: 10px;
    position: relative;
    z-index: 2;
}

.card-title {
    font-family: 'Crimson Pro', serif;
    font-weight: 600;
    font-size: 20px;
    color: #2A2E32;
    margin-bottom: 10px;
    line-height: 1.3;
    position: relative;
    z-index: 2;
}

.card-desc {
    font-family: 'Crimson Pro', serif;
    font-weight: 400;
    font-size: 15px;
    line-height: 1.7;
    color: #8A8E94;
    position: relative;
    z-index: 2;
}

/* --- Sources Section --- */
.sources-section {
    position: relative;
    padding: 80px 60px;
    background-color: #E4E8EC;
    overflow: hidden;
}

.sources-content {
    max-width: 700px;
    margin: 0 auto;
    position: relative;
    z-index: 2;
}

.sources-heading {
    font-family: 'Crimson Pro', serif;
    font-weight: 600;
    font-size: clamp(24px, 2.5vw, 36px);
    color: #2A2E32;
    margin-bottom: 36px;
}

.citations {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.citation {
    display: flex;
    gap: 12px;
    padding-left: 0;
}

.citation-num {
    font-family: 'DM Sans', sans-serif;
    font-weight: 500;
    font-size: 13px;
    color: #4060A0;
    flex-shrink: 0;
    margin-top: 3px;
}

.citation p {
    font-family: 'Crimson Pro', serif;
    font-weight: 400;
    font-size: 15px;
    line-height: 1.75;
    color: #2A2E32;
    text-indent: -0px;
    padding-left: 0px;
}

.citation em {
    font-style: italic;
}

/* --- Footer --- */
.footer {
    position: relative;
    background-color: #D0D4D8;
    padding: 40px 36px;
    overflow: hidden;
}

.footer-content {
    display: flex;
    align-items: center;
    justify-content: space-between;
    max-width: 900px;
    margin: 0 auto;
    position: relative;
    z-index: 2;
}

.footer-nav {
    display: flex;
    align-items: center;
    gap: 8px;
    text-decoration: none;
    color: #2A2E32;
    font-family: 'DM Sans', sans-serif;
    font-weight: 500;
    font-size: 13px;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    transition: color 0.3s ease;
}

.footer-nav:hover {
    color: #4060A0;
}

.nav-arrow {
    font-size: 18px;
    transition: transform 0.3s ease;
}

.footer-nav-prev:hover .nav-arrow {
    transform: translateX(-4px);
}

.footer-nav-next:hover .nav-arrow {
    transform: translateX(4px);
}

.footer-logotype .logotype-text {
    font-family: 'DM Sans', sans-serif;
    font-weight: 500;
    font-size: 15px;
    letter-spacing: 0.04em;
    color: #8A8E94;
}

/* --- Scroll Glitch Transition Effect --- */
.section-glitch-active {
    position: relative;
}

.section-glitch-active::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(228, 232, 236, 0.03);
    pointer-events: none;
    z-index: 100;
    animation: sectionGlitchFlash 0.15s ease-out;
}

@keyframes sectionGlitchFlash {
    0% { background-color: rgba(208, 196, 180, 0.06); }
    100% { background-color: transparent; }
}

/* Red channel ghost for scroll glitch */
.red-ghost {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 9998;
    mix-blend-mode: multiply;
    opacity: 0;
}

.red-ghost.active {
    animation: redGhostFlash 0.15s ease-out;
}

@keyframes redGhostFlash {
    0% {
        opacity: 0.15;
        transform: translateX(3px);
        background-color: rgba(224, 64, 64, 0.1);
    }
    100% {
        opacity: 0;
        transform: translateX(0);
        background-color: transparent;
    }
}

/* --- Static Noise for Date Reveal --- */
.date-display.static-noise .date-numeral {
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='100' height='100'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)' opacity='0.3'/%3E%3C/svg%3E");
    background-size: cover;
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
    animation: staticToSolid 0.8s ease forwards;
}

@keyframes staticToSolid {
    0% {
        -webkit-background-clip: text;
        background-clip: text;
        color: transparent;
    }
    70% {
        -webkit-background-clip: text;
        background-clip: text;
        color: transparent;
    }
    100% {
        -webkit-background-clip: unset;
        background-clip: unset;
        color: #2A2E32;
        background-image: none;
    }
}

/* --- Responsive --- */
@media (max-width: 900px) {
    .hero {
        flex-direction: column;
        height: auto;
        min-height: 100vh;
    }

    .hero-left {
        width: 100%;
        height: 50vh;
        min-height: 300px;
    }

    .hero-right {
        width: 100%;
        height: auto;
        padding: 40px 24px 60px;
    }

    .magazine-spread {
        flex-direction: column;
    }

    .spread-left {
        width: 100%;
        padding: 60px 24px;
    }

    .spread-right {
        width: 100%;
        min-height: 400px;
    }

    .fold-line {
        display: none;
    }

    .spread-content {
        margin-left: 0;
        margin-right: 0;
        max-width: 100%;
    }

    .sources-section {
        padding: 60px 24px;
    }

    .logotype {
        top: 20px;
        left: 24px;
    }
}

@media (max-width: 600px) {
    .timeline-card {
        flex: 0 0 220px;
        min-height: 200px;
        padding: 20px 18px;
    }

    .hero-left {
        min-height: 250px;
    }

    .footer-content {
        flex-direction: column;
        gap: 20px;
    }
}
