/* ============================================================
   cbdc.study — celestial cartographer's private study
   Palette: gold-black-luxury (zero gradients)
   Typography: Righteous / Nunito / Caveat
   Design parser tokens: Intersecting IntersectionObserver to trigger: IntersectionObserver((entries
   ============================================================ */

:root {
    --obsidian: #0D0D0D;
    --charcoal: #1A1A1A;
    --aurum: #C9A84C;
    --pale-gold: #E3C770;
    --parchment: #E8DCC8;
    --antique-brass: #8B6914;
    --star-white: #FFFDF5;
    --blood-amber: #D4763A;

    --font-display: 'Righteous', 'Arial Rounded MT Bold', system-ui, sans-serif;
    --font-body: 'Nunito', system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    --font-hand: 'Caveat', 'Comic Sans MS', cursive;

    --step-gap-x: 60px;
    --step-gap-y: 80px;
}

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

html {
    scroll-behavior: smooth;
}

body {
    font-family: var(--font-body);
    font-weight: 400;
    font-size: clamp(1rem, 1.8vw, 1.15rem);
    line-height: 1.72;
    color: var(--parchment);
    background-color: var(--obsidian);
    overflow-x: hidden;
    min-height: 100vh;
    position: relative;
}

strong {
    font-weight: 700;
    color: var(--pale-gold);
}

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

u {
    text-decoration-color: var(--aurum);
    text-decoration-thickness: 1px;
    text-underline-offset: 3px;
}

/* ============================================================
   STAR FIELD (background scatter)
   ============================================================ */
.star-field {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    min-height: 100%;
    pointer-events: none;
    z-index: 0;
    overflow: hidden;
}

.star-field svg {
    position: absolute;
    will-change: opacity;
    animation: twinkle 4s ease-in-out infinite;
}

@keyframes twinkle {
    0%, 100% { opacity: var(--twinkle-min, 0.15); }
    50% { opacity: var(--twinkle-max, 0.5); }
}

/* ============================================================
   SECTION 1: THE OBSERVATORY
   ============================================================ */
.observatory {
    position: relative;
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 4rem 2rem;
    background-color: var(--obsidian);
    overflow: hidden;
}

.iso-grid {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    opacity: 1;
}

.iso-grid line {
    stroke: var(--aurum);
    stroke-width: 0.5;
}

.observatory__frame {
    position: relative;
    z-index: 2;
    text-align: center;
    max-width: 860px;
    padding: 4rem 3rem;
}

.observatory__meta {
    font-family: var(--font-hand);
    font-size: clamp(1rem, 1.6vw, 1.25rem);
    color: var(--aurum);
    opacity: 0.75;
    margin-bottom: 2rem;
    letter-spacing: 0.05em;
    transform: rotate(-1.5deg);
    display: inline-block;
}

.observatory__title {
    font-family: var(--font-display);
    font-weight: 400;
    font-size: clamp(3.2rem, 10vw, 7.5rem);
    line-height: 1;
    color: var(--aurum);
    letter-spacing: 0.04em;
    margin-bottom: 2rem;
    text-transform: none;
    position: relative;
}

.observatory__word {
    display: inline-block;
}

.observatory__dot {
    color: var(--pale-gold);
    display: inline-block;
    transform: translateY(-0.1em);
}

.observatory__subtitle {
    font-family: var(--font-body);
    font-size: clamp(1rem, 1.6vw, 1.15rem);
    color: var(--parchment);
    max-width: 580px;
    margin: 0 auto 3rem;
    line-height: 1.7;
    opacity: 0.88;
}

.observatory__annotation {
    font-family: var(--font-hand);
    font-size: clamp(1.1rem, 1.8vw, 1.35rem);
    color: var(--aurum);
    opacity: 0.7;
    transform: rotate(-2deg);
    display: inline-block;
    margin-top: 1rem;
}

.observatory__star {
    position: absolute;
    width: 48px;
    height: 48px;
    opacity: 0.75;
}

.observatory__star--tl { top: 6%;  left: 6%;  width: 56px; height: 56px; transform: rotate(-12deg); }
.observatory__star--tr { top: 8%;  right: 8%; width: 40px; height: 40px; transform: rotate(18deg); }
.observatory__star--bl { bottom: 12%; left: 10%; width: 36px; height: 36px; transform: rotate(8deg); opacity: 0.55; }
.observatory__star--br { bottom: 10%; right: 12%; width: 52px; height: 52px; transform: rotate(-22deg); }

.observatory__scroll {
    position: absolute;
    bottom: 2rem;
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.75rem;
    z-index: 2;
}

.observatory__scroll-line {
    display: block;
    width: 1px;
    height: 48px;
    background-color: var(--aurum);
    opacity: 0.6;
    animation: scrollLine 2.2s ease-in-out infinite;
    transform-origin: top;
}

@keyframes scrollLine {
    0% { transform: scaleY(0); opacity: 0.2; }
    50% { transform: scaleY(1); opacity: 0.8; }
    100% { transform: scaleY(0); opacity: 0.2; transform-origin: bottom; }
}

.observatory__scroll-text {
    font-family: var(--font-hand);
    font-size: 1rem;
    color: var(--aurum);
    opacity: 0.7;
    letter-spacing: 0.08em;
}

/* ============================================================
   SECTION 2: THE MANUSCRIPT (isometric staircase)
   ============================================================ */
.staircase {
    position: relative;
    padding: 8rem 2rem 10rem;
    max-width: 1400px;
    margin: 0 auto;
    z-index: 2;
}

.staircase__chapter {
    font-family: var(--font-hand);
    font-size: clamp(1.25rem, 2vw, 1.65rem);
    color: var(--aurum);
    text-align: center;
    margin-bottom: 5rem;
    transform: rotate(-1deg);
    opacity: 0.85;
}

.step {
    position: relative;
    max-width: 620px;
    margin: 0 auto 2.5rem;
    padding: 0;
    transform: skewY(-5deg);
    margin-left: calc(var(--step-index, 0) * var(--step-gap-x));
    margin-top: calc(var(--step-index, 0) * -20px);
    transition: transform 0.4s ease;
}

.step:first-of-type {
    margin-top: 0;
}

.step__content {
    transform: skewY(5deg);
    padding: 3rem 3rem;
    position: relative;
    border: 1px solid var(--aurum);
}

.step--dark .step__content {
    background-color: var(--charcoal);
    color: var(--parchment);
}

.step--gold .step__content {
    background-color: var(--aurum);
    color: var(--obsidian);
    border-color: var(--antique-brass);
}

.step--gold .step__content strong {
    color: var(--antique-brass);
}

.step--gold .step__content em {
    color: var(--antique-brass);
    font-style: italic;
}

.step__number {
    font-family: var(--font-display);
    font-size: clamp(1rem, 1.4vw, 1.1rem);
    letter-spacing: 0.2em;
    color: var(--aurum);
    display: block;
    margin-bottom: 1rem;
    opacity: 0.85;
}

.step--gold .step__number {
    color: var(--obsidian);
    opacity: 0.7;
}

.step__title {
    font-family: var(--font-display);
    font-weight: 400;
    font-size: clamp(1.6rem, 3.2vw, 2.4rem);
    line-height: 1.15;
    letter-spacing: 0.03em;
    margin-bottom: 1.5rem;
    color: var(--pale-gold);
}

.step--gold .step__title {
    color: var(--obsidian);
}

.step__body {
    font-family: var(--font-body);
    font-size: clamp(1rem, 1.5vw, 1.08rem);
    line-height: 1.75;
}

.step--dark .step__body {
    color: var(--parchment);
}

.step--gold .step__body {
    color: var(--obsidian);
}

.step__annotation {
    font-family: var(--font-hand);
    font-size: clamp(1.1rem, 1.7vw, 1.3rem);
    color: var(--aurum);
    opacity: 0.85;
    margin-top: 2rem;
    transform: rotate(-2deg);
    display: inline-block;
    line-height: 1.2;
}

.step--gold .step__annotation {
    color: var(--antique-brass);
    opacity: 0.95;
}

/* decorative star on each step */
.step__content::before {
    content: "";
    position: absolute;
    top: -14px;
    left: -14px;
    width: 28px;
    height: 28px;
    background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 32 32'><path d='M16 2 L18 14 L30 15 L19 17 L22 30 L15 19 L5 29 L13 17 L2 15 L14 14 Z' fill='none' stroke='%23C9A84C' stroke-width='1.2' stroke-linejoin='round'/></svg>");
    background-repeat: no-repeat;
    background-size: contain;
    background-color: var(--obsidian);
    padding: 4px;
}

.step--gold .step__content::before {
    background-color: var(--aurum);
    background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 32 32'><path d='M16 2 L18 14 L30 15 L19 17 L22 30 L15 19 L5 29 L13 17 L2 15 L14 14 Z' fill='none' stroke='%238B6914' stroke-width='1.2' stroke-linejoin='round'/></svg>");
}

/* reveal animation */
.step {
    opacity: 0;
    transform: skewY(-5deg) translateY(40px);
}

.step.is-visible {
    opacity: 1;
    transform: skewY(-5deg) translateY(0);
    transition: opacity 0.9s ease, transform 0.9s ease;
}

/* ============================================================
   SECTION 3: THE CONSTELLATION
   ============================================================ */
.constellation {
    position: relative;
    padding: 8rem 2rem 10rem;
    max-width: 1280px;
    margin: 0 auto;
    background-color: var(--obsidian);
    z-index: 2;
}

.constellation__chapter {
    font-family: var(--font-hand);
    font-size: clamp(1.25rem, 2vw, 1.65rem);
    color: var(--aurum);
    text-align: center;
    margin-bottom: 1rem;
    transform: rotate(1deg);
    opacity: 0.85;
}

.constellation__title {
    font-family: var(--font-display);
    font-weight: 400;
    font-size: clamp(2.2rem, 5vw, 4.2rem);
    line-height: 1.1;
    letter-spacing: 0.04em;
    color: var(--aurum);
    text-align: center;
    margin-bottom: 1.5rem;
}

.constellation__caption {
    font-family: var(--font-body);
    font-size: clamp(0.95rem, 1.4vw, 1.08rem);
    text-align: center;
    max-width: 640px;
    margin: 0 auto 5rem;
    color: var(--parchment);
    opacity: 0.8;
    line-height: 1.7;
}

.constellation__stage {
    position: relative;
    width: 100%;
    aspect-ratio: 1000 / 600;
    max-width: 1100px;
    margin: 0 auto;
}

.constellation__sky {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
}

.constellation-path {
    stroke-linecap: round;
}

.node {
    position: absolute;
    left: var(--node-x);
    top: var(--node-y);
    transform: translate(-50%, -50%);
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.5rem;
    z-index: 3;
    transition: transform 0.4s ease;
}

.node:hover {
    transform: translate(-50%, -50%) scale(1.08);
}

.node__star {
    width: 56px;
    height: 56px;
    filter: drop-shadow(0 0 6px rgba(201, 168, 76, 0.25));
    animation: starPulse 3.6s ease-in-out infinite;
}

.node:nth-child(2) .node__star { animation-delay: 0.4s; }
.node:nth-child(3) .node__star { animation-delay: 0.8s; }
.node:nth-child(4) .node__star { animation-delay: 1.2s; }
.node:nth-child(5) .node__star { animation-delay: 1.6s; }

@keyframes starPulse {
    0%, 100% { opacity: 0.85; transform: scale(1) rotate(0deg); }
    50% { opacity: 1; transform: scale(1.08) rotate(3deg); }
}

.node__label {
    text-align: center;
    padding: 0.35rem 0.75rem;
    background-color: var(--obsidian);
    border: 1px solid var(--aurum);
    min-width: 130px;
}

.node__name {
    font-family: var(--font-display);
    font-weight: 400;
    font-size: 1.05rem;
    letter-spacing: 0.04em;
    color: var(--pale-gold);
    line-height: 1.1;
}

.node__meta {
    font-family: var(--font-hand);
    font-size: 0.95rem;
    color: var(--aurum);
    opacity: 0.75;
    margin-top: 0.15rem;
}

.constellation__margin {
    font-family: var(--font-hand);
    font-size: clamp(1.05rem, 1.7vw, 1.3rem);
    color: var(--aurum);
    opacity: 0.8;
    text-align: center;
    margin-top: 5rem;
    transform: rotate(-1.5deg);
    display: block;
}

/* ============================================================
   SECTION 4: THE COLOPHON
   ============================================================ */
.colophon {
    position: relative;
    padding: 6rem 2rem 6rem;
    text-align: center;
    background-color: var(--obsidian);
    z-index: 2;
}

.colophon__line {
    width: min(560px, 80%);
    height: 1px;
    background-color: var(--aurum);
    margin: 0 auto 3rem;
    opacity: 0.7;
}

.colophon__quill {
    width: 140px;
    height: 90px;
    margin: 0 auto 2rem;
    display: block;
    opacity: 0.85;
}

.colophon__mark {
    font-family: var(--font-display);
    font-weight: 400;
    font-size: clamp(1.5rem, 2.5vw, 2rem);
    letter-spacing: 0.05em;
    color: var(--aurum);
    margin-bottom: 1rem;
}

.colophon__note {
    font-family: var(--font-hand);
    font-size: clamp(1rem, 1.4vw, 1.15rem);
    color: var(--parchment);
    opacity: 0.7;
    margin-bottom: 0.75rem;
}

.colophon__year {
    font-family: var(--font-display);
    font-size: 0.95rem;
    letter-spacing: 0.3em;
    color: var(--antique-brass);
    opacity: 0.75;
}

/* ============================================================
   ISOMETRIC CUBE NAVIGATION WIDGET
   ============================================================ */
.iso-nav {
    position: fixed;
    bottom: 2rem;
    right: 2rem;
    z-index: 100;
    width: 90px;
    height: 90px;
}

.iso-cube {
    position: relative;
    width: 48px;
    height: 48px;
    margin: 21px;
    transform-style: preserve-3d;
    cursor: pointer;
    transition: transform 0.5s cubic-bezier(0.4, 0, 0.2, 1);
}

.iso-nav:hover .iso-cube,
.iso-nav.is-open .iso-cube {
    transform: rotate(15deg) scale(1.15);
}

.iso-cube__face {
    position: absolute;
    width: 36px;
    height: 36px;
}

.iso-cube__face--top {
    top: 0;
    left: 6px;
    background-color: var(--pale-gold);
    transform: rotate(45deg) scaleY(0.577);
    transform-origin: center;
    border: 1px solid var(--antique-brass);
}

.iso-cube__face--left {
    bottom: 0;
    left: 0;
    width: 24px;
    height: 30px;
    background-color: var(--antique-brass);
    transform: skewY(30deg);
    border: 1px solid var(--obsidian);
}

.iso-cube__face--right {
    bottom: 0;
    right: 0;
    width: 24px;
    height: 30px;
    background-color: var(--aurum);
    transform: skewY(-30deg);
    border: 1px solid var(--obsidian);
}

.iso-nav__links {
    position: absolute;
    bottom: 100%;
    right: 0;
    margin-bottom: 1rem;
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 0.5rem;
    pointer-events: none;
    opacity: 0;
    transform: translateY(10px);
    transition: opacity 0.4s ease, transform 0.4s ease;
}

.iso-nav:hover .iso-nav__links,
.iso-nav.is-open .iso-nav__links {
    pointer-events: auto;
    opacity: 1;
    transform: translateY(0);
}

.iso-nav__link {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.35rem 0.85rem;
    background-color: var(--charcoal);
    border: 1px solid var(--aurum);
    text-decoration: none;
    color: var(--parchment);
    font-family: var(--font-hand);
    font-size: 1.1rem;
    letter-spacing: 0.03em;
    white-space: nowrap;
    opacity: 0;
    transform: translateX(10px);
    transition: opacity 0.35s ease, transform 0.35s ease, color 0.25s ease, border-color 0.25s ease;
    transition-delay: calc(var(--link-index, 0) * 0.06s);
}

.iso-nav:hover .iso-nav__link,
.iso-nav.is-open .iso-nav__link {
    opacity: 1;
    transform: translateX(0);
}

.iso-nav__link:hover {
    color: var(--pale-gold);
    border-color: var(--pale-gold);
}

.iso-nav__link svg {
    width: 18px;
    height: 18px;
    flex-shrink: 0;
}

/* ============================================================
   RESPONSIVE — under 768px, drop the isometric transforms
   ============================================================ */
@media (max-width: 768px) {
    .staircase {
        padding: 5rem 1.25rem 6rem;
    }

    .step {
        transform: none;
        margin-left: 0;
        margin-top: 0;
        margin-bottom: 3rem;
        max-width: 100%;
    }

    .step.is-visible {
        transform: translateY(0);
    }

    .step__content {
        transform: none;
        padding: 2rem 1.5rem;
    }

    .observatory__frame {
        padding: 3rem 1.5rem;
    }

    .observatory__star--tl { top: 4%; left: 4%; width: 36px; height: 36px; }
    .observatory__star--tr { top: 5%; right: 4%; width: 28px; height: 28px; }
    .observatory__star--bl { bottom: 18%; left: 6%; width: 26px; height: 26px; }
    .observatory__star--br { bottom: 16%; right: 6%; width: 34px; height: 34px; }

    .constellation {
        padding: 5rem 1rem 6rem;
    }

    .constellation__stage {
        aspect-ratio: auto;
        min-height: 520px;
    }

    .node__label {
        min-width: 100px;
        padding: 0.25rem 0.5rem;
    }

    .node__name { font-size: 0.9rem; }
    .node__meta { font-size: 0.82rem; }

    .node__star { width: 42px; height: 42px; }

    .iso-nav {
        bottom: 1rem;
        right: 1rem;
        width: 70px;
        height: 70px;
    }

    .iso-cube {
        margin: 11px;
    }
}

@media (max-width: 480px) {
    .observatory__title {
        font-size: clamp(2.6rem, 12vw, 3.8rem);
    }
}
