/* ============================================
   ppuzzle.dev - Tangram Workshop in Zero Gravity
   ============================================ */

/* --- CSS Custom Properties --- */
:root {
    --deep-void: #0A0C10;
    --surface-dark: #161822;
    --surface-mid: #252A3A;
    --glacial-teal: #5BCCB3;
    --amber-signal: #E5A84B;
    --lilac-vertex: #9B7ED8;
    --bone-white: #E8E4DC;
    --coral-snap: #E85D5D;

    --font-display: 'Space Grotesk', sans-serif;
    --font-body: 'IBM Plex Sans', sans-serif;
    --font-code: 'Fira Code', monospace;

    --heading-size: clamp(2.5rem, 6vw, 5.5rem);
    --label-size: clamp(1.2rem, 2vw, 1.8rem);
    --body-size: clamp(0.95rem, 1.1vw, 1.15rem);
    --code-size: clamp(0.85rem, 1vw, 1rem);
    --hero-size: clamp(3rem, 8vw, 6rem);
}

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

html {
    scroll-behavior: smooth;
    overflow-x: hidden;
}

body {
    background-color: var(--deep-void);
    color: var(--bone-white);
    font-family: var(--font-body);
    font-size: var(--body-size);
    line-height: 1.72;
    overflow-x: hidden;
    min-height: 100vh;
}

/* --- Isometric Grid Watermark (fixed background) --- */
body::before {
    content: '';
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 0;
    pointer-events: none;
    background-image:
        repeating-linear-gradient(
            30deg,
            transparent,
            transparent 59px,
            rgba(37, 42, 58, 0.2) 59px,
            rgba(37, 42, 58, 0.2) 60px
        ),
        repeating-linear-gradient(
            150deg,
            transparent,
            transparent 59px,
            rgba(37, 42, 58, 0.2) 59px,
            rgba(37, 42, 58, 0.2) 60px
        );
}

/* --- Navigation Track --- */
#nav-track {
    position: fixed;
    right: 20px;
    top: 50%;
    transform: translateY(-50%);
    z-index: 100;
    width: 40px;
}

#nav-svg {
    width: 40px;
    height: 260px;
}

.nav-icon {
    fill: transparent;
    stroke: rgba(91, 204, 179, 0.3);
    stroke-width: 1.5;
    cursor: pointer;
    transition: fill 0.4s ease, stroke 0.4s ease;
}

.nav-icon:hover {
    stroke: var(--glacial-teal);
    fill: rgba(91, 204, 179, 0.1);
}

.nav-icon.active {
    fill: rgba(91, 204, 179, 0.25);
    stroke: var(--glacial-teal);
}

/* --- Constellation Sections --- */
.constellation {
    position: relative;
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 8vh 5vw;
    z-index: 1;
}

.constellation-inner {
    position: relative;
    width: 100%;
    max-width: 1200px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
}

/* --- Constellation Wireframe Lines --- */
.constellation-lines {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 0;
    opacity: 0;
    transition: opacity 0.8s ease;
}

.constellation.lines-visible .constellation-lines {
    opacity: 1;
}

.wire-line {
    stroke: rgba(91, 204, 179, 0.25);
    stroke-width: 0.5;
    fill: none;
    stroke-dasharray: 1000;
    stroke-dashoffset: 1000;
    transition: stroke-dashoffset 1.2s ease-out;
}

.constellation.lines-visible .wire-line {
    stroke-dashoffset: 0;
}

/* --- Polygon Containers (base) --- */
.polygon-container {
    position: relative;
    background: var(--surface-dark);
    border: 1px solid rgba(91, 204, 179, 0.4);
    box-shadow: 0 0 12px rgba(91, 204, 179, 0.15);
    transition: box-shadow 0.4s ease, border-color 0.4s ease;
    will-change: transform;
}

.polygon-container:hover {
    box-shadow: 0 0 20px rgba(91, 204, 179, 0.35);
    border-color: rgba(91, 204, 179, 0.6);
}

.polygon-content {
    position: relative;
    z-index: 2;
    padding: 3rem;
}

/* --- Vertex Markers --- */
.vertex {
    position: absolute;
    width: 4px;
    height: 4px;
    background: var(--glacial-teal);
    border-radius: 50%;
    z-index: 10;
    transform: translate(-50%, -50%);
    animation: vertexPulse 4s ease-in-out infinite;
}

.vertex:nth-child(2) { animation-delay: 0.5s; }
.vertex:nth-child(3) { animation-delay: 1.0s; }
.vertex:nth-child(4) { animation-delay: 1.5s; }
.vertex:nth-child(5) { animation-delay: 2.0s; }
.vertex:nth-child(6) { animation-delay: 2.5s; }

@keyframes vertexPulse {
    0%, 100% { transform: translate(-50%, -50%) scale(1); opacity: 0.8; }
    50% { transform: translate(-50%, -50%) scale(1.4); opacity: 1; }
}

/* --- Typography --- */
.wordmark {
    font-family: var(--font-display);
    font-size: var(--hero-size);
    font-weight: 700;
    letter-spacing: -0.02em;
    text-transform: lowercase;
    color: var(--bone-white);
    line-height: 1;
}

.domain-ext {
    font-family: var(--font-body);
    font-size: calc(var(--hero-size) * 0.5);
    font-weight: 400;
    color: var(--glacial-teal);
    display: block;
    margin-top: 0.2em;
}

.cluster-title {
    font-family: var(--font-display);
    font-size: var(--heading-size);
    font-weight: 700;
    letter-spacing: -0.02em;
    text-transform: lowercase;
    color: var(--bone-white);
    line-height: 1.1;
}

.constellation-title {
    margin-bottom: 3rem;
    text-align: center;
}

.polygon-label {
    font-family: var(--font-display);
    font-size: var(--label-size);
    font-weight: 500;
    letter-spacing: -0.02em;
    text-transform: lowercase;
    color: var(--bone-white);
    margin-bottom: 1rem;
}

.body-text {
    font-family: var(--font-body);
    font-size: var(--body-size);
    font-weight: 400;
    line-height: 1.72;
    color: rgba(232, 228, 220, 0.85);
}

.body-text strong {
    font-weight: 600;
    color: var(--bone-white);
}

/* --- Code Block --- */
.code-block {
    font-family: var(--font-code);
    font-size: var(--code-size);
    font-weight: 400;
    color: var(--glacial-teal);
    line-height: 1.6;
    white-space: pre;
    overflow: hidden;
}

.code-block code {
    font-family: inherit;
}

/* ============================================
   CONSTELLATION 1: The Single Piece (Hero)
   ============================================ */

#constellation-1 {
    min-height: 100vh;
}

#constellation-1 .constellation-inner {
    min-height: 80vh;
    justify-content: center;
}

.triangle-hero {
    clip-path: polygon(50% 0%, 100% 100%, 0% 100%);
    width: clamp(320px, 50vw, 550px);
    height: clamp(280px, 45vw, 480px);
    background: var(--surface-dark);
    border: none;
    box-shadow: none;
    position: relative;
    opacity: 0;
    transform: rotate(15deg);
    transition: none;
}

.triangle-hero::before {
    content: '';
    position: absolute;
    inset: 0;
    clip-path: polygon(50% 0%, 100% 100%, 0% 100%);
    box-shadow: 0 0 30px rgba(91, 204, 179, 0.3), inset 0 0 30px rgba(91, 204, 179, 0.05);
    border: 1px solid rgba(91, 204, 179, 0.4);
    pointer-events: none;
}

.triangle-hero .polygon-content {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    height: 100%;
    padding-top: 35%;
    text-align: center;
}

.triangle-hero.animate-in {
    animation: heroTriangleIn 1.2s cubic-bezier(0.34, 1.56, 0.64, 1) 0.6s forwards;
}

@keyframes heroTriangleIn {
    0% { opacity: 0; transform: rotate(15deg) scale(0.8); }
    100% { opacity: 1; transform: rotate(0deg) scale(1); }
}

.hero-tagline {
    font-family: var(--font-body);
    font-size: var(--body-size);
    font-weight: 400;
    color: rgba(232, 228, 220, 0.6);
    margin-top: 3rem;
    opacity: 0;
    text-align: center;
}

.hero-tagline.animate-in {
    animation: fadeIn 0.8s ease-out 1.8s forwards;
}

@keyframes fadeIn {
    0% { opacity: 0; transform: translateY(10px); }
    100% { opacity: 1; transform: translateY(0); }
}

/* Scroll Indicator */
.scroll-indicator {
    position: absolute;
    bottom: 3vh;
    left: 50%;
    transform: translateX(-50%) rotate(180deg);
    width: 24px;
    height: 24px;
    opacity: 0;
    animation: scrollPulse 2s ease-in-out infinite 2.5s;
}

.scroll-indicator.animate-in {
    opacity: 1;
}

@keyframes scrollPulse {
    0%, 100% { opacity: 0.4; transform: translateX(-50%) rotate(180deg) translateY(0); }
    50% { opacity: 0.8; transform: translateX(-50%) rotate(180deg) translateY(-8px); }
}

/* ============================================
   VOID SPACES
   ============================================ */

.void-space {
    position: relative;
    height: 60vh;
    overflow: hidden;
}

.drifting-piece {
    position: absolute;
    background: var(--surface-mid);
    opacity: 0.15;
    will-change: transform;
}

.drift-1 {
    clip-path: polygon(50% 0%, 100% 100%, 0% 100%);
    width: 40px;
    height: 35px;
    top: 20%;
    left: 10%;
    background: var(--coral-snap);
}

.drift-2 {
    clip-path: polygon(50% 0%, 100% 100%, 0% 100%);
    width: 25px;
    height: 22px;
    top: 60%;
    left: 70%;
    background: var(--lilac-vertex);
}

.drift-3 {
    clip-path: polygon(20% 0%, 100% 0%, 80% 100%, 0% 100%);
    width: 50px;
    height: 30px;
    top: 40%;
    left: 45%;
    background: var(--glacial-teal);
}

.drift-4 {
    clip-path: polygon(50% 0%, 100% 100%, 0% 100%);
    width: 30px;
    height: 26px;
    top: 30%;
    left: 25%;
    background: var(--amber-signal);
}

.drift-5 {
    clip-path: polygon(50% 0%, 100% 100%, 0% 100%);
    width: 35px;
    height: 30px;
    top: 55%;
    left: 80%;
    background: var(--glacial-teal);
}

.drift-6 {
    clip-path: polygon(20% 0%, 100% 0%, 80% 100%, 0% 100%);
    width: 45px;
    height: 28px;
    top: 25%;
    left: 60%;
    background: var(--lilac-vertex);
}

.drift-7 {
    clip-path: polygon(50% 0%, 100% 100%, 0% 100%);
    width: 20px;
    height: 18px;
    top: 70%;
    left: 15%;
    background: var(--coral-snap);
}

.drift-8 {
    clip-path: polygon(50% 0%, 100% 100%, 0% 100%);
    width: 32px;
    height: 28px;
    top: 45%;
    left: 85%;
    background: var(--amber-signal);
}

.drift-9 {
    clip-path: polygon(50% 0%, 100% 100%, 0% 100%);
    width: 28px;
    height: 24px;
    top: 35%;
    left: 40%;
    background: var(--glacial-teal);
}

.drift-10 {
    clip-path: polygon(20% 0%, 100% 0%, 80% 100%, 0% 100%);
    width: 38px;
    height: 24px;
    top: 65%;
    left: 55%;
    background: var(--lilac-vertex);
}

/* ============================================
   CONSTELLATION 2: The Pair
   ============================================ */

.pair-layout {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0;
    width: 100%;
    max-width: 1000px;
    position: relative;
}

.parallelogram {
    clip-path: polygon(15% 0%, 100% 0%, 85% 100%, 0% 100%);
    width: 55%;
    min-height: 350px;
    background: var(--surface-dark);
}

.parallelogram .polygon-content {
    padding: 3rem 4rem;
}

.parallelogram .body-text {
    transform: skewX(0deg);
}

.medium-triangle {
    clip-path: polygon(50% 0%, 100% 100%, 0% 100%);
    width: 40%;
    min-height: 350px;
    background: var(--surface-dark);
    margin-left: -2%;
}

.medium-triangle .polygon-content {
    display: flex;
    align-items: center;
    justify-content: center;
    height: 100%;
    padding-top: 30%;
}

/* Piece entry animations */
.piece-from-left {
    opacity: 0;
    transform: translateX(-100px);
    transition: opacity 0.8s ease-out, transform 0.8s ease-out;
}

.piece-from-right {
    opacity: 0;
    transform: translateX(100px);
    transition: opacity 0.8s ease-out, transform 0.8s ease-out;
}

.piece-from-left.visible,
.piece-from-right.visible {
    opacity: 1;
    transform: translateX(0);
}

/* Tangram display */
.tangram-display {
    padding: 2rem;
}

.tangram-svg {
    width: 100%;
    max-width: 180px;
    height: auto;
}

.tangram-config {
    opacity: 0;
    transition: opacity 1s ease;
}

.tangram-config.active {
    opacity: 1;
}

/* Edge flash */
.edge-flash {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 4px;
    height: 0;
    background: linear-gradient(to bottom, transparent, var(--amber-signal), transparent);
    opacity: 0;
    pointer-events: none;
    transition: height 0.4s ease-out, opacity 0.3s ease;
}

.edge-flash.flash-active {
    height: 200px;
    opacity: 0.8;
    animation: edgeFlashFade 1s ease-out forwards;
}

@keyframes edgeFlashFade {
    0% { opacity: 0.8; }
    100% { opacity: 0; height: 200px; }
}

/* ============================================
   CONSTELLATION 3: The Cluster
   ============================================ */

.cluster-layout {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    grid-template-rows: auto auto;
    gap: 2rem;
    width: 100%;
    max-width: 1100px;
    position: relative;
}

.cluster-piece {
    opacity: 0;
    transform: translateY(60px) scale(0.9);
    transition: opacity 0.6s ease-out, transform 0.6s ease-out;
}

.cluster-piece.visible {
    opacity: 1;
    transform: translateY(0) scale(1);
}

.cluster-piece-1 { transition-delay: 0s; }
.cluster-piece-2 { transition-delay: 0.15s; }
.cluster-piece-3 { transition-delay: 0.3s; }
.cluster-piece-4 { transition-delay: 0.45s; }
.cluster-piece-5 { transition-delay: 0.6s; }

/* Hexagon */
.hexagon {
    clip-path: polygon(50% 0%, 100% 25%, 100% 75%, 50% 100%, 0% 75%, 0% 25%);
    grid-column: 1;
    grid-row: 1;
    min-height: 300px;
    background: var(--surface-dark);
}

.hexagon .polygon-content {
    display: flex;
    align-items: center;
    justify-content: center;
    height: 100%;
    padding: 4rem 2rem;
}

/* Trapezoid */
.trapezoid {
    clip-path: polygon(15% 0%, 85% 0%, 100% 100%, 0% 100%);
    grid-column: 2;
    grid-row: 1;
    min-height: 300px;
    background: var(--surface-dark);
}

/* Large triangle */
.large-triangle {
    clip-path: polygon(50% 0%, 100% 100%, 0% 100%);
    grid-column: 3;
    grid-row: 1;
    min-height: 300px;
    background: var(--surface-dark);
}

.large-triangle .polygon-content {
    padding-top: 40%;
    padding-left: 2rem;
    padding-right: 2rem;
}

/* Hexagon alt */
.hexagon-alt {
    clip-path: polygon(50% 0%, 100% 25%, 100% 75%, 50% 100%, 0% 75%, 0% 25%);
    grid-column: 1 / span 2;
    grid-row: 2;
    min-height: 280px;
    background: var(--surface-dark);
}

/* Small triangle */
.small-triangle {
    clip-path: polygon(50% 0%, 100% 100%, 0% 100%);
    grid-column: 3;
    grid-row: 2;
    min-height: 280px;
    background: var(--surface-dark);
}

/* Capabilities list */
.capabilities-list {
    list-style: none;
    padding: 0;
}

.capabilities-list li {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    font-family: var(--font-body);
    font-size: var(--body-size);
    color: rgba(232, 228, 220, 0.85);
    margin-bottom: 0.5rem;
    line-height: 1.5;
}

.bullet-tri {
    width: 10px;
    height: 10px;
    flex-shrink: 0;
}

/* Kaleidoscope */
.kaleidoscope-container {
    display: flex;
    align-items: center;
    justify-content: center;
    height: 100%;
    padding: 2rem;
}

.kaleidoscope {
    width: 200px;
    height: 200px;
    clip-path: polygon(50% 0%, 100% 25%, 100% 75%, 50% 100%, 0% 75%, 0% 25%);
    background: conic-gradient(
        from 0deg,
        var(--surface-dark),
        var(--glacial-teal),
        var(--surface-mid),
        var(--lilac-vertex),
        var(--surface-dark),
        var(--amber-signal),
        var(--surface-mid),
        var(--glacial-teal),
        var(--surface-dark)
    );
    animation: kaleidoscopeRotate 12s linear infinite;
    opacity: 0.6;
}

@keyframes kaleidoscopeRotate {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* Vertex counter */
.vertex-counter-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    height: 100%;
    padding-top: 35%;
    text-align: center;
}

.vertex-count-label {
    font-family: var(--font-display);
    font-size: var(--label-size);
    font-weight: 500;
    text-transform: lowercase;
    letter-spacing: -0.02em;
    color: rgba(232, 228, 220, 0.5);
    margin-bottom: 0.5rem;
}

.vertex-count {
    font-family: var(--font-display);
    font-size: clamp(2rem, 5vw, 4rem);
    font-weight: 700;
    color: var(--amber-signal);
    letter-spacing: -0.02em;
}

/* ============================================
   CONSTELLATION 4: The Mirror
   ============================================ */

.mirror-layout {
    display: flex;
    align-items: stretch;
    justify-content: center;
    gap: 0;
    width: 100%;
    max-width: 1100px;
    position: relative;
}

.mirror-side {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 2rem;
}

.mirror-axis {
    width: 1px;
    background: linear-gradient(to bottom, transparent, rgba(91, 204, 179, 0.3), transparent);
    margin: 0 2rem;
    align-self: stretch;
}

.mirror-piece {
    opacity: 0;
    transform: translateY(40px);
    transition: opacity 0.7s ease-out, transform 0.7s ease-out;
}

.mirror-piece.visible {
    opacity: 1;
    transform: translateY(0);
}

.mirror-piece-1 { transition-delay: 0s; }
.mirror-piece-2 { transition-delay: 0.2s; }
.mirror-piece-3 { transition-delay: 0.1s; }
.mirror-piece-4 { transition-delay: 0.3s; }

/* Trapezoid variants */
.trapezoid-left {
    clip-path: polygon(10% 0%, 100% 0%, 100% 100%, 0% 100%);
    min-height: 250px;
    background: var(--surface-dark);
}

.trapezoid-right {
    clip-path: polygon(0% 0%, 90% 0%, 100% 100%, 0% 100%);
    min-height: 250px;
    background: var(--surface-dark);
}

/* Parallelogram variants */
.parallelogram-left {
    clip-path: polygon(20% 0%, 100% 0%, 80% 100%, 0% 100%);
    min-height: 220px;
    background: var(--surface-dark);
}

.parallelogram-right {
    clip-path: polygon(0% 0%, 80% 0%, 100% 100%, 20% 100%);
    min-height: 220px;
    background: var(--surface-dark);
}

/* Fractal patterns */
.pattern-container {
    display: flex;
    align-items: center;
    justify-content: center;
    height: 100%;
}

.fractal-pattern {
    width: 180px;
    height: 180px;
    position: relative;
}

.fractal-pattern-1 {
    background:
        linear-gradient(60deg, transparent 40%, rgba(91, 204, 179, 0.15) 40%, rgba(91, 204, 179, 0.15) 60%, transparent 60%),
        linear-gradient(-60deg, transparent 40%, rgba(155, 126, 216, 0.15) 40%, rgba(155, 126, 216, 0.15) 60%, transparent 60%),
        linear-gradient(0deg, transparent 45%, rgba(229, 168, 75, 0.1) 45%, rgba(229, 168, 75, 0.1) 55%, transparent 55%);
    clip-path: polygon(50% 0%, 100% 100%, 0% 100%);
}

.fractal-pattern-2 {
    background:
        conic-gradient(
            from 0deg at 50% 50%,
            rgba(91, 204, 179, 0.2) 0deg,
            transparent 60deg,
            rgba(155, 126, 216, 0.2) 120deg,
            transparent 180deg,
            rgba(229, 168, 75, 0.2) 240deg,
            transparent 300deg,
            rgba(91, 204, 179, 0.2) 360deg
        );
    clip-path: polygon(20% 0%, 100% 0%, 80% 100%, 0% 100%);
}

.mirror-right .fractal-pattern {
    transition: transform 0.1s linear;
}

/* ============================================
   CONSTELLATION 5: The Complete Puzzle
   ============================================ */

#constellation-5 {
    min-height: 120vh;
    padding-bottom: 15vh;
}

.tangram-square {
    position: relative;
    width: clamp(280px, 40vw, 450px);
    height: clamp(280px, 40vw, 450px);
    margin: 0 auto;
}

/* Tangram pieces - all 7 classic tangram pieces forming a square */
.tangram-piece {
    position: absolute;
    background: var(--surface-mid);
    border: 1px solid rgba(91, 204, 179, 0.4);
    box-shadow: 0 0 12px rgba(91, 204, 179, 0.15);
    will-change: transform;
    opacity: 0;
    transition: opacity 0.6s ease, transform 0.8s cubic-bezier(0.34, 1.56, 0.64, 1), box-shadow 0.6s ease;
}

/* Large triangle 1 (top-left) */
.tp-large-tri-1 {
    clip-path: polygon(0% 0%, 100% 0%, 0% 100%);
    width: 50%;
    height: 50%;
    top: 0;
    left: 0;
    transform: translate(-80px, -80px) rotate(-25deg);
}

/* Large triangle 2 (bottom-right, covers right half) */
.tp-large-tri-2 {
    clip-path: polygon(100% 0%, 100% 100%, 0% 100%);
    width: 50%;
    height: 50%;
    bottom: 0;
    right: 0;
    transform: translate(80px, 80px) rotate(25deg);
}

/* Medium triangle (bottom-left) */
.tp-medium-tri {
    clip-path: polygon(0% 100%, 100% 100%, 100% 0%);
    width: 35.36%;
    height: 35.36%;
    bottom: 0;
    left: 0;
    transform: translate(-60px, 40px) rotate(-15deg);
}

/* Small triangle 1 (center-top area) */
.tp-small-tri-1 {
    clip-path: polygon(0% 0%, 100% 0%, 100% 100%);
    width: 25%;
    height: 25%;
    top: 50%;
    left: 25%;
    transform: translate(0, -60px) rotate(20deg);
}

/* Small triangle 2 (center) */
.tp-small-tri-2 {
    clip-path: polygon(0% 0%, 0% 100%, 100% 100%);
    width: 25%;
    height: 25%;
    top: 25%;
    left: 50%;
    transform: translate(40px, 0) rotate(-20deg);
}

/* Square piece (center) */
.tp-square {
    width: 25%;
    height: 25%;
    top: 25%;
    left: 25%;
    transform: translate(0, 50px) rotate(45deg) scale(0.7);
    clip-path: polygon(50% 0%, 100% 50%, 50% 100%, 0% 50%);
}

/* Parallelogram */
.tp-parallelogram {
    clip-path: polygon(25% 0%, 100% 0%, 75% 100%, 0% 100%);
    width: 50%;
    height: 25%;
    top: 50%;
    right: 0;
    transform: translate(60px, 30px) rotate(15deg);
}

/* Assembled state */
.tangram-piece.assembled {
    opacity: 1;
    transform: translate(0, 0) rotate(0deg) scale(1);
    box-shadow: 0 0 25px rgba(91, 204, 179, 0.4);
}

.tp-square.assembled {
    transform: translate(0, 0) rotate(45deg) scale(1);
}

/* Solved overlay */
.solved-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 20;
    opacity: 0;
    transition: opacity 0.8s ease 0.5s;
}

.solved-overlay.show {
    opacity: 1;
}

.solved-word {
    font-family: var(--font-display);
    font-size: var(--heading-size);
    font-weight: 700;
    color: var(--amber-signal);
    text-transform: lowercase;
    letter-spacing: -0.02em;
}

/* Journey Map */
.journey-map {
    margin-top: 6rem;
    width: 100%;
    max-width: 800px;
    opacity: 0;
    transform: translateY(20px);
    transition: opacity 0.8s ease 1s, transform 0.8s ease 1s;
}

.journey-map.visible {
    opacity: 1;
    transform: translateY(0);
}

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

.journey-shape {
    fill: none;
    stroke: rgba(91, 204, 179, 0.35);
    stroke-width: 1;
    stroke-dasharray: 200;
    stroke-dashoffset: 200;
    transition: stroke-dashoffset 1.5s ease-out;
}

.journey-map.visible .journey-shape {
    stroke-dashoffset: 0;
}

.journey-line {
    stroke: rgba(91, 204, 179, 0.15);
    stroke-width: 0.5;
    stroke-dasharray: 4 4;
}

/* ============================================
   REDUCED MOTION
   ============================================ */

@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after {
        animation-duration: 0.01ms !important;
        animation-delay: 0ms !important;
        transition-duration: 0.01ms !important;
    }

    .triangle-hero {
        opacity: 1;
        transform: rotate(0deg);
    }

    .hero-tagline {
        opacity: 1;
    }

    .piece-from-left,
    .piece-from-right,
    .cluster-piece,
    .mirror-piece,
    .tangram-piece {
        opacity: 1;
        transform: none;
    }
}

/* ============================================
   RESPONSIVE
   ============================================ */

@media (max-width: 768px) {
    .pair-layout {
        flex-direction: column;
        gap: 2rem;
    }

    .parallelogram,
    .medium-triangle {
        width: 100%;
        margin-left: 0;
    }

    .cluster-layout {
        grid-template-columns: 1fr;
    }

    .hexagon,
    .trapezoid,
    .large-triangle,
    .hexagon-alt,
    .small-triangle {
        grid-column: 1;
        grid-row: auto;
    }

    .mirror-layout {
        flex-direction: column;
    }

    .mirror-axis {
        width: 80%;
        height: 1px;
        margin: 2rem auto;
    }

    #nav-track {
        right: 10px;
    }

    .polygon-content {
        padding: 2rem;
    }

    .void-space {
        height: 30vh;
    }
}

@media (max-width: 480px) {
    .polygon-content {
        padding: 1.5rem;
    }

    .tangram-square {
        width: 260px;
        height: 260px;
    }

    #nav-track {
        display: none;
    }
}
