/* monopole.quest - Kiln & Compass */
/* Colors: #D4A574 Terracotta Sand, #F2E6D6 Warm Parchment, #EDE0D0 Cream Linen,
   #2C1810 Deep Espresso, #4A2C17 Warm Umber, #8B6F5C Dusty Clay,
   #C4956A Kiln Orange, #B85C38 Lodestone Red, #5B8C7A Compass Teal,
   #FFF8F0 Milk Foam, #F5EBE0 alt light, #7A3A20 dark red */

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

html {
    scroll-behavior: smooth;
}

body {
    font-family: 'Nunito', sans-serif;
    font-weight: 400;
    background-color: #D4A574;
    color: #4A2C17;
    line-height: 1.72;
    letter-spacing: 0.005em;
    font-size: clamp(1rem, 1.8vw, 1.15rem);
    overflow-x: hidden;
    position: relative;
}

body::before {
    content: '';
    position: fixed;
    inset: 0;
    background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 256 256' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)' opacity='0.04'/%3E%3C/svg%3E");
    pointer-events: none;
    z-index: 0;
}

.grid-container {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 1.5rem;
    max-width: 1100px;
    margin: 0 auto;
    padding: 2rem 1.5rem;
    position: relative;
    z-index: 1;
}

/* ======= Block Base Styles ======= */
.block {
    border-radius: 1.2rem;
    padding: 2rem 2.2rem;
    position: relative;
    will-change: transform, box-shadow;
    transition: transform 0.3s cubic-bezier(0.34, 1.56, 0.64, 1), box-shadow 0.3s ease;
    box-shadow:
        0 2px 4px rgba(74, 44, 23, 0.08),
        0 8px 16px rgba(74, 44, 23, 0.12),
        0 24px 48px rgba(74, 44, 23, 0.16),
        inset 0 1px 0 rgba(255, 255, 255, 0.15);
}

.block:hover {
    transform: translateY(-2px);
    box-shadow:
        0 4px 8px rgba(74, 44, 23, 0.1),
        0 12px 24px rgba(74, 44, 23, 0.14),
        0 32px 64px rgba(74, 44, 23, 0.18),
        inset 0 1px 0 rgba(255, 255, 255, 0.2);
}

/* ======= Background Variants ======= */
.bg-parchment { background-color: #F2E6D6; }
.bg-cream { background-color: #EDE0D0; }
.bg-milk { background-color: #FFF8F0; }
.bg-espresso {
    background-color: #2C1810;
    color: #D4A574;
}

/* ======= Hero Block ======= */
.block-hero {
    grid-column: 1 / -1;
    min-height: 80vh;
    background-color: #F2E6D6;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
}

.hero-content {
    text-align: center;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 2rem;
}

.hero-title {
    font-family: 'Cormorant Garamond', serif;
    font-weight: 600;
    font-size: clamp(2.4rem, 5vw, 4.5rem);
    letter-spacing: 0.01em;
    line-height: 1.08;
    color: #2C1810;
}

.hero-tagline {
    font-family: 'Nunito', sans-serif;
    font-weight: 400;
    font-size: clamp(1rem, 2vw, 1.25rem);
    color: #4A2C17;
    max-width: 560px;
    line-height: 1.6;
}

/* ======= Monopole Sphere ======= */
.monopole-sphere-container {
    position: relative;
    width: 400px;
    height: 400px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.monopole-sphere {
    width: 200px;
    height: 200px;
    border-radius: 50%;
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    z-index: 2;
    background:
        radial-gradient(circle at 35% 30%, rgba(255,255,255,0.4) 0%, transparent 50%),
        radial-gradient(circle at 50% 50%, #B85C38 0%, #7A3A20 70%, #2C1810 100%);
    box-shadow:
        0 4px 8px rgba(74, 44, 23, 0.15),
        0 12px 32px rgba(74, 44, 23, 0.2),
        0 24px 64px rgba(74, 44, 23, 0.25),
        inset 0 -4px 12px rgba(0, 0, 0, 0.15);
}

.sphere-core {
    width: 100%;
    height: 100%;
    border-radius: 50%;
    background: radial-gradient(circle at 30% 25%, rgba(255,255,255,0.25) 0%, transparent 40%);
}

.field-lines {
    position: absolute;
    top: 0;
    left: 0;
    z-index: 1;
}

.field-line {
    fill: none;
    stroke: #5B8C7A;
    stroke-width: 1.5;
    stroke-linecap: round;
}

/* ======= Section Titles ======= */
.section-title {
    font-family: 'Cormorant Garamond', serif;
    font-weight: 600;
    font-size: clamp(2rem, 4vw, 3.2rem);
    letter-spacing: 0.01em;
    line-height: 1.08;
    color: #2C1810;
    margin-bottom: 1rem;
}

.section-title-light {
    color: #F2E6D6;
}

/* ======= Body Text ======= */
.body-text {
    font-family: 'Nunito', sans-serif;
    font-weight: 400;
    font-size: clamp(1rem, 1.8vw, 1.15rem);
    line-height: 1.72;
    letter-spacing: 0.005em;
    color: #4A2C17;
}

.body-text-light {
    color: #D4A574;
}

.body-text + .body-text {
    margin-top: 1.2rem;
}

/* ======= Caption / Mono ======= */
.caption {
    font-family: 'IBM Plex Mono', monospace;
    font-weight: 300;
    font-size: 0.8rem;
    color: #8B6F5C;
}

/* ======= Narrative Blocks ======= */
.block-narrative {
    grid-column: span 1;
}

/* ======= Diagram Blocks ======= */
.block-diagram {
    grid-column: 1 / -1;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1.5rem;
    padding: 2.5rem 2rem;
}

.diagram-label {
    color: #8B6F5C;
    text-align: center;
    margin-bottom: 0.5rem;
}

.diagram-comparison {
    display: flex;
    gap: 3rem;
    justify-content: center;
    flex-wrap: wrap;
}

.diagram-panel {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.5rem;
}

.diagram-svg {
    max-width: 100%;
    height: auto;
}

.diagram-line {
    stroke-linecap: round;
}

.timeline-diagram {
    display: flex;
    justify-content: center;
    overflow-x: auto;
}

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

/* ======= Quote Blocks ======= */
.block-quote {
    grid-column: span 1;
    position: relative;
    padding-top: 3rem;
}

.quote-mark {
    font-family: 'Cormorant Garamond', serif;
    font-size: 5rem;
    line-height: 1;
    color: #C4956A;
    position: absolute;
    top: 0.5rem;
    left: 1.5rem;
}

.quote-text {
    font-family: 'Cormorant Garamond', serif;
    font-weight: 600;
    font-size: clamp(1.2rem, 2.5vw, 1.6rem);
    font-style: italic;
    line-height: 1.4;
    color: #2C1810;
    margin-bottom: 0.8rem;
}

.quote-attribution {
    display: block;
    margin-top: 0.5rem;
}

/* ======= Cultural Blocks ======= */
.block-cultural {
    grid-column: span 1;
    position: relative;
    overflow: hidden;
    background-image: repeating-linear-gradient(
        to bottom,
        transparent,
        transparent 1.6rem,
        rgba(196, 149, 106, 0.13) 1.6rem,
        rgba(196, 149, 106, 0.13) calc(1.6rem + 1px)
    );
}

.cultural-watermark {
    position: absolute;
    bottom: -10px;
    left: -10px;
    opacity: 0.06;
    transform: rotate(15deg);
    pointer-events: none;
}

.cultural-title {
    font-family: 'Cormorant Garamond', serif;
    font-weight: 600;
    font-size: clamp(1.4rem, 3vw, 2rem);
    color: #2C1810;
    margin-bottom: 0.8rem;
    letter-spacing: 0.01em;
    line-height: 1.15;
}

.lodestone-fragments {
    position: absolute;
    top: 0.8rem;
    right: 0.8rem;
    display: flex;
    gap: 4px;
}

/* ======= Compass Divider ======= */
.compass-divider {
    grid-column: 1 / -1;
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 1rem 0;
}

.compass-rose {
    opacity: 0.7;
}

/* ======= Finale Block ======= */
.block-finale {
    grid-column: 1 / -1;
    min-height: 60vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background-color: #2C1810;
}

.finale-content {
    max-width: 680px;
    text-align: center;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1.2rem;
}

.finale-compass {
    margin-top: 2rem;
}

.compass-rose-finale {
    animation: slow-rotate 60s linear infinite;
}

@keyframes slow-rotate {
    from { transform: rotate(0deg); }
    to { transform: rotate(360deg); }
}

/* ======= Scroll Progress Indicator ======= */
.scroll-indicator {
    position: fixed;
    bottom: 1.5rem;
    right: 1.5rem;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: #F2E6D6;
    cursor: pointer;
    z-index: 100;
    overflow: hidden;
    box-shadow:
        0 2px 4px rgba(74, 44, 23, 0.08),
        0 8px 16px rgba(74, 44, 23, 0.12),
        0 16px 32px rgba(74, 44, 23, 0.16),
        inset 0 1px 0 rgba(255, 255, 255, 0.15);
    transition: transform 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.scroll-indicator:hover {
    transform: scale(1.1);
}

.scroll-fill {
    position: absolute;
    bottom: 0;
    left: 0;
    width: 100%;
    height: 0%;
    background: #B85C38;
    border-radius: 50%;
    transition: height 0.1s linear;
}

/* ======= Typewriter Effect ======= */
.typewriter .char {
    opacity: 0;
    transform: translateY(3px);
    display: inline-block;
    transition: opacity 0.15s ease, transform 0.15s ease;
}

.typewriter .char.visible {
    opacity: 1;
    transform: translateY(0);
}

.typewriter .char-space {
    display: inline;
}

.typewriter.revealed .char {
    opacity: 1;
    transform: translateY(0);
}

/* Typewriter cursor for captions */
.caption .tw-cursor {
    display: inline-block;
    width: 1px;
    height: 1em;
    background: #C4956A;
    margin-left: 2px;
    animation: cursor-blink 0.6s step-end infinite;
    vertical-align: text-bottom;
}

.caption .tw-cursor.done {
    animation: cursor-blink 0.6s step-end 2;
    animation-fill-mode: forwards;
}

@keyframes cursor-blink {
    0%, 100% { opacity: 1; }
    50% { opacity: 0; }
}

/* ======= Responsive ======= */
@media (max-width: 640px) {
    .grid-container {
        grid-template-columns: 1fr;
        padding: 1rem;
        gap: 1rem;
    }

    .block {
        padding: 1.5rem;
    }

    .block-hero {
        min-height: 70vh;
    }

    .monopole-sphere-container {
        width: 280px;
        height: 280px;
    }

    .monopole-sphere {
        width: 140px;
        height: 140px;
    }

    .field-lines {
        width: 280px;
        height: 280px;
    }

    .diagram-comparison {
        gap: 1.5rem;
    }

    .block-finale {
        min-height: 50vh;
    }
}
