/* ============================================
   mechanic.stream — styles.css
   Anti-design editorial + celestial observatory
   ============================================ */

/* --- Custom Properties (Palette) --- */
:root {
    --bg-primary: #f0ede8;        /* Lunar Parchment */
    --bg-secondary: #1a1a24;      /* Deep Observatory */
    --text-primary: #2c2c34;      /* Carbon Ink */
    --text-secondary: #8e8e9a;    /* Pewter Grey */
    --accent-gold: #b8a77c;       /* Faded Gold */
    --accent-violet: #7b6e8a;     /* Dusty Violet */
    --surface-card: #e8e4de;      /* Warm Smoke */
    --shadow-depth: #12121a;      /* Obsidian Mist */
    --text-body-light: #4a4a52;   /* Body text on light surfaces */

    --font-heading: 'Libre Baskerville', 'Georgia', serif;
    --font-body: 'Libre Baskerville', 'Georgia', serif;
    --font-accent: 'Noto Sans', 'Helvetica Neue', sans-serif;
    --font-numeral: 'Playfair Display', 'Georgia', serif;

    --ease-dignified: cubic-bezier(0.25, 0.1, 0.25, 1.0);
}

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

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

body {
    background-color: var(--bg-primary);
    color: var(--text-body-light);
    font-family: var(--font-body);
    font-weight: 400;
    line-height: 1.75;
    letter-spacing: 0.005em;
    overflow: hidden;
}

/* --- Scroll Container (Snap) --- */
.scroll-container {
    height: 100vh;
    overflow-y: scroll;
    scroll-snap-type: y mandatory;
}

/* --- Spread (Full-Viewport Page) --- */
.spread {
    min-height: 100vh;
    scroll-snap-align: start;
    position: relative;
    overflow: hidden;
    display: grid;
}

/* --- Spread Numeral Watermarks --- */
.spread-numeral {
    position: absolute;
    font-family: var(--font-numeral);
    font-weight: 900;
    font-size: clamp(8rem, 20vw, 28rem);
    color: var(--text-primary);
    opacity: 0.05;
    pointer-events: none;
    user-select: none;
    z-index: 0;
    line-height: 1;
}

.spread-1 .spread-numeral {
    bottom: 5%;
    right: 5%;
}

.spread-2 .spread-numeral {
    top: 3%;
    left: 2%;
    color: var(--bg-primary);
    opacity: 0.07;
}

.spread-3 .spread-numeral {
    top: 5%;
    right: 8%;
}

.spread-4 .spread-numeral {
    bottom: 10%;
    left: 50%;
    transform: translateX(-50%);
    opacity: 0.04;
}

/* --- Navigation Trigger (Star) --- */
.nav-trigger {
    position: fixed;
    top: 24px;
    right: 28px;
    z-index: 1000;
    background: none;
    border: none;
    color: var(--accent-gold);
    font-size: 1.1rem;
    cursor: pointer;
    opacity: 0.6;
    transition: opacity 400ms var(--ease-dignified), transform 400ms var(--ease-dignified);
    line-height: 1;
}

.nav-trigger:hover {
    opacity: 1;
    transform: scale(1.2) rotate(15deg);
}

/* --- Navigation Overlay --- */
.nav-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(18, 18, 26, 0.96);
    z-index: 999;
    opacity: 0;
    visibility: hidden;
    transform: scale(0.98);
    transition: opacity 600ms var(--ease-dignified), transform 600ms var(--ease-dignified), visibility 0s 600ms;
    display: flex;
    align-items: center;
    justify-content: center;
}

.nav-overlay.active {
    opacity: 1;
    visibility: visible;
    transform: scale(1);
    transition: opacity 600ms var(--ease-dignified), transform 600ms var(--ease-dignified), visibility 0s 0s;
}

.constellation-map {
    position: relative;
    width: 80%;
    max-width: 700px;
}

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

.constellation-line {
    stroke: var(--text-secondary);
    stroke-width: 0.5;
    opacity: 0.3;
}

.constellation-link circle {
    fill: var(--accent-gold);
    opacity: 0.7;
    transition: opacity 400ms var(--ease-dignified), r 400ms var(--ease-dignified);
    cursor: pointer;
}

.constellation-link:hover circle {
    opacity: 1;
}

.constellation-label {
    fill: var(--bg-primary);
    font-family: var(--font-accent);
    font-weight: 300;
    font-size: 11px;
    text-anchor: middle;
    letter-spacing: 0.18em;
    text-transform: uppercase;
    opacity: 0.5;
    transition: opacity 400ms var(--ease-dignified);
}

.constellation-link:hover .constellation-label {
    opacity: 1;
}

.bg-star {
    position: absolute;
}

/* ============================================
   SPREAD 1 — Hero / Title
   ============================================ */
.spread-1 {
    background-color: var(--bg-primary);
    grid-template-areas:
        "title . ."
        ". orb ."
        ". . stream";
    grid-template-columns: 1fr 1fr 1fr;
    grid-template-rows: 1fr 1.2fr 1fr;
    align-items: center;
    padding: 4vh 5vw;
}

.hero-grid {
    display: contents;
}

.hero-mechanic {
    grid-area: title;
    font-family: var(--font-heading);
    font-weight: 700;
    font-size: clamp(3.5rem, 10vw, 12rem);
    letter-spacing: -0.03em;
    line-height: 0.92;
    color: var(--text-primary);
    align-self: start;
    padding-top: 8vh;
    margin-left: -0.04em;
    z-index: 2;
}

.hero-stream {
    grid-area: stream;
    font-family: var(--font-heading);
    font-weight: 700;
    font-size: clamp(2rem, 5vw, 5rem);
    letter-spacing: -0.03em;
    line-height: 0.92;
    color: var(--text-secondary);
    text-align: right;
    align-self: end;
    padding-bottom: 8vh;
    z-index: 2;
}

/* Celestial Orb */
.celestial-orb-container {
    grid-area: orb;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1;
}

.celestial-orb {
    position: relative;
    width: clamp(180px, 22vw, 320px);
    height: clamp(180px, 22vw, 320px);
    perspective: 800px;
}

.orb-sphere {
    position: absolute;
    inset: 15%;
    border-radius: 50%;
    background: radial-gradient(circle at 35% 35%, #e8e4de, #7b6e8a, #1a1a24);
    box-shadow:
        0 0 60px rgba(123, 110, 138, 0.2),
        inset 0 0 30px rgba(26, 26, 36, 0.3);
}

.orbital-ring {
    position: absolute;
    inset: 0;
    border: 0.5px solid rgba(184, 167, 124, 0.3);
    border-radius: 50%;
}

.ring-1 {
    animation: orbit-1 23s linear infinite;
    transform: rotateX(70deg) rotateY(20deg);
}

.ring-2 {
    animation: orbit-2 37s linear infinite;
    transform: rotateX(40deg) rotateY(60deg);
    inset: -8%;
}

.ring-3 {
    animation: orbit-3 53s linear infinite;
    transform: rotateX(55deg) rotateY(-30deg);
    inset: -4%;
}

@keyframes orbit-1 {
    from { transform: rotateX(70deg) rotateY(20deg) rotateZ(0deg); }
    to   { transform: rotateX(70deg) rotateY(20deg) rotateZ(360deg); }
}

@keyframes orbit-2 {
    from { transform: rotateX(40deg) rotateY(60deg) rotateZ(0deg); }
    to   { transform: rotateX(40deg) rotateY(60deg) rotateZ(360deg); }
}

@keyframes orbit-3 {
    from { transform: rotateX(55deg) rotateY(-30deg) rotateZ(0deg); }
    to   { transform: rotateX(55deg) rotateY(-30deg) rotateZ(360deg); }
}

/* Star Clusters */
.star-cluster {
    position: absolute;
    display: flex;
    gap: 12px;
    align-items: center;
    z-index: 3;
}

.hero-stars {
    bottom: 12%;
    left: 8%;
}

.star-motif {
    transition: fill 400ms var(--ease-dignified);
}

.star-motif:hover {
    fill: var(--accent-gold);
}

/* ============================================
   SPREAD 2 — Manifesto
   ============================================ */
.spread-2 {
    background-color: var(--bg-secondary);
    color: var(--bg-primary);
    grid-template-columns: 1fr;
    align-items: center;
    padding: 0;
}

.manifesto-grid {
    display: grid;
    grid-template-columns: minmax(120px, 25%) 1fr;
    min-height: 100vh;
    gap: 0;
}

.manifesto-image-col {
    position: relative;
    overflow: hidden;
}

.manifesto-image {
    height: 100%;
}

.abstract-strip {
    position: relative;
    width: 100%;
    height: 100vh;
    overflow: hidden;
}

.strip-gradient {
    position: absolute;
    inset: 0;
    background: linear-gradient(
        180deg,
        var(--accent-violet) 0%,
        var(--bg-secondary) 30%,
        var(--accent-gold) 60%,
        var(--bg-secondary) 100%
    );
    opacity: 0.6;
}

.strip-rings {
    position: absolute;
    inset: 0;
}

.manifesto-text-col {
    padding: clamp(2rem, 6vw, 6rem);
    padding-left: clamp(2rem, 4vw, 5rem);
    display: flex;
    flex-direction: column;
    justify-content: center;
    gap: 2rem;
}

.manifesto-body {
    font-family: var(--font-body);
    font-weight: 400;
    font-size: clamp(1rem, 1.2vw, 1.25rem);
    line-height: 1.75;
    color: rgba(240, 237, 232, 0.85);
    max-width: 52ch;
}

.manifesto-body strong {
    font-weight: 700;
    color: var(--accent-gold);
    font-style: normal;
}

.manifesto-separator {
    display: flex;
    justify-content: flex-start;
    padding: 0.5rem 0;
}

.rotated-annotation {
    position: absolute;
    left: 18px;
    bottom: 50%;
    transform: rotate(-90deg) translateX(50%);
    transform-origin: left bottom;
    font-family: var(--font-accent);
    font-weight: 300;
    font-size: 0.7rem;
    letter-spacing: 0.18em;
    text-transform: uppercase;
    color: var(--text-secondary);
    opacity: 0.5;
    white-space: nowrap;
}

/* ============================================
   SPREAD 3 — Gallery / Stream
   ============================================ */
.spread-3 {
    background-color: var(--bg-primary);
    grid-template-columns: 1fr;
    align-items: center;
    justify-items: center;
    padding: 4vh 4vw;
}

.gallery-scatter {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    grid-template-rows: auto auto;
    gap: 24px 32px;
    max-width: 1100px;
    width: 100%;
    position: relative;
}

.gallery-card {
    background: var(--surface-card);
    border: 0.5px solid var(--text-secondary);
    border-radius: 0;
    padding: 0;
    transform: rotate(var(--rotate, 0deg));
    transition: transform 500ms var(--ease-dignified), box-shadow 500ms var(--ease-dignified);
    position: relative;
    overflow: hidden;
}

.gallery-card:hover {
    transform: rotate(0deg) translateY(-4px);
    box-shadow: 0 12px 40px rgba(18, 18, 26, 0.1);
}

.card-visual {
    height: 180px;
    overflow: hidden;
    position: relative;
    background: linear-gradient(135deg, var(--bg-primary) 0%, var(--surface-card) 100%);
}

.card-visual-narrow {
    height: 80px;
}

.card-label {
    display: block;
    font-family: var(--font-heading);
    font-weight: 700;
    font-size: 0.95rem;
    padding: 14px 16px 4px;
    color: var(--text-primary);
}

.card-meta {
    display: block;
    font-family: var(--font-accent);
    font-weight: 300;
    font-size: 0.7rem;
    letter-spacing: 0.18em;
    text-transform: uppercase;
    padding: 0 16px 14px;
    color: var(--text-secondary);
}

/* Card visuals */
.card-orb {
    width: 80px;
    height: 80px;
    border-radius: 50%;
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
}

.card-orb-1 {
    background: radial-gradient(circle at 40% 40%, var(--surface-card), var(--accent-violet), var(--bg-secondary));
    box-shadow: 0 0 30px rgba(123, 110, 138, 0.25);
}

.card-orb-2 {
    background: radial-gradient(circle at 40% 40%, var(--accent-gold), var(--accent-violet), var(--shadow-depth));
    box-shadow: 0 0 30px rgba(184, 167, 124, 0.2);
    width: 60px;
    height: 60px;
}

.card-gradient-band {
    position: absolute;
    inset: 0;
    background: linear-gradient(90deg,
        transparent 0%,
        var(--accent-violet) 20%,
        var(--accent-gold) 50%,
        var(--accent-violet) 80%,
        transparent 100%
    );
    opacity: 0.4;
    top: 50%;
    height: 4px;
    transform: translateY(-50%);
}

.card-constellation {
    width: 100%;
    height: 100%;
}

.card-wireframe-sphere {
    width: 90px;
    height: 90px;
    border-radius: 50%;
    border: 0.5px solid var(--text-secondary);
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    box-shadow: inset 0 0 0 0.5px rgba(142, 142, 154, 0.2);
}

.card-wireframe-sphere::before {
    content: '';
    position: absolute;
    inset: 10%;
    border-radius: 50%;
    border: 0.5px solid rgba(142, 142, 154, 0.3);
}

.card-wireframe-sphere::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 0;
    right: 0;
    height: 0.5px;
    background: rgba(142, 142, 154, 0.3);
    transform: translateY(-50%);
}

.card-strip-image {
    position: absolute;
    inset: 0;
    background: linear-gradient(180deg,
        var(--accent-gold) 0%,
        var(--accent-violet) 40%,
        var(--bg-secondary) 100%
    );
    opacity: 0.35;
}

/* Card overlap effects */
.card-1 { z-index: 3; }
.card-2 { z-index: 2; margin-top: 24px; }
.card-3 { z-index: 4; margin-top: -12px; }
.card-4 { z-index: 1; }
.card-5 { z-index: 5; margin-top: -20px; }
.card-6 { z-index: 2; margin-top: 16px; }

.gallery-stars {
    bottom: 6%;
    right: 10%;
}

/* ============================================
   SPREAD 4 — Index / Close
   ============================================ */
.spread-4 {
    background-color: var(--bg-primary);
    grid-template-columns: 1fr;
    align-items: center;
    justify-items: center;
    padding: 8vh 4vw;
}

.index-column {
    max-width: 560px;
    width: 100%;
}

.index-list {
    list-style: none;
}

.index-item {
    display: flex;
    align-items: baseline;
    gap: 1rem;
    padding: 1.2rem 0;
    border-bottom: 0.5px solid rgba(142, 142, 154, 0.2);
    transition: padding-left 400ms var(--ease-dignified);
}

.index-item:hover {
    padding-left: 8px;
}

.index-item:hover .index-star {
    fill: var(--accent-gold);
}

.index-number {
    font-family: var(--font-numeral);
    font-weight: 900;
    font-size: 1.1rem;
    color: var(--accent-gold);
    min-width: 2.5rem;
    opacity: 0.7;
}

.index-title {
    font-family: var(--font-body);
    font-weight: 400;
    font-style: italic;
    font-size: clamp(1rem, 1.2vw, 1.25rem);
    color: var(--text-primary);
    flex: 1;
}

.index-star {
    flex-shrink: 0;
    opacity: 0.4;
    transition: fill 400ms var(--ease-dignified), opacity 400ms var(--ease-dignified);
}

.index-item:hover .index-star {
    opacity: 1;
}

.index-footer {
    margin-top: 3rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.index-meta {
    font-family: var(--font-accent);
    font-weight: 300;
    font-size: 0.7rem;
    letter-spacing: 0.18em;
    text-transform: uppercase;
    color: var(--text-secondary);
}

.footer-stars {
    display: flex;
    gap: 8px;
}

/* ============================================
   FADE-REVEAL ANIMATION SYSTEM
   ============================================ */
.fade-element {
    opacity: 0;
    transform: translateY(16px);
    transition: opacity 800ms var(--ease-dignified), transform 800ms var(--ease-dignified);
}

.fade-element.visible {
    opacity: 1;
    transform: translateY(0);
}

/* Numeral watermarks don't translate, only fade */
.spread-numeral.fade-element {
    transform: none;
}

.spread-numeral.fade-element.visible {
    transform: none;
}

/* Restore low opacity for numeral watermarks when visible */
.spread-1 .spread-numeral.visible { opacity: 0.05; }
.spread-2 .spread-numeral.visible { opacity: 0.07; }
.spread-3 .spread-numeral.visible { opacity: 0.05; }
.spread-4 .spread-numeral.visible { opacity: 0.04; }

/* Image fade (pure opacity, no translate) */
.manifesto-image.fade-element {
    transform: none;
}

.manifesto-image.fade-element.visible {
    transform: none;
}

/* Star cascade delay */
.star-cluster .star-motif:nth-child(1) { transition-delay: 0ms; }
.star-cluster .star-motif:nth-child(2) { transition-delay: 200ms; }
.star-cluster .star-motif:nth-child(3) { transition-delay: 400ms; }

/* Index items cascade */
.index-item.fade-element:nth-child(1) { transition-delay: 0ms; }
.index-item.fade-element:nth-child(2) { transition-delay: 100ms; }
.index-item.fade-element:nth-child(3) { transition-delay: 200ms; }
.index-item.fade-element:nth-child(4) { transition-delay: 300ms; }
.index-item.fade-element:nth-child(5) { transition-delay: 400ms; }
.index-item.fade-element:nth-child(6) { transition-delay: 500ms; }
.index-item.fade-element:nth-child(7) { transition-delay: 600ms; }

/* Gallery cards cascade */
.gallery-card.fade-element:nth-child(1) { transition-delay: 0ms; }
.gallery-card.fade-element:nth-child(2) { transition-delay: 100ms; }
.gallery-card.fade-element:nth-child(3) { transition-delay: 200ms; }
.gallery-card.fade-element:nth-child(4) { transition-delay: 300ms; }
.gallery-card.fade-element:nth-child(5) { transition-delay: 400ms; }
.gallery-card.fade-element:nth-child(6) { transition-delay: 500ms; }

/* ============================================
   LINK HOVER — Star ::after
   ============================================ */
a {
    color: var(--accent-gold);
    text-decoration: none;
    transition: color 300ms var(--ease-dignified);
    position: relative;
}

a:hover {
    color: var(--accent-gold);
}

a::after {
    content: '';
    display: inline-block;
    width: 10px;
    height: 10px;
    margin-left: 4px;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpolygon points='12,2 15,9 22,9 16,14 18,21 12,17 6,21 8,14 2,9 9,9' fill='none' stroke='%23b8a77c' stroke-width='2'/%3E%3C/svg%3E");
    background-size: contain;
    background-repeat: no-repeat;
    vertical-align: middle;
    opacity: 0;
    transition: opacity 300ms var(--ease-dignified);
}

a:hover::after {
    opacity: 1;
}

/* ============================================
   RESPONSIVE
   ============================================ */
@media (max-width: 768px) {
    .spread-1 {
        grid-template-areas:
            "title"
            "orb"
            "stream";
        grid-template-columns: 1fr;
        grid-template-rows: 1fr 1.5fr 1fr;
        padding: 4vh 6vw;
    }

    .hero-mechanic {
        text-align: left;
    }

    .hero-stream {
        text-align: right;
    }

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

    .manifesto-image-col {
        display: none;
    }

    .manifesto-text-col {
        padding: 8vh 6vw;
    }

    .gallery-scatter {
        grid-template-columns: 1fr 1fr;
        gap: 16px;
    }

    .card-5,
    .card-6 {
        display: none;
    }

    .rotated-annotation {
        display: none;
    }
}

@media (max-width: 480px) {
    .gallery-scatter {
        grid-template-columns: 1fr;
    }

    .gallery-card {
        transform: rotate(0deg);
    }

    .celestial-orb {
        width: 160px;
        height: 160px;
    }

    .index-item {
        gap: 0.6rem;
    }
}
