/* ============================================
   ppuzzl.bar - Neomorphic Crystalline Design
   ============================================ */

/* CSS Custom Properties */
:root {
    --surface-base: #E0E5EC;
    --light-highlight: #FFFFFF;
    --dark-shadow: #A3B1C6;
    --deep-shadow: #7B8CA3;
    --text-primary: #2D3748;
    --text-secondary: #5A6A7E;
    --text-whisper: #8899AA;
    --inset-base: #D1D9E6;

    --shadow-dist: 8px;
    --shadow-blur: 16px;
    --shadow-color-dark: #A3B1C6;
    --shadow-color-light: #FFFFFF;

    --section-angle: 3.5deg;

    --font-main: 'Commissioner', sans-serif;
}

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

html {
    scroll-behavior: smooth;
}

body {
    font-family: var(--font-main);
    font-weight: 300;
    font-size: clamp(0.95rem, 1.4vw, 1.1rem);
    line-height: 1.75;
    letter-spacing: 0.01em;
    color: var(--text-primary);
    background-color: var(--surface-base);
    overflow-x: hidden;
    -webkit-font-smoothing: antialiased;
}

/* Hexagonal Lattice Background */
#hex-lattice {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 0;
    pointer-events: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='120' height='104'%3E%3Cpolygon points='60,2 110,27 110,77 60,102 10,77 10,27' fill='none' stroke='%23D1D9E6' stroke-width='0.5'/%3E%3C/svg%3E");
    background-size: 120px 104px;
    opacity: 0.4;
}

/* ============================================
   Navigation
   ============================================ */
#nav-bar {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 100;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 40px;
    background-color: var(--surface-base);
    box-shadow: inset 2px 2px 5px var(--dark-shadow), inset -2px -2px 5px var(--light-highlight);
}

.nav-domain {
    font-family: var(--font-main);
    font-weight: 700;
    font-size: clamp(1rem, 1.5vw, 1.2rem);
    letter-spacing: -0.015em;
    color: var(--text-primary);
}

#nav-toggle {
    display: flex;
    flex-direction: column;
    gap: 5px;
    background: none;
    border: none;
    cursor: pointer;
    padding: 8px;
    z-index: 101;
}

.hamburger-line {
    display: block;
    width: 24px;
    height: 2px;
    background-color: var(--text-secondary);
    transition: transform 0.3s ease, opacity 0.3s ease;
}

#nav-toggle.active .hamburger-line:nth-child(1) {
    transform: rotate(45deg) translate(5px, 5px);
}

#nav-toggle.active .hamburger-line:nth-child(2) {
    opacity: 0;
}

#nav-toggle.active .hamburger-line:nth-child(3) {
    transform: rotate(-45deg) translate(5px, -5px);
}

#nav-menu {
    position: fixed;
    top: 60px;
    right: 40px;
    display: flex;
    flex-direction: column;
    gap: 12px;
    opacity: 0;
    pointer-events: none;
    transform: translateY(-10px);
    transition: opacity 0.3s ease, transform 0.3s ease;
}

#nav-menu.open {
    opacity: 1;
    pointer-events: auto;
    transform: translateY(0);
}

.nav-pill {
    display: inline-block;
    font-family: var(--font-main);
    font-weight: 200;
    font-size: clamp(0.7rem, 0.9vw, 0.8rem);
    text-transform: uppercase;
    letter-spacing: 0.12em;
    color: var(--text-secondary);
    text-decoration: none;
    padding: 0;
    background: var(--surface-base);
    border: none;
    transition: padding 0.2s cubic-bezier(0.25, 0.46, 0.45, 0.94),
                box-shadow 0.2s cubic-bezier(0.25, 0.46, 0.45, 0.94),
                border-radius 0.2s ease;
    border-radius: 0;
}

.nav-pill:hover {
    padding: 12px 20px;
    border-radius: 16px;
    box-shadow: var(--shadow-dist) var(--shadow-dist) var(--shadow-blur) var(--shadow-color-dark),
                calc(var(--shadow-dist) * -1) calc(var(--shadow-dist) * -1) var(--shadow-blur) var(--shadow-color-light);
}

.nav-pill:active {
    box-shadow: inset 4px 4px 8px var(--shadow-color-dark),
                inset -4px -4px 8px var(--shadow-color-light);
}

/* ============================================
   Diagonal Sections
   ============================================ */
.diagonal-section {
    position: relative;
    z-index: 1;
    padding: 120px 40px 140px;
}

.diagonal-section.raised {
    background-color: var(--surface-base);
    clip-path: polygon(0 0, 100% 2%, 100% 98%, 0 100%);
    box-shadow: 0 8px 24px rgba(123, 140, 163, 0.3);
}

.diagonal-section.recessed {
    background-color: var(--inset-base);
    clip-path: polygon(0 2%, 100% 0, 100% 100%, 0 98%);
}

.diagonal-section.footer-well {
    background-color: var(--inset-base);
    clip-path: polygon(0 4%, 100% 0, 100% 100%, 0 100%);
    box-shadow: inset 0 12px 32px rgba(123, 140, 163, 0.4);
}

.section-inner {
    max-width: 1200px;
    margin: 0 auto;
    position: relative;
    z-index: 2;
}

/* ============================================
   Hero Section
   ============================================ */
#hero {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding-top: 80px;
    clip-path: polygon(0 0, 100% 0, 100% 96%, 0 100%);
}

.hero-content {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 32px;
}

#hero-title {
    font-family: var(--font-main);
    font-weight: 200;
    font-size: clamp(2.2rem, 5vw, 4.4rem);
    letter-spacing: -0.015em;
    color: var(--text-primary);
    opacity: 0;
    transition: font-weight 0.6s ease, opacity 0.6s ease;
}

#hero-title.crystallized {
    font-weight: 700;
    opacity: 1;
}

.hero-subtitle {
    font-family: var(--font-main);
    font-weight: 200;
    font-size: clamp(0.7rem, 0.9vw, 0.8rem);
    text-transform: uppercase;
    letter-spacing: 0.12em;
    color: var(--text-whisper);
    opacity: 0;
    transition: opacity 0.8s ease 0.8s;
}

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

/* Hero Crystal */
#hero-crystal {
    position: relative;
    width: 320px;
    height: 400px;
}

.crystal-facet {
    position: absolute;
    opacity: 0;
    transition: transform 0.6s cubic-bezier(0.34, 1.56, 0.64, 1),
                opacity 0.6s ease,
                box-shadow 0.3s ease;
}

.crystal-facet.assembled {
    opacity: 1;
}

.facet-1 {
    width: 120px;
    height: 180px;
    top: 40px;
    left: 100px;
    background: var(--surface-base);
    clip-path: polygon(50% 0%, 100% 25%, 100% 75%, 50% 100%, 0% 75%, 0% 25%);
    box-shadow: 6px 6px 12px var(--dark-shadow), -6px -6px 12px var(--light-highlight);
    transform: translate(calc(var(--mx, 0) * 5px), calc(var(--my, 0) * 5px));
}

.facet-2 {
    width: 100px;
    height: 140px;
    top: 80px;
    left: 40px;
    background: var(--inset-base);
    clip-path: polygon(50% 0%, 100% 30%, 80% 100%, 0% 70%);
    box-shadow: 4px 4px 10px var(--dark-shadow), -4px -4px 10px var(--light-highlight);
    transform: translate(calc(var(--mx, 0) * 4px), calc(var(--my, 0) * 4px));
}

.facet-3 {
    width: 90px;
    height: 120px;
    top: 60px;
    left: 180px;
    background: #D8DDE5;
    clip-path: polygon(20% 0%, 100% 15%, 80% 100%, 0% 85%);
    box-shadow: 5px 5px 12px var(--dark-shadow), -5px -5px 12px var(--light-highlight);
    transform: translate(calc(var(--mx, 0) * 3px), calc(var(--my, 0) * 3px));
}

.facet-4 {
    width: 80px;
    height: 100px;
    top: 200px;
    left: 60px;
    background: var(--dark-shadow);
    clip-path: polygon(50% 0%, 100% 40%, 70% 100%, 0% 60%);
    box-shadow: 3px 3px 8px var(--deep-shadow), -3px -3px 8px var(--light-highlight);
    transform: translate(calc(var(--mx, 0) * 2px), calc(var(--my, 0) * 2px));
}

.facet-5 {
    width: 110px;
    height: 130px;
    top: 180px;
    left: 150px;
    background: var(--surface-base);
    clip-path: polygon(30% 0%, 100% 20%, 70% 100%, 0% 80%);
    box-shadow: 5px 5px 14px var(--dark-shadow), -5px -5px 14px var(--light-highlight);
    transform: translate(calc(var(--mx, 0) * 4.5px), calc(var(--my, 0) * 4.5px));
}

.facet-6 {
    width: 70px;
    height: 90px;
    top: 10px;
    left: 130px;
    background: var(--inset-base);
    clip-path: polygon(50% 0%, 100% 50%, 50% 100%, 0% 50%);
    box-shadow: 4px 4px 10px var(--dark-shadow), -4px -4px 10px var(--light-highlight);
    transform: translate(calc(var(--mx, 0) * 1.5px), calc(var(--my, 0) * 1.5px));
}

.facet-7 {
    width: 60px;
    height: 80px;
    top: 300px;
    left: 120px;
    background: #CDD4DE;
    clip-path: polygon(40% 0%, 100% 30%, 60% 100%, 0% 70%);
    box-shadow: 3px 3px 8px var(--dark-shadow), -3px -3px 8px var(--light-highlight);
    transform: translate(calc(var(--mx, 0) * 3.5px), calc(var(--my, 0) * 3.5px));
}

/* Scroll Indicator */
#scroll-indicator {
    position: absolute;
    bottom: 60px;
    left: 50%;
    transform: translateX(-50%);
}

.diamond-pulse {
    width: 20px;
    height: 20px;
    background: var(--surface-base);
    transform: rotate(45deg);
    animation: shadowBreath 2s ease-in-out infinite;
}

@keyframes shadowBreath {
    0%, 100% {
        box-shadow: 4px 4px 8px var(--dark-shadow), -4px -4px 8px var(--light-highlight);
    }
    50% {
        box-shadow: 8px 8px 16px var(--dark-shadow), -8px -8px 16px var(--light-highlight);
    }
}

/* ============================================
   Section Dividers
   ============================================ */
.section-divider {
    position: relative;
    z-index: 3;
    display: flex;
    justify-content: center;
    margin: -20px 0;
    pointer-events: none;
}

.divider-crystal {
    transition: transform 0.6s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.divider-crystal.hexagon {
    width: 40px;
    height: 40px;
    background: var(--surface-base);
    clip-path: polygon(50% 0%, 100% 25%, 100% 75%, 50% 100%, 0% 75%, 0% 25%);
    box-shadow: 4px 4px 8px var(--dark-shadow), -4px -4px 8px var(--light-highlight);
}

.divider-crystal.diamond {
    width: 36px;
    height: 36px;
    background: var(--surface-base);
    transform: rotate(45deg);
    box-shadow: 4px 4px 8px var(--dark-shadow), -4px -4px 8px var(--light-highlight);
}

.divider-crystal.triangle {
    width: 0;
    height: 0;
    border-left: 20px solid transparent;
    border-right: 20px solid transparent;
    border-bottom: 36px solid var(--surface-base);
    filter: drop-shadow(3px 3px 4px var(--dark-shadow));
    background: none;
    box-shadow: none;
}

.divider-crystal.rotated {
    transform: rotate(60deg);
}

.divider-crystal.diamond.rotated {
    transform: rotate(105deg);
}

/* ============================================
   Section Labels & Headings
   ============================================ */
.section-label {
    display: block;
    font-family: var(--font-main);
    font-weight: 200;
    font-size: clamp(0.7rem, 0.9vw, 0.8rem);
    text-transform: uppercase;
    letter-spacing: 0.12em;
    color: var(--text-whisper);
    margin-bottom: 16px;
}

.section-heading {
    font-family: var(--font-main);
    font-weight: 500;
    font-size: clamp(1.4rem, 3vw, 2.4rem);
    letter-spacing: -0.015em;
    color: var(--text-primary);
    margin-bottom: 48px;
}

/* ============================================
   Neomorphic Cards
   ============================================ */
.neo-card {
    background: var(--surface-base);
    border-radius: 24px;
    padding: 40px;
    box-shadow: var(--shadow-dist) var(--shadow-dist) var(--shadow-blur) var(--shadow-color-dark),
                calc(var(--shadow-dist) * -1) calc(var(--shadow-dist) * -1) var(--shadow-blur) var(--shadow-color-light);
    transition: box-shadow 0.2s cubic-bezier(0.25, 0.46, 0.45, 0.94),
                transform 0.2s cubic-bezier(0.25, 0.46, 0.45, 0.94);
    position: relative;
    overflow: hidden;
    opacity: 0;
    transform: translateY(20px);
}

.neo-card.revealed {
    opacity: 1;
    transform: translateY(0);
}

/* Card corner facet notches */
.neo-card.corner-tl {
    clip-path: polygon(12px 0, 100% 0, 100% 100%, 0 100%, 0 12px);
}

.neo-card.corner-tr {
    clip-path: polygon(0 0, calc(100% - 12px) 0, 100% 12px, 100% 100%, 0 100%);
}

.neo-card.corner-bl {
    clip-path: polygon(0 0, 100% 0, 100% 100%, 12px 100%, 0 calc(100% - 12px));
}

.neo-card.corner-br {
    clip-path: polygon(0 0, 100% 0, 100% calc(100% - 12px), calc(100% - 12px) 100%, 0 100%);
}

.neo-card:hover {
    box-shadow: 12px 12px 24px var(--shadow-color-dark),
                -12px -12px 24px var(--shadow-color-light);
    transform: translateY(-2px);
}

.neo-card:active {
    box-shadow: inset 2px 2px 4px var(--shadow-color-dark),
                inset -2px -2px 4px var(--shadow-color-light);
    transform: translateY(1px);
}

.card-title {
    font-family: var(--font-main);
    font-weight: 500;
    font-size: clamp(1.1rem, 1.8vw, 1.3rem);
    letter-spacing: -0.015em;
    color: var(--text-primary);
    margin-bottom: 12px;
}

.card-text {
    font-family: var(--font-main);
    font-weight: 300;
    font-size: clamp(0.9rem, 1.2vw, 1rem);
    line-height: 1.75;
    letter-spacing: 0.01em;
    color: var(--text-secondary);
}

/* ============================================
   Card Grids
   ============================================ */
.card-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 32px;
}

.explore-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 32px;
}

.card-icon {
    width: 48px;
    height: 48px;
    margin-bottom: 20px;
    color: var(--text-whisper);
}

.crystal-icon {
    width: 100%;
    height: 100%;
}

/* ============================================
   Facets Section
   ============================================ */
.facets-showcase {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 32px;
}

.facet-panel {
    padding: 48px;
}

.facet-illustration {
    height: 180px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 24px;
}

/* Prism Cluster Illustration */
.prism-cluster {
    position: relative;
    width: 140px;
    height: 140px;
}

.prism {
    position: absolute;
    background: var(--inset-base);
    box-shadow: 4px 4px 10px var(--dark-shadow), -4px -4px 10px var(--light-highlight);
}

.prism-1 {
    width: 60px;
    height: 100px;
    top: 20px;
    left: 40px;
    clip-path: polygon(50% 0%, 100% 30%, 80% 100%, 0% 70%);
    animation: prismOscillate 8s ease-in-out infinite;
}

.prism-2 {
    width: 50px;
    height: 80px;
    top: 30px;
    left: 10px;
    clip-path: polygon(30% 0%, 100% 20%, 70% 100%, 0% 80%);
    animation: prismOscillate 8s ease-in-out infinite 2s;
}

.prism-3 {
    width: 45px;
    height: 70px;
    top: 40px;
    left: 80px;
    clip-path: polygon(50% 0%, 100% 50%, 50% 100%, 0% 50%);
    animation: prismOscillate 8s ease-in-out infinite 4s;
}

@keyframes prismOscillate {
    0%, 100% { transform: rotate(0deg); }
    50% { transform: rotate(0.5deg); }
}

/* Hex Spiral Illustration */
.hex-spiral {
    position: relative;
    width: 140px;
    height: 140px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.hex-ring {
    position: absolute;
    border: 1px solid var(--dark-shadow);
    clip-path: polygon(50% 0%, 100% 25%, 100% 75%, 50% 100%, 0% 75%, 0% 25%);
    animation: hexOscillate 8s ease-in-out infinite;
}

.hex-1 {
    width: 120px;
    height: 120px;
    animation-delay: 0s;
}

.hex-2 {
    width: 90px;
    height: 90px;
    animation-delay: 1s;
}

.hex-3 {
    width: 60px;
    height: 60px;
    animation-delay: 2s;
}

.hex-4 {
    width: 30px;
    height: 30px;
    animation-delay: 3s;
}

@keyframes hexOscillate {
    0%, 100% { transform: rotate(0deg); }
    50% { transform: rotate(0.5deg); }
}

/* ============================================
   Discover Section
   ============================================ */
.discover-layout {
    display: grid;
    grid-template-columns: 2fr 1fr;
    gap: 32px;
}

.discover-main {
    padding: 48px;
}

.discover-main .card-text + .card-text {
    margin-top: 16px;
}

.discover-side {
    display: flex;
    flex-direction: column;
    gap: 24px;
}

.discover-side .neo-card {
    padding: 28px 32px;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.stat-label {
    font-family: var(--font-main);
    font-weight: 200;
    font-size: clamp(0.7rem, 0.9vw, 0.8rem);
    text-transform: uppercase;
    letter-spacing: 0.12em;
    color: var(--text-whisper);
}

.stat-value {
    font-family: var(--font-main);
    font-weight: 500;
    font-size: clamp(1rem, 1.5vw, 1.2rem);
    letter-spacing: -0.015em;
    color: var(--text-primary);
}

/* ============================================
   Footer Well
   ============================================ */
.footer-well {
    padding-bottom: 80px;
}

.footer-inner {
    text-align: center;
}

.footer-inner .section-label,
.footer-inner .section-heading {
    text-align: center;
}

.footer-content {
    max-width: 600px;
    margin: 0 auto 48px;
}

.footer-text {
    font-family: var(--font-main);
    font-weight: 300;
    font-size: clamp(0.9rem, 1.2vw, 1rem);
    line-height: 1.75;
    color: var(--text-secondary);
    margin-bottom: 24px;
}

.footer-links {
    display: flex;
    justify-content: center;
}

.footer-link {
    font-family: var(--font-main);
    font-weight: 200;
    font-size: clamp(0.7rem, 0.9vw, 0.8rem);
    text-transform: uppercase;
    letter-spacing: 0.12em;
    color: var(--text-secondary);
    text-decoration: none;
    padding: 12px 24px;
    border-radius: 16px;
    background: var(--inset-base);
    box-shadow: var(--shadow-dist) var(--shadow-dist) var(--shadow-blur) var(--shadow-color-dark),
                calc(var(--shadow-dist) * -1) calc(var(--shadow-dist) * -1) var(--shadow-blur) var(--shadow-color-light);
    transition: box-shadow 0.2s cubic-bezier(0.25, 0.46, 0.45, 0.94),
                transform 0.2s ease;
}

.footer-link:hover {
    box-shadow: 12px 12px 24px var(--shadow-color-dark),
                -12px -12px 24px var(--shadow-color-light);
    transform: translateY(-2px);
}

.footer-link:active {
    box-shadow: inset 4px 4px 8px var(--shadow-color-dark),
                inset -4px -4px 8px var(--shadow-color-light);
    transform: translateY(1px);
}

.footer-mark {
    margin-top: 48px;
}

.whisper-text {
    font-family: var(--font-main);
    font-weight: 200;
    font-size: clamp(0.7rem, 0.9vw, 0.8rem);
    letter-spacing: 0.12em;
    color: var(--text-whisper);
    opacity: 0.5;
}

/* ============================================
   Scroll Reveal Animations
   ============================================ */
.neo-card {
    transition: box-shadow 0.2s cubic-bezier(0.25, 0.46, 0.45, 0.94),
                transform 0.3s cubic-bezier(0.34, 1.56, 0.64, 1),
                opacity 0.3s ease;
}

/* Staggered card reveal delays */
.card-grid .neo-card:nth-child(1),
.explore-grid .neo-card:nth-child(1) { transition-delay: 0ms; }
.card-grid .neo-card:nth-child(2),
.explore-grid .neo-card:nth-child(2) { transition-delay: 80ms; }
.card-grid .neo-card:nth-child(3),
.explore-grid .neo-card:nth-child(3) { transition-delay: 160ms; }
.card-grid .neo-card:nth-child(4),
.explore-grid .neo-card:nth-child(4) { transition-delay: 240ms; }

.section-label,
.section-heading {
    opacity: 0;
    transform: translateY(16px);
    transition: opacity 0.4s ease, transform 0.4s ease;
}

.section-label.revealed,
.section-heading.revealed {
    opacity: 1;
    transform: translateY(0);
}

/* Section seam shadow intensity via custom property */
.diagonal-section {
    --seam-intensity: 0;
}

.diagonal-section.recessed {
    box-shadow: inset 0 calc(8px + var(--seam-intensity) * 8px) calc(24px + var(--seam-intensity) * 16px) rgba(123, 140, 163, calc(0.2 + var(--seam-intensity) * 0.2));
}

/* ============================================
   Responsive
   ============================================ */
@media (max-width: 768px) {
    .card-grid,
    .explore-grid {
        grid-template-columns: repeat(2, 1fr);
    }

    .facets-showcase {
        grid-template-columns: 1fr;
    }

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

    .diagonal-section {
        padding: 80px 24px 100px;
    }

    #nav-bar {
        padding: 12px 24px;
    }

    #nav-menu {
        right: 24px;
    }

    #hero-crystal {
        width: 240px;
        height: 300px;
        transform: scale(0.8);
    }

    .neo-card {
        padding: 28px;
    }
}

@media (max-width: 480px) {
    .card-grid,
    .explore-grid {
        grid-template-columns: 1fr;
    }

    .diagonal-section {
        padding: 60px 16px 80px;
    }

    #hero-crystal {
        transform: scale(0.65);
    }

    .neo-card {
        padding: 24px;
    }

    .discover-side {
        flex-direction: row;
        flex-wrap: wrap;
    }

    .discover-side .neo-card {
        flex: 1;
        min-width: 120px;
    }
}
