/* ============================================
   GGIGGL.com - Wabi-Sabi Astronomical Design
   ============================================ */

:root {
    /* Palette */
    --deep-observatory-navy: #0B0E1A;
    --midnight-panel: #131729;
    --slate-indent: #1A1F35;
    --tarnished-silver: #C5C1D0;
    --pewter-mist: #8A8699;
    --oxidized-copper: #7A6853;
    --aged-brass: #B8976A;
    --nebula-blue: #4A6FA5;
    --kiln-ember: #8B4A3A;

    /* Annotation ink */
    --sepia-ink: #D4CFC0;

    /* Typography */
    --font-headline: 'Cormorant Garamond', serif;
    --font-body: 'IBM Plex Sans', sans-serif;
    --font-annotation: 'Caveat', cursive;

    /* Easing */
    --ease-celestial: cubic-bezier(0.25, 0.1, 0.25, 1.0);
}

/* ---- Reset & Base ---- */

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

html {
    scroll-behavior: smooth;
    background-color: var(--deep-observatory-navy);
}

body {
    font-family: var(--font-body);
    font-weight: 300;
    font-size: 1.125rem;
    line-height: 1.85;
    color: var(--tarnished-silver);
    background-color: var(--deep-observatory-navy);
    overflow-x: hidden;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

/* ---- Noise Texture Overlay ---- */

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

/* ---- Fixed Star Navigation ---- */

#star-nav {
    position: fixed;
    top: 1.5rem;
    left: 1.5rem;
    z-index: 1000;
    background: none;
    border: none;
    color: var(--oxidized-copper);
    cursor: pointer;
    opacity: 0.6;
    transition: opacity 0.6s var(--ease-celestial), color 0.6s var(--ease-celestial);
    padding: 0.5rem;
}

#star-nav:hover {
    opacity: 1;
    color: var(--aged-brass);
}

/* ---- Observation Plates ---- */

.observation-plate {
    position: relative;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    background-color: var(--deep-observatory-navy);
    overflow: hidden;
}

.observation-plate:nth-child(even) {
    background-color: var(--midnight-panel);
}

/* ---- Plate Starfields ---- */

.plate-starfield {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
}

/* ---- Constellation Lines ---- */

.constellation-lines {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 1;
}

.constellation-line {
    stroke: var(--pewter-mist);
    stroke-width: 0.15;
    stroke-opacity: 0.3;
}

.constellation-star {
    fill: var(--tarnished-silver);
    opacity: 0.6;
}

/* ---- Focal Stars ---- */

.focal-star {
    width: 12px;
    height: 12px;
    position: relative;
    z-index: 2;
    animation: starPulse 6s var(--ease-celestial) infinite;
}

.focal-star::before,
.focal-star::after {
    content: '';
    position: absolute;
    background-color: var(--aged-brass);
}

.focal-star::before {
    top: 0;
    left: 50%;
    transform: translateX(-50%);
    width: 2px;
    height: 100%;
    border-radius: 1px;
}

.focal-star::after {
    top: 50%;
    left: 0;
    transform: translateY(-50%);
    width: 100%;
    height: 2px;
    border-radius: 1px;
}

.focal-star--section {
    position: absolute;
    z-index: 2;
}

.focal-star--hero {
    margin: 0 auto 2rem;
}

@keyframes starPulse {
    0%, 100% { opacity: 0.7; }
    50% { opacity: 1.0; }
}

/* ---- Plate Content ---- */

.plate-content {
    position: relative;
    z-index: 3;
    max-width: 680px;
    width: 100%;
    padding: 4rem 2rem;
}

.plate-content--centered {
    text-align: center;
    margin: 0 auto;
}

.plate-content--left {
    margin-left: 8%;
    margin-right: auto;
}

.plate-content--right {
    margin-left: auto;
    margin-right: 8%;
}

/* ---- Hero Section ---- */

.plate-hero {
    background-color: var(--deep-observatory-navy);
}

.hero-title {
    font-family: var(--font-headline);
    font-weight: 300;
    font-size: 4.5rem;
    letter-spacing: 0.15em;
    color: var(--tarnished-silver);
    text-shadow: 0 0 40px rgba(192, 192, 210, 0.08);
    opacity: 0;
    transition: opacity 1.5s var(--ease-celestial);
}

.hero-title.visible {
    opacity: 1;
}

.hero-tagline {
    font-size: 1.1rem;
    color: var(--sepia-ink);
    margin-top: 1.5rem;
    opacity: 0;
    transition: opacity 1.2s var(--ease-celestial);
}

.hero-tagline.visible {
    opacity: 1;
}

#hero-star {
    opacity: 0;
    transition: opacity 1s var(--ease-celestial);
}

#hero-star.visible {
    opacity: 1;
}

/* ---- Typography ---- */

.section-title {
    font-family: var(--font-headline);
    font-weight: 600;
    font-size: 2.5rem;
    letter-spacing: -0.01em;
    color: var(--tarnished-silver);
    text-shadow: 0 0 40px rgba(192, 192, 210, 0.08);
    margin-bottom: 2rem;
}

.body-text {
    font-family: var(--font-body);
    font-weight: 300;
    font-size: 1.125rem;
    line-height: 1.85;
    color: var(--tarnished-silver);
    margin-bottom: 1.5rem;
}

.body-text em {
    font-weight: 500;
    font-style: italic;
    color: var(--aged-brass);
}

.caveat {
    font-family: var(--font-annotation);
    font-weight: 400;
}

/* ---- Annotations ---- */

.annotation {
    position: absolute;
    font-size: 0.95rem;
    color: var(--sepia-ink);
    opacity: 0.65;
    white-space: nowrap;
    pointer-events: none;
}

/* ---- Vintage Plate Images ---- */

.plate-wide-image {
    width: 90vw;
    max-width: 90vw;
    margin: 4rem auto;
    position: relative;
    z-index: 2;
}

.vintage-plate {
    position: relative;
    border-radius: 2px;
    border: 1px solid rgba(122, 104, 83, 0.4);
    overflow: hidden;
}

.vintage-plate::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: var(--nebula-blue);
    mix-blend-mode: luminosity;
    opacity: 0.15;
    pointer-events: none;
}

.vintage-plate-image {
    width: 100%;
    height: 320px;
    background-color: var(--midnight-panel);
    filter: grayscale(0.7) contrast(1.2) brightness(0.85) sepia(0.15);
}

/* Astro plate 1: starfield-like gradient */
#astro-plate-1 {
    background:
        radial-gradient(1px 1px at 15% 30%, var(--tarnished-silver) 50%, transparent 100%),
        radial-gradient(1px 1px at 45% 60%, var(--tarnished-silver) 50%, transparent 100%),
        radial-gradient(1.5px 1.5px at 70% 25%, var(--tarnished-silver) 50%, transparent 100%),
        radial-gradient(1px 1px at 85% 70%, var(--tarnished-silver) 50%, transparent 100%),
        radial-gradient(2px 2px at 30% 80%, var(--tarnished-silver) 50%, transparent 100%),
        radial-gradient(1px 1px at 55% 15%, var(--tarnished-silver) 50%, transparent 100%),
        radial-gradient(1px 1px at 92% 40%, var(--tarnished-silver) 50%, transparent 100%),
        radial-gradient(1.5px 1.5px at 20% 55%, var(--pewter-mist) 50%, transparent 100%),
        radial-gradient(1px 1px at 65% 90%, var(--tarnished-silver) 50%, transparent 100%),
        radial-gradient(1px 1px at 40% 45%, var(--pewter-mist) 50%, transparent 100%),
        radial-gradient(60% 60% at 50% 50%, rgba(74, 111, 165, 0.06) 0%, transparent 100%),
        var(--deep-observatory-navy);
}

/* Astro plate 2: nebula-like gradient */
#astro-plate-2 {
    background:
        radial-gradient(1px 1px at 25% 35%, var(--tarnished-silver) 50%, transparent 100%),
        radial-gradient(1px 1px at 60% 55%, var(--tarnished-silver) 50%, transparent 100%),
        radial-gradient(1.5px 1.5px at 80% 20%, var(--tarnished-silver) 50%, transparent 100%),
        radial-gradient(1px 1px at 10% 75%, var(--pewter-mist) 50%, transparent 100%),
        radial-gradient(1px 1px at 50% 85%, var(--tarnished-silver) 50%, transparent 100%),
        radial-gradient(1px 1px at 35% 10%, var(--tarnished-silver) 50%, transparent 100%),
        radial-gradient(2px 2px at 72% 65%, var(--tarnished-silver) 50%, transparent 100%),
        radial-gradient(1px 1px at 88% 42%, var(--pewter-mist) 50%, transparent 100%),
        radial-gradient(40% 40% at 35% 60%, rgba(74, 111, 165, 0.08) 0%, transparent 100%),
        radial-gradient(30% 30% at 70% 35%, rgba(139, 74, 58, 0.04) 0%, transparent 100%),
        var(--deep-observatory-navy);
}

/* ---- Wabi-Sabi Dividers ---- */

.wabi-divider {
    width: 100%;
    max-width: 600px;
    margin: 0 auto;
    padding: 2rem 0;
    opacity: 0.4;
}

.wabi-divider svg {
    width: 100%;
    height: 2px;
}

.wabi-line {
    stroke: var(--oxidized-copper);
    stroke-width: 0.8;
    fill: none;
    stroke-linecap: round;
}

/* ---- Blockquote ---- */

.wabi-blockquote {
    position: relative;
    padding: 2rem 2rem 2rem 2.5rem;
    margin: 2rem 0;
    background-color: var(--slate-indent);
    border-radius: 2px;
}

.wabi-blockquote::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 2px;
    height: 100%;
    background: var(--oxidized-copper);
    mask-image: linear-gradient(
        to bottom,
        rgba(0,0,0,0.3) 0%,
        rgba(0,0,0,0.8) 20%,
        rgba(0,0,0,1) 40%,
        rgba(0,0,0,0.6) 60%,
        rgba(0,0,0,0.9) 80%,
        rgba(0,0,0,0.4) 100%
    );
    -webkit-mask-image: linear-gradient(
        to bottom,
        rgba(0,0,0,0.3) 0%,
        rgba(0,0,0,0.8) 20%,
        rgba(0,0,0,1) 40%,
        rgba(0,0,0,0.6) 60%,
        rgba(0,0,0,0.9) 80%,
        rgba(0,0,0,0.4) 100%
    );
}

.wabi-blockquote p {
    font-family: var(--font-headline);
    font-weight: 300;
    font-size: 1.6rem;
    line-height: 1.6;
    color: var(--tarnished-silver);
    font-style: italic;
}

/* ---- Return Section ---- */

.plate-return {
    background-color: var(--deep-observatory-navy);
}

.return-text {
    font-family: var(--font-body);
    font-weight: 300;
    font-size: 1.25rem;
    color: var(--pewter-mist);
    margin-top: 2rem;
    margin-bottom: 1rem;
}

.return-sub {
    font-size: 1.1rem;
    color: var(--sepia-ink);
    opacity: 0.7;
}

/* ---- Star Map ---- */

.plate-starmap {
    background-color: var(--deep-observatory-navy);
    min-height: 80vh;
}

.starmap-title {
    margin-bottom: 3rem;
}

.starmap {
    max-width: 500px;
    margin: 0 auto;
}

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

.starmap-line {
    stroke: var(--pewter-mist);
    stroke-width: 0.5;
    stroke-opacity: 0.3;
}

.starmap-star {
    fill: var(--aged-brass);
    cursor: pointer;
    transition: r 0.4s var(--ease-celestial), fill 0.4s var(--ease-celestial);
}

.starmap-node:hover .starmap-star {
    fill: var(--tarnished-silver);
}

.starmap-label {
    font-family: var(--font-annotation);
    font-size: 9px;
    fill: var(--sepia-ink);
    text-anchor: middle;
    pointer-events: none;
    opacity: 0.7;
}

.starmap-node:nth-child(odd) .starmap-label {
    text-anchor: end;
}

.starmap-node:nth-child(even) .starmap-label {
    text-anchor: start;
}

/* ---- Zoom-Focus Effect ---- */

.zoom-focus {
    opacity: 0.85;
    transform: scale(0.95);
    transition: opacity 0.8s var(--ease-celestial), transform 0.8s var(--ease-celestial);
}

.zoom-focus.in-view {
    opacity: 1;
    transform: scale(1);
}

/* ---- Reduced Motion ---- */

@media (prefers-reduced-motion: reduce) {
    .focal-star {
        animation: none;
        opacity: 0.85;
    }

    .zoom-focus {
        opacity: 1;
        transform: none;
        transition: none;
    }

    .hero-title,
    .hero-tagline,
    #hero-star {
        opacity: 1;
        transition: none;
    }
}

/* ---- Responsive ---- */

@media (max-width: 768px) {
    .hero-title {
        font-size: 3rem;
        letter-spacing: 0.1em;
    }

    .section-title {
        font-size: 2rem;
    }

    .plate-content {
        padding: 3rem 1.5rem;
    }

    .plate-content--left,
    .plate-content--right {
        margin-left: 5%;
        margin-right: 5%;
    }

    .plate-wide-image {
        width: 95vw;
        max-width: 95vw;
    }

    .annotation {
        display: none;
    }

    .vintage-plate-image {
        height: 220px;
    }

    .wabi-blockquote p {
        font-size: 1.3rem;
    }
}

@media (max-width: 480px) {
    .hero-title {
        font-size: 2.5rem;
        letter-spacing: 0.08em;
    }

    .section-title {
        font-size: 1.75rem;
    }

    .plate-content {
        padding: 2rem 1.25rem;
    }

    .vintage-plate-image {
        height: 180px;
    }
}
