/* ============================================================
   mysterious.day -- anti-design manifesto disguised as celebration
   Palette: muted optimism / Typography: Garamond-classic
   ============================================================ */

:root {
    --bg: #F4F0E8;
    --bg-white: #FFFFFF;
    --void: #E8E2D6;
    --ink: #2B2520;
    --terracotta: #B85C38;
    --jade: #3D6B5E;
    --gold: #C4A35A;
    --sage: #7A8B6F;
    --shadow: #8B7D6B;
    --salmon: #D4856A;

    --serif: "EB Garamond", Georgia, "Times New Roman", serif;
    --hand: "Caveat", "Comic Sans MS", cursive;
    --mono: "IBM Plex Mono", "Menlo", monospace;

    --ease: cubic-bezier(0.25, 0.46, 0.45, 0.94);
}

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

html {
    scroll-behavior: smooth;
}

body {
    background: var(--bg);
    color: var(--ink);
    font-family: var(--serif);
    font-size: 18px;
    line-height: 1.65;
    overflow-x: hidden;
    min-height: 100vh;
    position: relative;
}

/* paper noise overlay -- hand-paper feel */
.paper-noise {
    position: fixed;
    inset: 0;
    pointer-events: none;
    z-index: 1;
    opacity: 0.5;
    background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='200' height='200' viewBox='0 0 200 200'><filter id='n'><feTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='2' stitchTiles='stitch'/><feColorMatrix values='0 0 0 0 0.17 0 0 0 0 0.14 0 0 0 0 0.13 0 0 0 0.06 0'/></filter><rect width='200' height='200' filter='url(%23n)'/></svg>");
    mix-blend-mode: multiply;
}

.mono {
    font-family: var(--mono);
    font-size: 12px;
    color: var(--jade);
    letter-spacing: 0.02em;
    line-height: 1.5;
}

a {
    color: var(--terracotta);
    text-decoration: underline;
    text-decoration-thickness: 1px;
    text-underline-offset: 2px;
}

a:hover {
    color: var(--jade);
    transition: color 200ms ease-out;
}

em {
    font-style: italic;
    color: var(--terracotta);
}

p {
    font-size: 18px;
    line-height: 1.65;
    letter-spacing: 0.005em;
}

/* ============================================================
   Floating compass rose -- the only persistent UI
   ============================================================ */

.compass-rose {
    position: fixed;
    bottom: 24px;
    right: 24px;
    width: 64px;
    height: 64px;
    z-index: 100;
    pointer-events: none;
}

.compass-rose svg {
    width: 100%;
    height: 100%;
}

.compass-spin {
    transform-origin: 50px 50px;
    animation: compass-spin 60s linear infinite;
}

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

/* ============================================================
   Scene container shared
   ============================================================ */

.scene {
    position: relative;
    z-index: 2;
    width: 100%;
}

.section-tag {
    display: inline-block;
    padding: 8px 0;
    color: var(--jade);
}

/* ============================================================
   SCENE 1: SCATTER FIELD
   ============================================================ */

.scatter-field {
    min-height: 100vh;
    padding: 0;
    overflow: hidden;
}

.torii-frame {
    position: absolute;
    top: 28px;
    left: 50%;
    transform: translateX(-50%) rotate(-1.2deg);
    width: min(720px, 88vw);
    height: auto;
    z-index: 3;
    opacity: 0.95;
}

.meta-tag {
    position: absolute;
    z-index: 4;
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.meta-tag--top-left {
    top: 240px;
    left: 47px;
    transform: rotate(-2deg);
}

.meta-tag--top-right {
    top: 260px;
    right: 61px;
    transform: rotate(1.5deg);
}

/* Scattered title letters */
.scatter-title {
    position: relative;
    z-index: 5;
    font-family: var(--serif);
    font-weight: 600;
    font-size: clamp(64px, 9vw, 96px);
    line-height: 1.0;
    letter-spacing: -0.01em;
    color: var(--ink);
    margin: 320px auto 0;
    width: 100%;
    max-width: 1100px;
    text-align: center;
    padding: 0 5vw;
    white-space: nowrap;
    overflow: visible;
}

.scatter-title .letter {
    display: inline-block;
    transform: translate(var(--drift-x), var(--drift-y)) rotate(var(--rot));
    transition: transform 800ms var(--ease), color 600ms var(--ease);
    will-change: transform;
}

.scatter-title.assembled .letter {
    transform: translate(0, 0) rotate(0deg);
}

.scatter-title .letter.dot {
    color: var(--terracotta);
}

/* Manifesto fragments in Caveat handwriting */
.manifesto {
    position: absolute;
    z-index: 4;
    font-family: var(--hand);
    font-weight: 400;
    font-size: 20px;
    line-height: 1.3;
    color: var(--ink);
    max-width: 320px;
}

.manifesto--1 {
    top: 60vh;
    left: 8vw;
    transform: rotate(-3deg);
    color: var(--terracotta);
}

.manifesto--2 {
    top: 70vh;
    right: 6vw;
    transform: rotate(2deg);
    color: var(--jade);
    max-width: 280px;
}

.manifesto--3 {
    top: 86vh;
    left: 38vw;
    transform: rotate(-1.5deg);
    font-size: 18px;
    color: var(--ink);
}

/* Hero marketplace illustration */
.hero-marketplace {
    position: relative;
    z-index: 2;
    width: 100%;
    height: auto;
    margin-top: -40px;
    display: block;
}

.hero-marketplace .stall {
    transform-origin: center bottom;
    animation: float-gentle 3s ease-in-out infinite;
}

.hero-marketplace .stall-1 { animation-delay: 0s; }
.hero-marketplace .stall-2 { animation-delay: 0.6s; }
.hero-marketplace .stall-3 { animation-delay: 1.2s; }
.hero-marketplace .stall-4 { animation-delay: 0.3s; }
.hero-marketplace .stall-5 { animation-delay: 0.9s; }

@keyframes float-gentle {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-2px); }
}

.hero-marketplace .magpie,
.hero-marketplace .sun-face {
    animation: float-gentle 4s ease-in-out infinite;
}

.hero-marketplace .magpie { animation-delay: 0.4s; }
.hero-marketplace .sun-face { animation-delay: 1.5s; }

/* Marginalia anchor links */
.marginalia {
    position: absolute;
    font-family: var(--hand);
    font-size: 16px;
    color: var(--terracotta);
    text-decoration: underline;
    text-decoration-thickness: 1px;
    z-index: 6;
}

.marginalia--scatter {
    bottom: 18px;
    right: 8vw;
    transform: rotate(-2deg);
}

/* ============================================================
   Section dividers (small SVG vignettes)
   ============================================================ */

.divider {
    width: 80px;
    height: 60px;
    margin: 56px auto 56px;
    opacity: 0.65;
    z-index: 2;
    position: relative;
}

.divider svg {
    width: 100%;
    height: 100%;
}

.divider--key { transform: rotate(-3deg); margin-left: 12vw; }
.divider--moon { transform: rotate(4deg); margin-left: auto; margin-right: 14vw; }
.divider--map { transform: rotate(-2deg); margin-left: 32vw; }
.divider--cup { transform: rotate(3deg); margin-left: 60vw; }
.divider--shell { transform: rotate(-5deg); margin-left: 18vw; }

/* ============================================================
   SCENE 2: NARROW CONFESSION
   ============================================================ */

.narrow-confession {
    min-height: 80vh;
    padding: 60px 0 80px;
    background: var(--void);
    position: relative;
    z-index: 2;
}

.floating-lantern {
    position: absolute;
    width: 100px;
    height: 140px;
    top: 50%;
    left: 20%;
    transform: translateY(-50%) rotate(-3deg);
    z-index: 3;
    animation: lantern-float 5s ease-in-out infinite;
}

@keyframes lantern-float {
    0%, 100% { transform: translateY(-50%) rotate(-3deg); }
    50% { transform: translateY(calc(-50% - 6px)) rotate(-1deg); }
}

.confession-column {
    max-width: 340px;
    margin-left: auto;
    margin-right: 5vw;
    padding: 40px 0;
    position: relative;
    z-index: 4;
}

.confession-column p {
    font-size: 18px;
    line-height: 1.7;
    margin-bottom: 18px;
    color: var(--ink);
}

.confession-meta {
    margin-bottom: 12px !important;
    color: var(--jade);
}

.confession-heading {
    font-family: var(--serif);
    font-weight: 600;
    font-size: 32px;
    line-height: 1.15;
    letter-spacing: -0.01em;
    color: var(--ink);
    margin-bottom: 24px;
}

.caveat-aside {
    font-family: var(--hand);
    font-size: 20px;
    line-height: 1.3;
    color: var(--terracotta);
    transform: rotate(-1.5deg);
    margin: 24px 0 !important;
    display: inline-block;
}

.anchor-fragment {
    font-family: var(--hand);
    font-size: 18px;
    color: var(--terracotta);
    text-decoration: underline;
    text-decoration-thickness: 1px;
    display: inline-block;
    transform: rotate(-2deg);
    padding: 0 2px;
}

.anchor-fragment:hover {
    color: var(--jade);
}

/* ============================================================
   SCENE 3: OVERLAP GALLERY
   ============================================================ */

.overlap-gallery {
    min-height: 100vh;
    padding: 80px 5vw 80px;
    position: relative;
    display: grid;
    grid-template-columns: 47px 1fr 23% 180px 2fr 61px;
    grid-template-rows: auto 1fr auto;
    gap: 0;
}

.overlap-gallery .section-tag {
    grid-column: 2 / 3;
    grid-row: 1;
    transform: rotate(-1deg);
    margin-bottom: 24px;
}

.overlap-stage {
    grid-column: 1 / -1;
    grid-row: 2;
    position: relative;
    min-height: 720px;
    margin-top: 40px;
}

.overlap-block {
    position: absolute;
    width: 360px;
    padding: 28px;
    background: var(--bg-white);
    border: 1.5px solid var(--ink);
    z-index: 3;
}

.overlap-block h3 {
    font-family: var(--serif);
    font-weight: 600;
    font-size: 26px;
    line-height: 1.2;
    letter-spacing: -0.01em;
    margin: 16px 0 12px;
    color: var(--ink);
}

.overlap-block p {
    font-size: 17px;
    line-height: 1.55;
    color: var(--ink);
}

.overlap-illustration {
    width: 100%;
    height: 140px;
    display: block;
}

.overlap-block--1 {
    top: 20px;
    left: 6vw;
    transform: rotate(-1.5deg);
    background: #F4F0E8;
}

.overlap-block--2 {
    top: 180px;
    left: calc(6vw + 240px);
    transform: rotate(2deg);
    mix-blend-mode: multiply;
    background: var(--gold);
    background-color: rgba(196, 163, 90, 0.85);
}

.overlap-block--3 {
    top: 360px;
    left: calc(6vw + 480px);
    transform: rotate(-1deg);
    background: var(--bg-white);
}

@media (max-width: 980px) {
    .overlap-gallery {
        grid-template-columns: 1fr;
        padding: 60px 5vw;
    }
    .overlap-gallery .section-tag {
        grid-column: 1;
    }
    .overlap-stage {
        min-height: 1100px;
    }
    .overlap-block {
        width: min(420px, 86vw);
        position: relative;
        margin-bottom: 30px;
    }
    .overlap-block--1 { top: 0; left: 0; }
    .overlap-block--2 { top: -40px; left: 8vw; }
    .overlap-block--3 { top: -60px; left: 4vw; }
}

/* ============================================================
   SCENE 4: SIDEWAYS INTERLUDE
   ============================================================ */

.sideways-interlude {
    min-height: 80vh;
    position: relative;
    overflow: hidden;
    padding: 60px 0;
}

.sideways-bg {
    position: absolute;
    inset: 0;
    background: var(--gold);
    opacity: 0.15;
    z-index: 1;
}

.sideways-tag {
    position: absolute;
    top: 40px;
    left: 47px;
    z-index: 3;
    transform: rotate(-1deg);
}

.sideways-content {
    position: relative;
    z-index: 3;
    height: 70vh;
    display: flex;
    align-items: flex-start;
    justify-content: center;
    padding-top: 80px;
}

.sideways-text {
    font-family: var(--serif);
    font-style: italic;
    font-weight: 500;
    font-size: 36px;
    line-height: 1.25;
    letter-spacing: -0.01em;
    color: var(--ink);
    transform: rotate(-90deg);
    transform-origin: center center;
    white-space: nowrap;
    max-width: none;
}

.sideways-aside {
    position: absolute;
    bottom: 48px;
    right: 5vw;
    z-index: 3;
    transform: rotate(2deg);
    color: var(--jade);
}

@media (max-width: 760px) {
    .sideways-text {
        font-size: 24px;
        white-space: normal;
        max-width: 70vh;
    }
}

/* ============================================================
   SCENE 5: RETURN -- CARDS
   ============================================================ */

.return-cards {
    min-height: 100vh;
    padding: 80px 5vw 80px;
    position: relative;
}

.return-header {
    max-width: 720px;
    margin-bottom: 60px;
    margin-left: 8vw;
}

.return-heading {
    font-family: var(--serif);
    font-weight: 600;
    font-size: 42px;
    line-height: 1.15;
    letter-spacing: -0.01em;
    color: var(--ink);
    margin: 16px 0 12px;
}

.return-aside {
    color: var(--shadow);
    font-size: 22px;
}

.cards-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
    gap: 28px 24px;
    margin-top: 40px;
}

.object-card {
    padding: 20px 18px 22px;
    background: var(--bg-white);
    border-left: 3px solid var(--jade);
    border-top: 1px solid rgba(43, 37, 32, 0.08);
    border-right: 1px solid rgba(43, 37, 32, 0.08);
    border-bottom: 1px solid rgba(43, 37, 32, 0.08);
    position: relative;
    opacity: 0;
    transform: translateY(20px);
    transition: opacity 600ms var(--ease), transform 600ms var(--ease);
}

.object-card:nth-child(odd) {
    transform: translateY(20px) rotate(-0.6deg);
}

.object-card:nth-child(even) {
    transform: translateY(20px) rotate(0.4deg);
}

.object-card.visible {
    opacity: 1;
}

.object-card:nth-child(odd).visible {
    transform: translateY(0) rotate(-0.6deg);
}

.object-card:nth-child(even).visible {
    transform: translateY(0) rotate(0.4deg);
}

.card-illustration {
    width: 100%;
    height: 90px;
    display: block;
    margin-bottom: 12px;
}

.card-title {
    font-family: var(--serif);
    font-weight: 600;
    font-size: 19px;
    line-height: 1.25;
    letter-spacing: -0.005em;
    color: var(--ink);
    margin-bottom: 8px;
}

.card-aside {
    font-family: var(--hand);
    font-size: 16px;
    line-height: 1.3;
    color: var(--terracotta);
    margin-bottom: 12px;
    transform: rotate(-1deg);
    display: inline-block;
}

.card-meta {
    font-family: var(--mono);
    font-size: 11px;
    color: var(--jade);
    letter-spacing: 0.04em;
    text-transform: uppercase;
}

/* ============================================================
   SCENE 6: GENEROUS VOID
   ============================================================ */

.generous-void {
    min-height: 120vh;
    padding: 80px 5vw 40px;
    position: relative;
    background: var(--bg);
    display: flex;
    flex-direction: column;
    justify-content: flex-start;
}

.void-question {
    max-width: 760px;
    margin: 80px auto 0;
    padding: 0 4vw;
    text-align: center;
    position: relative;
    z-index: 2;
}

.void-text {
    font-family: var(--serif);
    font-weight: 500;
    font-size: 48px;
    line-height: 1.2;
    letter-spacing: -0.01em;
    color: var(--ink);
    margin-bottom: 24px;
}

.void-aside {
    color: var(--shadow);
    font-size: 22px;
}

.void-meta {
    position: absolute;
    bottom: 80px;
    left: 5vw;
    color: var(--shadow);
    transform: rotate(-1deg);
}

@media (max-width: 760px) {
    .void-text { font-size: 32px; }
    .return-heading { font-size: 32px; }
    .confession-heading { font-size: 26px; }
    .scatter-title { font-size: clamp(40px, 12vw, 64px); }
    .floating-lantern { display: none; }
}

/* ============================================================
   Reveal-on-scroll classes
   ============================================================ */

.reveal {
    opacity: 0;
    transform: translateY(20px);
    transition: opacity 700ms var(--ease), transform 700ms var(--ease);
}

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

.reveal-from-left {
    opacity: 0;
    transform: translateX(-40px) rotate(-1.5deg);
    transition: opacity 700ms var(--ease), transform 700ms var(--ease);
}

.reveal-from-left.visible {
    opacity: 1;
    transform: translateX(0) rotate(-1.5deg);
}

.reveal-from-right {
    opacity: 0;
    transform: translateX(40px) rotate(2deg);
    transition: opacity 700ms var(--ease), transform 700ms var(--ease);
}

.reveal-from-right.visible {
    opacity: 1;
    transform: translateX(0) rotate(2deg);
}

.reveal-from-bottom {
    opacity: 0;
    transform: translateY(40px) rotate(-1deg);
    transition: opacity 700ms var(--ease), transform 700ms var(--ease);
}

.reveal-from-bottom.visible {
    opacity: 1;
    transform: translateY(0) rotate(-1deg);
}
