/* ============================================================
   monopole.ai - Wabi-Sabi Physics Timeline Stylesheet
   ============================================================ */

/* CSS Custom Properties & Reset */
:root {
    --bg-raw-clay: #1E1A16;
    --bg-fired-earth: #2A2420;
    --timeline-aged-gold: #C4A882;
    --timeline-kiln-stone: #7A6A58;
    --text-parchment-light: #F0E8DA;
    --text-worn-ink: #8A7E72;
    --text-dusty-sage: #A0947E;
    --accent-terracotta: #C87A5A;
    --accent-celadon: #6A8A78;

    --font-display: 'Noto Serif JP', serif;
    --font-body: 'Crimson Pro', serif;
    --font-label: 'Zen Kaku Gothic New', sans-serif;

    --hero-size: clamp(3rem, 7vw, 6rem);
    --body-size: clamp(0.95rem, 1.15vw, 1.1rem);
    --label-size: clamp(0.75rem, 0.9vw, 0.85rem);

    scroll-behavior: smooth;
}

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

html {
    overflow-x: hidden;
}

body {
    background-color: var(--bg-raw-clay);
    color: var(--text-worn-ink);
    font-family: var(--font-body);
    font-size: var(--body-size);
    line-height: 1.8;
    position: relative;
    overflow-x: hidden;
}

/* Global Paper Texture Overlay */
#page-container {
    position: relative;
    background: linear-gradient(135deg, var(--bg-raw-clay) 0%, var(--bg-raw-clay) 100%);
}

#page-container::before {
    content: '';
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background:
        url('data:image/svg+xml,<svg xmlns="http://www.w3.org/2000/svg" width="400" height="400"><filter id="n"><feTurbulence type="fractalNoise" baseFrequency="0.6" numOctaves="3" result="noise" seed="1" /></filter><rect width="100%" height="100%" fill="rgba(58,50,40,0.04)" filter="url(%23n)" /></svg>');
    pointer-events: none;
    z-index: 1;
    mix-blend-mode: overlay;
    animation: texture-fade-in 400ms ease-out forwards;
}

@keyframes texture-fade-in {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}

/* Typography */
h1, h2, h3 {
    font-family: var(--font-display);
    font-weight: 700;
    color: var(--text-parchment-light);
    letter-spacing: 0.01em;
}

.hero-title {
    font-size: var(--hero-size);
    letter-spacing: 0.01em;
    color: var(--text-parchment-light);
    margin-bottom: 1.5rem;
    font-weight: 700;
}

.epoch-title {
    font-size: clamp(1.5rem, 2vw, 2rem);
    margin-bottom: 0.5rem;
    color: var(--text-parchment-light);
}

.epoch-label {
    font-family: var(--font-label);
    font-size: var(--label-size);
    color: var(--text-dusty-sage);
    letter-spacing: 0.03em;
    margin-bottom: 1rem;
    font-weight: 500;
    text-transform: uppercase;
}

.epoch-text {
    color: var(--text-worn-ink);
    line-height: 1.8;
    margin-top: 1rem;
}

.epoch-question {
    font-size: clamp(1rem, 1.3vw, 1.25rem);
    color: var(--text-dusty-sage);
    font-family: var(--font-body);
    font-weight: 400;
    line-height: 1.6;
    max-width: 60vw;
    margin-left: 60%;
}

/* Timeline Line & Markers */
.timeline-line {
    position: fixed;
    top: 0;
    left: 15%;
    width: 2px;
    height: 100vh;
    pointer-events: none;
    z-index: 10;
}

.timeline-marker {
    position: absolute;
    left: 12.4%;
    width: 40px;
    height: 40px;
    pointer-events: none;
}

/* Ensō Circle Styles (Timeline Markers) */
.ensō-circle {
    fill: none;
    stroke: var(--timeline-aged-gold);
    stroke-width: 2;
    stroke-linecap: round;
    stroke-linejoin: round;
    transform-origin: 20px 20px;
}

.ensō-filled {
    fill: var(--timeline-kiln-stone);
    stroke: var(--timeline-aged-gold);
}

.ensō-unfilled {
    fill: none;
    stroke: var(--timeline-aged-gold);
}

.ensō-open {
    fill: none;
    stroke: var(--timeline-aged-gold);
}

/* Epoch Sections */
.epoch {
    position: relative;
    min-height: 100vh;
    display: flex;
    align-items: center;
    padding: 4rem 5%;
    overflow: hidden;
}

#epoch-0 {
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: flex-start;
    min-height: 100vh;
    padding: 0 5%;
    padding-left: 60%;
    animation: epoch-0-enter 2500ms ease-out;
}

@keyframes epoch-0-enter {
    0% {
        opacity: 0;
    }
    15% {
        opacity: 1;
    }
    100% {
        opacity: 1;
    }
}

.epoch-0 .hero-title {
    animation: hero-text-seep 1400ms ease-out 600ms forwards;
    opacity: 0;
}

.epoch-0 .hero-question {
    animation: hero-text-seep 600ms ease-out 2200ms forwards;
    opacity: 0;
}

@keyframes hero-text-seep {
    from {
        opacity: 0;
        filter: blur(4px);
    }
    to {
        opacity: 1;
        filter: blur(0);
    }
}

/* Card Styles */
.epoch-card {
    background-color: var(--bg-fired-earth);
    border-left: 3px solid var(--timeline-aged-gold);
    padding: 2.5rem;
    margin-left: 4%;
    max-width: 55vw;
    position: relative;
    z-index: 5;
    opacity: 0;
    transform: translateX(-20px);
    animation: card-fade-reveal 500ms ease-out forwards;
}

.epoch-1 .epoch-card {
    animation-delay: 0s;
}

.epoch-2 .epoch-card {
    animation-delay: 0s;
    max-width: 60vw;
}

.epoch-3 .epoch-card {
    animation-delay: 0s;
    max-width: 45vw;
}

.epoch-4 .epoch-card {
    animation-delay: 0s;
    max-width: 55vw;
}

.epoch-5 .epoch-card {
    animation-delay: 0s;
    max-width: 50vw;
}

#epoch-present .epoch-card {
    animation-delay: 0s;
    max-width: 55vw;
}

@keyframes card-fade-reveal {
    from {
        opacity: 0;
        transform: translateX(-20px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

/* Card Texture Variations */
.card-1 {
    filter: url(#card-texture-1);
}

.card-2 {
    filter: url(#card-texture-2);
}

.card-3 {
    filter: url(#card-texture-3);
}

.card-4 {
    filter: url(#card-texture-4);
}

.card-5 {
    filter: url(#card-texture-5);
}

.card-present {
    filter: url(#card-texture-1);
}

/* Card Hover States */
.epoch-card:hover {
    border-left-width: 5px;
    border-left-color: var(--accent-terracotta);
    transition: all 200ms ease-out;
}

/* Field Diagrams */
.epoch-diagram {
    margin: 1.5rem 0;
    padding: 1.5rem 0;
    background: linear-gradient(to bottom, rgba(255,255,255,0.02), rgba(255,255,255,0.01));
    border-radius: 2px;
}

.field-diagram {
    stroke-linecap: round;
    stroke-linejoin: round;
}

.field-line {
    fill: none;
    stroke: var(--timeline-aged-gold);
    stroke-width: 1.5;
    stroke-dasharray: 12, 2, 4, 2;
    opacity: 0.8;
    animation: field-draw 800ms ease-out forwards;
}

.field-line:nth-of-type(1) {
    animation-delay: 100ms;
}

.field-line:nth-of-type(2) {
    animation-delay: 200ms;
}

.field-line:nth-of-type(3) {
    animation-delay: 300ms;
}

.field-line:nth-of-type(4) {
    animation-delay: 400ms;
}

.field-line:nth-of-type(5) {
    animation-delay: 500ms;
}

.field-line:nth-of-type(6) {
    animation-delay: 600ms;
}

.field-line:nth-of-type(7) {
    animation-delay: 700ms;
}

.field-line:nth-of-type(8) {
    animation-delay: 800ms;
}

.field-line:nth-of-type(9) {
    animation-delay: 900ms;
}

.field-line:nth-of-type(10) {
    animation-delay: 1000ms;
}

@keyframes field-draw {
    from {
        stroke-dashoffset: 100;
        opacity: 0;
    }
    to {
        stroke-dashoffset: 0;
        opacity: 0.8;
    }
}

.monopole-point {
    filter: drop-shadow(0 0 3px var(--timeline-aged-gold));
}

/* Timeline Marker Animation */
.timeline-marker circle {
    stroke-dasharray: 113;
    stroke-dashoffset: 113;
    animation: ensō-draw 500ms ease-out forwards;
}

.epoch-1 .timeline-marker circle {
    animation-delay: -200ms;
}

.epoch-2 .timeline-marker circle {
    animation-delay: -200ms;
}

.epoch-3 .timeline-marker circle {
    animation-delay: -200ms;
}

.epoch-4 .timeline-marker circle {
    animation-delay: -200ms;
}

.epoch-5 .timeline-marker circle {
    animation-delay: -200ms;
}

#epoch-present .timeline-marker circle {
    animation-delay: -200ms;
}

@keyframes ensō-draw {
    from {
        stroke-dashoffset: 113;
    }
    to {
        stroke-dashoffset: 0;
    }
}

/* Hover Effect for Ensō - Gap Closing */
.timeline-marker:hover .ensō-circle {
    stroke-width: 3;
    transition: stroke-width 200ms ease-out;
}

/* Epoch Positioning */
#epoch-0 {
    min-height: 100vh;
}

#epoch-1 {
    min-height: 120vh;
    margin-top: 0;
}

#epoch-2 {
    min-height: 150vh;
    margin-top: 2rem;
}

#epoch-3 {
    min-height: 150vh;
    margin-top: 2rem;
}

#epoch-4 {
    min-height: 150vh;
    margin-top: 2rem;
}

#epoch-5 {
    min-height: 150vh;
    margin-top: 2rem;
}

#epoch-present {
    min-height: 100vh;
    margin-top: 2rem;
    display: flex;
    align-items: center;
}

/* Coda Section */
.coda {
    background: linear-gradient(180deg, var(--bg-fired-earth) 0%, var(--bg-raw-clay) 100%);
    border-top: 1px solid var(--timeline-aged-gold);
    padding: 4rem 5%;
    margin-left: 15%;
    min-height: 60vh;
    display: flex;
    align-items: center;
    justify-content: center;
}

.coda-content {
    text-align: center;
    max-width: 50vw;
}

.coda-content h3 {
    font-size: clamp(1.25rem, 1.8vw, 1.75rem);
    margin-bottom: 2rem;
    color: var(--text-parchment-light);
}

.coda-links {
    list-style: none;
    display: flex;
    flex-direction: column;
    gap: 1rem;
    margin-bottom: 2rem;
}

.coda-link {
    color: var(--text-worn-ink);
    text-decoration: none;
    font-family: var(--font-label);
    font-size: var(--label-size);
    letter-spacing: 0.03em;
    position: relative;
    display: inline-block;
    transition: color 200ms ease-out;
}

.coda-link::after {
    content: '';
    position: absolute;
    bottom: -2px;
    left: 0;
    width: 0;
    height: 1px;
    background-color: var(--accent-terracotta);
    animation: link-underline-draw 200ms ease-out forwards;
}

.coda-link:hover {
    color: var(--accent-terracotta);
}

.coda-link:hover::after {
    animation: link-underline-hover 200ms ease-out forwards;
}

@keyframes link-underline-draw {
    from {
        width: 0;
    }
    to {
        width: 0;
    }
}

@keyframes link-underline-hover {
    from {
        width: 0;
    }
    to {
        width: 100%;
    }
}

.coda-footer {
    font-family: var(--font-label);
    font-size: 0.85rem;
    color: var(--text-dusty-sage);
    letter-spacing: 0.02em;
    margin-top: 2rem;
}

/* Text Character Seep Effect (Ink-Seep) */
.seep-char {
    display: inline-block;
    animation: char-seep 150ms ease-out forwards;
}

@keyframes char-seep {
    from {
        opacity: 0.3;
        filter: blur(4px);
    }
    to {
        opacity: 1;
        filter: blur(0);
    }
}

/* Responsive Adjustments */
@media (max-width: 1024px) {
    .timeline-line {
        left: 2%;
    }

    .timeline-marker {
        left: 0.4%;
    }

    .epoch {
        padding: 3rem 2%;
    }

    #epoch-0 {
        padding: 0 2%;
        padding-left: 50%;
    }

    .epoch-card {
        max-width: 70vw !important;
        padding: 2rem;
        margin-left: 2%;
    }

    .epoch-question {
        max-width: 80vw;
    }
}

@media (max-width: 768px) {
    .timeline-line {
        left: 1%;
    }

    .timeline-marker {
        left: -1.5%;
    }

    #epoch-0 {
        padding-left: 15%;
    }

    .epoch-card {
        max-width: 85vw !important;
        padding: 1.5rem;
    }

    .coda {
        margin-left: 1%;
    }
}

/* Scroll-triggered animations - these will be handled by JavaScript */
.scroll-in {
    opacity: 0;
    transform: translateY(20px);
}

.scroll-in.visible {
    opacity: 1;
    transform: translateY(0);
    transition: all 500ms ease-out;
}

/* Prevent layout shift */
html {
    scroll-behavior: smooth;
    scrollbar-gutter: stable;
}

/* Print Styles */
@media print {
    .timeline-line,
    .timeline-marker {
        display: none;
    }

    body {
        background-color: white;
        color: black;
    }
}
