/* tanso.in - Holographic Carbon Design */

:root {
    --bg-void: #0a0a12;
    --surface-graphite: #1a1a2e;
    --neon-magenta: #ff2d7b;
    --neon-cyan: #00f0ff;
    --neon-violet: #8b00ff;
    --holo-gold: #ffd000;
    --text-diamond: #f0eef5;
    --text-graphene: #8a8a9e;
    --trace-color: #2a2a3e;
    --mx: 50%;
    --my: 50%;
    --scroll: 0;
}

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

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

body {
    background: var(--bg-void);
    color: var(--text-diamond);
    font-family: 'IBM Plex Sans', sans-serif;
    font-weight: 400;
    font-size: clamp(0.95rem, 1.2vw, 1.15rem);
    line-height: 1.72;
    overflow-x: hidden;
}

/* ============================
   Typography
   ============================ */

.mono-accent {
    font-family: 'IBM Plex Mono', monospace;
    font-weight: 400;
    font-size: 0.85rem;
    letter-spacing: 0.08em;
}

.slab-heading {
    font-family: 'Roboto Slab', serif;
    font-weight: 300;
    font-size: clamp(1.4rem, 3vw, 2.4rem);
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: var(--text-diamond);
}

/* ============================
   Depth Indicator
   ============================ */

#depth-indicator {
    position: fixed;
    right: 16px;
    top: 50%;
    transform: translateY(-50%);
    width: 2px;
    height: 60vh;
    background: var(--surface-graphite);
    z-index: 100;
    border-radius: 1px;
}

#depth-fill {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 0%;
    background: linear-gradient(to bottom, var(--neon-magenta), var(--neon-violet), var(--neon-cyan));
    border-radius: 1px;
    transition: height 0.15s ease-out;
}

#depth-label {
    position: absolute;
    bottom: -24px;
    left: 50%;
    transform: translateX(-50%);
    color: var(--text-graphene);
    white-space: nowrap;
}

/* ============================
   Hexagonal Background Pattern
   ============================ */

.hex-bg {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    opacity: 0.05;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='56' height='100'%3E%3Cpath d='M28 66L0 50L0 16L28 0L56 16L56 50Z' fill='none' stroke='%231a1a2e' stroke-width='0.5'/%3E%3Cpath d='M28 166L0 150L0 116L28 100L56 116L56 150Z' fill='none' stroke='%231a1a2e' stroke-width='0.5'/%3E%3C/svg%3E");
    background-size: 56px 100px;
    pointer-events: none;
    transition: opacity 0.8s ease;
}

.hex-bg-active {
    opacity: 0.3;
}

/* ============================
   Stages (Sections)
   ============================ */

.stage {
    position: relative;
    width: 100%;
    min-height: 100vh;
    overflow: hidden;
}

/* ============================
   Stage 0 - Surface Iridescence
   ============================ */

#stage-0 {
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--bg-void);
}

#holo-glow {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: radial-gradient(
        ellipse 60vw 60vw at var(--mx) var(--my),
        rgba(255, 45, 123, 0.15),
        rgba(139, 0, 255, 0.1) 25%,
        rgba(0, 240, 255, 0.08) 50%,
        rgba(255, 208, 0, 0.05) 70%,
        transparent 100%
    );
    pointer-events: none;
    opacity: 0;
    animation: fadeInGlow 0.8s 0.8s forwards;
}

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

#hero-content {
    position: relative;
    z-index: 2;
    text-align: center;
}

#hero-title {
    font-family: 'Zilla Slab', serif;
    font-weight: 700;
    font-size: clamp(5rem, 12vw, 10rem);
    letter-spacing: 0.02em;
    line-height: 1;
    background: linear-gradient(
        135deg,
        var(--neon-magenta),
        var(--neon-violet),
        var(--neon-cyan),
        var(--holo-gold),
        var(--neon-magenta)
    );
    background-size: 300% 300%;
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
    animation: holoShift 8s ease-in-out infinite;
}

@keyframes holoShift {
    0%, 100% { background-position: 0% 50%; }
    25% { background-position: 100% 0%; }
    50% { background-position: 100% 100%; }
    75% { background-position: 0% 100%; }
}

#hero-subtitle {
    font-family: 'IBM Plex Sans', sans-serif;
    font-weight: 300;
    font-size: clamp(1rem, 2vw, 1.5rem);
    color: var(--text-graphene);
    margin-top: 1.5rem;
    opacity: 0;
    animation: fadeIn 1s 1.5s forwards;
}

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

/* Mobile fallback for holographic effect */
@media (hover: none) {
    #holo-glow {
        animation: mobileHolo 6s ease-in-out infinite, fadeInGlow 0.8s 0.8s forwards;
    }
    @keyframes mobileHolo {
        0%, 100% { --mx: 30%; --my: 40%; }
        33% { --mx: 70%; --my: 30%; }
        66% { --mx: 50%; --my: 70%; }
    }
}

/* ============================
   Stage 1 - Lattice Structure
   ============================ */

#stage-1 {
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--bg-void);
}

#lattice-container {
    position: relative;
    width: 100%;
    max-width: 1200px;
    padding: 5vh 2rem;
    z-index: 2;
}

.hex-row {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 1.5rem;
    margin-bottom: 1rem;
    will-change: transform;
}

.hex-row-fg {
    margin-left: 5rem;
}

.hex-tile {
    width: 200px;
    height: 230px;
    clip-path: polygon(50% 0%, 100% 25%, 100% 75%, 50% 100%, 0% 75%, 0% 25%);
    background: var(--surface-graphite);
    display: flex;
    align-items: center;
    justify-content: center;
    transition: transform 0.5s ease, opacity 0.5s ease;
    will-change: transform;
    position: relative;
}

.hex-tile::before {
    content: '';
    position: absolute;
    inset: 2px;
    clip-path: polygon(50% 0%, 100% 25%, 100% 75%, 50% 100%, 0% 75%, 0% 25%);
    background: var(--bg-void);
    z-index: 0;
}

.hex-inner {
    position: relative;
    z-index: 1;
    text-align: center;
    padding: 2rem 1.2rem;
}

.hex-text {
    display: block;
    color: var(--neon-cyan);
    font-size: 1.1rem;
    margin-bottom: 0.8rem;
}

.hex-desc {
    font-family: 'IBM Plex Sans', sans-serif;
    font-weight: 300;
    font-size: 0.8rem;
    line-height: 1.5;
    color: var(--text-graphene);
}

.hex-tile.in-focus {
    transform: scale(1.08);
}

.hex-tile.in-focus::before {
    background: linear-gradient(135deg, rgba(255,45,123,0.05), rgba(0,240,255,0.05));
}

.hex-tile.in-focus .hex-text {
    color: var(--neon-magenta);
}

.hex-tile.dimmed {
    opacity: 0.6;
}

.hex-tile.in-focus {
    background: linear-gradient(135deg, var(--neon-magenta), var(--neon-violet), var(--neon-cyan), var(--holo-gold));
}

/* ============================
   Stage 2 - Electron Cloud
   ============================ */

#stage-2 {
    background: var(--bg-void);
}

#electron-cloud {
    position: relative;
    width: 100%;
    height: 100vh;
    overflow: hidden;
}

.molecule {
    position: absolute;
    will-change: transform;
}

.molecule-fullerene {
    width: 200px;
    height: 200px;
    top: 10%;
    left: 15%;
}

.molecule-diamond {
    width: 180px;
    height: 180px;
    top: 30%;
    right: 15%;
}

.molecule-nanotube {
    width: 220px;
    height: 160px;
    bottom: 15%;
    left: 35%;
}

.molecule-label {
    font-family: 'IBM Plex Mono', monospace;
    font-size: 10px;
    fill: var(--text-graphene);
    letter-spacing: 0.08em;
}

.draw-path {
    transition: stroke-dashoffset 1.2s ease-in-out;
}

.draw-path.drawn {
    stroke-dashoffset: 0;
}

.cloud-text {
    position: absolute;
    will-change: transform;
    opacity: 0;
    transition: opacity 0.6s ease;
}

.cloud-text.visible {
    opacity: 1;
}

.annotation-label {
    font-family: 'IBM Plex Mono', monospace;
    font-size: 0.75rem;
    color: var(--text-graphene);
    letter-spacing: 0.08em;
    white-space: nowrap;
}

.annotation-arrow {
    position: absolute;
    width: 60px;
    height: 30px;
    will-change: transform;
}

.annotation-arrow:hover .arrow-line {
    stroke: var(--neon-cyan);
}

.lens-flare {
    position: absolute;
    width: 30px;
    height: 30px;
    border-radius: 50%;
    background: radial-gradient(circle, var(--neon-magenta), var(--neon-violet), var(--neon-cyan), transparent);
    opacity: 0.3;
    animation: pulseLens 4s ease-in-out infinite;
    pointer-events: none;
}

.lens-flare:nth-child(2n) {
    animation-delay: -1.5s;
}

.lens-flare:nth-child(3n) {
    animation-delay: -2.8s;
    width: 20px;
    height: 20px;
}

.lens-flare:nth-child(4n) {
    animation-delay: -0.7s;
    width: 40px;
    height: 40px;
}

@keyframes pulseLens {
    0%, 100% { opacity: 0.3; transform: scale(1); }
    50% { opacity: 0.8; transform: scale(1.2); }
}

/* ============================
   Stage 3 - Bond Formation
   ============================ */

#stage-3 {
    background: var(--bg-void);
    display: flex;
    align-items: center;
    justify-content: center;
}

#bond-container {
    position: relative;
    width: 100%;
    max-width: 1200px;
    min-height: 100vh;
    display: flex;
    align-items: stretch;
    padding: 10vh 0;
}

.bond-column {
    width: 40%;
    display: flex;
    flex-direction: column;
    justify-content: center;
    gap: 4rem;
    will-change: transform;
    padding: 2rem;
}

#bond-col-left {
    margin-left: 5%;
}

#bond-col-right {
    margin-left: auto;
    margin-right: 5%;
    text-align: right;
}

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

.bond-line {
    fill: none;
    stroke: var(--text-graphene);
    stroke-width: 1.5;
    stroke-linecap: round;
    transition: stroke 0.6s ease;
}

.bond-line.active {
    stroke: var(--neon-magenta);
}

.bond-item {
    position: relative;
}

.bond-item .slab-heading {
    margin-bottom: 0.5rem;
}

.bond-desc {
    font-family: 'IBM Plex Sans', sans-serif;
    font-weight: 300;
    font-size: clamp(0.85rem, 1.1vw, 1rem);
    line-height: 1.6;
    color: var(--text-graphene);
}

/* ============================
   Stage 4 - Core
   ============================ */

#stage-4 {
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--bg-void);
}

#core-content {
    text-align: center;
    padding: 2rem;
    max-width: 900px;
}

#core-statement {
    font-family: 'Zilla Slab', serif;
    font-weight: 600;
    font-size: clamp(2.5rem, 6vw, 5rem);
    line-height: 1.2;
    letter-spacing: 0.02em;
    background: linear-gradient(
        135deg,
        var(--neon-magenta),
        var(--neon-violet),
        var(--neon-cyan),
        var(--holo-gold),
        var(--neon-magenta)
    );
    background-size: 400% 400%;
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
    animation: slowHolo 20s ease-in-out infinite;
}

@keyframes slowHolo {
    0%, 100% { background-position: 0% 50%; }
    25% { background-position: 100% 0%; }
    50% { background-position: 100% 100%; }
    75% { background-position: 0% 100%; }
}

#core-hexagon {
    margin-top: 4rem;
    display: inline-block;
    position: relative;
    cursor: pointer;
    opacity: 0.3;
    animation: pulseLens 4s ease-in-out infinite;
}

#core-hexagon svg {
    width: 48px;
    height: 48px;
}

#core-hexagon:hover {
    opacity: 1;
    animation: none;
}

#core-contact {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    white-space: nowrap;
    transition: opacity 0.4s ease, transform 0.4s ease;
}

#core-contact.hidden {
    opacity: 0;
    pointer-events: none;
    transform: translate(-50%, -50%) scale(0.8);
}

#core-contact.visible {
    opacity: 1;
    pointer-events: auto;
    transform: translate(-50%, calc(-50% - 40px)) scale(1);
}

#core-contact a {
    color: var(--neon-cyan);
    text-decoration: none;
    font-size: 0.85rem;
    transition: color 0.3s ease;
}

#core-contact a:hover {
    color: var(--neon-magenta);
}

/* ============================
   Responsive
   ============================ */

@media (max-width: 768px) {
    .hex-tile {
        width: 150px;
        height: 173px;
    }

    .hex-inner {
        padding: 1.2rem 0.8rem;
    }

    .hex-row-fg {
        margin-left: 2.5rem;
    }

    .hex-desc {
        font-size: 0.7rem;
    }

    .bond-column {
        width: 45%;
        padding: 1rem;
        gap: 2.5rem;
    }

    #bond-col-left {
        margin-left: 2%;
    }

    #bond-col-right {
        margin-right: 2%;
    }

    .molecule-fullerene {
        width: 150px;
        height: 150px;
    }

    .molecule-diamond {
        width: 130px;
        height: 130px;
    }

    .molecule-nanotube {
        width: 170px;
        height: 120px;
    }

    #depth-indicator {
        right: 8px;
    }
}

@media (max-width: 480px) {
    .hex-tile {
        width: 130px;
        height: 150px;
    }

    .hex-row-fg {
        margin-left: 1rem;
    }

    .hex-row {
        gap: 0.8rem;
    }

    .bond-column {
        width: 48%;
        gap: 2rem;
    }

    #core-statement {
        font-size: clamp(1.8rem, 5vw, 3rem);
    }
}
