/* ============================================================
   GAZZA.NEWS — Victorian Broadsheet Stylesheet
   ============================================================ */

/* --- Color Palette ---
   Gazette Black:     #0A0806
   Aged Gilt:         #C9A96E
   Vellum Cream:      #E8DFD0
   Manuscript Ivory:  #D4CCBA
   Oxidized Bronze:   #7A6C5D
   Sealing Wax:       #8B2E2E
   Sealing Wax Dark:  #5A1A1A
   Copperplate Teal:  #2D5F5F
   Watermark:         #0D0B08
   Tarnished Gilt:    #8B7744
*/

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

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

html {
    scroll-behavior: smooth;
    scrollbar-width: thin;
    scrollbar-color: #7A6C5D #0A0806;
}

html::-webkit-scrollbar {
    width: 6px;
}

html::-webkit-scrollbar-track {
    background: #0A0806;
}

html::-webkit-scrollbar-thumb {
    background: #7A6C5D;
    border-radius: 3px;
}

body {
    background-color: #0A0806;
    color: #D4CCBA;
    font-family: 'Lora', serif;
    font-weight: 400;
    font-size: clamp(0.95rem, 1.2vw, 1.15rem);
    line-height: 1.75;
    letter-spacing: 0.005em;
    overflow-x: hidden;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

/* ============================================================
   SVG FILTERS (hidden)
   ============================================================ */

.svg-filters {
    position: absolute;
    width: 0;
    height: 0;
    overflow: hidden;
}

/* ============================================================
   NOISE OVERLAY — aged paper texture
   ============================================================ */

.noise-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 9999;
    opacity: 0.02;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='300' height='300'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.65' numOctaves='3' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
    background-repeat: repeat;
}

/* ============================================================
   WATERMARK — GN monogram pattern
   ============================================================ */

.watermark {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 0;
    opacity: 0.03;
    background-color: #0D0B08;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='120' height='120' viewBox='0 0 120 120'%3E%3Ctext x='60' y='45' text-anchor='middle' font-family='serif' font-size='28' font-weight='bold' fill='%23E8DFD0'%3EG%3C/text%3E%3Ctext x='60' y='85' text-anchor='middle' font-family='serif' font-size='28' font-weight='bold' fill='%23E8DFD0'%3EN%3C/text%3E%3C/svg%3E");
    background-attachment: fixed;
    background-size: 120px 120px;
}

/* ============================================================
   MAIN CONTENT
   ============================================================ */

#main-content {
    position: relative;
    z-index: 1;
    transition: filter 0.8s ease;
}

#main-content.dimmed {
    filter: brightness(0.85);
}

/* ============================================================
   MASTHEAD UNFURL
   ============================================================ */

.masthead {
    height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    overflow: hidden;
}

.masthead-inner {
    text-align: center;
    position: relative;
    width: 100%;
    max-width: 1200px;
    padding: 0 2rem;
}

/* Ornamental rule container */
.ornamental-rule-container {
    position: relative;
    width: 100%;
    height: 80px;
    margin-bottom: 2rem;
}

.ornamental-rule {
    position: absolute;
    width: 100%;
    height: 40px;
    left: 0;
    transition: transform 0.8s cubic-bezier(0.16, 1, 0.3, 1);
}

.ornamental-rule-top {
    top: 20px;
}

.ornamental-rule-bottom {
    top: 20px;
}

.ornamental-rule-top.split {
    transform: translateY(-30px);
}

.ornamental-rule-bottom.split {
    transform: translateY(30px);
}

.rule-line {
    stroke-dasharray: 1200;
    stroke-dashoffset: 1200;
    animation: drawRule 600ms ease-out 400ms forwards;
}

.rule-flourish-left,
.rule-flourish-right,
.rule-diamond {
    opacity: 0;
    animation: fadeIn 300ms ease-out 800ms forwards;
}

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

@keyframes fadeIn {
    to {
        opacity: 1;
    }
}

/* Masthead title */
.masthead-title {
    font-family: 'Playfair Display SC', serif;
    font-weight: 900;
    font-size: clamp(3rem, 8vw, 7rem);
    letter-spacing: 0.25em;
    text-transform: uppercase;
    color: #C9A96E;
    text-shadow: 0 0 60px rgba(201, 169, 110, 0.15), 0 2px 0 #8B7744;
    opacity: 0;
    animation: fadeIn 500ms ease-out 1200ms forwards;
    margin-bottom: 1.5rem;
}

/* Subtitle characters — typewriter effect */
.masthead-subtitle {
    font-family: 'IM Fell English', serif;
    font-style: italic;
    font-size: clamp(0.8rem, 1vw, 1rem);
    letter-spacing: 0.08em;
    color: #7A6C5D;
    margin-bottom: 1rem;
}

.subtitle-char {
    opacity: 0;
    display: inline-block;
}

/* Generate animation delays for each character */
.subtitle-char:nth-child(1)  { animation: fadeIn 100ms ease-out 1700ms forwards; }
.subtitle-char:nth-child(2)  { animation: fadeIn 100ms ease-out 1780ms forwards; }
.subtitle-char:nth-child(3)  { animation: fadeIn 100ms ease-out 1860ms forwards; }
.subtitle-char:nth-child(4)  { animation: fadeIn 100ms ease-out 1940ms forwards; }
.subtitle-char:nth-child(5)  { animation: fadeIn 100ms ease-out 2020ms forwards; }
.subtitle-char:nth-child(6)  { animation: fadeIn 100ms ease-out 2100ms forwards; }
.subtitle-char:nth-child(7)  { animation: fadeIn 100ms ease-out 2180ms forwards; }
.subtitle-char:nth-child(8)  { animation: fadeIn 100ms ease-out 2260ms forwards; }
.subtitle-char:nth-child(9)  { animation: fadeIn 100ms ease-out 2340ms forwards; }
.subtitle-char:nth-child(10) { animation: fadeIn 100ms ease-out 2420ms forwards; }
.subtitle-char:nth-child(11) { animation: fadeIn 100ms ease-out 2500ms forwards; }

/* Dateline */
.masthead-dateline {
    font-family: 'IM Fell English', serif;
    font-style: italic;
    font-size: clamp(0.75rem, 0.9vw, 0.9rem);
    letter-spacing: 0.08em;
    color: #7A6C5D;
    opacity: 0;
    animation: fadeIn 500ms ease-out 2800ms forwards;
}

/* ============================================================
   ORNAMENTAL BANDS — between editions
   ============================================================ */

.ornamental-band {
    width: 100%;
    height: 40px;
    position: relative;
    overflow: hidden;
    margin: 2rem 0;
}

.band-pattern {
    width: 100%;
    height: 100%;
    background-image:
        radial-gradient(circle at 20px 20px, transparent 12px, rgba(122, 108, 93, 0.12) 12px, rgba(122, 108, 93, 0.12) 13px, transparent 13px),
        radial-gradient(circle at 0 0, transparent 12px, rgba(122, 108, 93, 0.12) 12px, rgba(122, 108, 93, 0.12) 13px, transparent 13px),
        linear-gradient(45deg, transparent 48%, rgba(122, 108, 93, 0.08) 48%, rgba(122, 108, 93, 0.08) 52%, transparent 52%),
        linear-gradient(-45deg, transparent 48%, rgba(122, 108, 93, 0.08) 48%, rgba(122, 108, 93, 0.08) 52%, transparent 52%);
    background-size: 40px 40px;
    opacity: 0.2;
}

/* ============================================================
   EDITION HEADERS
   ============================================================ */

.edition {
    padding: 4rem 2rem;
    max-width: 1200px;
    margin: 0 auto;
}

.edition-header {
    text-align: center;
    margin-bottom: 3rem;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 1.5rem;
}

.edition-title {
    font-family: 'Cormorant Garamond', serif;
    font-weight: 700;
    font-size: clamp(1.8rem, 4vw, 3.2rem);
    line-height: 1.1;
    letter-spacing: 0.02em;
    color: #E8DFD0;
}

.edition-ornament {
    font-size: 1.5em;
    color: #7A6C5D;
    flex-shrink: 0;
}

/* ============================================================
   EDITION I — THREE-COLUMN LAYOUT
   ============================================================ */

.three-columns {
    display: grid;
    grid-template-columns: 2fr 3fr 2fr;
    gap: 0;
    position: relative;
}

.column {
    padding: 0 1.5rem;
    position: relative;
}

.column-narrow {
    position: relative;
}

.column-wide {
    padding: 0 2rem;
}

/* Vertical ornamental rules */
.vertical-rule-svg {
    position: absolute;
    top: 0;
    height: 100%;
    width: 20px;
    z-index: 1;
}

.column-left .vertical-rule-svg {
    right: -10px;
}

.column-right .vertical-rule-svg {
    left: -10px;
}

.vertical-rule-svg svg {
    width: 100%;
    height: 100%;
}

.fleur-rule {
    stroke-dasharray: 4 8;
}

/* Marginal notes */
.marginal-note {
    margin-bottom: 2rem;
    position: relative;
}

.note-marker {
    display: block;
    font-size: 1.5em;
    color: #7A6C5D;
    margin-bottom: 0.5rem;
    text-align: center;
}

.note-text {
    font-family: 'IM Fell English', serif;
    font-style: italic;
    font-size: clamp(0.8rem, 1vw, 1rem);
    letter-spacing: 0.08em;
    color: #7A6C5D;
    line-height: 1.65;
}

/* Article blocks */
.article-block {
    margin-bottom: 2rem;
}

.body-text {
    font-family: 'Lora', serif;
    font-weight: 400;
    font-size: clamp(0.95rem, 1.2vw, 1.15rem);
    line-height: 1.75;
    letter-spacing: 0.005em;
    color: #D4CCBA;
}

/* Drop caps */
.drop-cap {
    float: left;
    font-family: 'Playfair Display SC', serif;
    font-weight: 900;
    font-size: 4.5em;
    line-height: 0.75;
    color: #8B2E2E;
    padding-right: 0.1em;
    padding-top: 0.05em;
    margin-right: 0.05em;
    border: 2px solid transparent;
    border-image: repeating-linear-gradient(
        45deg,
        rgba(201, 169, 110, 0.3) 0px,
        rgba(201, 169, 110, 0.3) 1px,
        transparent 1px,
        transparent 4px
    ) 6;
    shape-outside: margin-box;
}

/* Stagger animation */
.stagger-item {
    opacity: 0;
    transform: translateY(20px);
    transition: opacity 0.5s ease-out, transform 0.5s ease-out;
}

.stagger-item.visible {
    opacity: 1;
    transform: translateY(0);
}

/* ============================================================
   EDITION II — CORRESPONDENCE LAYOUT
   ============================================================ */

.correspondence-layout {
    max-width: 800px;
    margin: 0 auto;
    display: flex;
    flex-direction: column;
    gap: 3rem;
    padding: 0 1rem;
}

.letter-block {
    position: relative;
    padding: 2.5rem 2rem;
    background: rgba(10, 8, 6, 0.6);
    border: 1px solid transparent;
    border-image: repeating-linear-gradient(
        45deg,
        #2D5F5F 0px,
        #2D5F5F 2px,
        transparent 2px,
        transparent 6px
    ) 8;
    box-shadow: 4px 4px 0 #7A6C5D;
    opacity: 0;
    transform: translateX(-60px);
    transition: opacity 0.6s ease-out, transform 0.6s ease-out;
}

.letter-block[data-direction="right"] {
    transform: translateX(60px);
}

.letter-block.visible {
    opacity: 1;
    transform: translateX(0) rotate(0deg);
}

.letter-left.visible {
    transform: rotate(-1deg);
}

.letter-right.visible {
    transform: rotate(1.5deg);
}

.letter-dateline {
    font-family: 'IM Fell English', serif;
    font-style: italic;
    font-size: clamp(0.8rem, 1vw, 1rem);
    letter-spacing: 0.08em;
    color: #C9A96E;
    margin-bottom: 1.2rem;
    padding-bottom: 0.8rem;
    border-bottom: 1px solid rgba(122, 108, 93, 0.3);
}

/* ============================================================
   EDITION III — THE INDEX
   ============================================================ */

.index-layout {
    max-width: 680px;
    margin: 0 auto;
    display: flex;
    flex-direction: column;
    gap: 2rem;
}

.index-entry {
    position: relative;
    padding: 1.2rem 2rem;
    transition: opacity 0.4s ease, transform 0.4s ease;
}

.index-entry.dimmed {
    opacity: 0.3;
    transform: scale(0.97);
}

.index-entry.active {
    opacity: 1;
    transform: scale(1);
}

.index-bracket {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    font-family: 'Cormorant Garamond', serif;
    font-size: 2.5rem;
    color: #C9A96E;
    opacity: 0;
    transition: opacity 0.3s ease, transform 0.3s ease;
    font-weight: 300;
    line-height: 1;
}

.index-bracket-left {
    left: -1rem;
    transform: translateY(-50%) translateX(-10px);
}

.index-bracket-right {
    right: -1rem;
    transform: translateY(-50%) translateX(10px);
}

.index-entry.active .index-bracket {
    opacity: 1;
}

.index-entry.active .index-bracket-left {
    transform: translateY(-50%) translateX(0);
}

.index-entry.active .index-bracket-right {
    transform: translateY(-50%) translateX(0);
}

.index-text {
    font-family: 'Lora', serif;
    font-weight: 400;
    font-size: clamp(0.9rem, 1.1vw, 1.05rem);
    line-height: 1.7;
    color: #D4CCBA;
}

.index-ornament {
    color: #7A6C5D;
    font-size: 1.2em;
    margin-right: 0.3em;
}

/* ============================================================
   COLOPHON
   ============================================================ */

.colophon {
    max-width: 480px;
    margin: 4rem auto;
    padding: 4rem 2rem;
    text-align: center;
    position: relative;
    z-index: 2;
}

.colophon.illuminated {
    filter: brightness(1);
}

/* Wax Seal */
.wax-seal {
    width: 64px;
    height: 64px;
    border-radius: 50%;
    background: radial-gradient(circle at 40% 35%, #8B2E2E 0%, #5A1A1A 100%);
    box-shadow:
        inset 0 2px 8px rgba(0, 0, 0, 0.5),
        inset 0 -1px 4px rgba(139, 46, 46, 0.3),
        0 2px 12px rgba(90, 26, 26, 0.4);
    margin: 0 auto 2rem;
    display: flex;
    align-items: center;
    justify-content: center;
    animation: rotateSeal 30s linear infinite;
    position: relative;
}

.seal-letter {
    font-family: 'Playfair Display SC', serif;
    font-weight: 900;
    font-size: 1.6rem;
    color: rgba(201, 169, 110, 0.6);
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.4);
}

@keyframes rotateSeal {
    from { transform: rotate(0deg); }
    to { transform: rotate(360deg); }
}

.colophon-content {
    opacity: 0;
    transform: translateY(15px);
    transition: opacity 0.8s ease-out, transform 0.8s ease-out;
}

.colophon-content.visible {
    opacity: 1;
    transform: translateY(0);
}

.colophon-text {
    font-family: 'IM Fell English', serif;
    font-style: italic;
    font-size: clamp(0.8rem, 1vw, 1rem);
    letter-spacing: 0.08em;
    color: #7A6C5D;
    line-height: 1.8;
}

.colophon-detail {
    margin-top: 1rem;
    color: #C9A96E;
}

.colophon-rule {
    margin: 1.5rem auto;
    width: 200px;
}

.colophon-rule svg {
    width: 100%;
    height: 20px;
}

.colophon-ornament {
    font-size: 1.5em;
    color: #7A6C5D;
    margin-top: 1rem;
}

/* ============================================================
   HOVER EFFECTS — underline draw on text blocks
   ============================================================ */

.article-block,
.letter-block,
.index-entry {
    position: relative;
}

.article-block::after,
.letter-content::after {
    content: '';
    position: absolute;
    bottom: -2px;
    left: 0;
    width: 0;
    height: 1px;
    background: #C9A96E;
    transition: width 0.4s ease-out;
}

.article-block:hover::after,
.letter-content:hover::after {
    width: 100%;
}

.letter-content {
    position: relative;
}

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

@media (max-width: 900px) {
    .three-columns {
        grid-template-columns: 1fr;
        gap: 2rem;
    }

    .column-narrow {
        display: none;
    }

    .column-wide {
        padding: 0;
    }

    .vertical-rule-svg {
        display: none;
    }

    .letter-block {
        box-shadow: 2px 2px 0 #7A6C5D;
    }

    .letter-left.visible,
    .letter-right.visible {
        transform: rotate(0deg);
    }

    .edition {
        padding: 3rem 1.5rem;
    }

    .index-bracket {
        display: none;
    }
}

@media (max-width: 600px) {
    .masthead-title {
        letter-spacing: 0.12em;
    }

    .edition-header {
        flex-direction: column;
        gap: 0.5rem;
    }

    .edition-ornament:first-child {
        display: none;
    }

    .correspondence-layout {
        gap: 2rem;
    }

    .letter-block {
        padding: 1.5rem 1.2rem;
    }
}

/* ============================================================
   REDUCED MOTION
   ============================================================ */

@media (prefers-reduced-motion: reduce) {
    .rule-line {
        animation: none;
        stroke-dashoffset: 0;
    }

    .rule-flourish-left,
    .rule-flourish-right,
    .rule-diamond {
        animation: none;
        opacity: 1;
    }

    .masthead-title {
        animation: none;
        opacity: 1;
    }

    .subtitle-char {
        animation: none !important;
        opacity: 1;
    }

    .masthead-dateline {
        animation: none;
        opacity: 1;
    }

    .stagger-item {
        opacity: 1;
        transform: none;
        transition: none;
    }

    .letter-block {
        opacity: 1;
        transform: none;
        transition: none;
    }

    .letter-left,
    .letter-right {
        transform: none;
    }

    .colophon-content {
        opacity: 1;
        transform: none;
        transition: none;
    }

    .wax-seal {
        animation: none;
    }

    .ornamental-rule-top,
    .ornamental-rule-bottom {
        transition: none;
    }
}
