/* === Custom Properties === */
:root {
    --nm-bg: #0b1e3d;
    --nm-shadow-dark: #06101f;
    --nm-shadow-light: #1a3a6a;
    --nm-radius: 40px;
    --nm-distance: 8px;
    --nm-blur: 24px;

    --color-abyssal: #050d1a;
    --color-primary-bg: #0b1e3d;
    --color-neo-light: #1a3a6a;
    --color-neo-dark: #06101f;
    --color-accent: #1e6f9f;
    --color-text: #8bb8d4;
    --color-heading: #c8dce8;
    --color-diamond: #7b68ee;
    --color-fullerene: #d4a853;
    --color-hex-stroke: #0f2847;

    --scroll-wght: 200;

    --font-display: 'Outfit', sans-serif;
    --font-body: 'Libre Franklin', sans-serif;
    --font-jp: 'Zen Kaku Gothic New', sans-serif;
}

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

html {
    scroll-behavior: smooth;
}

body {
    background: var(--nm-bg);
    color: var(--color-text);
    font-family: var(--font-body);
    font-weight: 300;
    font-size: clamp(1rem, 1.2vw, 1.25rem);
    line-height: 1.75;
    letter-spacing: 0.015em;
    overflow-x: hidden;
}

/* === Hexagonal Background === */
#hex-bg {
    position: fixed;
    top: -10%;
    left: -10%;
    width: 120%;
    height: 120%;
    z-index: 0;
    pointer-events: none;
    animation: hex-drift 30s ease-in-out infinite alternate;
}

@keyframes hex-drift {
    0% { transform: translate(0, 0); }
    50% { transform: translate(3px, -3px); }
    100% { transform: translate(-3px, 3px); }
}

/* === Marine Snow Canvas === */
#marine-snow {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 1;
    pointer-events: none;
}

/* === Scroll Indicator === */
#scroll-indicator {
    position: fixed;
    right: 0;
    top: 0;
    width: 2px;
    height: 0%;
    background: var(--color-accent);
    z-index: 100;
    transition: height 0.1s linear;
}

/* === Neomorphic Classes === */
.nm-raised {
    background: var(--nm-bg);
    border-radius: var(--nm-radius);
    box-shadow: 0 0 0 transparent, 0 0 0 transparent;
    transition: box-shadow 0.8s cubic-bezier(0.23, 1, 0.32, 1);
}

.nm-raised.nm-visible {
    box-shadow: var(--nm-distance) var(--nm-distance) var(--nm-blur) var(--nm-shadow-dark),
                calc(-1 * var(--nm-distance)) calc(-1 * var(--nm-distance)) var(--nm-blur) var(--nm-shadow-light);
}

.nm-raised:hover {
    box-shadow: 12px 12px 36px var(--nm-shadow-dark),
                -12px -12px 36px var(--color-accent);
}

.nm-inset {
    display: inline;
    padding: 2px 8px;
    border-radius: 8px;
    box-shadow: inset 4px 4px 12px var(--nm-shadow-dark), inset -4px -4px 12px var(--nm-shadow-light);
}

/* === Typography === */
.section-heading {
    font-family: var(--font-display);
    font-variation-settings: 'wght' var(--scroll-wght);
    color: var(--color-heading);
    font-size: clamp(1.8rem, 4vw, 3.2rem);
    letter-spacing: 0.01em;
    line-height: 1.1;
    margin-bottom: 1.5rem;
}

/* === Hero === */
#hero {
    position: relative;
    z-index: 2;
    height: 100vh;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    background: radial-gradient(ellipse at 50% 60%, #0f3460 0%, #162447 40%, #0b1e3d 80%);
}

.hero-content {
    text-align: center;
}

.hero-kanji {
    font-family: var(--font-jp);
    font-weight: 500;
    font-size: clamp(3rem, 8vw, 8rem);
    color: var(--color-heading);
    text-shadow: 0 0 60px rgba(30, 111, 159, 0.2);
    /* Neomorphic inset text effect */
    filter: drop-shadow(4px 4px 8px var(--nm-shadow-dark)) drop-shadow(-4px -4px 8px var(--nm-shadow-light));
}

.hero-subtitle {
    font-family: var(--font-display);
    font-variation-settings: 'wght' 200;
    font-size: clamp(1.2rem, 3vw, 2.4rem);
    color: var(--color-text);
    letter-spacing: 0.08em;
    margin-top: 0.5rem;
}

.hero-chevron {
    position: absolute;
    bottom: 3rem;
    animation: pulse-chevron 2s ease-in-out infinite;
}

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

/* === Graphene Plateau === */
#graphene-plateau {
    position: relative;
    z-index: 2;
    min-height: 80vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: clamp(6vh, 10vh, 14vh) clamp(1rem, 8vw, 6rem);
}

.plateau-panel {
    max-width: 720px;
    padding: clamp(2rem, 4vw, 4rem);
}

.plateau-panel .section-heading {
    font-size: clamp(2rem, 5vw, 3.5rem);
}

/* === Allotrope Gallery === */
#allotrope-gallery {
    position: relative;
    z-index: 2;
    padding: 0 clamp(1rem, 8vw, 6rem);
}

.allotrope-pod {
    display: flex;
    align-items: center;
    gap: clamp(1.5rem, 3vw, 3rem);
    padding: clamp(2rem, 4vw, 4rem);
    margin-bottom: clamp(4rem, 8vh, 8rem);
    max-width: 900px;
}

.allotrope-pod:nth-child(odd) {
    margin-left: auto;
    margin-right: 5%;
}

.allotrope-pod:nth-child(even) {
    margin-left: 5%;
    margin-right: auto;
}

.allotrope-visual {
    flex-shrink: 0;
    width: 200px;
    height: 200px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.allotrope-text {
    flex: 1;
}

/* Diamond pod - angular clip */
.diamond-pod {
    clip-path: polygon(5% 0%, 100% 0%, 95% 100%, 0% 100%);
    border-radius: 8px;
}

/* Fullerene pod - circular */
.fullerene-pod {
    border-radius: 50% / 40%;
}

/* Graphite pod - wide slab */
.graphite-pod {
    border-radius: 20px;
    min-height: auto;
}

/* Nanotube pod - tall narrow */
.nanotube-pod {
    border-radius: 60px;
    flex-direction: column;
    max-width: 500px;
    text-align: center;
}

.nanotube-pod .allotrope-visual {
    width: 160px;
    height: 160px;
}

/* Amorphous pod - blob shape */
.amorphous-pod {
    border-radius: 30% 70% 50% 50% / 60% 40% 60% 40%;
}

/* === Diamond Visual: CSS Cube === */
#diamond-visual {
    perspective: 600px;
}

.cube-wireframe {
    width: 100px;
    height: 100px;
    position: relative;
    transform-style: preserve-3d;
    animation: rotate-cube 20s linear infinite;
}

@keyframes rotate-cube {
    from { transform: rotateX(0deg) rotateY(0deg); }
    to { transform: rotateX(360deg) rotateY(360deg); }
}

.cube-face {
    position: absolute;
    width: 100px;
    height: 100px;
    border: 1px solid var(--color-diamond);
    background: transparent;
}

.cube-face:nth-child(1) { transform: translateZ(50px); }
.cube-face:nth-child(2) { transform: rotateY(180deg) translateZ(50px); }
.cube-face:nth-child(3) { transform: rotateY(90deg) translateZ(50px); }
.cube-face:nth-child(4) { transform: rotateY(-90deg) translateZ(50px); }
.cube-face:nth-child(5) { transform: rotateX(90deg) translateZ(50px); }
.cube-face:nth-child(6) { transform: rotateX(-90deg) translateZ(50px); }

/* === Graphene Mesh === */
#graphene-mesh {
    width: 100%;
    height: 100%;
}

/* === Fullerene / Buckyball === */
.buckyball {
    width: 140px;
    height: 140px;
    border-radius: 50%;
    border: 1.5px solid var(--color-fullerene);
    background: radial-gradient(circle, rgba(212, 168, 83, 0.1) 0%, transparent 70%);
    position: relative;
    animation: rotate-bucky 25s linear infinite;
    box-shadow: inset 0 0 30px rgba(212, 168, 83, 0.05);
}

.buckyball::before,
.buckyball::after {
    content: '';
    position: absolute;
    border-radius: 50%;
    border: 1px solid rgba(212, 168, 83, 0.4);
}

.buckyball::before {
    width: 80%;
    height: 80%;
    top: 10%;
    left: 10%;
}

.buckyball::after {
    width: 55%;
    height: 55%;
    top: 22.5%;
    left: 22.5%;
}

@keyframes rotate-bucky {
    from { transform: rotateY(0deg); }
    to { transform: rotateY(360deg); }
}

/* === Nanotube Visual === */
#nanotube-visual {
    overflow: hidden;
    border-radius: 40px;
}

.nanotube-rings {
    display: flex;
    flex-direction: column;
    gap: 6px;
    animation: nanotube-scroll 4s linear infinite;
}

.nanotube-ring {
    width: 120px;
    height: 20px;
    border: 1px solid var(--color-accent);
    border-radius: 50%;
    margin: 0 auto;
}

@keyframes nanotube-scroll {
    from { transform: translateY(0); }
    to { transform: translateY(-156px); }
}

/* === Amorphous Canvas === */
#amorphous-canvas {
    width: 200px;
    height: 200px;
}

/* === Carbon Cycle === */
#carbon-cycle {
    position: relative;
    z-index: 2;
    padding: clamp(6vh, 10vh, 14vh) clamp(1rem, 8vw, 6rem);
    display: flex;
    justify-content: center;
}

.cycle-content {
    max-width: 640px;
}

.cycle-content p {
    margin-bottom: 2rem;
}

.cycle-content .section-heading {
    margin-bottom: 2.5rem;
}

/* === Footer: The Depths === */
#the-depths {
    position: relative;
    z-index: 2;
    min-height: 60vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(to bottom, var(--nm-bg) 0%, var(--color-abyssal) 100%);
    padding: 4rem 2rem;
}

.depths-content {
    text-align: center;
}

.depths-text {
    font-family: var(--font-display);
    font-variation-settings: 'wght' 600;
    font-size: clamp(1.6rem, 4vw, 3rem);
    color: var(--color-heading);
    letter-spacing: 0.02em;
    line-height: 1.3;
    min-height: 4rem;
}

.depths-text .char {
    display: inline-block;
    opacity: 0;
    transform: translateY(8px);
    transition: opacity 0.3s, transform 0.3s;
}

.depths-text .char.visible {
    opacity: 1;
    transform: translateY(0);
}

.depths-url {
    font-family: var(--font-display);
    font-weight: 200;
    font-size: 1rem;
    color: var(--color-accent);
    margin-top: 3rem;
    opacity: 0.6;
    text-shadow: 0 0 20px rgba(30, 111, 159, 0.4);
}

/* === Responsive === */
@media (max-width: 768px) {
    .allotrope-pod {
        flex-direction: column;
        text-align: center;
    }

    .allotrope-pod:nth-child(odd),
    .allotrope-pod:nth-child(even) {
        margin-left: auto;
        margin-right: auto;
    }

    .diamond-pod {
        clip-path: none;
        border-radius: var(--nm-radius);
    }

    .nanotube-pod {
        max-width: 100%;
    }
}
