/* =============================================
   matchumnews.com - Styles
   Japanese-minimal meets retro-futuristic newsroom
   ============================================= */

/* CSS Custom Properties */
:root {
    --midnight-indigo: #0f1729;
    --ink-navy: #1a2744;
    --starlight-cream: #e8dcc8;
    --copper-patina: #b87333;
    --nebula-teal: #4a8c96;
    --cosmic-dust: #6b7f8a;
    --solar-flare: #d4a04a;
    --void-purple: #2d1f4e;
    --dark-blend: #1a1f35;
    --divider-line: #4a6670;

    --font-display: 'Caveat', cursive;
    --font-body: 'Zen Kaku Gothic New', sans-serif;
    --font-mono: 'Space Mono', monospace;
}

/* 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);
    font-weight: 400;
    color: var(--starlight-cream);
    background: linear-gradient(180deg, var(--midnight-indigo) 0%, var(--dark-blend) 50%, var(--midnight-indigo) 100%);
    background-attachment: fixed;
    line-height: 1.75;
    letter-spacing: 0.005em;
    overflow-x: hidden;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

/* Constellation Field */
#constellation-field {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 0;
    pointer-events: none;
    opacity: 0;
    transition: opacity 800ms ease-in;
}

#constellation-field.visible {
    opacity: 1;
}

#constellation-field .star-dot {
    position: absolute;
    border-radius: 50%;
    background: var(--starlight-cream);
}

/* Loading Overlay */
#loading-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 1000;
    background: var(--midnight-indigo);
    display: flex;
    align-items: center;
    justify-content: center;
    transition: opacity 500ms ease-out;
}

#loading-overlay.fade-out {
    opacity: 0;
    pointer-events: none;
}

#loading-star {
    animation: spin 8s linear infinite;
}

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

/* Main Content */
#main-content {
    position: relative;
    z-index: 1;
    max-width: 680px;
    margin: 0 auto;
    padding: 0 clamp(1.5rem, 5vw, 4rem);
}

#main-content.hidden {
    opacity: 0;
}

#main-content.visible {
    opacity: 1;
    transition: opacity 500ms ease-in;
}

/* Masthead */
#masthead {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 2rem 0;
}

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

.masthead-title {
    font-family: var(--font-display);
    font-weight: 700;
    font-size: clamp(2.4rem, 6vw, 4.8rem);
    line-height: 1.1;
    letter-spacing: 0.01em;
    color: var(--starlight-cream);
    margin-bottom: 0.5rem;
    opacity: 0;
    transform: translateY(12px);
    transition: opacity 500ms ease-out, transform 500ms ease-out;
}

.masthead-title.visible {
    opacity: 1;
    transform: translateY(0);
}

.word-matchum {
    display: inline-block;
    transform: rotate(-1.2deg);
}

.word-news {
    display: inline-block;
    transform: rotate(0.8deg);
    margin-left: 0.3em;
}

.masthead-title span {
    display: inline-block;
    transition: text-shadow 200ms ease-out;
}

.masthead-title span.glow {
    text-shadow: 0 0 8px rgba(184, 115, 51, 0.3);
}

.dateline {
    font-family: var(--font-body);
    font-size: 0.85rem;
    font-weight: 400;
    color: var(--copper-patina);
    letter-spacing: 0.08em;
    text-transform: uppercase;
    margin-bottom: 2.5rem;
    opacity: 0;
    transform: translateY(8px);
    transition: opacity 400ms ease-out, transform 400ms ease-out;
}

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

/* Today's Numbers */
.todays-numbers {
    display: flex;
    justify-content: center;
    gap: 3rem;
    margin-bottom: 3rem;
    opacity: 0;
    transform: translateY(10px);
    transition: opacity 400ms ease-out, transform 400ms ease-out;
}

.todays-numbers.visible {
    opacity: 1;
    transform: translateY(0);
}

.number-metric {
    text-align: center;
}

.metric-value {
    display: block;
    font-family: var(--font-mono);
    font-weight: 400;
    font-size: clamp(1.8rem, 4vw, 3rem);
    color: var(--copper-patina);
    line-height: 1.2;
    transition: color 300ms ease-out, transform 60ms ease-out;
}

.metric-value.flash {
    color: var(--solar-flare);
}

.metric-value.bounce {
    transform: translateY(-2px);
}

.metric-label {
    display: block;
    font-family: var(--font-body);
    font-weight: 500;
    font-size: 0.7rem;
    color: var(--cosmic-dust);
    text-transform: uppercase;
    letter-spacing: 0.1em;
    margin-top: 0.3rem;
}

/* Photography Treatment */
.photo-container {
    position: relative;
    width: 100%;
    margin: 1.5rem 0;
    overflow: hidden;
    border: 2px solid rgba(74, 140, 150, 0.3);
    box-shadow: 0 4px 20px rgba(15, 23, 41, 0.6);
}

.photo-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: var(--void-purple);
    opacity: 0.25;
    mix-blend-mode: luminosity;
    z-index: 1;
    transition: opacity 600ms ease;
    pointer-events: none;
}

.story-image {
    display: block;
    width: 100%;
    height: auto;
    filter: grayscale(0.35) contrast(1.1) brightness(0.85);
    transition: filter 600ms ease;
}

.photo-container:hover .photo-overlay {
    opacity: 0;
}

.photo-container:hover .story-image {
    filter: grayscale(0) contrast(1.05) brightness(1);
}

.hero-photo {
    opacity: 0;
    transform: translateY(30px);
    transition: opacity 400ms ease-out, transform 400ms ease-out, border-color 300ms ease;
}

.hero-photo.visible {
    opacity: 1;
    transform: translateY(0);
}

/* Celestial Dividers */
.celestial-divider {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 60px 0;
    position: relative;
}

.divider-line {
    position: absolute;
    left: 0;
    right: 0;
    height: 1px;
    background: rgba(74, 102, 112, 0.4); /* #4a6670 at 40% */
}

.divider-star {
    position: relative;
    z-index: 1;
    filter: drop-shadow(0 0 3px rgba(184, 115, 51, 0.4));
}

/* Story Blocks */
.story-block {
    margin-bottom: 0;
}

.story-content {
    opacity: 0;
    transform: translateY(20px);
    transition: opacity 400ms ease-out, transform 400ms ease-out;
}

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

.headline-wrapper {
    display: flex;
    align-items: baseline;
    gap: 0.6rem;
    margin-bottom: 0.5rem;
}

.headline-star {
    flex-shrink: 0;
    margin-top: 0.3em;
}

.story-headline {
    font-family: var(--font-display);
    font-weight: 700;
    font-size: clamp(1.6rem, 4vw, 2.8rem);
    line-height: 1.2;
    color: var(--starlight-cream);
    cursor: default;
    position: relative;
}

.story-headline:hover {
    color: var(--starlight-cream);
}

/* SVG underline on hover */
.headline-underline {
    position: absolute;
    bottom: -4px;
    left: 0;
    width: 100%;
    height: 8px;
    overflow: visible;
}

.headline-underline path {
    stroke: var(--nebula-teal);
    stroke-opacity: 0.6;
    stroke-width: 1.5;
    fill: none;
    stroke-dasharray: 1000;
    stroke-dashoffset: 1000;
    transition: stroke-dashoffset 300ms ease-out;
}

.story-headline:hover .headline-underline path {
    stroke-dashoffset: 0;
}

.story-kicker {
    font-family: var(--font-body);
    font-weight: 500;
    font-size: 0.85rem;
    color: var(--nebula-teal);
    text-transform: uppercase;
    letter-spacing: 0.06em;
    margin-bottom: 0.8rem;
}

/* Reading Time */
.reading-time {
    display: flex;
    align-items: baseline;
    gap: 0.4rem;
    margin-bottom: 1rem;
}

.reading-counter {
    font-family: var(--font-mono);
    font-weight: 400;
    font-size: clamp(0.8rem, 1.5vw, 1rem);
    color: var(--copper-patina);
    transition: color 300ms ease-out, transform 60ms ease-out;
    display: inline-block;
}

.reading-counter.flash {
    color: var(--solar-flare);
}

.reading-counter.bounce {
    transform: translateY(-2px);
}

.reading-unit {
    font-family: var(--font-mono);
    font-size: 0.75rem;
    color: var(--cosmic-dust);
}

/* Story Body */
.story-body {
    margin-bottom: 1.2rem;
}

.story-body p {
    font-family: var(--font-body);
    font-weight: 400;
    font-size: clamp(0.95rem, 1.8vw, 1.1rem);
    line-height: 1.75;
    letter-spacing: 0.005em;
    color: var(--starlight-cream);
    text-align: justify;
    text-indent: 1.5em;
    margin-bottom: 1rem;
}

.story-body p:first-child {
    text-indent: 0;
}

.story-byline {
    font-family: var(--font-body);
    font-weight: 500;
    font-size: 0.8rem;
    color: var(--cosmic-dust);
    font-style: italic;
    margin-top: 1rem;
    margin-bottom: 0;
}

/* Margin Annotations */
.margin-annotation {
    position: absolute;
    left: calc(50% - 340px - 120px);
    font-family: var(--font-display);
    font-weight: 700;
    font-size: 0.75rem;
    color: var(--copper-patina);
    opacity: 0.5;
    white-space: nowrap;
    pointer-events: none;
}

.annotation-1 {
    transform: rotate(-3deg);
    margin-top: -2rem;
}

.annotation-2 {
    transform: rotate(4deg);
    margin-top: -1rem;
}

.annotation-3 {
    transform: rotate(-5deg);
    margin-top: -1.5rem;
}

/* Colophon / Footer */
#colophon {
    padding: 0 0 4rem;
    text-align: center;
}

.colophon-text {
    font-family: var(--font-body);
    font-weight: 400;
    font-size: 0.85rem;
    line-height: 1.8;
    color: var(--cosmic-dust);
    font-style: italic;
    text-align: center;
    max-width: 560px;
    margin: 0 auto 2.5rem;
}

.cassiopeia {
    display: flex;
    justify-content: center;
    margin-bottom: 2rem;
}

.copyright {
    font-family: var(--font-mono);
    font-size: 0.7rem;
    color: var(--cosmic-dust);
    opacity: 0.5;
    letter-spacing: 0.1em;
}

/* Scroll reveal animation stagger */
.story-content .story-kicker {
    transition-delay: 100ms;
}

.story-content .photo-container {
    transition-delay: 200ms;
}

.story-content .story-body {
    transition-delay: 300ms;
}

.story-content .story-byline {
    transition-delay: 350ms;
}

/* Responsive */
@media (max-width: 768px) {
    #main-content {
        padding: 0 1.2rem;
    }

    .margin-annotation {
        display: none;
    }

    .todays-numbers {
        gap: 1.5rem;
    }

    .celestial-divider {
        padding: 40px 0;
    }

    .story-body p {
        text-align: left;
        text-indent: 0;
    }
}

@media (max-width: 480px) {
    .todays-numbers {
        flex-direction: column;
        gap: 1rem;
    }
}

/* Selection styling */
::selection {
    background: var(--void-purple);
    color: var(--starlight-cream);
}

/* Scrollbar styling */
::-webkit-scrollbar {
    width: 6px;
}

::-webkit-scrollbar-track {
    background: var(--midnight-indigo);
}

::-webkit-scrollbar-thumb {
    background: rgba(184, 115, 51, 0.3);
    border-radius: 3px;
}

::-webkit-scrollbar-thumb:hover {
    background: rgba(184, 115, 51, 0.5);
}
