/* ========================================
   namu.market — Evolved-Minimal Editorial
   Midnight-blue palette, magazine-spread layout,
   path-draw SVG animation language
   ======================================== */

/* ========================================
   CUSTOM PROPERTIES
   ======================================== */

:root {
    /* Color Palette */
    --midnight-indigo: #0F1A2E;
    --deep-navy: #1B2A4A;
    --warm-bone: #F2EDE4;
    --tarnished-gold: #B8926A;
    --steel-blue: #4A6FA5;
    --weathered-copper: #7A9E7E;
    --warm-parchment: #E8DCC8;
    --charcoal: #2D3748;
    --stone-gray: #C4B8A4;
    --ink-blue: #2C3E6B;

    /* Typography */
    --font-display: 'DM Serif Display', serif;
    --font-label: 'Space Grotesk', sans-serif;
    --font-body: 'Source Serif 4', serif;

    /* Layout */
    --margin-x: 80px;
    --margin-y: 60px;
    --gutter-width: 28px;
    --dominant-width: 62%;
    --subordinate-width: 38%;

    /* Animation */
    --ease-draw: cubic-bezier(0.25, 0.1, 0.25, 1);
    --draw-duration: 2.5s;
    --draw-duration-small: 1.2s;
}

/* ========================================
   RESET & BASE
   ======================================== */

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

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

body {
    font-family: var(--font-body);
    background-color: var(--midnight-indigo);
    color: var(--warm-parchment);
    line-height: 1.7;
    overflow-x: hidden;
}

/* ========================================
   GRID SUBSTRATE
   ======================================== */

.grid-substrate {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 0;
    background-image:
        linear-gradient(to right, rgba(27, 42, 74, 0.08) 1px, transparent 1px),
        linear-gradient(to bottom, rgba(27, 42, 74, 0.08) 1px, transparent 1px);
    background-size: 80px 80px;
    transition: opacity 0.6s ease;
}

/* ========================================
   GOLDEN RATIO LINE
   ======================================== */

.golden-line {
    position: fixed;
    top: 0;
    left: 38.2%;
    width: 1px;
    height: 100%;
    background-color: var(--ink-blue);
    opacity: 0.15;
    pointer-events: none;
    z-index: 1;
}

/* ========================================
   SPREADS (Full-viewport sections)
   ======================================== */

.spread {
    position: relative;
    width: 100%;
    height: 100vh;
    padding: var(--margin-y) var(--margin-x);
    z-index: 2;
    overflow: hidden;
}

.spread-inner {
    position: relative;
    display: flex;
    width: 100%;
    height: 100%;
    align-items: center;
}

.spread-centered {
    justify-content: center;
    align-items: center;
    flex-direction: column;
}

/* ========================================
   ZONES (Dominant / Subordinate)
   ======================================== */

.zone {
    position: relative;
    height: 100%;
    display: flex;
    flex-direction: column;
    justify-content: center;
}

.zone-dominant {
    flex: 0 0 var(--dominant-width);
    max-width: var(--dominant-width);
}

.zone-subordinate {
    flex: 0 0 var(--subordinate-width);
    max-width: var(--subordinate-width);
}

/* ========================================
   GUTTER
   ======================================== */

.gutter {
    flex: 0 0 var(--gutter-width);
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
}

.gutter::after {
    content: '';
    position: absolute;
    top: 10%;
    bottom: 10%;
    width: 1px;
    background-color: var(--ink-blue);
    opacity: 0.3;
}

.gutter-inverted::after {
    background-color: var(--tarnished-gold);
    opacity: 0.2;
}

/* ========================================
   CORNER NOTATION
   ======================================== */

.corner-notation {
    position: absolute;
    display: flex;
    align-items: center;
    gap: 6px;
    font-family: var(--font-label);
    font-size: 0.65rem;
    font-weight: 400;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--steel-blue);
    opacity: 0.2;
    z-index: 5;
}

.corner-bl {
    bottom: 20px;
    left: var(--margin-x);
}

.corner-br {
    bottom: 20px;
    right: var(--margin-x);
}

.inverted-notation {
    color: var(--deep-navy);
}

.notation-number {
    font-weight: 500;
    font-size: 0.7rem;
}

.notation-dash {
    opacity: 0.5;
}

.notation-label {
    letter-spacing: 0.12em;
}

/* ========================================
   TYPOGRAPHY
   ======================================== */

/* Primary Display Headlines */
.title-namu {
    font-family: var(--font-display);
    font-size: clamp(2.4rem, 6vw + 0.5rem, 5rem);
    font-weight: 400;
    letter-spacing: -0.02em;
    line-height: 1.05;
    color: var(--warm-parchment);
    margin-bottom: 0.5rem;
}

.title-market {
    font-family: var(--font-label);
    font-size: clamp(0.85rem, 1.5vw + 0.2rem, 1.15rem);
    font-weight: 500;
    letter-spacing: 0.2em;
    text-transform: uppercase;
    color: var(--steel-blue);
    display: block;
}

.section-label {
    font-family: var(--font-label);
    font-size: clamp(0.85rem, 1.5vw + 0.2rem, 1.15rem);
    font-weight: 500;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: var(--steel-blue);
    margin-bottom: 2rem;
}

.display-headline {
    font-family: var(--font-display);
    font-size: clamp(2rem, 4.5vw + 0.5rem, 3.6rem);
    font-weight: 400;
    letter-spacing: -0.02em;
    line-height: 1.1;
    color: var(--warm-parchment);
}

.inverted-headline {
    color: var(--deep-navy);
}

.body-text {
    font-family: var(--font-body);
    font-size: 1.05rem;
    font-weight: 400;
    line-height: 1.7;
    max-width: 52ch;
    color: var(--stone-gray);
    margin-bottom: 1.5rem;
}

/* Captions / Metadata */
.caption {
    font-family: var(--font-label);
    font-size: clamp(0.7rem, 0.9vw + 0.1rem, 0.8rem);
    font-weight: 400;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: rgba(74, 111, 165, 0.7);
}

/* ========================================
   SPREAD 1 — COVER
   ======================================== */

.spread-1 {
    background-color: var(--midnight-indigo);
}

.spread-1 .zone-dominant {
    padding-bottom: 80px;
}

.spread-1 .zone-subordinate {
    display: flex;
    align-items: center;
    justify-content: center;
}

.svg-branch {
    width: 100%;
    max-width: 280px;
    height: auto;
}

/* ========================================
   SPREAD 2 — PHILOSOPHY
   ======================================== */

.spread-2 {
    background-color: var(--midnight-indigo);
}

.spread-2 .zone-subordinate {
    align-items: center;
    justify-content: center;
}

.svg-vessel-container {
    position: relative;
    width: 100%;
    max-width: 280px;
    display: flex;
    align-items: center;
    justify-content: center;
}

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

.line-cluster {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-top: 2rem;
    padding-left: 20%;
}

.line-cluster span {
    display: block;
    height: 1px;
    background-color: var(--steel-blue);
    opacity: 0.3;
}

.line-cluster span:nth-child(1) { width: 60px; }
.line-cluster span:nth-child(2) { width: 80px; }
.line-cluster span:nth-child(3) { width: 50px; }
.line-cluster span:nth-child(4) { width: 70px; }

/* ========================================
   SPREAD 3 — INVERSION (Light)
   ======================================== */

.spread-inverted {
    background-color: var(--warm-bone);
    color: var(--deep-navy);
}

.spread-inverted .grid-override {
    background-image:
        linear-gradient(to right, rgba(184, 146, 106, 0.05) 1px, transparent 1px),
        linear-gradient(to bottom, rgba(184, 146, 106, 0.05) 1px, transparent 1px);
    background-size: 80px 80px;
}

.object-trio {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 2.5rem;
    padding-top: 40px;
}

.svg-object {
    width: 100px;
    height: auto;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.svg-object.is-visible {
    opacity: 1;
}

.svg-bowl { width: 110px; }
.svg-bottle { width: 70px; }
.svg-box { width: 90px; }

/* ========================================
   SPREAD 4 — GRID STUDY
   ======================================== */

.spread-4 {
    background-color: var(--midnight-indigo);
}

.svg-crosshair {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 80%;
    height: 80%;
    z-index: 1;
}

.grid-quote {
    position: relative;
    z-index: 2;
    text-align: center;
    max-width: 600px;
}

.quote-text {
    font-size: clamp(1.8rem, 3.5vw + 0.5rem, 3rem);
}

/* ========================================
   SPREAD 5 — COLLECTION
   ======================================== */

.spread-5 {
    background-color: var(--midnight-indigo);
}

.spread-5 .zone-subordinate {
    align-items: center;
    justify-content: center;
}

.svg-contour {
    width: 100%;
    max-width: 160px;
    height: auto;
}

.collection-cards {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

.collection-card {
    position: relative;
    background-color: var(--deep-navy);
    border: 1px solid var(--ink-blue);
    padding: 2rem 2.5rem;
    margin-left: var(--card-offset, 0px);
    opacity: 0;
    transform: translateY(20px);
    transition: opacity 0.6s var(--ease-draw), transform 0.6s var(--ease-draw);
}

.collection-card.is-visible {
    opacity: 1;
    transform: translateY(0);
}

.card-title {
    font-family: var(--font-display);
    font-size: 1.4rem;
    font-weight: 400;
    letter-spacing: -0.01em;
    line-height: 1.2;
    color: var(--warm-parchment);
    margin-bottom: 0.6rem;
}

.card-desc {
    font-family: var(--font-body);
    font-size: 0.95rem;
    line-height: 1.65;
    color: var(--stone-gray);
    max-width: 45ch;
}

/* Crop Marks */
.crop-mark {
    position: absolute;
    width: 12px;
    height: 12px;
    opacity: 0.4;
}

.crop-mark::before,
.crop-mark::after {
    content: '';
    position: absolute;
    background-color: var(--steel-blue);
}

.crop-tl { top: -6px; left: -6px; }
.crop-tl::before { top: 6px; left: 0; width: 12px; height: 1px; }
.crop-tl::after { top: 0; left: 6px; width: 1px; height: 12px; }

.crop-tr { top: -6px; right: -6px; }
.crop-tr::before { top: 6px; right: 0; width: 12px; height: 1px; }
.crop-tr::after { top: 0; right: 6px; width: 1px; height: 12px; }

.crop-bl { bottom: -6px; left: -6px; }
.crop-bl::before { bottom: 6px; left: 0; width: 12px; height: 1px; }
.crop-bl::after { bottom: 0; left: 6px; width: 1px; height: 12px; }

.crop-br { bottom: -6px; right: -6px; }
.crop-br::before { bottom: 6px; right: 0; width: 12px; height: 1px; }
.crop-br::after { bottom: 0; right: 6px; width: 1px; height: 12px; }

/* ========================================
   SPREAD 6 — CLOSE
   ======================================== */

.spread-6 {
    background-color: var(--midnight-indigo);
}

.close-title {
    font-family: var(--font-display);
    font-size: clamp(2.4rem, 6vw + 0.5rem, 5rem);
    font-weight: 400;
    letter-spacing: -0.02em;
    line-height: 1.05;
    color: var(--warm-parchment);
    text-align: center;
    margin-bottom: 2rem;
}

.svg-close-line {
    width: 40vw;
    height: 4px;
    display: block;
}

/* ========================================
   SPREAD DIVIDERS
   ======================================== */

.spread-divider {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    height: 60px;
    z-index: 2;
    background-color: var(--midnight-indigo);
}

.divider-line {
    width: 40vw;
    height: 12px;
}

/* Handle divider between inverted spread transitions */
.spread-3 + .spread-divider {
    background-color: var(--midnight-indigo);
}

.spread-inverted + .spread-divider {
    background: linear-gradient(to bottom, var(--warm-bone), var(--midnight-indigo));
}

/* Divider before the inverted spread */
.spread-2 + .spread-divider {
    background: linear-gradient(to bottom, var(--midnight-indigo), var(--warm-bone));
}

/* ========================================
   SVG PATH-DRAW ANIMATION
   ======================================== */

.draw-path {
    stroke-dasharray: var(--path-length, 1000);
    stroke-dashoffset: var(--path-length, 1000);
    transition: stroke-dashoffset var(--draw-duration) var(--ease-draw);
}

.draw-path.is-drawn {
    stroke-dashoffset: 0;
}

/* Small paths get shorter duration */
.divider-path {
    --draw-duration: 1.5s;
}

/* Close line paths */
.close-line-path,
.close-line-path-left {
    --draw-duration: 2s;
}

/* Crosshair lines */
.crosshair-h,
.crosshair-v {
    --draw-duration: 2s;
}

/* ========================================
   LINE CLUSTER ANIMATIONS
   ======================================== */

.line-cluster span {
    transform: scaleX(0);
    transform-origin: left;
    transition: transform 0.8s var(--ease-draw);
}

.line-cluster.is-visible span {
    transform: scaleX(1);
}

.line-cluster.is-visible span:nth-child(1) { transition-delay: 0.1s; }
.line-cluster.is-visible span:nth-child(2) { transition-delay: 0.2s; }
.line-cluster.is-visible span:nth-child(3) { transition-delay: 0.3s; }
.line-cluster.is-visible span:nth-child(4) { transition-delay: 0.4s; }

/* ========================================
   SPREAD 4 ENHANCED GRID
   ======================================== */

.spread-4 .grid-substrate-local {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    background-image:
        linear-gradient(to right, rgba(27, 42, 74, 0.12) 1px, transparent 1px),
        linear-gradient(to bottom, rgba(27, 42, 74, 0.12) 1px, transparent 1px);
    background-size: 80px 80px;
}

/* ========================================
   SMALL GEOMETRIC DECORATIONS (marginalia)
   ======================================== */

.margin-geom {
    position: absolute;
    opacity: 0;
    transition: opacity 0.8s ease;
}

.margin-geom.is-visible {
    opacity: 1;
}

/* ========================================
   RESPONSIVE
   ======================================== */

@media (max-width: 1024px) {
    :root {
        --margin-x: 40px;
        --margin-y: 40px;
    }
}

@media (max-width: 768px) {
    :root {
        --margin-x: 24px;
        --margin-y: 30px;
        --gutter-width: 16px;
    }

    .spread-inner {
        flex-direction: column;
        gap: 2rem;
    }

    .zone-dominant,
    .zone-subordinate {
        flex: 1 1 auto;
        max-width: 100%;
        width: 100%;
    }

    .gutter {
        flex: 0 0 1px;
        width: 60%;
        height: 1px;
    }

    .gutter::after {
        top: 0;
        bottom: auto;
        left: 0;
        right: 0;
        width: 100%;
        height: 1px;
    }

    .golden-line {
        display: none;
    }

    .spread {
        height: auto;
        min-height: 100vh;
        padding: 60px var(--margin-x);
    }

    .title-namu {
        font-size: clamp(2rem, 10vw, 3.5rem);
    }

    .close-title {
        font-size: clamp(2rem, 10vw, 3.5rem);
    }

    .display-headline {
        font-size: clamp(1.6rem, 5vw, 2.5rem);
    }

    .collection-card {
        margin-left: 0;
        padding: 1.5rem;
    }

    .svg-crosshair {
        width: 95%;
        height: 60%;
    }

    .svg-close-line {
        width: 60vw;
    }

    .corner-notation {
        font-size: 0.6rem;
    }

    .corner-bl { left: var(--margin-x); }
    .corner-br { right: var(--margin-x); }

    .object-trio {
        flex-direction: row;
        flex-wrap: wrap;
        justify-content: center;
        gap: 1.5rem;
    }
}

@media (max-width: 480px) {
    :root {
        --margin-x: 16px;
        --margin-y: 24px;
    }

    .body-text {
        font-size: 0.95rem;
    }

    .section-label {
        font-size: 0.75rem;
    }

    .svg-branch {
        max-width: 200px;
    }

    .svg-vessel-container {
        max-width: 200px;
    }

    .line-cluster {
        padding-left: 10%;
    }
}
