/* mysterious.day v2 -- Swiss aesthetic, immersive-scroll, sunset-warm palette */

:root {
    --sunset-orange: #E8A050;
    --sunset-red: #D85838;
    --twilight-purple: #1A1028;
    --day-cream: #FAF5E0;
    --mystery-gray: #6A6A78;
    --star-white: #F0EDE0;
    --dusk-blue: #3A4868;
    --scroll-progress: 0;
    --gutter: 24px;
    --max-content: 1240px;
}

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

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

body {
    font-family: 'Albert Sans', sans-serif;
    font-weight: 400;
    color: var(--day-cream);
    background-color: var(--twilight-purple);
    background-image: linear-gradient(
        180deg,
        var(--sunset-orange) 0%,
        var(--sunset-red) 18%,
        var(--twilight-purple) 48%,
        var(--dusk-blue) 100%
    );
    background-attachment: fixed;
    background-size: 100% 320vh;
    background-position: 0 calc(var(--scroll-progress) * -220vh);
    min-height: 100vh;
    overflow-x: hidden;
    line-height: 1.8;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

/* --- Star-celestial dot field --- */
#star-field {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 0;
}

.star-dot {
    position: absolute;
    width: 2px;
    height: 2px;
    background: var(--star-white);
    border-radius: 50%;
    opacity: 0;
    transition: opacity 0.6s ease;
}

.star-dot.visible {
    opacity: var(--star-opacity, 0.3);
}

.star-dot.bright {
    opacity: 1 !important;
    box-shadow: 0 0 6px rgba(240, 237, 224, 0.45);
}

/* --- Swiss grid rules --- */
#grid-rules {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 1;
    display: grid;
    grid-template-columns: repeat(12, 1fr);
    gap: var(--gutter);
    padding: 0 var(--gutter);
}

.grid-rule {
    border-right: 1px solid var(--mystery-gray);
    opacity: 0.07;
    transition: opacity 0.3s ease;
    height: 100%;
}

/* --- Main content --- */
#main-content {
    position: relative;
    z-index: 2;
}

/* --- Observatory gate (hero) --- */
#observatory-gate {
    min-height: 100vh;
    display: grid;
    grid-template-columns: repeat(12, 1fr);
    gap: var(--gutter);
    align-content: center;
    padding: 80px var(--gutter);
    max-width: var(--max-content);
    margin: 0 auto;
    position: relative;
}

.gate-meta {
    grid-column: 3 / 11;
    display: flex;
    justify-content: space-between;
    font-family: 'Albert Sans', sans-serif;
    font-weight: 300;
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: 0.18em;
    color: var(--day-cream);
    opacity: 0;
    animation: fadeInTitle 800ms ease 200ms forwards;
    margin-bottom: 32px;
}

#site-title {
    grid-column: 3 / 11;
    font-family: 'Albert Sans', sans-serif;
    font-weight: 700;
    font-size: clamp(40px, 8vw, 96px);
    letter-spacing: -0.025em;
    color: var(--day-cream);
    line-height: 1;
    opacity: 0;
    animation: fadeInTitle 900ms ease forwards;
}

.gate-tagline {
    grid-column: 3 / 11;
    font-family: 'Albert Sans', sans-serif;
    font-weight: 400;
    font-style: italic;
    font-size: clamp(15px, 1.4vw, 19px);
    letter-spacing: 0;
    color: var(--day-cream);
    margin-top: 28px;
    max-width: 620px;
    opacity: 0;
    animation: fadeInTitle 800ms ease 600ms forwards;
}

.gate-rule {
    grid-column: 3 / 11;
    height: 1px;
    background: var(--day-cream);
    opacity: 0;
    margin-top: 56px;
    animation: ruleGrow 1100ms ease 900ms forwards;
    transform-origin: left center;
    transform: scaleX(0);
}

.scroll-hint {
    grid-column: 3 / 11;
    font-family: 'Albert Sans', sans-serif;
    font-weight: 300;
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.32em;
    color: var(--day-cream);
    opacity: 0;
    margin-top: 18px;
    animation: fadeInTitle 800ms ease 1300ms forwards, scrollPulse 2.4s ease 2100ms infinite;
}

@keyframes fadeInTitle {
    from { opacity: 0; transform: translateY(8px); }
    to   { opacity: 1; transform: translateY(0); }
}

@keyframes ruleGrow {
    from { opacity: 0; transform: scaleX(0); }
    to   { opacity: 0.65; transform: scaleX(1); }
}

@keyframes scrollPulse {
    0%, 100% { opacity: 0.6; }
    50%      { opacity: 1; }
}

/* --- Mystery stream --- */
#mystery-stream {
    max-width: var(--max-content);
    margin: 0 auto;
    padding: 0 var(--gutter);
    display: grid;
    grid-template-columns: repeat(12, 1fr);
    gap: 0 var(--gutter);
}

/* --- Stream section headers --- */
.stream-header {
    grid-column: 3 / 11;
    padding: 96px 0 32px;
    border-top: 1px solid var(--day-cream);
    margin-top: 64px;
    opacity: 0.92;
}

.stream-label {
    display: block;
    font-family: 'Albert Sans', sans-serif;
    font-weight: 500;
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.32em;
    color: var(--sunset-orange);
    margin-bottom: 18px;
}

.stream-title {
    font-family: 'Albert Sans', sans-serif;
    font-weight: 700;
    font-size: clamp(28px, 3.4vw, 52px);
    letter-spacing: -0.018em;
    line-height: 1.1;
    color: var(--day-cream);
    margin-bottom: 18px;
}

.stream-intro {
    font-family: 'Albert Sans', sans-serif;
    font-weight: 400;
    font-style: italic;
    font-size: clamp(15px, 1.1vw, 17px);
    color: var(--day-cream);
    opacity: 0.85;
    max-width: 640px;
    line-height: 1.7;
}

/* --- Mystery entries --- */
.mystery-entry {
    grid-column: 3 / 11;
    padding: 80px 0;
    position: relative;
    border-bottom: 1px solid rgba(106, 106, 120, 0.25);
}

.mystery-entry:last-of-type {
    border-bottom: none;
}

.mystery-meta {
    display: block;
    font-family: 'Albert Sans', sans-serif;
    font-weight: 300;
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: 0.14em;
    color: var(--mystery-gray);
    margin-bottom: 18px;
}

.mystery-headline {
    font-family: 'Albert Sans', sans-serif;
    font-weight: 700;
    font-size: clamp(24px, 3vw, 44px);
    letter-spacing: -0.012em;
    color: var(--day-cream);
    margin-bottom: 26px;
    transition: color 0.25s ease;
    cursor: default;
    line-height: 1.18;
}

.mystery-headline:hover {
    color: var(--sunset-orange);
}

.mystery-body {
    font-family: 'Albert Sans', sans-serif;
    font-weight: 400;
    font-size: clamp(15px, 1vw, 17px);
    line-height: 1.8;
    color: var(--day-cream);
    max-width: 68ch;
    opacity: 0.92;
}

.mystery-quote {
    margin-top: 28px;
    padding-left: 20px;
    border-left: 2px solid var(--sunset-orange);
    font-family: 'Albert Sans', sans-serif;
    font-weight: 600;
    font-size: clamp(18px, 2vw, 24px);
    letter-spacing: -0.005em;
    line-height: 1.4;
    color: var(--sunset-orange);
    max-width: 62ch;
}

/* --- Duotone bands --- */
.duotone-band {
    grid-column: 1 / -1;
    margin: 56px 0;
    overflow: hidden;
    position: relative;
}

.duotone-image {
    width: 100%;
    height: 320px;
    background-size: cover;
    background-position: center;
    filter: grayscale(1) sepia(0.5) hue-rotate(-10deg) contrast(1.1);
    transform: scale(0.98);
    transition: transform 700ms cubic-bezier(0.22, 0.61, 0.36, 1), filter 700ms ease;
}

.duotone-band.in-view .duotone-image {
    transform: scale(1);
    filter: grayscale(0.85) sepia(0.45) hue-rotate(-10deg) contrast(1.12);
}

.duotone-caption {
    display: block;
    margin-top: 12px;
    padding: 0 var(--gutter);
    max-width: var(--max-content);
    margin-left: auto;
    margin-right: auto;
    font-family: 'Albert Sans', sans-serif;
    font-weight: 300;
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.18em;
    color: var(--mystery-gray);
}

/* --- Stream footer --- */
.stream-footer {
    grid-column: 3 / 11;
    padding: 96px 0 120px;
    text-align: left;
}

.footer-rule {
    height: 1px;
    background: var(--day-cream);
    opacity: 0.4;
    margin-bottom: 32px;
}

.footer-line {
    font-family: 'Albert Sans', sans-serif;
    font-weight: 600;
    font-size: clamp(16px, 1.4vw, 20px);
    letter-spacing: -0.005em;
    color: var(--day-cream);
    margin-bottom: 12px;
}

.footer-coord {
    font-family: 'Albert Sans', sans-serif;
    font-weight: 300;
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.22em;
    color: var(--mystery-gray);
}

/* --- Reality-glitch shake --- */
@keyframes shakeGlitch {
    0%   { transform: translateX(0); }
    10%  { transform: translateX(-2px); }
    22%  { transform: translateX(2px); }
    34%  { transform: translateX(-2px); }
    46%  { transform: translateX(2px); }
    58%  { transform: translateX(-2px); }
    70%  { transform: translateX(2px); }
    82%  { transform: translateX(-1px); }
    100% { transform: translateX(0); }
}

#main-content.shaking {
    animation: shakeGlitch 150ms ease-in-out;
}

/* --- Reveal-on-scroll --- */
.reveal {
    opacity: 0;
    transform: translateY(14px);
    transition: opacity 700ms ease, transform 700ms cubic-bezier(0.22, 0.61, 0.36, 1);
}

.reveal.in-view {
    opacity: 1;
    transform: translateY(0);
}

/* --- Responsive --- */
@media (max-width: 900px) {
    .gate-meta,
    #site-title,
    .gate-tagline,
    .gate-rule,
    .scroll-hint,
    .stream-header,
    .mystery-entry,
    .stream-footer {
        grid-column: 2 / 12;
    }

    .gate-meta {
        flex-direction: column;
        gap: 6px;
    }

    .duotone-image {
        height: 240px;
    }
}

@media (max-width: 640px) {
    :root { --gutter: 16px; }

    .gate-meta,
    #site-title,
    .gate-tagline,
    .gate-rule,
    .scroll-hint,
    .stream-header,
    .mystery-entry,
    .stream-footer {
        grid-column: 1 / -1;
    }

    #observatory-gate {
        padding: 64px var(--gutter);
    }

    .mystery-entry {
        padding: 56px 0;
    }

    .stream-header {
        padding: 64px 0 24px;
        margin-top: 32px;
    }

    .duotone-image {
        height: 180px;
    }

    .grid-rule {
        display: none;
    }
}

@media (max-width: 420px) {
    #site-title {
        font-size: clamp(34px, 12vw, 56px);
    }
}

@media (prefers-reduced-motion: reduce) {
    html { scroll-behavior: auto; }
    .reveal { opacity: 1; transform: none; transition: none; }
    .star-dot { transition: none; }
    #main-content.shaking { animation: none; }
    .scroll-hint { animation: fadeInTitle 800ms ease forwards; }
}
