/* ============================================================
   economics.day -- Styles
   A Living Broadsheet Since 1776
   ============================================================ */

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

:root {
    --aged-vellum: #f5f0e6;
    --pressed-linen: #ebe3d1;
    --compositors-black: #1a1612;
    --tarnished-brass: #8b7355;
    --gazette-red: #b8432f;
    --ledger-green: #5c6b5e;
    --foxed-page: #d4c9b5;
    --fresh-ink: #2c2418;
    --baseline: 1.375rem;
    --col-gap: 1.5%;
}

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

body {
    background-color: var(--aged-vellum);
    color: var(--compositors-black);
    font-family: 'Lora', Georgia, serif;
    font-weight: 400;
    font-size: clamp(0.95rem, 1.1vw, 1.125rem);
    line-height: 1.625;
    overflow-x: hidden;
}

/* --- Typography --- */
.masthead-title {
    font-family: 'Playfair Display', 'Georgia', serif;
    font-weight: 900;
    text-transform: uppercase;
    letter-spacing: 0.18em;
    font-size: clamp(2rem, 5vw, 4.5rem);
    color: var(--compositors-black);
    text-align: center;
}

.masthead-title span {
    display: inline-block;
    opacity: 0;
}

.section-headline {
    font-family: 'Playfair Display', 'Georgia', serif;
    font-weight: 900;
    text-transform: uppercase;
    letter-spacing: 0.18em;
    font-size: clamp(1.2rem, 2.5vw, 2rem);
    color: var(--compositors-black);
    margin-bottom: calc(var(--baseline) * 1.5);
    line-height: 1.3;
}

.section-label {
    font-family: 'Space Grotesk', sans-serif;
    font-weight: 500;
    letter-spacing: 0.15em;
    font-size: clamp(0.65rem, 0.8vw, 0.75rem);
    text-transform: uppercase;
    color: var(--tarnished-brass);
}

.quote-text {
    font-family: 'Cormorant Garamond', 'Georgia', serif;
    font-weight: 300;
    font-style: italic;
    font-size: clamp(2rem, 4vw, 3.5rem);
    line-height: 1.35;
    color: var(--compositors-black);
}

.ticker-concept,
.ticker-change,
.ticker-separator {
    font-family: 'IBM Plex Mono', monospace;
    font-weight: 400;
    font-size: clamp(0.7rem, 0.9vw, 0.85rem);
    letter-spacing: 0.02em;
}

.data-date,
.data-event {
    font-family: 'IBM Plex Mono', monospace;
    font-weight: 400;
    font-size: clamp(0.7rem, 0.9vw, 0.85rem);
    letter-spacing: 0.02em;
}

.marginalia-note p {
    font-family: 'IBM Plex Mono', monospace;
    font-size: clamp(0.7rem, 0.85vw, 0.8rem);
    color: var(--ledger-green);
    line-height: 1.5;
}

.marginalia-marker {
    font-family: 'Space Grotesk', sans-serif;
    font-weight: 500;
    color: var(--tarnished-brass);
    font-size: 0.75rem;
    letter-spacing: 0.1em;
}

/* --- Drop Caps --- */
.drop-cap {
    float: left;
    font-family: 'Playfair Display', serif;
    font-weight: 900;
    font-size: 3.8em;
    line-height: 0.8;
    padding-right: 0.08em;
    padding-top: 0.05em;
    color: var(--gazette-red);
    position: relative;
}

.drop-cap::before {
    content: '';
    position: absolute;
    inset: -4px;
    border: 1px solid var(--foxed-page);
    pointer-events: none;
}

/* Small corner ornaments on drop cap */
.drop-cap::after {
    content: '';
    position: absolute;
    top: -4px;
    left: -4px;
    width: 8px;
    height: 8px;
    border-top: 2px solid var(--foxed-page);
    border-left: 2px solid var(--foxed-page);
}

/* --- Section: Masthead --- */
.section-masthead {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    position: relative;
    padding: 2rem;
}

.masthead-inner {
    text-align: center;
    width: 100%;
    max-width: 900px;
}

.masthead-top-bar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    width: 100%;
    max-width: 700px;
    margin: 0 auto 2rem;
    padding: 0 1rem;
}

.masthead-date,
.masthead-edition {
    font-family: 'Space Grotesk', sans-serif;
    font-weight: 500;
    letter-spacing: 0.15em;
    font-size: clamp(0.6rem, 0.75vw, 0.72rem);
    text-transform: uppercase;
    color: var(--tarnished-brass);
}

.edition-number {
    color: var(--gazette-red);
}

.masthead-rule {
    width: 100%;
    max-width: 700px;
    margin: 1.5rem auto;
    height: 2px;
    overflow: visible;
}

.masthead-rule-svg {
    width: 100%;
    height: 2px;
    display: block;
}

.masthead-line {
    stroke-dasharray: 600;
    stroke-dashoffset: 600;
}

.masthead-subtitle {
    font-family: 'Space Grotesk', sans-serif;
    font-weight: 500;
    letter-spacing: 0.15em;
    font-size: clamp(0.7rem, 0.85vw, 0.8rem);
    text-transform: uppercase;
    color: var(--tarnished-brass);
    opacity: 0;
    margin-top: 0.5rem;
}

/* --- Ticker --- */
.ticker-container {
    position: absolute;
    bottom: 3rem;
    left: 0;
    width: 100%;
    overflow: hidden;
    border-top: 1px solid var(--foxed-page);
    border-bottom: 1px solid var(--foxed-page);
    padding: 0.6rem 0;
    opacity: 0;
}

.ticker-track {
    display: flex;
    align-items: center;
    gap: 1.2rem;
    white-space: nowrap;
    animation: ticker-scroll 60s linear infinite;
    width: max-content;
}

@keyframes ticker-scroll {
    0% { transform: translateX(0); }
    100% { transform: translateX(-50%); }
}

.ticker-item {
    display: inline-flex;
    gap: 0.5em;
    align-items: baseline;
}

.ticker-concept {
    color: var(--compositors-black);
}

.ticker-change {
    font-weight: 400;
}

.ticker-change.positive { color: var(--ledger-green); }
.ticker-change.negative { color: var(--gazette-red); }
.ticker-change.neutral { color: var(--tarnished-brass); }

.ticker-separator {
    color: var(--foxed-page);
}

.ticker-item.active .ticker-concept {
    color: var(--gazette-red);
    transition: color 300ms ease;
}

/* --- Section Common --- */
.section {
    position: relative;
    padding: 5rem 4rem;
    overflow: hidden;
}

.section-header-bar {
    display: flex;
    align-items: center;
    gap: 1.5rem;
    margin-bottom: calc(var(--baseline) * 2);
}

.section-rule-h {
    flex: 1;
    height: 1px;
    background: var(--tarnished-brass);
}

/* --- Column Rules --- */
.column-rules {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    pointer-events: none;
    z-index: 1;
}

.column-rule-line {
    position: absolute;
    top: 0;
    width: 1px;
    height: 100%;
    background: var(--tarnished-brass);
    transform-origin: top center;
    transform: scaleY(0);
    transition: background-color 300ms ease, width 300ms ease;
    pointer-events: auto;
    cursor: default;
}

.column-rule-line:hover {
    background-color: var(--gazette-red);
    width: 2px;
}

.column-rule-line.drawn {
    transform: scaleY(1);
}

/* --- Section: Lead Story --- */
.section-lead {
    background-color: var(--aged-vellum);
}

.lead-content {
    display: grid;
    grid-template-columns: 3fr 1fr;
    gap: 2.5rem;
    position: relative;
    z-index: 2;
}

.lead-main {
    border-right: 1px solid var(--tarnished-brass);
    padding-right: 2.5rem;
}

.lead-body {
    margin-bottom: var(--baseline);
    text-align: justify;
    hyphens: auto;
}

.lead-marginalia {
    padding-top: 0.5rem;
}

.marginalia-note {
    margin-bottom: 1.5rem;
    padding-left: 0.75rem;
    border-left: 1px solid var(--foxed-page);
}

.marginalia-note .marginalia-marker {
    display: block;
    margin-bottom: 0.25rem;
}

.engraved-vignette {
    opacity: 0.15;
    transition: opacity 600ms ease;
    margin-top: 2rem;
}

.engraved-vignette:hover {
    opacity: 0.4;
}

.vignette-svg {
    width: 100%;
    max-width: 120px;
}

/* --- Section: Editorial Spread (Pull Quote) --- */
.section-editorial {
    background-color: var(--pressed-linen);
    min-height: 80vh;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    text-align: center;
    padding: 6rem 8rem;
    position: relative;
}

.editorial-rule-enter {
    width: 0;
    height: 1px;
    background: var(--tarnished-brass);
    margin-bottom: 3rem;
    transition: width 1.5s ease;
}

.editorial-rule-enter.active {
    width: 100%;
}

.editorial-quote {
    max-width: 900px;
}

.quote-text {
    margin-bottom: 2rem;
}

.quote-text span {
    display: inline-block;
    opacity: 0;
    transform: translateY(4px);
}

.quote-text span.revealed {
    opacity: 1;
    transform: translateY(0);
    transition: opacity 200ms ease, transform 200ms ease;
}

.quote-attribution {
    font-family: 'Space Grotesk', sans-serif;
    font-weight: 500;
    letter-spacing: 0.1em;
    font-size: clamp(0.7rem, 0.85vw, 0.8rem);
    text-transform: uppercase;
    color: var(--tarnished-brass);
    opacity: 0;
    transform: translateX(20px);
    transition: opacity 400ms ease, transform 400ms ease;
}

.quote-attribution.revealed {
    opacity: 1;
    transform: translateX(0);
}

.attribution-dash {
    margin-right: 0.5em;
}

/* --- Watermark Layer --- */
.watermark-layer {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 60%;
    max-width: 500px;
    opacity: 0.05;
    pointer-events: none;
    z-index: 0;
}

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

/* --- Section Ornaments --- */
.section-ornament {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 0.75rem;
    padding: 2.5rem 0;
    background-color: var(--aged-vellum);
}

.ornament-diamond {
    width: 8px;
    height: 8px;
    background: var(--tarnished-brass);
    transform: rotate(45deg);
}

.ornament-dot {
    width: 4px;
    height: 4px;
    border-radius: 50%;
    background: var(--tarnished-brass);
}

.ornament-cross {
    position: relative;
    width: 10px;
    height: 10px;
}

.ornament-cross::before,
.ornament-cross::after {
    content: '';
    position: absolute;
    background: var(--tarnished-brass);
}

.ornament-cross::before {
    width: 10px;
    height: 1px;
    top: 50%;
    left: 0;
    transform: translateY(-50%);
}

.ornament-cross::after {
    width: 1px;
    height: 10px;
    left: 50%;
    top: 0;
    transform: translateX(-50%);
}

/* --- Section: Data Folio --- */
.section-data {
    background-color: var(--aged-vellum);
    padding-bottom: 4rem;
}

.data-headline {
    text-align: center;
    margin-bottom: 3rem;
}

.data-table {
    max-width: 800px;
    margin: 0 auto;
}

.data-row {
    display: flex;
    align-items: baseline;
    gap: 1.5rem;
    padding: 0.6rem 0;
    border-bottom: 1px solid var(--foxed-page);
    opacity: 0;
}

.data-row.revealed {
    opacity: 1;
}

.data-date {
    flex-shrink: 0;
    width: 4.5rem;
    color: var(--gazette-red);
    font-weight: 400;
}

.data-separator {
    width: 2rem;
    height: 1px;
    background: var(--tarnished-brass);
    flex-shrink: 0;
    align-self: center;
}

.data-event {
    color: var(--compositors-black);
    line-height: 1.6;
}

.data-event em {
    font-style: italic;
}

.data-cursor {
    display: inline-block;
    width: 1px;
    height: 1em;
    background: var(--compositors-black);
    animation: cursor-blink 1.06s step-end infinite;
    vertical-align: text-bottom;
    margin-left: 2px;
    opacity: 0;
}

.data-cursor.active {
    opacity: 1;
}

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

/* --- Section: Op-Ed --- */
.section-oped {
    background-color: var(--pressed-linen);
    display: flex;
    justify-content: center;
    position: relative;
}

.oped-column {
    max-width: 35%;
    min-width: 320px;
    position: relative;
    z-index: 2;
}

.oped-headline {
    text-align: center;
}

.oped-byline {
    font-family: 'Space Grotesk', sans-serif;
    font-weight: 500;
    letter-spacing: 0.15em;
    font-size: clamp(0.65rem, 0.8vw, 0.72rem);
    text-transform: uppercase;
    color: var(--tarnished-brass);
    text-align: center;
    margin-bottom: 2rem;
}

.oped-body {
    margin-bottom: var(--baseline);
    text-align: justify;
    hyphens: auto;
}

/* --- Section: Supplement --- */
.section-supplement {
    background-color: var(--aged-vellum);
}

.supplement-headline {
    text-align: center;
}

.supplement-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 3rem;
    max-width: 1100px;
    margin: 0 auto;
}

.school-card {
    display: flex;
    gap: 1.5rem;
    padding: 2rem;
    border: 1px solid var(--foxed-page);
    background: var(--aged-vellum);
    transition: border-color 400ms ease;
}

.school-card:hover {
    border-color: var(--tarnished-brass);
}

.school-portrait {
    flex-shrink: 0;
    width: 120px;
    height: 120px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.school-svg {
    width: 100%;
    height: 100%;
}

.school-name {
    font-family: 'Playfair Display', serif;
    font-weight: 900;
    font-size: clamp(1rem, 1.3vw, 1.2rem);
    letter-spacing: 0.08em;
    text-transform: uppercase;
    margin-bottom: 0.25rem;
    color: var(--compositors-black);
}

.school-years {
    font-family: 'Space Grotesk', sans-serif;
    font-weight: 500;
    letter-spacing: 0.12em;
    font-size: 0.7rem;
    text-transform: uppercase;
    color: var(--tarnished-brass);
    margin-bottom: 0.75rem;
}

.school-description {
    font-family: 'Lora', serif;
    font-size: clamp(0.85rem, 0.95vw, 0.95rem);
    line-height: 1.6;
    color: var(--compositors-black);
}

/* --- Section: Back Page --- */
.section-backpage {
    background-color: var(--aged-vellum);
    display: flex;
    flex-direction: column;
    align-items: center;
    padding-bottom: 3rem;
}

.backpage-column {
    max-width: 600px;
    text-align: center;
}

.backpage-headline {
    text-align: center;
    margin-bottom: 2rem;
}

.backpage-body {
    margin-bottom: var(--baseline);
    text-align: justify;
    hyphens: auto;
}

.backpage-body:last-child {
    text-align: center;
    font-family: 'Playfair Display', serif;
    font-weight: 900;
    font-size: 1.2em;
    letter-spacing: 0.05em;
    margin-top: 1.5rem;
}

/* --- Colophon --- */
.colophon {
    margin-top: 4rem;
    text-align: center;
    width: 100%;
    max-width: 500px;
}

.colophon-rule {
    width: 100%;
    height: 1px;
    background: var(--tarnished-brass);
    margin-bottom: 2rem;
}

.colophon-line {
    font-family: 'Space Grotesk', sans-serif;
    font-weight: 500;
    letter-spacing: 0.15em;
    font-size: 0.7rem;
    text-transform: uppercase;
    color: var(--tarnished-brass);
    line-height: 2;
}

.colophon-detail {
    font-size: 0.6rem;
    letter-spacing: 0.1em;
    color: var(--foxed-page);
}

.colophon-small {
    margin-top: 1rem;
    font-size: 0.6rem;
    font-style: italic;
    font-family: 'Lora', serif;
    letter-spacing: 0.05em;
    color: var(--tarnished-brass);
    text-transform: none;
}

/* --- Section Entrance Animations --- */
.section .section-headline,
.section .lead-body,
.section .oped-body,
.section .backpage-body,
.section .school-card,
.section .marginalia-note {
    opacity: 0;
    transform: translateY(8px);
    transition: opacity 400ms ease, transform 400ms ease;
}

.section.in-view .section-headline {
    opacity: 1;
    transform: translateY(0) translateX(0);
}

.section.in-view .lead-body,
.section.in-view .oped-body,
.section.in-view .backpage-body {
    opacity: 1;
    transform: translateY(0);
}

.section.in-view .school-card {
    opacity: 1;
    transform: translateY(0);
}

.section.in-view .marginalia-note {
    opacity: 1;
    transform: translateY(0);
}

/* Section headline slide-in from left */
.section .section-headline {
    transform: translateX(-30px);
}

.section.in-view .section-headline {
    transform: translateX(0);
    transition: opacity 500ms cubic-bezier(0.34, 1.56, 0.64, 1), transform 500ms cubic-bezier(0.34, 1.56, 0.64, 1);
}

/* Engraved vignette entrance */
.section .engraved-vignette {
    opacity: 0;
    transition: opacity 800ms ease;
}

.section.in-view .engraved-vignette {
    opacity: 0.15;
}

.section.in-view .engraved-vignette:hover {
    opacity: 0.4;
    transform: scale(1.03);
}

/* --- Parallax for watermarks --- */
.watermark-layer {
    will-change: transform;
}

/* --- Responsive: Tablet --- */
@media (max-width: 1024px) {
    .section {
        padding: 4rem 2.5rem;
    }

    .lead-content {
        grid-template-columns: 2fr 1fr;
    }

    .supplement-grid {
        grid-template-columns: 1fr;
        max-width: 600px;
    }

    .section-editorial {
        padding: 4rem 3rem;
    }

    .oped-column {
        max-width: 65%;
    }
}

/* --- Responsive: Mobile --- */
@media (max-width: 768px) {
    .section {
        padding: 3rem 1.5rem;
    }

    .lead-content {
        grid-template-columns: 1fr;
    }

    .lead-main {
        border-right: none;
        padding-right: 0;
        border-bottom: 1px solid var(--tarnished-brass);
        padding-bottom: 2rem;
        margin-bottom: 2rem;
    }

    .section-editorial {
        padding: 3rem 1.5rem;
    }

    .oped-column {
        max-width: 100%;
        min-width: unset;
    }

    .supplement-grid {
        grid-template-columns: 1fr;
    }

    .school-card {
        flex-direction: column;
        align-items: center;
        text-align: center;
    }

    .masthead-top-bar {
        flex-direction: column;
        gap: 0.5rem;
    }

    .backpage-column {
        max-width: 100%;
    }

    .quote-text {
        font-size: clamp(1.5rem, 5vw, 2.5rem);
    }
}
