/* ========================================
   interplanetary.biz — Styles
   Evolved-minimal meets interstellar grandeur
   Horizontal-scroll waypoint panels, isometric icons,
   leaf-organic motifs, complementary indigo-gold palette
   ======================================== */

/* --- CSS Custom Properties --- */
:root {
    --void-indigo: #0B0B14;
    --antique-gold: #C9A96E;
    --parchment-ivory: #F2EDE4;
    --burnished-copper: #A67C52;
    --deep-lapis: #1E2A5E;
    --celestial-slate: #3A4A7A;
    --sage-patina: #7A8B6F;
    --pale-champagne: #E8DCC8;

    --font-caveat: 'Caveat', cursive;
    --font-cormorant: 'Cormorant Garamond', serif;
    --font-dm-sans: 'DM Sans', sans-serif;

    --nav-height: 48px;
    --panel-count: 5;
    --transit-width: 30vw;
}

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

html {
    overflow: hidden;
    height: 100%;
}

body {
    background: var(--void-indigo);
    color: var(--parchment-ivory);
    font-family: var(--font-cormorant);
    height: 100%;
    overflow: hidden;
}

/* --- Font Utilities --- */
.font-caveat {
    font-family: var(--font-caveat);
}

.font-cormorant {
    font-family: var(--font-cormorant);
}

.font-dm-sans {
    font-family: var(--font-dm-sans);
}

/* --- Navigation --- */
#nav-bar {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: var(--nav-height);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 32px;
    z-index: 100;
    background: rgba(11, 11, 20, 0.85);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    opacity: 0;
    transition: opacity 0.8s ease;
}

#nav-bar.visible {
    opacity: 1;
}

#nav-domain {
    font-size: clamp(1.2rem, 2vw, 1.6rem);
    color: var(--parchment-ivory);
    letter-spacing: 0.02em;
    font-weight: 700;
}

#nav-indicators {
    display: flex;
    gap: 12px;
    align-items: center;
}

.nav-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    border: 1px solid var(--celestial-slate);
    background: transparent;
    cursor: pointer;
    transition: background-color 0.3s ease, border-color 0.3s ease;
    padding: 0;
}

.nav-dot.active {
    background: var(--antique-gold);
    border-color: var(--antique-gold);
}

.nav-dot:hover {
    border-color: var(--antique-gold);
}

/* --- Entry Overlay --- */
#entry-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: var(--void-indigo);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 200;
    transition: opacity 0.6s ease;
}

#entry-overlay.fade-out {
    opacity: 0;
    pointer-events: none;
}

#entry-overlay.hidden {
    display: none;
}

#entry-rule {
    width: 80%;
    height: 2px;
}

#entry-line-right,
#entry-line-left {
    stroke-dasharray: 500;
    stroke-dashoffset: 500;
}

#entry-line-right.animate {
    animation: drawLineRight 1200ms cubic-bezier(0.22, 1, 0.36, 1) forwards;
}

#entry-line-left.animate {
    animation: drawLineLeft 1200ms cubic-bezier(0.22, 1, 0.36, 1) forwards;
}

@keyframes drawLineRight {
    to { stroke-dashoffset: 0; }
}

@keyframes drawLineLeft {
    to { stroke-dashoffset: 0; }
}

/* --- Scroll Architecture --- */
#scroll-wrapper {
    width: 100%;
    height: 100%;
    overflow-x: auto;
    overflow-y: hidden;
    scroll-snap-type: x mandatory;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
}

#scroll-wrapper::-webkit-scrollbar {
    display: none;
}

#scroll-container {
    display: flex;
    flex-direction: row;
    height: 100%;
    /* 5 panels (100vw each) + 4 transit zones (30vw each) */
    width: calc(5 * 100vw + 4 * 30vw);
}

/* --- Waypoint Panels --- */
.waypoint-panel {
    width: 100vw;
    height: 100vh;
    flex-shrink: 0;
    scroll-snap-align: start;
    position: relative;
    overflow: hidden;
}

.panel-content {
    width: 100%;
    height: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding-top: var(--nav-height);
}

/* --- Transit Zones --- */
.transit-zone {
    width: 30vw;
    height: 100vh;
    flex-shrink: 0;
    background: var(--void-indigo);
    display: flex;
    align-items: center;
    justify-content: center;
    scroll-snap-align: none;
    position: relative;
}

.transit-rule {
    width: 0%;
    height: 1px;
    background: var(--antique-gold);
    transition: width 0.1s linear;
}

/* --- Gold Rules --- */
.gold-rule {
    height: 1px;
    background: var(--antique-gold);
}

.origin-rule {
    width: 120px;
    margin: 24px auto;
    opacity: 0;
}

.origin-rule.visible {
    opacity: 1;
    animation: fadeInRule 0.8s ease forwards;
}

.section-rule {
    width: 80px;
    margin: 12px auto 32px;
}

@keyframes fadeInRule {
    from { opacity: 0; width: 0; }
    to { opacity: 1; width: 120px; }
}

/* ========================================
   PANEL 1: ORIGIN
   ======================================== */
.origin-content {
    text-align: center;
}

.hero-text {
    font-size: clamp(2.8rem, 6vw, 5.2rem);
    font-weight: 700;
    color: var(--parchment-ivory);
    letter-spacing: 0.02em;
    line-height: 1.2;
    max-width: 14ch;
    opacity: 0;
    transform: translateY(8px);
}

.hero-text.visible {
    animation: fadeInUp 800ms cubic-bezier(0.22, 1, 0.36, 1) forwards;
}

@keyframes fadeInUp {
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.origin-planet {
    margin-top: 16px;
    opacity: 0;
}

.origin-planet.visible {
    animation: fadeIn 600ms ease 200ms forwards;
}

.planet-icon {
    width: 96px;
    height: 96px;
    animation: rotatePlanet 60s linear infinite;
}

@keyframes rotatePlanet {
    from { transform: rotate(0deg); }
    to { transform: rotate(360deg); }
}

@keyframes fadeIn {
    to { opacity: 1; }
}

/* Watermark leaf */
.watermark-leaf {
    position: absolute;
    bottom: 32px;
    right: 32px;
    width: 48px;
    height: 48px;
}

/* ========================================
   PANEL 2: CARTOGRAPHY
   ======================================== */
.cartography-content {
    padding: 80px 40px 40px;
    overflow: hidden;
}

.section-title {
    font-size: clamp(1.6rem, 3vw, 2.4rem);
    font-weight: 700;
    color: var(--parchment-ivory);
    letter-spacing: 0.02em;
    text-align: center;
}

.hex-grid {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    align-items: center;
    gap: 8px;
    max-width: 900px;
    margin: 0 auto;
    padding: 0 20px;
}

.hex-tile {
    position: relative;
    width: 120px;
    height: 104px;
    flex-shrink: 0;
    cursor: pointer;
    opacity: 0;
    transform: translateY(20px);
}

.hex-tile.visible {
    animation: hexFadeIn 400ms cubic-bezier(0.16, 1, 0.3, 1) forwards;
    animation-delay: calc(var(--stagger) * 100ms);
}

@keyframes hexFadeIn {
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.hex-shape {
    width: 100%;
    height: 100%;
    position: absolute;
    top: 0;
    left: 0;
}

.hex-shape polygon {
    transition: stroke 0.3s ease;
}

.hex-tile:hover .hex-shape polygon {
    stroke: var(--pale-champagne);
}

.hex-content {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding-top: 4px;
}

.hex-icon {
    width: 48px;
    height: 48px;
    transition: transform 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.hex-tile:hover .hex-icon {
    transform: scale(1.08);
}

.hex-label {
    font-size: clamp(0.75rem, 1.2vw, 0.95rem);
    color: var(--parchment-ivory);
    letter-spacing: 0.01em;
    margin-top: 2px;
}

/* ========================================
   PANEL 3: FOLIAGE
   ======================================== */
.foliage-content {
    position: relative;
}

.floating-leaf {
    position: absolute;
    opacity: 0;
    transform: scale(0.85);
    will-change: transform;
}

.floating-leaf.visible {
    animation: leafFadeIn 800ms ease-out forwards;
}

@keyframes leafFadeIn {
    to {
        opacity: 0.7;
        transform: scale(1) rotate(0deg) translateX(0px);
    }
}

.leaf-1 {
    width: 200px;
    top: 10%;
    left: 5%;
}

.leaf-2 {
    width: 300px;
    top: 55%;
    right: 8%;
}

.leaf-3 {
    width: 160px;
    top: 20%;
    right: 15%;
}

.leaf-4 {
    width: 240px;
    bottom: 5%;
    left: 12%;
}

.leaf-5 {
    width: 180px;
    top: 40%;
    left: 60%;
}

@keyframes leafRotate {
    from { transform: rotate(0deg); }
    to { transform: rotate(360deg); }
}

.foliage-text {
    position: relative;
    z-index: 2;
    max-width: 36ch;
    text-align: center;
    padding: 40px 20px;
}

.foliage-text p {
    font-size: clamp(1rem, 1.5vw, 1.2rem);
    font-weight: 300;
    line-height: 1.85;
    letter-spacing: -0.01em;
    color: var(--parchment-ivory);
    margin-bottom: 1.6em;
}

.foliage-text p:last-child {
    margin-bottom: 0;
}

/* ========================================
   PANEL 4: LEDGER
   ======================================== */
.ledger-content {
    padding: 80px 40px 40px;
}

.ledger-entries {
    display: flex;
    flex-direction: column;
    gap: 24px;
    max-width: 800px;
    width: 100%;
    margin-top: 8px;
}

.ledger-entry {
    display: flex;
    align-items: center;
    gap: 24px;
    padding: 20px 28px;
    background: rgba(11, 11, 20, 0.6);
    border: 1px solid rgba(201, 169, 110, 0.15);
    border-radius: 4px;
    opacity: 0;
    transform: translateX(40px);
    transition: background-color 0.3s ease, border-color 0.3s ease;
}

.ledger-entry.visible {
    animation: ledgerSlideIn 500ms cubic-bezier(0.22, 1, 0.36, 1) forwards;
    animation-delay: calc(var(--stagger) * 200ms);
}

.ledger-entry:hover {
    background: rgba(232, 220, 200, 0.05);
    border-color: rgba(201, 169, 110, 0.3);
}

@keyframes ledgerSlideIn {
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

.ledger-icon {
    flex-shrink: 0;
    width: 64px;
    height: 64px;
}

.ledger-icon svg {
    width: 100%;
    height: 100%;
}

.ledger-text h3 {
    font-size: clamp(1.4rem, 2.5vw, 1.8rem);
    font-weight: 700;
    color: var(--parchment-ivory);
    letter-spacing: 0.02em;
    margin-bottom: 6px;
}

.ledger-text p {
    font-size: clamp(0.9rem, 1.3vw, 1.05rem);
    font-weight: 300;
    line-height: 1.7;
    letter-spacing: -0.01em;
    color: var(--pale-champagne);
}

/* ========================================
   PANEL 5: TERMINUS
   ======================================== */
.terminus-border {
    width: calc(100% - 64px);
    height: calc(100% - 64px);
    border: 1px solid var(--antique-gold);
    position: absolute;
    top: 32px;
    left: 32px;
}

.terminus-content {
    text-align: center;
    position: relative;
}

#panel-terminus .hero-text {
    max-width: 18ch;
}

.constellation-arc {
    display: flex;
    justify-content: center;
    align-items: flex-end;
    gap: 16px;
    margin-bottom: 32px;
    height: 60px;
}

.constellation-icon {
    width: 36px;
    height: 36px;
    opacity: 0;
    transform: scale(0);
}

.constellation-icon.visible {
    animation: constellationPop 300ms cubic-bezier(0.34, 1.56, 0.64, 1) forwards;
    animation-delay: calc(var(--stagger) * 80ms);
}

@keyframes constellationPop {
    to {
        opacity: 1;
        transform: scale(1);
    }
}

/* Arc positioning for gentle arc above text */
.ci-1 { align-self: center; }
.ci-2 { align-self: flex-start; }
.ci-3 { align-self: center; }
.ci-4 { align-self: flex-end; margin-bottom: -8px; }
.ci-5 { align-self: flex-end; margin-bottom: -4px; }
.ci-6 { align-self: center; }
.ci-7 { align-self: flex-start; }
.ci-8 { align-self: center; }
.ci-9 { align-self: center; }

.terminus-contact {
    position: absolute;
    bottom: 24px;
    right: 24px;
    font-size: clamp(0.65rem, 0.9vw, 0.8rem);
    letter-spacing: 0.08em;
    text-transform: uppercase;
    font-weight: 500;
}

.terminus-contact a {
    color: var(--celestial-slate);
    text-decoration: none;
    transition: color 0.3s ease;
}

.terminus-contact a:hover {
    color: var(--antique-gold);
}

/* ========================================
   RESPONSIVE (< 768px) — Vertical Layout
   ======================================== */
@media (max-width: 768px) {
    html {
        overflow: auto;
        overflow-x: hidden;
    }

    body {
        overflow: auto;
        overflow-x: hidden;
    }

    #scroll-wrapper {
        overflow-x: hidden;
        overflow-y: auto;
        scroll-snap-type: y mandatory;
        height: auto;
    }

    #scroll-container {
        flex-direction: column;
        width: 100%;
        height: auto;
    }

    .waypoint-panel {
        width: 100%;
        height: 100vh;
        scroll-snap-align: start;
    }

    .transit-zone {
        width: 100%;
        height: 15vh;
        flex-shrink: 0;
    }

    .transit-rule {
        width: 0%;
        height: 1px;
    }

    .hex-grid {
        max-width: 320px;
        gap: 4px;
    }

    .hex-tile {
        width: 90px;
        height: 78px;
    }

    .hex-icon {
        width: 32px;
        height: 32px;
    }

    .hex-label {
        font-size: 0.65rem;
    }

    .ledger-entry {
        flex-direction: column;
        text-align: center;
        gap: 12px;
        padding: 16px;
    }

    .ledger-icon {
        width: 48px;
        height: 48px;
    }

    .constellation-arc {
        flex-wrap: wrap;
        gap: 8px;
    }

    .constellation-icon {
        width: 28px;
        height: 28px;
    }

    .terminus-border {
        top: 16px;
        left: 16px;
        width: calc(100% - 32px);
        height: calc(100% - 32px);
    }

    .terminus-contact {
        bottom: 12px;
        right: 12px;
    }

    .floating-leaf {
        opacity: 0.4;
    }

    .leaf-1 { width: 120px; }
    .leaf-2 { width: 180px; }
    .leaf-3 { width: 100px; }
    .leaf-4 { width: 140px; }
    .leaf-5 { width: 100px; }

    .foliage-text {
        max-width: 90%;
    }

    .hero-text {
        font-size: clamp(2rem, 8vw, 3rem);
        max-width: 90%;
    }

    #panel-terminus .hero-text {
        max-width: 90%;
    }

    #nav-bar {
        padding: 0 16px;
    }

    #nav-indicators {
        gap: 8px;
    }

    .nav-dot {
        width: 8px;
        height: 8px;
    }
}
