/* =============================================
   bada.news — Editorial Zen Stylesheet
   ============================================= */

/* CSS Custom Properties */
:root {
    --marble-white: #f2f0ed;
    --stone-mist: #e4e2df;
    --ink-charcoal: #2d2b28;
    --reading-gray: #3d3b38;
    --vein-gray: #8a8783;
    --warm-slate: #5a5856;
    --marble-vein: #b8b5b0;
    --blush-mist: #ebe6e0;
    --charcoal-warm: #1e1d1b;
}

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

html {
    scroll-behavior: smooth;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

body {
    background-color: var(--marble-white);
    color: var(--reading-gray);
    font-family: 'Source Serif 4', Georgia, serif;
    font-weight: 400;
    font-size: clamp(1rem, 1.4vw, 1.15rem);
    line-height: 1.72;
    overflow: hidden;
    height: 100vh;
}

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

/* =============================================
   Split-Screen Layout
   ============================================= */

.split-screen {
    display: flex;
    width: 100vw;
    height: 100vh;
}

/* Left Panel: The Broadsheet */
.broadsheet {
    width: 61.8%;
    height: 100vh;
    overflow-y: auto;
    overflow-x: hidden;
    background-color: var(--marble-white);
    position: relative;
    scroll-snap-type: y proximity;
    /* Marble texture via layered gradients */
    background-image:
        radial-gradient(ellipse at 20% 50%, rgba(184, 181, 176, 0.15) 0%, transparent 50%),
        radial-gradient(ellipse at 80% 20%, rgba(184, 181, 176, 0.08) 0%, transparent 40%),
        conic-gradient(from 145deg at 60% 30%, rgba(138, 135, 131, 0.08) 0%, transparent 15%, rgba(138, 135, 131, 0.06) 30%, transparent 45%),
        radial-gradient(ellipse at 50% 80%, rgba(228, 226, 223, 0.2) 0%, transparent 60%);
    background-color: var(--marble-white);
}

/* Right Panel: The Margin */
.margin-panel {
    width: 38.2%;
    height: 100vh;
    overflow: hidden;
    background-color: var(--stone-mist);
    position: relative;
    border-left: 1px solid var(--marble-vein);
}

/* =============================================
   Spreads (Full Viewport Sections)
   ============================================= */

.spread {
    min-height: 100vh;
    display: flex;
    align-items: flex-start;
    scroll-snap-align: start;
    position: relative;
    will-change: transform, opacity;
    transition: transform 0.6s cubic-bezier(0.25, 0.1, 0.25, 1.0),
                opacity 0.6s cubic-bezier(0.25, 0.1, 0.25, 1.0);
}

.spread-inner {
    width: 100%;
    padding: 0;
}

/* Grid system inside broadsheet */
.spread-grid {
    display: grid;
    grid-template-columns: repeat(8, 1fr);
    gap: 0 16px;
    padding: 6vh 8% 6vh 12%;
    min-height: 100vh;
    align-content: center;
}

/* =============================================
   Masthead
   ============================================= */

.masthead {
    grid-column: 1 / 7;
    opacity: 0;
    transition: opacity 0.6s ease;
}

.masthead-text {
    font-family: 'Albert Sans', 'Helvetica Neue', sans-serif;
    font-weight: 500;
    font-size: clamp(1.2rem, 2vw, 1.8rem);
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: var(--vein-gray);
    display: inline-block;
}

.masthead-rule {
    grid-column: 1 / 9;
    height: 1px;
    background-color: var(--marble-vein);
    width: 0%;
    transition: width 0.8s cubic-bezier(0.25, 0.1, 0.25, 1.0);
    margin-bottom: 4vh;
}

.masthead-rule.animate {
    width: 100%;
}

/* =============================================
   Headlines
   ============================================= */

.headline {
    grid-column: 1 / 7;
    font-family: 'Libre Baskerville', 'Georgia', serif;
    font-weight: 400;
    font-size: clamp(2.4rem, 5.5vw, 4.8rem);
    letter-spacing: -0.02em;
    line-height: 1.08;
    color: var(--ink-charcoal);
    margin-bottom: 1.2em;
    position: relative;
}

.headline .char {
    display: inline-block;
    opacity: 0;
    transform: translateY(8px);
    transition: opacity 0.4s ease-out, transform 0.4s ease-out;
}

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

/* Whitespace characters need to keep their width */
.headline .char-space {
    display: inline;
    width: 0.3em;
}

/* =============================================
   Body Text
   ============================================= */

.body-text {
    grid-column: 2 / 7;
}

.body-text p {
    font-family: 'Source Serif 4', Georgia, serif;
    font-weight: 400;
    font-size: clamp(1rem, 1.4vw, 1.15rem);
    line-height: 1.72;
    color: var(--reading-gray);
    margin-bottom: 1.4em;
}

/* Drop Cap */
.body-text p.drop-cap::first-letter {
    font-family: 'Libre Baskerville', Georgia, serif;
    font-weight: 700;
    font-size: 3.2em;
    float: left;
    line-height: 0.85;
    margin-right: 0.08em;
    margin-top: 0.05em;
    color: var(--ink-charcoal);
}

.body-text p.drop-cap {
    overflow: hidden;
}

/* Paragraph Separator */
.paragraph-separator {
    text-align: center;
    color: var(--marble-vein);
    font-size: 1.2em;
    letter-spacing: 0.5em;
    padding: 1rem 0;
}

/* =============================================
   Section Ornaments
   ============================================= */

.section-ornament {
    grid-column: 1 / 9;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 1.5rem;
    padding: 4rem 0;
    color: var(--marble-vein);
}

.ornament-rule {
    flex: 1;
    height: 1px;
    background-color: var(--marble-vein);
    display: block;
    width: 0%;
    transition: width 0.6s ease;
}

.ornament-rule.animate {
    width: 100%;
}

.ornament-diamond {
    font-size: 0.6rem;
    color: var(--marble-vein);
    flex-shrink: 0;
}

/* =============================================
   Image Frame
   ============================================= */

.image-frame {
    grid-column: 1 / 7;
    margin: 2rem 0;
    overflow: hidden;
}

.image-placeholder {
    transform: scale(1.08);
    opacity: 0.6;
    transition: transform 0.9s cubic-bezier(0.25, 0.1, 0.25, 1.0),
                opacity 0.9s cubic-bezier(0.25, 0.1, 0.25, 1.0);
}

.image-placeholder.in-view {
    transform: scale(1.0);
    opacity: 1.0;
}

.image-placeholder svg {
    width: 100%;
    height: auto;
    display: block;
}

/* =============================================
   Closing Dash
   ============================================= */

.closing-dash {
    text-align: center;
    color: var(--marble-vein);
    font-family: 'Libre Baskerville', Georgia, serif;
    font-size: 2rem;
    padding-top: 3rem;
    letter-spacing: 0.1em;
}

/* =============================================
   Dot Navigation
   ============================================= */

.dot-nav {
    position: fixed;
    right: 20px;
    top: 50%;
    transform: translateY(-50%);
    z-index: 100;
    display: flex;
    flex-direction: column;
    gap: 16px;
    align-items: flex-end;
}

.dot-item {
    display: flex;
    align-items: center;
    gap: 10px;
    cursor: pointer;
    flex-direction: row-reverse;
}

.dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background-color: var(--marble-vein);
    transition: background-color 0.3s ease, transform 0.2s ease;
    flex-shrink: 0;
}

.dot.active {
    background-color: var(--warm-slate);
}

.dot-item:hover .dot {
    transform: scale(1.3);
}

.dot-label {
    font-family: 'Albert Sans', sans-serif;
    font-weight: 300;
    font-size: clamp(0.75rem, 1.2vw, 0.95rem);
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: var(--vein-gray);
    opacity: 0;
    transform: translateX(5px);
    transition: opacity 0.2s ease, transform 0.2s ease;
    white-space: nowrap;
    pointer-events: none;
}

.dot-item:hover .dot-label {
    opacity: 1;
    transform: translateX(0);
}

/* =============================================
   Margin Panel
   ============================================= */

.margin-spread {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    opacity: 0;
    transition: opacity 0.5s ease;
    pointer-events: none;
}

.margin-spread-active {
    opacity: 1;
    pointer-events: auto;
}

.margin-content {
    padding: 6vh 12% 6vh 10%;
    height: 100%;
    display: flex;
    flex-direction: column;
    justify-content: center;
    gap: 3rem;
}

/* Dateline */
.dateline {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
}

.dateline-label,
.dateline-date {
    font-family: 'Albert Sans', sans-serif;
    font-weight: 500;
    font-size: clamp(0.75rem, 1.2vw, 0.95rem);
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: var(--vein-gray);
}

/* Karesansui SVG Patterns */
.karesansui-container {
    width: 100%;
    opacity: 0.1;
    transition: opacity 0.8s ease;
}

.margin-spread-active .karesansui-container {
    opacity: 0.1;
}

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

/* Enso circle animation */
.enso-circle {
    stroke-dasharray: 1200;
    stroke-dashoffset: 1200;
    transition: stroke-dashoffset 1.2s cubic-bezier(0.25, 0.1, 0.25, 1.0);
}

.margin-spread-active .enso-circle {
    stroke-dashoffset: 0;
}

/* Wave line animation */
.wave-line {
    stroke-dasharray: 400;
    stroke-dashoffset: 400;
    transition: stroke-dashoffset 0.8s cubic-bezier(0.25, 0.1, 0.25, 1.0);
}

.margin-spread-active .wave-line {
    stroke-dashoffset: 0;
}

/* Spiral path animation */
.spiral-path {
    stroke-dasharray: 1500;
    stroke-dashoffset: 1500;
    transition: stroke-dashoffset 1.5s cubic-bezier(0.25, 0.1, 0.25, 1.0);
}

.margin-spread-active .spiral-path {
    stroke-dashoffset: 0;
}

/* Stagger wave lines */
.margin-spread-active .wave-line:nth-child(1) { transition-delay: 0ms; }
.margin-spread-active .wave-line:nth-child(2) { transition-delay: 60ms; }
.margin-spread-active .wave-line:nth-child(3) { transition-delay: 120ms; }
.margin-spread-active .wave-line:nth-child(4) { transition-delay: 180ms; }
.margin-spread-active .wave-line:nth-child(5) { transition-delay: 240ms; }
.margin-spread-active .wave-line:nth-child(6) { transition-delay: 300ms; }
.margin-spread-active .wave-line:nth-child(7) { transition-delay: 360ms; }
.margin-spread-active .wave-line:nth-child(8) { transition-delay: 420ms; }
.margin-spread-active .wave-line:nth-child(9) { transition-delay: 480ms; }

/* Stagger enso circles */
.margin-spread-active .enso-circle:nth-child(1) { transition-delay: 0ms; }
.margin-spread-active .enso-circle:nth-child(2) { transition-delay: 100ms; }
.margin-spread-active .enso-circle:nth-child(3) { transition-delay: 200ms; }
.margin-spread-active .enso-circle:nth-child(4) { transition-delay: 300ms; }
.margin-spread-active .enso-circle:nth-child(5) { transition-delay: 400ms; }
.margin-spread-active .enso-circle:nth-child(6) { transition-delay: 500ms; }
.margin-spread-active .enso-circle:nth-child(7) { transition-delay: 600ms; }

/* Pull Quotes */
.pull-quote {
    padding: 1.5rem 0;
    border-top: 1px solid var(--marble-vein);
    border-bottom: 1px solid var(--marble-vein);
    cursor: default;
}

.pull-quote blockquote {
    font-family: 'Libre Baskerville', Georgia, serif;
    font-style: italic;
    font-weight: 400;
    font-size: clamp(1rem, 1.6vw, 1.25rem);
    line-height: 1.5;
    color: var(--warm-slate);
    margin-bottom: 0.8rem;
}

.pull-quote-attribution {
    font-family: 'Albert Sans', sans-serif;
    font-weight: 300;
    font-size: clamp(0.75rem, 1vw, 0.85rem);
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: var(--vein-gray);
    display: block;
}

/* Margin Annotations */
.margin-annotation {
    padding-top: 1rem;
}

.annotation-label {
    font-family: 'Albert Sans', sans-serif;
    font-weight: 500;
    font-size: clamp(0.65rem, 1vw, 0.8rem);
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--vein-gray);
    display: block;
    margin-bottom: 0.5rem;
}

.margin-annotation p {
    font-family: 'Source Serif 4', Georgia, serif;
    font-size: clamp(0.85rem, 1.1vw, 0.95rem);
    line-height: 1.6;
    color: var(--warm-slate);
}

/* =============================================
   Pull Quote Highlight Interaction
   ============================================= */

.body-text p.text-highlight {
    background-image: linear-gradient(var(--blush-mist), var(--blush-mist));
    background-size: 0% 100%;
    background-position: center;
    background-repeat: no-repeat;
    transition: background-size 0.4s ease;
}

.body-text p.text-highlight-active {
    background-size: 100% 100%;
}

/* =============================================
   Zoom-Focus Transition States
   ============================================= */

.spread.exiting {
    transform: scale(0.96);
    opacity: 0.3;
}

.spread.entering {
    transform: scale(1.04);
    opacity: 0;
}

.spread.active {
    transform: scale(1);
    opacity: 1;
}

/* =============================================
   Noise Overlay
   ============================================= */

.broadsheet::after {
    content: '';
    position: fixed;
    top: 0;
    left: 0;
    width: 61.8%;
    height: 100%;
    filter: url(#noise-filter);
    pointer-events: none;
    z-index: 1;
    opacity: 0.5;
}

/* =============================================
   Scrollbar Styling
   ============================================= */

.broadsheet::-webkit-scrollbar {
    width: 4px;
}

.broadsheet::-webkit-scrollbar-track {
    background: transparent;
}

.broadsheet::-webkit-scrollbar-thumb {
    background-color: var(--marble-vein);
    border-radius: 2px;
}

/* =============================================
   Mobile Responsive (below 768px)
   ============================================= */

@media (max-width: 768px) {
    body {
        overflow-y: auto;
        overflow-x: hidden;
        height: auto;
    }

    .split-screen {
        flex-direction: column;
        height: auto;
    }

    .broadsheet {
        width: 100%;
        height: auto;
        overflow-y: visible;
        scroll-snap-type: none;
        background-image:
            radial-gradient(ellipse at 20% 50%, rgba(184, 181, 176, 0.12) 0%, transparent 50%),
            conic-gradient(from 145deg at 60% 30%, rgba(138, 135, 131, 0.06) 0%, transparent 15%, rgba(138, 135, 131, 0.04) 30%, transparent 45%);
    }

    .broadsheet::after {
        width: 100%;
        position: absolute;
    }

    .margin-panel {
        width: 100%;
        height: auto;
        border-left: none;
        border-top: 1px solid var(--marble-vein);
        position: relative;
    }

    .margin-spread {
        position: relative;
        opacity: 1;
        pointer-events: auto;
        border-bottom: 1px solid var(--marble-vein);
    }

    .margin-spread .enso-circle,
    .margin-spread .wave-line,
    .margin-spread .spiral-path {
        stroke-dashoffset: 0;
    }

    .margin-content {
        padding: 4vh 8%;
    }

    .spread {
        min-height: auto;
        scroll-snap-align: none;
    }

    .spread-grid {
        display: block;
        padding: 4vh 6%;
    }

    .dot-nav {
        display: none;
    }

    .headline {
        font-size: clamp(2rem, 7vw, 3rem);
    }

    .body-text {
        padding: 0;
    }

    .karesansui-container {
        max-width: 200px;
        margin: 0 auto;
    }
}

/* Tablet adjustments */
@media (min-width: 769px) and (max-width: 1024px) {
    .spread-grid {
        padding: 4vh 6% 4vh 8%;
    }

    .headline {
        font-size: clamp(2rem, 4vw, 3.2rem);
    }
}
