/* ============================================
   monopole.wiki — Styles
   Swiss-Memphis Bento-Box Wiki
   ============================================ */

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

html {
    scroll-behavior: smooth;
    font-size: 16px;
}

body {
    font-family: 'DM Sans', sans-serif;
    background-color: #1A1A2E;
    color: #2A2A38;
    overflow-x: hidden;
}

/* --- Typography --- */
h1, h2, h3 {
    font-family: 'Playfair Display', serif;
}

h2.module-title {
    font-weight: 700;
    font-size: clamp(1.6rem, 3.5vw, 2.8rem);
    color: #1A1A2E;
    margin-bottom: 0.75rem;
    line-height: 1.2;
}

h3.module-label {
    font-family: 'DM Sans', sans-serif;
    font-weight: 500;
    font-size: 0.85rem;
    color: #1A1A2E;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    margin-bottom: 1rem;
}

p {
    font-family: 'Playfair Display', serif;
    font-weight: 400;
    font-size: clamp(0.95rem, 1.2vw, 1.05rem);
    line-height: 1.75;
    color: #2A2A38;
    margin-bottom: 0.75rem;
}

.mono {
    font-family: 'JetBrains Mono', monospace;
    font-weight: 400;
    font-size: 0.8rem;
    color: #5A5A68;
    letter-spacing: 0.04em;
}

.equation {
    text-align: center;
    font-size: 1rem;
    padding: 0.5rem 0;
    color: #1A1A2E;
}

/* --- Header (Row 0) --- */
.header {
    position: sticky;
    top: 0;
    z-index: 10;
    height: 120px;
    background: linear-gradient(90deg, #F0C8D0, #C8D8F0, #C0E8D0, #F0E0C0);
    backdrop-filter: blur(2px);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 16px;
}

.header-title {
    font-family: 'DM Sans', sans-serif;
    font-weight: 700;
    font-size: clamp(1.4rem, 3vw, 2.2rem);
    color: #1A1A2E;
    letter-spacing: 0.06em;
}

.header-squiggle {
    flex-shrink: 0;
}

.squiggle-path {
    stroke-dasharray: 100;
    stroke-dashoffset: 100;
    animation: drawSquiggle 600ms 600ms ease-out forwards;
}

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

/* --- Bento Grid Base --- */
.bento-grid {
    display: grid;
    gap: 6px;
    padding: 6px;
}

/* --- Row 1: Introduction Grid --- */
.row-intro {
    grid-template-columns: repeat(2, 1fr);
    grid-template-rows: 1fr 1fr;
    min-height: calc(100vh - 120px);
}

.module-a {
    grid-column: 1 / -1;
    background: #F8F4F0;
    padding: clamp(1.5rem, 4vw, 3rem);
    display: flex;
    flex-direction: column;
    justify-content: center;
}

.module-b {
    background: #F8F4F0;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1rem;
    overflow: hidden;
}

.monopole-illustration {
    max-width: 100%;
    max-height: 100%;
}

.module-c {
    background: #C8D8F0;
    padding: clamp(1rem, 2vw, 1.5rem);
    position: relative;
    overflow: hidden;
}

.module-c::after {
    content: '';
    position: absolute;
    inset: 0;
    background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='200' height='200'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.6' numOctaves='3'/%3E%3C/filter%3E%3Crect width='200' height='200' filter='url(%23n)'/%3E%3C/svg%3E");
    opacity: 0.03;
    pointer-events: none;
}

.facts-list {
    display: grid;
    grid-template-columns: auto 1fr;
    gap: 0.4rem 0.75rem;
}

.facts-list dt {
    font-family: 'DM Sans', sans-serif;
    font-weight: 500;
    font-size: 0.85rem;
    color: #1A1A2E;
    text-transform: uppercase;
    letter-spacing: 0.08em;
}

.facts-list dd {
    font-family: 'DM Sans', sans-serif;
    font-weight: 400;
    font-size: 0.85rem;
    color: #2A2A38;
}

.facts-list dd.mono {
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.8rem;
    color: #5A5A68;
}

/* --- Row 2: History Grid --- */
.row-history {
    grid-template-columns: repeat(4, 1fr);
    grid-auto-rows: minmax(200px, auto);
}

.module-d {
    grid-column: span 2;
    background: #F8F4F0;
    padding: clamp(1.5rem, 3vw, 2.5rem);
}

.module-e {
    grid-column: span 1;
    background: #E06080;
    padding: 0;
    overflow: hidden;
}

.module-f {
    grid-column: span 1;
    background: #F8F4F0;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0.5rem;
    overflow: hidden;
}

.dirac-portrait {
    max-width: 100%;
    max-height: 100%;
}

.module-g {
    grid-column: span 1;
    background: #C0E8D0;
    padding: clamp(1rem, 2vw, 1.5rem);
}

.module-g p {
    font-size: clamp(0.85rem, 1.1vw, 0.95rem);
}

.module-h {
    grid-column: span 2;
    background: #F8F4F0;
    padding: clamp(1.5rem, 3vw, 2.5rem);
    position: relative;
    overflow: hidden;
}

.module-h::after {
    content: '';
    position: absolute;
    inset: 0;
    background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='200' height='200'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.6' numOctaves='3'/%3E%3C/filter%3E%3Crect width='200' height='200' filter='url(%23n)'/%3E%3C/svg%3E");
    opacity: 0.03;
    pointer-events: none;
}

.module-i {
    grid-column: span 1;
    background: #F8F4F0;
    padding: clamp(1rem, 2vw, 1.5rem);
}

/* --- Memphis Decorative Module --- */
.memphis-decorative {
    min-height: 200px;
}

.memphis-zigzag {
    display: block;
    width: 100%;
    height: 100%;
}

/* --- Progressive Disclosure (Expandable Modules) --- */
.expandable .module-preview {
    color: #5A5A68;
    margin-bottom: 0.5rem;
}

.read-more-toggle {
    font-family: 'DM Sans', sans-serif;
    font-weight: 400;
    font-size: 0.8rem;
    color: #6A6A7A;
    background: none;
    border: none;
    cursor: pointer;
    padding: 0.25rem 0;
    transition: color 200ms ease;
}

.read-more-toggle:hover {
    color: #E06080;
}

.expandable-content {
    max-height: 0;
    overflow: hidden;
    transition: max-height 300ms ease;
}

.expandable.expanded .expandable-content {
    max-height: 2000px;
}

.expandable.expanded .read-more-toggle {
    display: none;
}

.expandable-content p {
    opacity: 0;
    transform: translateY(6px);
    transition: opacity 200ms ease, transform 200ms ease;
}

.expandable.expanded .expandable-content p {
    opacity: 1;
    transform: translateY(0);
}

/* --- Row 3: Mountain Landscape --- */
.landscape-row {
    position: relative;
    height: 100vh;
    min-height: 500px;
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
}

.landscape-svg {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
}

.monopole-float {
    animation: floatMonopole 3s ease-in-out infinite;
}

@keyframes floatMonopole {
    0%, 100% { transform: translateY(-4px); }
    50% { transform: translateY(4px); }
}

.monopole-glow-small {
    animation: floatMonopole 3s ease-in-out infinite;
}

.landscape-quote {
    position: relative;
    z-index: 2;
    font-family: 'Playfair Display', serif;
    font-weight: 400;
    font-style: italic;
    font-size: clamp(1.2rem, 2.5vw, 2rem);
    color: #1A1A2E;
    text-align: center;
    max-width: 600px;
    padding: 0 2rem;
    line-height: 1.5;
    margin-bottom: 0;
}

/* Floating particles */
.floating-particles {
    position: absolute;
    inset: 0;
    pointer-events: none;
    z-index: 1;
}

.particle {
    position: absolute;
    bottom: 30%;
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: linear-gradient(135deg, #F0C8D0, #C8D8F0, #C0E8D0, #F0E0C0);
    opacity: 0.6;
    animation: floatUp 8s linear infinite;
}

@keyframes floatUp {
    0% {
        transform: translateY(0) scale(1);
        opacity: 0.6;
    }
    80% {
        opacity: 0.3;
    }
    100% {
        transform: translateY(-200px) scale(0.3);
        opacity: 0;
    }
}

/* --- Row 4: Footer --- */
.footer {
    position: relative;
    height: 100px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #1A1A2E;
    overflow: hidden;
}

.footer-pattern {
    position: absolute;
    inset: 0;
    background-image:
        radial-gradient(circle 3px at 10% 30%, #E06080 100%, transparent 100%),
        radial-gradient(circle 3px at 25% 70%, #F0E0C0 100%, transparent 100%),
        radial-gradient(circle 3px at 40% 20%, #C0E8D0 100%, transparent 100%),
        radial-gradient(circle 3px at 55% 60%, #C8D8F0 100%, transparent 100%),
        radial-gradient(circle 3px at 70% 40%, #E06080 100%, transparent 100%),
        radial-gradient(circle 3px at 85% 75%, #F0E0C0 100%, transparent 100%),
        radial-gradient(circle 3px at 15% 80%, #C8D8F0 100%, transparent 100%),
        radial-gradient(circle 3px at 60% 15%, #C0E8D0 100%, transparent 100%),
        radial-gradient(circle 3px at 90% 50%, #F0C8D0 100%, transparent 100%),
        radial-gradient(circle 3px at 35% 45%, #E06080 100%, transparent 100%);
    opacity: 0.15;
}

.footer-text {
    position: relative;
    z-index: 1;
    font-family: 'DM Sans', sans-serif;
    font-weight: 400;
    font-size: 0.85rem;
    color: #A0A0B0;
    margin-bottom: 0;
}

/* --- Fade-in Animations (IntersectionObserver) --- */
.fade-module {
    opacity: 0;
    transform: translateY(8px);
    transition: opacity 400ms ease, transform 400ms ease;
}

.fade-module.visible {
    opacity: 1;
    transform: translateY(0);
}

/* --- Entry animation for Row 1 modules --- */
.row-intro .fade-module.visible {
    animation: none;
}

/* --- Responsive: 3 columns below 900px --- */
@media (max-width: 900px) {
    .row-history {
        grid-template-columns: repeat(3, 1fr);
    }

    .module-d,
    .module-h {
        grid-column: span 2;
    }
}

/* --- Responsive: 2 columns below 600px --- */
@media (max-width: 600px) {
    .row-intro {
        grid-template-columns: 1fr;
        grid-template-rows: auto;
        min-height: auto;
    }

    .module-a {
        grid-column: 1;
    }

    .row-history {
        grid-template-columns: repeat(2, 1fr);
    }

    .module-d,
    .module-h {
        grid-column: span 2;
    }

    .module-e,
    .module-f,
    .module-g,
    .module-i {
        grid-column: span 1;
    }

    .header {
        height: 80px;
    }
}

/* --- Responsive: single column below 480px --- */
@media (max-width: 480px) {
    .bento-grid {
        gap: 4px;
        padding: 4px;
    }

    .row-intro {
        grid-template-columns: 1fr;
    }

    .row-history {
        grid-template-columns: 1fr;
    }

    .module-d,
    .module-e,
    .module-f,
    .module-g,
    .module-h,
    .module-i {
        grid-column: span 1;
    }

    /* Hide Memphis decorative module on small screens */
    .module-e {
        display: none;
    }

    /* Expand all content by default on small screens */
    .expandable .expandable-content {
        max-height: none;
        overflow: visible;
    }

    .expandable .expandable-content p {
        opacity: 1;
        transform: none;
    }

    .read-more-toggle {
        display: none;
    }

    .header {
        height: 70px;
    }

    .landscape-row {
        height: 60vh;
        min-height: 350px;
    }
}

/* --- Design Palette Reference (used in SVG inline and CSS) --- */
/* Mountain Far: #D4D8E0 | Mountain Mid: #B8C0D0 | Mountain Near: #8A9AB0 | Grain: #808088 */
.landscape-row {
    background-color: #D4D8E0;
}

.landscape-svg path:nth-of-type(2) {
    color: #B8C0D0;
}

.landscape-svg path:nth-of-type(3) {
    color: #8A9AB0;
}

.grain-overlay::before {
    color: #808088;
}

/* --- Grain overlay utility --- */
.grain-overlay {
    position: relative;
}

/* Hide the filter SVG */
.grain-svg {
    position: absolute;
    width: 0;
    height: 0;
}
