/* ==========================================================================
   tanso.club — Cabinet of Carbon Curiosities
   Horizontal-scroll surreal gallery
   ========================================================================== */

:root {
    --paper: #F5E6D0;
    --carbon: #1A1A1A;
    --void: #050510;
    --neon-magenta: #FF2D95;
    --neon-cyan: #00F5D4;
    --neon-yellow: #FFD60A;
    --deep-purple: #1A1040;
    --paper-shadow: #8B7355;

    --font-display: "Josefin Sans", "Futura", sans-serif;
    --font-body: "Libre Baskerville", "Georgia", serif;
    --font-mono: "Overpass Mono", "Space Mono", monospace;
}

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

html, body {
    width: 100%;
    height: 100%;
    overflow: hidden;
    background: var(--void);
    color: var(--carbon);
    font-family: var(--font-body);
    -webkit-font-smoothing: antialiased;
}

/* ==========================================================================
   GALLERY CONTAINER — horizontal scroll with snap
   ========================================================================== */

.gallery {
    display: flex;
    flex-direction: row;
    width: 100vw;
    height: 100vh;
    overflow-x: auto;
    overflow-y: hidden;
    scroll-snap-type: x mandatory;
    scroll-behavior: smooth;
    perspective: 1000px;
    transform-style: preserve-3d;
}

.gallery::-webkit-scrollbar {
    height: 4px;
    background: transparent;
}
.gallery::-webkit-scrollbar-thumb {
    background: var(--neon-magenta);
    border-radius: 2px;
}
.gallery::-webkit-scrollbar-track {
    background: transparent;
}

.panel {
    min-width: 100vw;
    width: 100vw;
    height: 100vh;
    flex-shrink: 0;
    scroll-snap-align: start;
    position: relative;
    overflow: hidden;
    transform-style: preserve-3d;
}

.panel-inner {
    position: relative;
    width: 100%;
    height: 100%;
    padding: 4vh 6vw;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
}

/* ==========================================================================
   PAPER / VOID BACKGROUNDS
   ========================================================================== */

.paper {
    background: var(--paper);
    color: var(--carbon);
}

.paper::before {
    content: "";
    position: absolute;
    inset: 0;
    background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='200' height='200'><filter id='n'><feTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='2' stitchTiles='stitch'/><feColorMatrix values='0 0 0 0 0.55 0 0 0 0 0.45 0 0 0 0 0.33 0 0 0 0.4 0'/></filter><rect width='200' height='200' filter='url(%23n)' opacity='0.6'/></svg>");
    opacity: 0.06;
    pointer-events: none;
    mix-blend-mode: multiply;
    z-index: 1;
}

.paper::after {
    content: "";
    position: absolute;
    inset: 0;
    background: radial-gradient(ellipse at center, transparent 40%, rgba(139, 115, 85, 0.25) 100%);
    pointer-events: none;
    z-index: 1;
}

.void {
    background: var(--void);
    color: var(--paper);
}

.void::before {
    content: "";
    position: absolute;
    inset: 0;
    background: radial-gradient(ellipse at center, rgba(26, 16, 64, 0.4) 0%, transparent 70%);
    pointer-events: none;
    z-index: 1;
}

.gradient-bond {
    background: linear-gradient(120deg, var(--void) 0%, var(--deep-purple) 100%);
}

.panel-inner > * {
    position: relative;
    z-index: 2;
}

/* ==========================================================================
   SPECIMEN LABELS (Overpass Mono)
   ========================================================================== */

.specimen-label {
    position: absolute;
    font-family: var(--font-mono);
    font-size: 0.72rem;
    font-weight: 400;
    letter-spacing: 0.14em;
    text-transform: uppercase;
    color: var(--paper-shadow);
    display: flex;
    flex-direction: column;
    gap: 0.2em;
    line-height: 1.3;
    z-index: 5;
}

.specimen-label.inverted {
    color: rgba(245, 230, 208, 0.55);
}

.specimen-label.top-left { top: 3vh; left: 4vw; }
.specimen-label.top-right { top: 3vh; right: 4vw; text-align: right; }
.specimen-label.bottom-left { bottom: 3vh; left: 4vw; }
.specimen-label.bottom-right { bottom: 3vh; right: 4vw; text-align: right; }

/* ==========================================================================
   NEON LINES
   ========================================================================== */

.neon-line {
    position: absolute;
    background: var(--neon-magenta);
    box-shadow: 0 0 12px rgba(255, 45, 149, 0.55);
}

.neon-line.horizontal {
    height: 1px;
    width: 70vw;
    left: 15vw;
}

.neon-line.vertical {
    width: 1px;
    height: 70vh;
    top: 15vh;
}

.neon-line.bisect {
    top: 50%;
}

.neon-line.neon-magenta { background: var(--neon-magenta); }
.neon-line.neon-cyan { background: var(--neon-cyan); box-shadow: 0 0 12px rgba(0, 245, 212, 0.55); }
.neon-line.neon-yellow { background: var(--neon-yellow); box-shadow: 0 0 12px rgba(255, 214, 10, 0.55); }

/* ==========================================================================
   HERO TITLE (Josefin Sans)
   ========================================================================== */

.hero-title {
    font-family: var(--font-display);
    font-weight: 700;
    font-size: clamp(3rem, 7vw, 5.5rem);
    letter-spacing: 0.12em;
    text-transform: uppercase;
    line-height: 1;
    color: var(--carbon);
    display: flex;
    align-items: baseline;
    gap: 0;
    margin: 0;
    position: relative;
    z-index: 3;
}

.hero-title.inverted { color: var(--paper); }

.hero-title .word { display: inline-block; }

.hero-title .dot {
    color: var(--neon-magenta);
    margin: 0 0.1em;
    animation: dotPulse 2.8s ease-in-out infinite;
}

.hero-title.inverted .dot { color: var(--neon-cyan); }

@keyframes dotPulse {
    0%, 100% { opacity: 1; transform: translateY(0); }
    50% { opacity: 0.55; transform: translateY(-0.05em); }
}

.exit-title { letter-spacing: 0.18em; }

.entrance-caption {
    margin-top: 2.2rem;
    font-family: var(--font-body);
    font-style: italic;
    font-size: 1.05rem;
    color: var(--paper-shadow);
    max-width: 520px;
    text-align: center;
    line-height: 1.6;
}

.entrance-caption.inverted { color: rgba(245, 230, 208, 0.7); }

/* ==========================================================================
   PANEL TITLES
   ========================================================================== */

.panel-title {
    font-family: var(--font-display);
    font-weight: 700;
    font-size: clamp(2.2rem, 4.8vw, 3.8rem);
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: var(--carbon);
    margin-bottom: 3vh;
    text-align: center;
    position: relative;
}

.panel-title.inverted { color: var(--paper); }

.panel-title::after {
    content: "";
    display: block;
    width: 60px;
    height: 1px;
    background: var(--neon-magenta);
    margin: 1.2rem auto 0;
    box-shadow: 0 0 8px rgba(255, 45, 149, 0.5);
}

.panel-title.inverted::after { background: var(--neon-cyan); box-shadow: 0 0 8px rgba(0, 245, 212, 0.6); }

.panel-caption {
    margin-top: 3vh;
    font-family: var(--font-body);
    font-style: italic;
    font-size: 1rem;
    color: var(--paper-shadow);
    text-align: center;
    max-width: 620px;
    line-height: 1.6;
}

.panel-caption.inverted { color: rgba(245, 230, 208, 0.65); }

/* ==========================================================================
   PANEL 2: GRAPHITE CARD FLIP
   ========================================================================== */

.card-scene {
    width: min(420px, 50vw);
    height: min(420px, 50vw);
    perspective: 1400px;
    margin: 1rem auto;
}

.card {
    position: relative;
    width: 100%;
    height: 100%;
    transform-style: preserve-3d;
    transition: transform 1.2s cubic-bezier(0.68, -0.55, 0.265, 1.55);
    transform: rotateY(0deg);
}

.card.flipped { transform: rotateY(180deg); }

.card-face {
    position: absolute;
    inset: 0;
    backface-visibility: hidden;
    -webkit-backface-visibility: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    border: 1px solid var(--paper-shadow);
    box-shadow: 0 30px 60px -25px rgba(26, 26, 26, 0.4), 0 0 0 1px rgba(139, 115, 85, 0.25);
}

.card-front {
    background: var(--carbon);
    color: var(--paper);
}

.card-front::before {
    content: "";
    position: absolute;
    inset: 8px;
    border: 1px solid rgba(245, 230, 208, 0.08);
    pointer-events: none;
}

.card-front .face-mark {
    font-family: var(--font-mono);
    letter-spacing: 0.4em;
    font-size: 0.75rem;
    color: rgba(245, 230, 208, 0.35);
    text-transform: uppercase;
}

.card-back {
    background: var(--carbon);
    transform: rotateY(180deg);
    flex-direction: column;
    gap: 1rem;
}

.graphite-svg {
    width: 100%;
    height: 100%;
}

.specimen-tag {
    position: absolute;
    bottom: 14px;
    left: 14px;
    font-family: var(--font-mono);
    font-size: 0.68rem;
    letter-spacing: 0.18em;
    color: var(--neon-magenta);
    text-transform: uppercase;
    text-shadow: 0 0 6px rgba(255, 45, 149, 0.5);
}

/* ==========================================================================
   PANEL 3: DIAMOND VOID
   ========================================================================== */

.diamond-stage {
    position: relative;
    width: min(320px, 40vw);
    height: min(320px, 40vw);
    perspective: 800px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 2rem 0;
}

.diamond-spinner {
    position: relative;
    width: 100%;
    height: 100%;
    transform-style: preserve-3d;
    animation: spin 20s linear infinite;
}

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

.diamond {
    position: absolute;
    inset: 0;
    width: 200px;
    height: 200px;
    margin: auto;
    border: 2px solid var(--neon-magenta);
    clip-path: polygon(50% 0%, 100% 50%, 50% 100%, 0% 50%);
    background: transparent;
    box-shadow: 0 0 30px rgba(255, 45, 149, 0.25);
}

.diamond.outline-cyan {
    width: 260px;
    height: 260px;
    border-color: var(--neon-cyan);
    opacity: 0.55;
    transform: rotateY(45deg);
    box-shadow: 0 0 30px rgba(0, 245, 212, 0.2);
}

.diamond.outline-yellow {
    width: 140px;
    height: 140px;
    border-color: var(--neon-yellow);
    opacity: 0.7;
    transform: rotateY(-30deg);
    box-shadow: 0 0 20px rgba(255, 214, 10, 0.3);
}

.diamond-halo {
    position: absolute;
    inset: -30%;
    border-radius: 50%;
    background: radial-gradient(circle, rgba(255, 45, 149, 0.18) 0%, transparent 60%);
    pointer-events: none;
    z-index: -1;
    animation: haloPulse 6s ease-in-out infinite;
}

@keyframes haloPulse {
    0%, 100% { opacity: 0.6; transform: scale(1); }
    50% { opacity: 1; transform: scale(1.1); }
}

/* ==========================================================================
   PANEL 4: FULLERENE CAROUSEL
   ========================================================================== */

.fullerene-row {
    display: flex;
    flex-direction: row;
    align-items: center;
    justify-content: space-around;
    gap: 2vw;
    width: 100%;
    max-width: 1400px;
    margin: 2rem auto;
}

.fullerene-cell {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1rem;
    flex: 1;
}

.fullerene-cell.cell-tall { transform: translateY(-4vh); }
.fullerene-cell.cell-short { transform: translateY(4vh); }
.fullerene-cell.cell-mid { transform: translateY(-2vh); }

.buckyball {
    width: clamp(120px, 18vw, 240px);
    height: clamp(120px, 18vw, 240px);
    overflow: visible;
}

.bucky-group {
    transform-origin: center;
    transform-box: fill-box;
}

.buckyball.speed-slow .bucky-group { animation: spinFlat 28s linear infinite; }
.buckyball.speed-mid .bucky-group { animation: spinFlat 18s linear infinite reverse; }
.buckyball.speed-fast .bucky-group { animation: spinFlat 11s linear infinite; }

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

.bucky-label {
    font-family: var(--font-mono);
    font-size: 0.7rem;
    letter-spacing: 0.14em;
    text-transform: uppercase;
    color: var(--paper-shadow);
    text-align: center;
}

/* ==========================================================================
   PANEL 5: CHARCOAL STUDY
   ========================================================================== */

.study-title { margin-bottom: 4vh; }

.charcoal-text {
    max-width: 640px;
    margin: 0 auto;
    font-family: var(--font-body);
    font-size: 1.15rem;
    line-height: 1.8;
    letter-spacing: 0.01em;
    color: var(--carbon);
    column-count: 1;
}

.charcoal-text p {
    margin-bottom: 1.2rem;
    text-align: justify;
    hyphens: auto;
}

.dropcap {
    float: left;
    font-family: var(--font-display);
    font-size: 4.2rem;
    line-height: 0.85;
    padding: 0.2rem 0.6rem 0 0;
    font-weight: 700;
    color: var(--neon-magenta);
    text-shadow: 0 0 10px rgba(255, 45, 149, 0.25);
}

.charcoal-text em {
    font-style: italic;
    color: var(--carbon);
}

.charcoal-text .mono {
    font-family: var(--font-mono);
    font-weight: 600;
    padding: 0 0.2em;
}

.charcoal-text .attribution {
    margin-top: 2rem;
    font-size: 0.9rem;
    color: var(--paper-shadow);
    text-align: right;
    font-style: italic;
}

/* ==========================================================================
   PANEL 6: THE BOND
   ========================================================================== */

.bond-stage {
    width: 90%;
    max-width: 1200px;
    margin: 2rem auto;
    position: relative;
}

.bond-svg {
    width: 100%;
    height: auto;
    max-height: 60vh;
    filter: drop-shadow(0 0 20px rgba(255, 214, 10, 0.15));
}

.atom-ring {
    animation: ringPulse 5s ease-in-out infinite;
    transform-origin: center;
    transform-box: fill-box;
}

@keyframes ringPulse {
    0%, 100% { opacity: 0.7; stroke-width: 2; }
    50% { opacity: 1; stroke-width: 3; }
}

.bond-lines { animation: bondVibrate 0.9s ease-in-out infinite; transform-origin: center; }

@keyframes bondVibrate {
    0%, 100% { transform: translateY(0); }
    25% { transform: translateY(-1.5px); }
    50% { transform: translateY(0); }
    75% { transform: translateY(1.5px); }
}

.bond-line { filter: drop-shadow(0 0 6px rgba(255, 214, 10, 0.6)); }

.atom-label {
    font-family: var(--font-display);
    font-weight: 700;
    font-size: 64px;
    letter-spacing: 0.12em;
    fill: var(--paper);
    text-transform: uppercase;
}

/* ==========================================================================
   UI CHROME — scroll hint + panel indicator
   ========================================================================== */

.scroll-hint {
    position: fixed;
    bottom: 24px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 20;
    font-family: var(--font-mono);
    font-size: 0.72rem;
    letter-spacing: 0.3em;
    text-transform: uppercase;
    color: var(--neon-magenta);
    display: flex;
    align-items: center;
    gap: 0.8rem;
    mix-blend-mode: difference;
    pointer-events: none;
    transition: opacity 0.5s ease;
}

.scroll-hint.hidden { opacity: 0; }

.scroll-hint .hint-arrow {
    animation: arrowBob 1.6s ease-in-out infinite;
    font-size: 1rem;
}

@keyframes arrowBob {
    0%, 100% { transform: translateX(0); }
    50% { transform: translateX(8px); }
}

.panel-indicator {
    position: fixed;
    top: 50%;
    right: 20px;
    transform: translateY(-50%);
    z-index: 20;
    display: flex;
    flex-direction: column;
    gap: 12px;
    mix-blend-mode: difference;
    pointer-events: none;
}

.indicator-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: transparent;
    border: 1px solid var(--neon-magenta);
    transition: all 0.3s ease;
}

.indicator-dot.active {
    background: var(--neon-magenta);
    box-shadow: 0 0 10px rgba(255, 45, 149, 0.8);
    transform: scale(1.2);
}

/* ==========================================================================
   LAYERED DEPTH HELPERS
   ========================================================================== */

.panel-entrance .panel-inner,
.panel-exit .panel-inner {
    transform-style: preserve-3d;
}

.panel-entrance .hero-title { transform: translateZ(20px); }
.panel-exit .hero-title { transform: translateZ(20px); }

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

@media (max-width: 768px) {
    .specimen-label { font-size: 0.6rem; }
    .fullerene-row { flex-wrap: wrap; gap: 4vw; }
    .fullerene-cell { flex: 0 0 45%; }
    .fullerene-cell.cell-tall,
    .fullerene-cell.cell-short,
    .fullerene-cell.cell-mid { transform: none; }
    .charcoal-text { font-size: 1rem; line-height: 1.7; }
    .panel-indicator { right: 10px; }
    .atom-label { font-size: 48px; }
}
