/* === Reset & Base === */
*, *::before, *::after { margin: 0; padding: 0; box-sizing: border-box; }
html, body { height: 100%; overflow: hidden; background: #1B1F3B; color: #F0E6D3; }

/* === Typography === */
@import url('https://fonts.googleapis.com/css2?family=Caveat&family=Nunito:wght@800&family=Quicksand:wght@400;500&display=swap');

/* === Scroll Wrapper === */
#scroll-wrapper {
    width: 100vw;
    height: 100vh;
    overflow-x: auto;
    overflow-y: hidden;
    scroll-snap-type: x mandatory;
    position: relative;
}

#scroll-container {
    display: flex;
    flex-direction: row;
    width: max-content;
    height: 100vh;
    position: relative;
}

#star-canvas {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 0;
}

/* === Panes === */
.pane {
    height: 100vh;
    flex-shrink: 0;
    position: relative;
    scroll-snap-align: start;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    z-index: 1;
}

/* === Pane 1: Meadow === */
.pane-meadow {
    justify-content: flex-end;
    padding-bottom: 20vh;
}

.domain-title {
    font-family: 'Nunito', sans-serif;
    font-weight: 800;
    font-size: clamp(3rem, 8vw, 6rem);
    letter-spacing: 0.04em;
    color: #F0E6D3;
    z-index: 2;
}

.scroll-hint {
    position: absolute;
    right: 40px;
    top: 50%;
    transform: translateY(-50%);
    animation: hint-pulse 2s cubic-bezier(0.4, 0, 0.2, 1) infinite;
    z-index: 2;
}

@keyframes hint-pulse {
    0%, 100% { opacity: 0.3; transform: translateY(-50%) translateX(0); }
    50% { opacity: 1; transform: translateY(-50%) translateX(8px); }
}

/* === Horizon Line === */
.horizon-line {
    position: absolute;
    bottom: 15%;
    left: 0;
    width: 100%;
    height: 1px;
    background: #C4A265;
    opacity: 0.2;
}

/* === Constellation Panes === */
.pane-constellation {
    justify-content: flex-start;
    align-items: stretch;
}

.constellation-diagram {
    position: relative;
    width: 100%;
    height: 70vh;
    margin-top: 5vh;
}

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

.constellation-lines line {
    stroke: #C4A265;
    stroke-width: 1;
    stroke-dasharray: 4 8;
    stroke-opacity: 0.4;
}

.constellation-name {
    font-family: 'Nunito', sans-serif;
    font-weight: 800;
    font-size: clamp(1.4rem, 3vw, 2.4rem);
    letter-spacing: 0.04em;
    color: #C4A265;
    text-align: center;
    margin-top: auto;
    margin-bottom: 4vh;
    opacity: 0;
    transition: opacity 1s cubic-bezier(0.4, 0, 0.2, 1);
}

.marginalia {
    font-family: 'Caveat', cursive;
    font-size: 0.85rem;
    color: #8B9A6B;
    position: absolute;
    bottom: 12vh;
    right: 10%;
    transform: rotate(-2deg);
    opacity: 0;
    transition: opacity 0.8s cubic-bezier(0.4, 0, 0.2, 1);
}

/* === Icon Cards === */
.icon-card {
    position: absolute;
    width: 120px;
    height: 120px;
    perspective: 800px;
    cursor: pointer;
    z-index: 2;
    opacity: 0;
    transform: translateY(20px);
    transition: opacity 0.8s cubic-bezier(0.4, 0, 0.2, 1), transform 0.8s cubic-bezier(0.4, 0, 0.2, 1);
}

.icon-card.visible {
    opacity: 1;
    transform: translateY(0);
}

.card-inner {
    position: relative;
    width: 100%;
    height: 100%;
    transform-style: preserve-3d;
    transition: transform 0.6s cubic-bezier(0.4, 0, 0.2, 1);
}

.icon-card.flipped .card-inner {
    transform: rotateY(180deg);
}

.icon-card.flipped {
    box-shadow: 0 4px 20px rgba(27, 31, 59, 0.5);
    border-radius: 12px;
}

.card-front, .card-back {
    position: absolute;
    width: 100%;
    height: 100%;
    backface-visibility: hidden;
    border-radius: 12px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
}

.card-front {
    background: rgba(27, 31, 59, 0.8);
    border: 1px solid rgba(196, 162, 101, 0.2);
}

.card-front svg {
    width: 48px;
    height: 48px;
}

.card-front:hover svg {
    stroke: #C4A265;
}

.card-label {
    font-family: 'Quicksand', sans-serif;
    font-weight: 500;
    font-size: 0.75rem;
    color: #F0E6D3;
    margin-top: 8px;
    letter-spacing: 0.01em;
}

.card-back {
    background: #3A4A3C;
    transform: rotateY(180deg);
    padding: 12px;
}

.card-back p {
    font-family: 'Quicksand', sans-serif;
    font-weight: 400;
    font-size: 0.78rem;
    color: #F0E6D3;
    line-height: 1.7;
    letter-spacing: 0.01em;
    text-align: center;
}

/* === Breathing Panes === */
.pane-breathing {
    justify-content: center;
    align-items: center;
}

.haiku {
    font-family: 'Quicksand', sans-serif;
    font-weight: 400;
    font-size: clamp(0.9rem, 1.5vw, 1.1rem);
    color: #8B9A6B;
    line-height: 2;
    letter-spacing: 0.01em;
    text-align: center;
    opacity: 0;
    transform: translateX(30px);
    transition: opacity 1.2s cubic-bezier(0.4, 0, 0.2, 1), transform 1.2s cubic-bezier(0.4, 0, 0.2, 1);
}

.haiku.visible {
    opacity: 1;
    transform: translateX(0);
}

/* === Dawn Pane === */
.pane-dawn {
    background: linear-gradient(to right, #1B1F3B, #3A2A3F, #B8848C);
}

.dawn-text {
    font-family: 'Nunito', sans-serif;
    font-weight: 800;
    font-size: clamp(1.2rem, 2.5vw, 2rem);
    color: #F0E6D3;
    text-align: center;
    line-height: 2;
    letter-spacing: 0.04em;
}

/* === Progress Bar === */
#progress-bar {
    position: fixed;
    bottom: 0;
    left: 0;
    width: 100%;
    height: 3px;
    background: rgba(240, 230, 211, 0.1);
    z-index: 100;
}

#progress-fill {
    height: 100%;
    width: 0%;
    background: #C4A265;
    transition: width 0.1s linear;
}

.diamond {
    position: absolute;
    top: -2px;
    width: 6px;
    height: 6px;
    background: #C4A265;
    transform: rotate(45deg);
    z-index: 101;
}

/* === Shooting Star === */
#shooting-star {
    position: fixed;
    width: 3px;
    height: 3px;
    background: #EDE8DF;
    border-radius: 50%;
    box-shadow: -10px 0 6px 1px rgba(237, 232, 223, 0.4), -20px 0 12px 1px rgba(237, 232, 223, 0.2);
    opacity: 0;
    pointer-events: none;
    z-index: 50;
}

#shooting-star.active {
    animation: shoot 1.5s cubic-bezier(0.4, 0, 0.2, 1) forwards;
}

@keyframes shoot {
    0% { opacity: 1; transform: translate(0, 0); }
    100% { opacity: 0; transform: translate(60vw, 30vh); }
}

/* === Animated states for constellation panes === */
.pane-constellation.in-view .constellation-name {
    opacity: 1;
}

.pane-constellation.in-view .marginalia {
    opacity: 1;
}

/* === Line draw animation === */
.constellation-lines line {
    transition: stroke-dashoffset 1.2s cubic-bezier(0.4, 0, 0.2, 1);
}
