/* ===========================================
   economic.day - Worn Seminar / Wabi-Sabi
   Hexagonal-Honeycomb Layout
   Burgundy-Cream Palette
   =========================================== */

/* --- CSS Custom Properties --- */
:root {
    /* Palette */
    --warm-cream: #F5EDE0;
    --aged-linen: #E8DBC8;
    --parchment: #F0E6D6;
    --deep-burgundy: #5B1A2A;
    --espresso: #3D2B1F;
    --faded-umber: #7A6B5D;
    --oxblood: #4A1525;
    --muted-rose: #8B4557;
    --candle-glow: #D4A857;
    --aged-umber: #8B7355;

    /* Typography */
    --font-display: 'EB Garamond', serif;
    --font-body: 'Lora', serif;

    /* Spacing */
    --hex-gap: 6px;

    /* Wabi-sabi offset */
    --wabi-offset: 0px;
}

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

html {
    scroll-behavior: smooth;
}

body {
    background-color: var(--warm-cream);
    color: var(--espresso);
    font-family: var(--font-body);
    font-size: clamp(0.9375rem, 1.6vw, 1.0625rem);
    line-height: 1.85;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    overflow-x: hidden;
}

/* --- SVG Filters (hidden) --- */
.svg-filters {
    position: absolute;
    width: 0;
    height: 0;
    overflow: hidden;
}

/* --- Navigation --- */
#main-nav {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 100;
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1.25rem 2rem;
    transition: background 400ms ease, padding 300ms ease;
}

#main-nav.scrolled {
    background: rgba(245, 237, 224, 0.85);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    padding: 0.75rem 2rem;
}

.nav-wordmark {
    font-family: var(--font-display);
    font-weight: 500;
    font-size: 0.875rem;
    color: var(--warm-cream);
    text-decoration: none;
    letter-spacing: 0.04em;
    text-shadow: 0 1px 3px rgba(0,0,0,0.15);
    transition: color 400ms ease;
}

#main-nav.scrolled .nav-wordmark {
    color: var(--deep-burgundy);
    text-shadow: none;
}

.nav-links {
    display: flex;
    gap: 1.5rem;
}

.nav-links a {
    font-family: var(--font-body);
    font-weight: 400;
    font-size: 0.8125rem;
    letter-spacing: 0.04em;
    color: var(--warm-cream);
    text-decoration: none;
    text-shadow: 0 1px 3px rgba(0,0,0,0.15);
    transition: color 400ms ease;
}

#main-nav.scrolled .nav-links a {
    color: var(--faded-umber);
    text-shadow: none;
}

.nav-links a:hover {
    color: var(--muted-rose);
}

/* --- Section 1: The Foyer --- */
.section-foyer {
    position: relative;
    width: 100%;
    height: 100vh;
    background-color: var(--deep-burgundy);
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
}

/* Bokeh Layers */
.bokeh-layer {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    opacity: 0;
    pointer-events: none;
}

.bokeh-layer-1 {
    background:
        radial-gradient(circle at 15% 20%, rgba(212,168,87,0.06) 0%, transparent 70%),
        radial-gradient(circle at 75% 15%, rgba(245,237,224,0.04) 0%, transparent 60%),
        radial-gradient(circle at 45% 80%, rgba(212,168,87,0.05) 0%, transparent 65%),
        radial-gradient(circle at 85% 65%, rgba(245,237,224,0.03) 0%, transparent 55%),
        radial-gradient(circle at 25% 55%, rgba(212,168,87,0.04) 0%, transparent 50%);
    background-size: 120px 120px, 90px 90px, 100px 100px, 80px 80px, 70px 70px;
    background-position: 10% 20%, 70% 10%, 40% 75%, 85% 60%, 20% 50%;
    background-repeat: no-repeat;
    animation: bokeh-fade-in 600ms ease forwards, bokeh-drift-1 42s linear infinite;
    animation-delay: 0ms, 1600ms;
}

.bokeh-layer-2 {
    background:
        radial-gradient(circle at 60% 30%, rgba(245,237,224,0.05) 0%, transparent 65%),
        radial-gradient(circle at 20% 70%, rgba(212,168,87,0.07) 0%, transparent 70%),
        radial-gradient(circle at 90% 45%, rgba(245,237,224,0.04) 0%, transparent 55%),
        radial-gradient(circle at 35% 10%, rgba(212,168,87,0.06) 0%, transparent 60%),
        radial-gradient(circle at 70% 85%, rgba(245,237,224,0.03) 0%, transparent 50%);
    background-size: 100px 100px, 110px 110px, 75px 75px, 95px 95px, 85px 85px;
    background-position: 55% 25%, 15% 65%, 88% 40%, 30% 8%, 65% 80%;
    background-repeat: no-repeat;
    animation: bokeh-fade-in 600ms ease forwards, bokeh-drift-2 58s linear infinite;
    animation-delay: 150ms, 1600ms;
}

.bokeh-layer-3 {
    background:
        radial-gradient(circle at 40% 50%, rgba(212,168,87,0.08) 0%, transparent 70%),
        radial-gradient(circle at 80% 25%, rgba(245,237,224,0.05) 0%, transparent 60%),
        radial-gradient(circle at 10% 40%, rgba(212,168,87,0.04) 0%, transparent 55%),
        radial-gradient(circle at 55% 90%, rgba(245,237,224,0.06) 0%, transparent 65%),
        radial-gradient(circle at 95% 80%, rgba(212,168,87,0.03) 0%, transparent 50%);
    background-size: 130px 130px, 85px 85px, 60px 60px, 105px 105px, 70px 70px;
    background-position: 35% 45%, 78% 20%, 8% 35%, 50% 88%, 92% 75%;
    background-repeat: no-repeat;
    animation: bokeh-fade-in 600ms ease forwards, bokeh-drift-3 35s linear infinite;
    animation-delay: 300ms, 1600ms;
}

.bokeh-layer-4 {
    background:
        radial-gradient(circle at 50% 60%, rgba(245,237,224,0.04) 0%, transparent 60%),
        radial-gradient(circle at 30% 35%, rgba(212,168,87,0.05) 0%, transparent 65%),
        radial-gradient(circle at 70% 50%, rgba(245,237,224,0.06) 0%, transparent 70%),
        radial-gradient(circle at 15% 85%, rgba(212,168,87,0.03) 0%, transparent 50%),
        radial-gradient(circle at 85% 10%, rgba(245,237,224,0.04) 0%, transparent 55%);
    background-size: 95px 95px, 115px 115px, 80px 80px, 65px 65px, 90px 90px;
    background-position: 45% 55%, 25% 30%, 68% 48%, 12% 82%, 83% 8%;
    background-repeat: no-repeat;
    animation: bokeh-fade-in 600ms ease forwards, bokeh-drift-4 48s linear infinite;
    animation-delay: 450ms, 1600ms;
}

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

@keyframes bokeh-drift-1 {
    0% { transform: translate(0, 0); }
    25% { transform: translate(12px, -8px); }
    50% { transform: translate(-6px, 10px); }
    75% { transform: translate(8px, 5px); }
    100% { transform: translate(0, 0); }
}

@keyframes bokeh-drift-2 {
    0% { transform: translate(0, 0); }
    25% { transform: translate(-10px, 6px); }
    50% { transform: translate(8px, -12px); }
    75% { transform: translate(-5px, -4px); }
    100% { transform: translate(0, 0); }
}

@keyframes bokeh-drift-3 {
    0% { transform: translate(0, 0); }
    25% { transform: translate(7px, 11px); }
    50% { transform: translate(-14px, -3px); }
    75% { transform: translate(4px, -9px); }
    100% { transform: translate(0, 0); }
}

@keyframes bokeh-drift-4 {
    0% { transform: translate(0, 0); }
    25% { transform: translate(-8px, -10px); }
    50% { transform: translate(11px, 7px); }
    75% { transform: translate(-3px, 12px); }
    100% { transform: translate(0, 0); }
}

/* Foyer Content */
.foyer-content {
    position: relative;
    z-index: 2;
    text-align: center;
}

.foyer-title {
    font-family: var(--font-display);
    font-weight: 500;
    font-size: clamp(2.4rem, 5.5vw, 4.2rem);
    color: var(--warm-cream);
    letter-spacing: 0.12em;
    opacity: 0;
    transform: translateY(16px);
    animation: foyer-title-in 700ms cubic-bezier(0.34, 1.56, 0.64, 1) forwards;
    animation-delay: 800ms;
}

.foyer-epigraph {
    font-family: var(--font-display);
    font-style: italic;
    font-weight: 400;
    font-size: clamp(1.1rem, 2.5vw, 1.8rem);
    color: var(--warm-cream);
    letter-spacing: 0.02em;
    margin-top: 1rem;
    opacity: 0;
    animation: foyer-epigraph-in 900ms ease forwards;
    animation-delay: 1300ms;
}

@keyframes foyer-title-in {
    from {
        opacity: 0;
        transform: translateY(16px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes foyer-epigraph-in {
    from { opacity: 0; }
    to { opacity: 0.85; }
}

/* Skip animations for returning visitors */
body.skip-entry .bokeh-layer {
    opacity: 1;
    animation: none;
}

body.skip-entry .bokeh-layer-1 { animation: bokeh-drift-1 42s linear infinite; opacity: 1; }
body.skip-entry .bokeh-layer-2 { animation: bokeh-drift-2 58s linear infinite; opacity: 1; }
body.skip-entry .bokeh-layer-3 { animation: bokeh-drift-3 35s linear infinite; opacity: 1; }
body.skip-entry .bokeh-layer-4 { animation: bokeh-drift-4 48s linear infinite; opacity: 1; }

body.skip-entry .foyer-title {
    opacity: 1;
    transform: translateY(0);
    animation: none;
}

body.skip-entry .foyer-epigraph {
    opacity: 0.85;
    animation: none;
}

/* --- Section Borders --- */
.section-border {
    width: calc(100% - 4rem);
    height: 2px;
    background-color: var(--deep-burgundy);
    margin: 0 auto;
    opacity: 0.3;
}

/* --- Section 2: Primary Honeycomb --- */
.section-honeycomb-primary {
    background-color: var(--warm-cream);
    padding: 4rem 2rem 5rem;
    position: relative;
}

.section-heading {
    font-family: var(--font-display);
    font-weight: 600;
    font-size: clamp(1.6rem, 3vw, 2.6rem);
    color: var(--deep-burgundy);
    letter-spacing: 0.02em;
    text-align: center;
    margin: 2.5rem 0 3rem;
    margin-left: calc(2px + var(--wabi-offset, 1px));
}

/* Honeycomb Grid */
.honeycomb-grid {
    max-width: 1100px;
    margin: 0 auto;
}

.hex-row {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: var(--hex-gap);
    margin-bottom: calc(var(--hex-gap) - 30px);
}

.hex-row-offset {
    transform: translateX(calc(50% / 3));
    width: calc(100% - (100% / 3));
}

/* Hexagonal Cards */
.hex-card {
    position: relative;
    clip-path: polygon(50% 0.3%, 99.5% 25.2%, 100% 74.8%, 50.2% 100%, 0% 75.1%, 0.3% 24.8%);
    background: var(--parchment);
    aspect-ratio: 1 / 1.1;
    opacity: 0;
    transform: scale(0.92);
    transition: opacity 450ms cubic-bezier(0.34, 1.56, 0.64, 1),
                transform 450ms cubic-bezier(0.34, 1.56, 0.64, 1);
    filter: url(#paper-texture) brightness(1) hue-rotate(calc(var(--card-index) * 1.7deg));
}

.hex-card.visible {
    opacity: 1;
    transform: scale(1);
}

.hex-card::before {
    content: '';
    position: absolute;
    inset: 0;
    background: radial-gradient(ellipse at center, transparent 40%, rgba(139,115,85,0.06) 100%);
    pointer-events: none;
    z-index: 1;
}

.hex-card:hover {
    box-shadow: 0 0 0 1px rgba(212,168,87,0.5);
    filter: url(#paper-texture) brightness(1.04) hue-rotate(calc(var(--card-index) * 1.7deg));
}

.hex-card:hover .hex-title {
    color: var(--deep-burgundy);
}

.hex-card-inner {
    position: relative;
    z-index: 2;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    height: 100%;
    padding: 22% 12% 22%;
}

.hex-title {
    font-family: var(--font-display);
    font-weight: 600;
    font-size: clamp(1rem, 1.8vw, 1.25rem);
    color: var(--espresso);
    letter-spacing: 0.005em;
    margin-bottom: 0.6rem;
    transition: color 250ms cubic-bezier(0.34, 1.56, 0.64, 1);
}

.hex-body {
    font-family: var(--font-body);
    font-weight: 400;
    font-size: clamp(0.75rem, 1.2vw, 0.875rem);
    color: var(--espresso);
    line-height: 1.7;
    margin-bottom: 0.5rem;
}

.hex-meta {
    font-family: var(--font-body);
    font-weight: 400;
    font-size: 0.6875rem;
    color: var(--faded-umber);
    letter-spacing: 0.04em;
    line-height: 1.5;
}

/* --- Section 3: City Window --- */
.section-city-window {
    position: relative;
    width: 100%;
    min-height: 80vh;
    background-color: var(--deep-burgundy);
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    padding: 6rem 2rem;
}

/* City Bokeh Layers */
.city-bokeh-layer {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
}

.city-bokeh-far {
    background:
        radial-gradient(circle at 10% 30%, rgba(91,26,42,0.12) 0%, transparent 70%),
        radial-gradient(circle at 50% 20%, rgba(139,69,87,0.08) 0%, transparent 65%),
        radial-gradient(circle at 80% 60%, rgba(245,237,224,0.06) 0%, transparent 60%),
        radial-gradient(circle at 30% 80%, rgba(212,168,87,0.07) 0%, transparent 70%),
        radial-gradient(circle at 70% 40%, rgba(91,26,42,0.10) 0%, transparent 55%),
        radial-gradient(circle at 90% 15%, rgba(245,237,224,0.05) 0%, transparent 60%),
        radial-gradient(circle at 20% 55%, rgba(139,69,87,0.06) 0%, transparent 65%);
    background-size: 120px 120px, 100px 100px, 80px 80px, 110px 110px, 90px 90px, 70px 70px, 95px 95px;
    background-repeat: no-repeat;
    background-position: 8% 28%, 48% 18%, 78% 58%, 28% 78%, 68% 38%, 88% 13%, 18% 53%;
}

.city-bokeh-mid {
    background:
        radial-gradient(circle at 25% 45%, rgba(212,168,87,0.08) 0%, transparent 65%),
        radial-gradient(circle at 65% 25%, rgba(245,237,224,0.06) 0%, transparent 60%),
        radial-gradient(circle at 85% 75%, rgba(139,69,87,0.07) 0%, transparent 70%),
        radial-gradient(circle at 40% 65%, rgba(212,168,87,0.05) 0%, transparent 55%),
        radial-gradient(circle at 15% 15%, rgba(245,237,224,0.04) 0%, transparent 50%),
        radial-gradient(circle at 55% 85%, rgba(212,168,87,0.06) 0%, transparent 60%);
    background-size: 60px 60px, 50px 50px, 55px 55px, 45px 45px, 40px 40px, 52px 52px;
    background-repeat: no-repeat;
    background-position: 23% 43%, 63% 23%, 83% 73%, 38% 63%, 13% 13%, 53% 83%;
}

.city-bokeh-near {
    background:
        radial-gradient(circle at 35% 55%, rgba(245,237,224,0.05) 0%, transparent 60%),
        radial-gradient(circle at 75% 35%, rgba(212,168,87,0.06) 0%, transparent 55%),
        radial-gradient(circle at 15% 75%, rgba(245,237,224,0.04) 0%, transparent 50%),
        radial-gradient(circle at 55% 15%, rgba(212,168,87,0.05) 0%, transparent 55%),
        radial-gradient(circle at 90% 55%, rgba(245,237,224,0.03) 0%, transparent 45%);
    background-size: 30px 30px, 25px 25px, 20px 20px, 28px 28px, 22px 22px;
    background-repeat: no-repeat;
    background-position: 33% 53%, 73% 33%, 13% 73%, 53% 13%, 88% 53%;
}

.city-window-content {
    position: relative;
    z-index: 2;
    max-width: 640px;
    margin: 0 auto;
}

.city-text {
    font-family: var(--font-display);
    font-weight: 400;
    font-size: clamp(1.15rem, 2vw, 1.35rem);
    color: var(--warm-cream);
    line-height: 2.1;
    margin-bottom: 2rem;
    opacity: 0;
    transition: opacity 1000ms ease;
}

.city-text.visible {
    opacity: 1;
}

.city-text:last-child {
    margin-bottom: 0;
}

/* --- Section 4: Secondary Honeycomb --- */
.section-honeycomb-secondary {
    background-color: var(--aged-linen);
    padding: 4rem 2rem 5rem;
    position: relative;
}

.section-honeycomb-secondary .section-heading {
    margin-left: calc(2px + 3px);
}

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

.honeycomb-grid-large .hex-row-offset {
    transform: translateX(calc(50% / 2));
    width: calc(100% - (100% / 2));
}

.hex-card-large {
    clip-path: polygon(50% 0.5%, 99.2% 25.4%, 99.8% 74.6%, 50.3% 99.7%, 0.2% 75.3%, 0.5% 24.5%);
    aspect-ratio: 1 / 1.1;
}

.hex-card-large::after {
    content: '';
    position: absolute;
    inset: 0;
    background: repeating-linear-gradient(
        45deg,
        transparent,
        transparent 7px,
        rgba(122,107,93,0.02) 7px,
        rgba(122,107,93,0.02) 8px
    );
    pointer-events: none;
    z-index: 1;
}

.hex-card-large .hex-body {
    font-size: clamp(0.8rem, 1.3vw, 0.9375rem);
    line-height: 1.75;
}

.hex-card-large .hex-meta {
    font-size: 0.75rem;
}

/* --- Section 5: Closing Desk --- */
.section-closing-desk {
    position: relative;
    width: 100%;
    min-height: 50vh;
    background-color: var(--deep-burgundy);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 5rem 2rem;
}

/* City grid pattern on footer */
.section-closing-desk::before {
    content: '';
    position: absolute;
    inset: 0;
    background:
        repeating-linear-gradient(
            0deg,
            rgba(245,237,224,0.04) 0px,
            rgba(245,237,224,0.04) 1px,
            transparent 1px,
            transparent 60px
        ),
        repeating-linear-gradient(
            90deg,
            rgba(245,237,224,0.04) 0px,
            rgba(245,237,224,0.04) 1px,
            transparent 1px,
            transparent 80px
        ),
        repeating-linear-gradient(
            90deg,
            rgba(245,237,224,0.02) 0px,
            rgba(245,237,224,0.02) 1px,
            transparent 1px,
            transparent 140px
        );
    pointer-events: none;
}

.closing-content {
    position: relative;
    z-index: 2;
    max-width: 580px;
    margin: 0 auto;
    text-align: center;
}

.closing-text {
    font-family: var(--font-display);
    font-style: italic;
    font-weight: 400;
    font-size: clamp(1.3rem, 2.8vw, 2rem);
    color: var(--warm-cream);
    line-height: 1.9;
    margin-bottom: 2.5rem;
}

.closing-rule {
    border: none;
    height: 1px;
    background: rgba(245, 237, 224, 0.25);
    width: 60%;
    margin: 0 auto 1.5rem;
}

.closing-colophon {
    font-family: var(--font-display);
    font-weight: 500;
    font-size: 0.75rem;
    color: var(--warm-cream);
    letter-spacing: 0.15em;
    text-transform: uppercase;
    opacity: 0.6;
}

/* --- Responsive: Below 768px --- */
@media (max-width: 768px) {
    .hex-row {
        grid-template-columns: 1fr;
        gap: 12px;
        margin-bottom: 0;
    }

    .hex-row-offset {
        transform: none;
        width: 100%;
    }

    .hex-card,
    .hex-card-large {
        clip-path: none;
        border-radius: 3px;
        aspect-ratio: auto;
    }

    .hex-card-inner {
        padding: 2rem 1.5rem;
    }

    .honeycomb-grid-large .hex-row {
        grid-template-columns: 1fr;
    }

    .honeycomb-grid-large .hex-row-offset {
        transform: none;
        width: 100%;
    }

    .section-honeycomb-primary,
    .section-honeycomb-secondary {
        padding: 3rem 1rem 4rem;
    }

    .section-city-window {
        padding: 4rem 1.5rem;
    }

    .nav-links {
        gap: 1rem;
    }

    .nav-links a {
        font-size: 0.75rem;
    }

    #main-nav {
        padding: 1rem 1.25rem;
    }

    .section-border {
        width: calc(100% - 2rem);
    }
}

/* --- Responsive: Above 1200px --- */
@media (min-width: 1200px) {
    .honeycomb-grid {
        max-width: 1400px;
    }

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

    .honeycomb-grid-large {
        max-width: 1200px;
    }
}

/* --- Links within body text --- */
.hex-body a,
.city-text a {
    color: var(--muted-rose);
    text-decoration: underline;
    text-decoration-thickness: 1px;
    text-underline-offset: 2px;
    transition: text-decoration-thickness 200ms ease;
}

.hex-body a:hover,
.city-text a:hover {
    text-decoration-thickness: 2px;
}

/* --- Prefers Reduced Motion --- */
@media (prefers-reduced-motion: reduce) {
    .bokeh-layer,
    .foyer-title,
    .foyer-epigraph {
        animation: none !important;
        opacity: 1 !important;
        transform: none !important;
    }

    .foyer-epigraph {
        opacity: 0.85 !important;
    }

    .hex-card {
        opacity: 1 !important;
        transform: none !important;
        transition: none !important;
    }

    .city-text {
        opacity: 1 !important;
        transition: none !important;
    }
}
