/* ==========================================
   tanso.tech — Styles
   Victorian Crystal Laboratory in Neon Light
   ========================================== */

:root {
    --bg-primary: #06070d;
    --bg-secondary: #0e1019;
    --cyan: #00fff7;
    --magenta: #ff00c8;
    --violet: #7b2fff;
    --text-primary: #c0c8d8;
    --text-secondary: #8892a6;
    --diamond-white: #e8f0ff;
    --brass: #b8944a;
    --breath-duration: 8s;
}

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

html, body {
    width: 100%;
    height: 100%;
    overflow: hidden;
    background: var(--bg-primary);
    color: var(--text-primary);
    font-family: 'Nunito Sans', sans-serif;
    font-weight: 400;
}

/* ---- Hex Watermark ---- */
.hex-watermark {
    position: fixed;
    inset: 0;
    z-index: 0;
    opacity: 0.4;
    pointer-events: none;
}

/* ---- Scroll Container ---- */
.scroll-container {
    display: flex;
    width: 700vw;
    height: 100vh;
    overflow-x: auto;
    overflow-y: hidden;
    scroll-snap-type: x mandatory;
    scroll-behavior: smooth;
    -webkit-overflow-scrolling: touch;
}

/* ---- Panel ---- */
.panel {
    position: relative;
    width: 100vw;
    height: 100vh;
    flex-shrink: 0;
    scroll-snap-align: start;
    display: flex;
    align-items: center;
    justify-content: center;
    background: radial-gradient(ellipse at center, var(--bg-primary) 0%, var(--bg-secondary) 100%);
    overflow: hidden;
    transition: opacity 0.8s ease;
}

.panel.faded {
    opacity: 0.3;
}

/* ---- Victorian Frames (SVG) ---- */
.frame {
    position: absolute;
    inset: 4vh 4vw;
    width: calc(100% - 8vw);
    height: calc(100% - 8vh);
    pointer-events: none;
    z-index: 2;
}

.frame-path {
    stroke-dasharray: 3000;
    stroke-dashoffset: 3000;
    transition: stroke-dashoffset 2s ease;
}

.panel.active .frame-path {
    stroke-dashoffset: 0;
}

/* ---- Panel Title ---- */
.panel-title {
    position: absolute;
    top: 12vh;
    left: 50%;
    transform: translateX(-50%);
    font-family: 'Josefin Sans', sans-serif;
    font-weight: 300;
    font-size: clamp(2rem, 5vw, 4.5rem);
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: var(--cyan);
    text-shadow: 0 0 20px rgba(0, 255, 247, 0.4), 0 0 40px rgba(0, 255, 247, 0.15);
    z-index: 3;
    opacity: 0;
    transform: translateX(-50%) translateY(20px);
    transition: opacity 1s ease 0.3s, transform 1s ease 0.3s;
}

.panel.active .panel-title {
    opacity: 1;
    transform: translateX(-50%) translateY(0);
}

/* ---- Labels ---- */
.label {
    position: absolute;
    bottom: 12vh;
    left: 50%;
    transform: translateX(-50%);
    font-family: 'IBM Plex Mono', monospace;
    font-weight: 400;
    font-size: clamp(0.7rem, 0.9vw, 0.85rem);
    letter-spacing: 0.08em;
    color: var(--magenta);
    text-shadow: 0 0 10px rgba(255, 0, 200, 0.3);
    z-index: 3;
    opacity: 0;
    transition: opacity 1s ease 0.6s;
}

.panel.active .label {
    opacity: 1;
}

.label--final {
    font-family: 'Josefin Sans', sans-serif;
    font-weight: 300;
    font-size: clamp(1rem, 2vw, 1.8rem);
    letter-spacing: 0.2em;
    color: var(--diamond-white);
    text-shadow: 0 0 15px rgba(232, 240, 255, 0.4);
}

/* ---- Kanji Watermark ---- */
.kanji-watermark {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-family: 'Noto Sans JP', sans-serif;
    font-weight: 300;
    font-size: 20vmin;
    color: var(--bg-secondary);
    opacity: 0.03;
    pointer-events: none;
    z-index: 1;
}

/* ---- Specimens ---- */
.specimen {
    position: relative;
    z-index: 2;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* == Panel 1: Single Atom == */
.specimen--atom {
    width: 300px;
    height: 300px;
    perspective: 800px;
    transform-style: preserve-3d;
}

.atom-core {
    position: absolute;
    top: 50%;
    left: 50%;
    width: 16px;
    height: 16px;
    margin: -8px 0 0 -8px;
    border-radius: 50%;
    background: var(--cyan);
    box-shadow: 0 0 4px var(--cyan), 0 0 15px rgba(0, 255, 247, 0.5), 0 0 40px rgba(0, 255, 247, 0.2);
}

.orbit {
    position: absolute;
    top: 50%;
    left: 50%;
    border: 1px solid rgba(0, 255, 247, 0.3);
    border-radius: 50%;
    transform-style: preserve-3d;
}

.orbit--1 {
    width: 140px; height: 140px;
    margin: -70px 0 0 -70px;
    animation: orbitSpin1 var(--breath-duration) linear infinite;
}
.orbit--2 {
    width: 200px; height: 200px;
    margin: -100px 0 0 -100px;
    animation: orbitSpin2 var(--breath-duration) linear infinite;
}
.orbit--3 {
    width: 260px; height: 260px;
    margin: -130px 0 0 -130px;
    animation: orbitSpin3 var(--breath-duration) linear infinite;
}

.electron {
    position: absolute;
    top: -4px;
    left: 50%;
    margin-left: -4px;
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--magenta);
    box-shadow: 0 0 6px var(--magenta), 0 0 15px rgba(255, 0, 200, 0.4);
}

@keyframes orbitSpin1 {
    from { transform: rotateX(70deg) rotateY(0deg); }
    to { transform: rotateX(70deg) rotateY(360deg); }
}
@keyframes orbitSpin2 {
    from { transform: rotateX(30deg) rotateZ(60deg) rotateY(0deg); }
    to { transform: rotateX(30deg) rotateZ(60deg) rotateY(360deg); }
}
@keyframes orbitSpin3 {
    from { transform: rotateX(50deg) rotateZ(-30deg) rotateY(0deg); }
    to { transform: rotateX(50deg) rotateZ(-30deg) rotateY(360deg); }
}

/* == Panel 2: Graphite Layers == */
.specimen--graphite {
    width: 320px;
    height: 280px;
    perspective: 600px;
    transform-style: preserve-3d;
}

.graphite-layer {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    transform-style: preserve-3d;
}

.hex-grid {
    width: 280px;
    height: 240px;
}

.graphite-layer--1 {
    transform: rotateX(55deg) translateZ(40px);
    animation: graphiteShear1 var(--breath-duration) ease-in-out infinite;
}
.graphite-layer--2 {
    transform: rotateX(55deg) translateZ(0px);
    animation: graphiteShear2 var(--breath-duration) ease-in-out infinite;
}
.graphite-layer--3 {
    transform: rotateX(55deg) translateZ(-40px);
    animation: graphiteShear3 var(--breath-duration) ease-in-out infinite;
}

@keyframes graphiteShear1 {
    0%, 100% { transform: rotateX(55deg) translateZ(40px) translateX(0); }
    50% { transform: rotateX(55deg) translateZ(40px) translateX(20px); }
}
@keyframes graphiteShear2 {
    0%, 100% { transform: rotateX(55deg) translateZ(0px) translateX(0); }
    50% { transform: rotateX(55deg) translateZ(0px) translateX(0); }
}
@keyframes graphiteShear3 {
    0%, 100% { transform: rotateX(55deg) translateZ(-40px) translateX(0); }
    50% { transform: rotateX(55deg) translateZ(-40px) translateX(-20px); }
}

/* == Panel 3: Buckyball == */
.specimen--buckyball {
    width: 300px;
    height: 300px;
    perspective: 800px;
}

.buckyball {
    width: 100%;
    height: 100%;
    position: relative;
    transform-style: preserve-3d;
    animation: buckyRotate var(--breath-duration) linear infinite;
}

.buckyball:hover {
    animation-duration: 3s;
}

.bucky-face {
    position: absolute;
    top: 50%;
    left: 50%;
    width: 80px;
    height: 80px;
    margin: -40px 0 0 -40px;
    border: 1px solid var(--cyan);
    box-shadow: 0 0 4px rgba(0, 255, 247, 0.3);
    clip-path: polygon(50% 0%, 100% 38%, 81% 100%, 19% 100%, 0% 38%);
}

.bucky-face--1 { transform: rotateY(0deg) translateZ(100px); }
.bucky-face--2 { transform: rotateY(72deg) translateZ(100px); }
.bucky-face--3 { transform: rotateY(144deg) translateZ(100px); }
.bucky-face--4 { transform: rotateY(216deg) translateZ(100px); }
.bucky-face--5 { transform: rotateY(288deg) translateZ(100px); }
.bucky-face--6 { transform: rotateX(90deg) translateZ(100px); }
.bucky-face--7 { transform: rotateX(-90deg) translateZ(100px); }
.bucky-face--8 { transform: rotateX(180deg) translateZ(100px); }

.buckyball:hover .bucky-face:nth-child(odd) {
    border-color: var(--magenta);
    box-shadow: 0 0 8px rgba(255, 0, 200, 0.4);
}

.bucky-ring {
    position: absolute;
    top: 50%;
    left: 50%;
    border-radius: 50%;
    border: 1px solid rgba(0, 255, 247, 0.2);
}
.bucky-ring--1 {
    width: 200px; height: 200px; margin: -100px 0 0 -100px;
    transform: rotateX(60deg);
}
.bucky-ring--2 {
    width: 180px; height: 180px; margin: -90px 0 0 -90px;
    transform: rotateY(60deg);
}
.bucky-ring--3 {
    width: 160px; height: 160px; margin: -80px 0 0 -80px;
    transform: rotateZ(60deg);
}

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

/* == Panel 4: Nanotube == */
.specimen--nanotube {
    width: 300px;
    height: 300px;
    perspective: 600px;
    transform-style: preserve-3d;
    display: flex;
    align-items: center;
    justify-content: center;
}

.nanotube-ring {
    position: absolute;
    border: 1.5px solid var(--cyan);
    border-radius: 50%;
    top: 50%;
    left: 50%;
}

.nanotube-ring--1 { width: 40px; height: 40px; margin: -20px 0 0 -20px; transform: translateZ(-200px); animation: tubeRotCW var(--breath-duration) linear infinite; box-shadow: 0 0 8px rgba(0, 255, 247, 0.3); }
.nanotube-ring--2 { width: 60px; height: 60px; margin: -30px 0 0 -30px; transform: translateZ(-140px); animation: tubeRotCCW var(--breath-duration) linear infinite; box-shadow: 0 0 8px rgba(0, 255, 247, 0.25); }
.nanotube-ring--3 { width: 80px; height: 80px; margin: -40px 0 0 -40px; transform: translateZ(-80px); animation: tubeRotCW var(--breath-duration) linear infinite; box-shadow: 0 0 8px rgba(0, 255, 247, 0.2); }
.nanotube-ring--4 { width: 100px; height: 100px; margin: -50px 0 0 -50px; transform: translateZ(-20px); animation: tubeRotCCW var(--breath-duration) linear infinite; box-shadow: 0 0 10px rgba(0, 255, 247, 0.3); }
.nanotube-ring--5 { width: 120px; height: 120px; margin: -60px 0 0 -60px; transform: translateZ(40px); animation: tubeRotCW var(--breath-duration) linear infinite; box-shadow: 0 0 10px rgba(0, 255, 247, 0.3); }
.nanotube-ring--6 { width: 140px; height: 140px; margin: -70px 0 0 -70px; transform: translateZ(100px); animation: tubeRotCCW var(--breath-duration) linear infinite; box-shadow: 0 0 8px rgba(0, 255, 247, 0.2); }
.nanotube-ring--7 { width: 160px; height: 160px; margin: -80px 0 0 -80px; transform: translateZ(160px); animation: tubeRotCW var(--breath-duration) linear infinite; box-shadow: 0 0 8px rgba(0, 255, 247, 0.15); opacity: 0.6; }
.nanotube-ring--8 { width: 180px; height: 180px; margin: -90px 0 0 -90px; transform: translateZ(220px); animation: tubeRotCCW var(--breath-duration) linear infinite; box-shadow: 0 0 6px rgba(0, 255, 247, 0.1); opacity: 0.3; }

@keyframes tubeRotCW {
    from { transform: translateZ(var(--tz, 0)) rotateZ(0deg); }
    to { transform: translateZ(var(--tz, 0)) rotateZ(360deg); }
}
@keyframes tubeRotCCW {
    from { transform: translateZ(var(--tz, 0)) rotateZ(0deg); }
    to { transform: translateZ(var(--tz, 0)) rotateZ(-360deg); }
}

/* == Panel 5: Diamond Lattice == */
.specimen--diamond {
    width: 300px;
    height: 300px;
    perspective: 800px;
}

.diamond-lattice {
    width: 100%;
    height: 100%;
    position: relative;
    transform-style: preserve-3d;
    animation: diamondRotate calc(var(--breath-duration) * 2) linear infinite;
}

.diamond-atom {
    position: absolute;
    width: 12px;
    height: 12px;
    margin: -6px 0 0 -6px;
    border-radius: 50%;
    background: var(--diamond-white);
    box-shadow: 0 0 4px var(--diamond-white), 0 0 15px rgba(232, 240, 255, 0.5), 0 0 40px rgba(232, 240, 255, 0.2);
    animation: atomPulse var(--breath-duration) ease-in-out infinite;
}

.diamond-atom--1 { top: 50%; left: 50%; transform: translateZ(60px); }
.diamond-atom--2 { top: 30%; left: 30%; transform: translateZ(20px); }
.diamond-atom--3 { top: 30%; left: 70%; transform: translateZ(20px); }
.diamond-atom--4 { top: 70%; left: 30%; transform: translateZ(20px); }
.diamond-atom--5 { top: 70%; left: 70%; transform: translateZ(20px); }
.diamond-atom--6 { top: 50%; left: 50%; transform: translateZ(-20px); }
.diamond-atom--7 { top: 20%; left: 50%; transform: translateZ(-60px); }
.diamond-atom--8 { top: 80%; left: 50%; transform: translateZ(-60px); }

.diamond-bond {
    position: absolute;
    width: 2px;
    height: 80px;
    top: 50%;
    left: 50%;
    margin-left: -1px;
    background: linear-gradient(to bottom, var(--cyan), var(--diamond-white));
    transform-origin: top center;
    opacity: 0.6;
    animation: bondPulse var(--breath-duration) ease-in-out infinite reverse;
}

.diamond-bond--1 { transform: rotateZ(-35deg) rotateX(20deg); }
.diamond-bond--2 { transform: rotateZ(35deg) rotateX(20deg); }
.diamond-bond--3 { transform: rotateZ(-35deg) rotateX(-20deg); }
.diamond-bond--4 { transform: rotateZ(35deg) rotateX(-20deg); }
.diamond-bond--5 { transform: rotateZ(0deg) rotateX(45deg); height: 60px; }
.diamond-bond--6 { transform: rotateZ(0deg) rotateX(-45deg); height: 60px; }

@keyframes diamondRotate {
    from { transform: rotateX(20deg) rotateY(0deg); }
    to { transform: rotateX(20deg) rotateY(360deg); }
}

@keyframes atomPulse {
    0%, 100% { transform: translateZ(var(--tz, 0)) scale(1); }
    50% { transform: translateZ(var(--tz, 0)) scale(1.3); }
}

@keyframes bondPulse {
    0%, 100% { opacity: 0.6; }
    50% { opacity: 1; }
}

/* == Panel 6: Graphene Sheet == */
.specimen--graphene {
    width: 80vw;
    max-width: 600px;
    height: 50vh;
    perspective: 600px;
}

.graphene-sheet {
    width: 100%;
    height: 100%;
    transform: rotateX(65deg);
    animation: grapheneShimmer var(--breath-duration) ease-in-out infinite alternate;
}

@keyframes grapheneShimmer {
    0% { filter: drop-shadow(0 0 4px rgba(0, 255, 247, 0.3)); }
    100% { filter: drop-shadow(0 0 8px rgba(123, 47, 255, 0.4)); }
}

/* == Panel 7: Convergence == */
.specimen--convergence {
    width: 400px;
    height: 400px;
}

.convergence-glow {
    position: absolute;
    top: 50%;
    left: 50%;
    width: 300px;
    height: 300px;
    margin: -150px 0 0 -150px;
    border-radius: 50%;
    background: radial-gradient(circle, rgba(0, 255, 247, 0.08) 0%, transparent 70%);
    animation: convGlow var(--breath-duration) ease-in-out infinite alternate;
}

.convergence-svg {
    width: 100%;
    height: 100%;
    animation: convRotate calc(var(--breath-duration) * 3) linear infinite;
}

.conv-atom {
    filter: drop-shadow(0 0 6px var(--cyan)) drop-shadow(0 0 20px rgba(0, 255, 247, 0.3));
}

@keyframes convGlow {
    0% { opacity: 0.5; transform: scale(1); }
    100% { opacity: 1; transform: scale(1.1); }
}

@keyframes convRotate {
    from { transform: rotate(0deg); }
    to { transform: rotate(360deg); }
}

/* ---- Progress Bar ---- */
.progress-bar {
    position: fixed;
    bottom: 3vh;
    left: 10vw;
    right: 10vw;
    height: 2px;
    background: rgba(14, 16, 25, 0.8);
    z-index: 100;
}

.progress-fill {
    height: 100%;
    width: 0%;
    background: linear-gradient(90deg, var(--cyan), var(--violet), var(--magenta));
    transition: width 0.3s ease;
    box-shadow: 0 0 8px rgba(0, 255, 247, 0.4);
}

.diamond-markers {
    position: absolute;
    top: 50%;
    left: 0;
    right: 0;
    transform: translateY(-50%);
    display: flex;
    justify-content: space-between;
}

.diamond-marker {
    width: 10px;
    height: 10px;
    background: var(--bg-secondary);
    border: 1px solid var(--text-secondary);
    clip-path: polygon(50% 0%, 100% 50%, 50% 100%, 0% 50%);
    cursor: pointer;
    transition: all 0.5s ease;
    padding: 0;
}

.diamond-marker.active {
    background: var(--cyan);
    border-color: var(--cyan);
    box-shadow: 0 0 8px rgba(0, 255, 247, 0.6);
    animation: breathe var(--breath-duration) ease-in-out infinite;
}

@keyframes breathe {
    0%, 100% { transform: scale(1); opacity: 1; }
    50% { transform: scale(1.4); opacity: 0.7; }
}

/* ---- Bookends ---- */
.bookend {
    position: fixed;
    z-index: 100;
    font-family: 'Josefin Sans', sans-serif;
    font-weight: 300;
    letter-spacing: 0.12em;
    color: var(--text-secondary);
    font-size: 0.75rem;
    writing-mode: vertical-rl;
    opacity: 0.5;
}

.bookend--left {
    left: 2vw;
    top: 50%;
    transform: translateY(-50%);
    font-family: 'Noto Sans JP', sans-serif;
    font-size: 0.9rem;
}

.bookend--right {
    right: 2vw;
    top: 50%;
    transform: translateY(-50%);
    text-transform: uppercase;
}

/* ---- Scrollbar ---- */
.scroll-container::-webkit-scrollbar {
    display: none;
}
.scroll-container {
    -ms-overflow-style: none;
    scrollbar-width: none;
}
