/* ==========================================================================
   K. THAMOJ — Portfolio
   Deep Space / Cyber-Developer aesthetic
   Matrix Green #00ffcc (coding) · Python Blue #306998 (automation) · Python Yellow #f9d342 (accents)
   Neo-Brutalism + Glassmorphism · Space Grotesk + Inter
   Omni-device: Smartwatch < 320px · Mobile 320–768 · Tablet 768–1024 · PC > 1024
   ========================================================================== */

/* ---------- Design tokens ---------- */
:root {
  --bg: #0a0a0a;
  --bg-2: #0d0d12;
  --panel: rgba(255, 255, 255, 0.035);
  --panel-2: rgba(255, 255, 255, 0.06);
  --line: rgba(255, 255, 255, 0.11);
  --line-strong: rgba(255, 255, 255, 0.22);
  --text: #eef3f2;
  --muted: #8f9a98;
  --matrix: #00ffcc;
  --matrix-dim: rgba(0, 255, 204, 0.14);
  --chart: #306998;
  --chart-dim: rgba(48, 105, 152, 0.2);
  --python: #f9d342;
  --python-dim: rgba(249, 211, 66, 0.16);
  --danger: #ff4d5e;
  --font-head: 'Space Grotesk', 'Inter', sans-serif;
  --font-body: 'Inter', sans-serif;
  --font-mono: 'SFMono-Regular', 'Consolas', 'Courier New', monospace;
  --nav-h: 72px;
  --ticker-h: 32px;
  --radius: 16px;
  --ease-out: cubic-bezier(0.16, 1, 0.3, 1);
}

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

html {
  scroll-behavior: smooth;
  scroll-padding-top: calc(var(--nav-h) + var(--ticker-h) + 18px);
}

body {
  font-family: var(--font-body);
  font-size: clamp(0.94rem, 0.82rem + 0.4vw, 1.1rem);
  background: var(--bg);
  color: var(--text);
  line-height: 1.65;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
  position: relative;
  min-height: 100vh;
}

::selection {
  background: var(--matrix);
  color: #04120f;
}

a { color: inherit; text-decoration: none; }
ul { list-style: none; }
img { max-width: 100%; display: block; }

button {
  font-family: inherit;
  cursor: pointer;
  border: none;
  background: none;
  color: inherit;
}

.container {
  width: min(1180px, 92%);
  margin-inline: auto;
}

.grad {
  background: linear-gradient(100deg, var(--matrix) 10%, var(--chart) 55%, var(--python) 115%);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
}

.t-green { color: var(--matrix); }
.t-dim { color: var(--muted); }
.t-ok { color: var(--matrix); }

/* Keyboard focus — visible ring for tab navigation */
:focus-visible {
  outline: 2px solid var(--matrix);
  outline-offset: 3px;
  border-radius: 4px;
}

.t-field input:focus-visible,
.t-field textarea:focus-visible,
.dev-term-input-row input:focus-visible {
  outline: none; /* these already have their own focus styling */
}

/* ---------- Scroll progress bar ---------- */
.scroll-progress {
  position: fixed;
  top: var(--ticker-h);
  left: 0;
  right: 0;
  height: 2px;
  z-index: 1100;
  background: linear-gradient(90deg, var(--matrix), var(--chart));
  box-shadow: 0 0 10px rgba(0, 255, 204, 0.5);
  transform: scaleX(0);
  transform-origin: left;
  pointer-events: none;
}

/* ---------- Back to top ---------- */
.back-to-top {
  position: fixed;
  right: 1.4rem;
  bottom: 1.4rem;
  z-index: 1100;
  width: 46px;
  height: 46px;
  display: grid;
  place-items: center;
  border-radius: 12px;
  border: 1px solid var(--line);
  background: rgba(10, 10, 10, 0.7);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  color: var(--matrix);
  opacity: 0;
  transform: translateY(14px);
  pointer-events: none;
  transition: opacity 0.35s ease, transform 0.35s var(--ease-out), border-color 0.25s ease, box-shadow 0.25s ease;
}

.back-to-top.show {
  opacity: 1;
  transform: translateY(0);
  pointer-events: auto;
}

.back-to-top:hover {
  border-color: var(--matrix);
  box-shadow: 0 0 22px var(--matrix-dim);
}

/* ---------- Background layers ---------- */
#bgCanvas {
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
}

.bg-grid {
  position: fixed;
  inset: 0;
  z-index: 1;
  pointer-events: none;
  background-image:
    linear-gradient(rgba(0, 255, 204, 0.028) 1px, transparent 1px),
    linear-gradient(90deg, rgba(0, 255, 204, 0.028) 1px, transparent 1px);
  background-size: 52px 52px;
  -webkit-mask-image: radial-gradient(ellipse 90% 70% at 50% 30%, #000 30%, transparent 75%);
  mask-image: radial-gradient(ellipse 90% 70% at 50% 30%, #000 30%, transparent 75%);
}

main, .navbar, .footer {
  position: relative;
  z-index: 2;
}

/* ---------- Glassmorphism ---------- */
.glass {
  background: var(--panel);
  backdrop-filter: blur(20px) saturate(140%);
  -webkit-backdrop-filter: blur(20px) saturate(140%);
  border: 1px solid var(--line);
  border-radius: var(--radius);
}

/* ---------- Preloader ---------- */
.preloader {
  position: fixed;
  inset: 0;
  z-index: 5000;
  display: grid;
  place-items: center;
  background: var(--bg);
  transition: opacity 0.55s ease, visibility 0.55s ease;
}

.preloader.done {
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
}

.loader-inner {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1.1rem;
}

.loader-brackets {
  display: flex;
  align-items: center;
  gap: 0.9rem;
  font-family: var(--font-mono);
  font-size: clamp(1.9rem, 1.4rem + 2vw, 2.6rem);
  color: var(--matrix);
  text-shadow: 0 0 18px rgba(0, 255, 204, 0.6);
}

.bracket {
  animation: bracketPulse 1.2s ease-in-out infinite;
}

.bracket:first-child { animation-delay: 0.15s; }
.bracket:last-child { animation-delay: 0.45s; }

@keyframes bracketPulse {
  0%, 100% { transform: scale(1); opacity: 0.55; }
  50% { transform: scale(1.25); opacity: 1; }
}

.loader-core {
  display: flex;
  gap: 6px;
}

.loader-core i {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--matrix);
  animation: coreDot 1s ease-in-out infinite;
}

.loader-core i:nth-child(2) { animation-delay: 0.15s; }
.loader-core i:nth-child(3) { animation-delay: 0.3s; }

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

.loader-candle {
  display: flex;
  align-items: center;
  gap: 5px;
  height: 34px;
}

.candle-body {
  width: 14px;
  border-radius: 2px;
  animation: candleGrow 1.6s ease-in-out infinite;
}

.candle-body-up {
  height: 22px;
  background: var(--matrix);
  box-shadow: 0 0 14px rgba(0, 255, 204, 0.55);
}

.candle-body-down {
  height: 30px;
  background: var(--chart);
  box-shadow: 0 0 14px rgba(0, 102, 255, 0.55);
  animation-delay: 0.5s;
}

.candle-wick {
  width: 2px;
  height: 34px;
  background: rgba(255, 255, 255, 0.35);
}

@keyframes candleGrow {
  0%, 100% { transform: scaleY(0.55); }
  50% { transform: scaleY(1.15); }
}

.loader-name {
  font-family: var(--font-head);
  font-weight: 700;
  font-size: clamp(1rem, 0.9rem + 0.5vw, 1.2rem);
  letter-spacing: 4px;
}

.cursor-blink { animation: blink 1s step-end infinite; color: var(--matrix); }

.loader-track {
  width: 220px;
  height: 3px;
  border-radius: 3px;
  background: rgba(255, 255, 255, 0.08);
  overflow: hidden;
}

.loader-fill {
  display: block;
  height: 100%;
  width: 0;
  background: linear-gradient(90deg, var(--matrix), var(--chart));
  box-shadow: 0 0 12px rgba(0, 255, 204, 0.6);
}

.loader-pct {
  font-family: var(--font-mono);
  font-size: clamp(0.72rem, 0.65rem + 0.2vw, 0.85rem);
  color: var(--muted);
  letter-spacing: 1px;
}

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

/* ---------- Navbar: floating Dynamic Island dock ---------- */
.navbar {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 1000;
  display: flex;
  justify-content: center;
  padding-top: calc(var(--ticker-h) + 14px);
  pointer-events: none;
}

/* Smart scroll: the dock rides up out of view on scroll-down,
   and slides back in on scroll-up (class toggled in script.js). */
.navbar.nav-hidden .nav-dock {
  transform: translateY(-170%);
}

.nav-dock {
  pointer-events: auto;
  display: flex;
  align-items: center;
  gap: clamp(0.9rem, 0.5rem + 1.2vw, 1.7rem);
  padding: 0.55rem 0.65rem 0.55rem 1.15rem;
  border-radius: 999px;
  background: rgba(10, 10, 10, 0.55);
  backdrop-filter: blur(20px) saturate(140%);
  -webkit-backdrop-filter: blur(20px) saturate(140%);
  border: 1px solid var(--line);
  box-shadow: 0 10px 34px rgba(0, 0, 0, 0.5);
  transition: transform 0.45s var(--ease-out), box-shadow 0.3s ease, border-color 0.3s ease, background 0.3s ease;
}

.navbar.scrolled .nav-dock {
  background: rgba(10, 10, 10, 0.72);
  border-color: rgba(0, 255, 204, 0.22);
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.6), 0 0 24px rgba(0, 255, 204, 0.08);
}

.logo {
  display: inline-flex;
  align-items: center;
  gap: 0.65rem;
  font-family: var(--font-head);
  font-weight: 700;
  font-size: clamp(0.98rem, 0.85rem + 0.35vw, 1.15rem);
  letter-spacing: 1.5px;
  will-change: transform;
}

.logo-sigil {
  font-family: var(--font-mono);
  font-size: clamp(0.78rem, 0.7rem + 0.2vw, 0.9rem);
  color: var(--matrix);
  border: 1px solid var(--matrix-dim);
  padding: 0.28rem 0.42rem;
  border-radius: 5px;
  background: var(--matrix-dim);
  text-shadow: 0 0 10px rgba(0, 255, 204, 0.7);
}

.logo-accent { color: var(--matrix); }

.nav-links {
  position: relative;
  display: flex;
  align-items: center;
  gap: clamp(0.3rem, 0.1rem + 0.7vw, 0.7rem);
}

/* Sliding indicator: a pill that glides behind the active/hovered link */
.nav-indicator {
  position: absolute;
  top: 0;
  left: 0;
  height: 100%;
  width: 0;
  border-radius: 999px;
  background: linear-gradient(90deg, rgba(0, 255, 204, 0.14), rgba(0, 102, 255, 0.14));
  border: 1px solid rgba(0, 255, 204, 0.22);
  box-shadow: inset 0 0 14px rgba(0, 255, 204, 0.08), 0 0 16px rgba(0, 255, 204, 0.1);
  transition: transform 0.4s var(--ease-out), width 0.4s var(--ease-out);
  pointer-events: none;
  z-index: 0;
}

.nav-link {
  position: relative;
  z-index: 1;
  font-family: var(--font-head);
  font-size: clamp(0.88rem, 0.8rem + 0.25vw, 1rem);
  font-weight: 500;
  color: var(--muted);
  letter-spacing: 0.6px;
  padding: 0.5rem 0.95rem;
  border-radius: 999px;
  white-space: nowrap;
  will-change: transform;
  transition: color 0.25s ease;
}

.nav-link:hover {
  color: var(--text);
}

.nav-link.active {
  color: var(--matrix);
}

/* Morphing SVG hamburger */
.nav-toggle {
  display: none;
  align-items: center;
  justify-content: center;
  padding: 4px;
  z-index: 1001;
  border-radius: 10px;
}

.nav-toggle-svg {
  display: block;
}

.nline {
  stroke: var(--text);
  stroke-width: 2.2;
  stroke-linecap: round;
  transform-box: fill-box;
  transform-origin: center;
  transition: transform 0.4s var(--ease-out), opacity 0.3s ease, stroke 0.3s ease;
}

.nav-toggle.open .nline {
  stroke: var(--matrix);
}

.nav-toggle.open .nline-top {
  transform: translateY(6px) rotate(45deg);
}

.nav-toggle.open .nline-mid {
  opacity: 0;
  transform: translateX(-10px);
}

.nav-toggle.open .nline-bot {
  transform: translateY(-6px) rotate(-45deg);
}

/* ---------- Buttons (neo-brutalism) ---------- */
.btn {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.6rem;
  padding: 1rem 1.8rem;
  min-height: 50px;
  border-radius: 6px;
  border: 2px solid;
  font-family: var(--font-head);
  font-weight: 600;
  font-size: clamp(0.92rem, 0.84rem + 0.25vw, 1.05rem);
  letter-spacing: 0.6px;
  transition: box-shadow 0.25s ease, background 0.25s ease, color 0.25s ease, border-color 0.25s ease;
  will-change: transform;
  overflow: hidden;
}

.btn-primary {
  background: var(--matrix);
  border-color: var(--matrix);
  color: #04120f;
  box-shadow: 6px 6px 0 0 var(--chart);
}

.btn-primary:hover {
  box-shadow: 9px 9px 0 0 var(--chart), 0 0 28px rgba(0, 255, 204, 0.35);
}

.btn-primary:active {
  box-shadow: 3px 3px 0 0 var(--chart);
}

.btn-ghost {
  background: transparent;
  border-color: var(--line-strong);
  color: var(--text);
  box-shadow: 6px 6px 0 0 rgba(0, 0, 0, 0.7);
}

.btn-ghost:hover {
  border-color: var(--matrix);
  color: var(--matrix);
  box-shadow: 6px 6px 0 0 var(--matrix-dim);
}

.btn-block { width: 100%; }

/* ---------- Hero ---------- */
.hero {
  position: relative;
  min-height: 100vh;
  min-height: 100svh;
  display: flex;
  align-items: center;
  padding-top: var(--nav-h);
  overflow: hidden;
}

.hero-inner {
  padding-block: 3rem 5rem;
}

.hero-badge {
  font-family: var(--font-mono);
  font-size: clamp(0.7rem, 0.58rem + 0.35vw, 0.9rem);
  letter-spacing: 2px;
  color: var(--matrix);
  margin-bottom: 1.6rem;
  display: inline-block;
  border: 1px solid var(--matrix-dim);
  background: var(--matrix-dim);
  padding: 0.45rem 0.9rem;
  border-radius: 4px;
}

.hero-title {
  font-family: var(--font-head);
  font-weight: 700;
  font-size: clamp(2.1rem, 0.9rem + 5.2vw, 6.2rem);
  line-height: 1.04;
  letter-spacing: -1.5px;
}

.line {
  display: block;
  overflow: hidden;
}

.line-inner {
  display: inline-block;
  transform: translateY(115%);
  transition: transform 1s var(--ease-out);
}

.line:nth-child(2) .line-inner { transition-delay: 0.12s; }

body.loaded .line-inner {
  transform: translateY(0);
}

/* Hero typing line */
.hero-typing {
  margin-top: 1.4rem;
  font-family: var(--font-mono);
  font-size: clamp(0.98rem, 0.8rem + 0.6vw, 1.4rem);
  color: var(--text);
  min-height: 1.6em;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.typing-prefix { color: var(--matrix); }

.typing-text {
  color: var(--matrix);
  text-shadow: 0 0 14px rgba(0, 255, 204, 0.45);
}

.typing-caret {
  display: inline-block;
  width: 3px;
  height: 1.25em;
  background: var(--matrix);
  box-shadow: 0 0 10px rgba(0, 255, 204, 0.8);
  animation: blink 0.9s step-end infinite;
}

.hero-sub {
  max-width: 58ch;
  margin-top: 1.1rem;
  color: var(--muted);
  font-size: clamp(0.98rem, 0.88rem + 0.3vw, 1.15rem);
}

.hero-sub strong { color: var(--text); }

.hero-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 1.2rem;
  margin-top: 2.4rem;
}

.hero-console {
  margin-top: 2rem;
  font-family: var(--font-mono);
  font-size: clamp(0.74rem, 0.66rem + 0.25vw, 0.9rem);
  color: var(--muted);
  letter-spacing: 0.5px;
}

/* Entrance choreography for hero elements */
.hero-anim {
  opacity: 0;
  transform: translateY(22px);
  transition: opacity 0.7s ease, transform 0.7s var(--ease-out);
}

body.loaded .hero-anim {
  opacity: 1;
  transform: translateY(0);
}

.hero-badge.hero-anim { transition-delay: 0.35s; }
.hero-typing.hero-anim { transition-delay: 0.42s; }
.hero-sub.hero-anim { transition-delay: 0.5s; }
.hero-actions.hero-anim { transition-delay: 0.6s; }
.hero-console.hero-anim { transition-delay: 0.7s; }

/* Floating abstract shapes */
.hero-shapes {
  position: absolute;
  inset: 0;
  pointer-events: none;
  z-index: 0;
}

.shape { position: absolute; }

.ring {
  border: 1.5px dashed rgba(0, 255, 204, 0.35);
  border-radius: 50%;
  animation: spin 30s linear infinite;
}

.ring-1 {
  width: 420px;
  height: 420px;
  top: 8%;
  right: -90px;
}

.ring-2 {
  width: 620px;
  height: 620px;
  top: -60px;
  right: -180px;
  border-color: rgba(0, 102, 255, 0.3);
  animation-direction: reverse;
  animation-duration: 44s;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

.cube {
  width: 64px;
  height: 64px;
  top: 22%;
  right: 24%;
  border: 2px solid rgba(0, 102, 255, 0.55);
  transform: rotate(45deg);
  animation: cubeFloat 7s ease-in-out infinite;
  box-shadow: inset 0 0 24px rgba(0, 102, 255, 0.25);
}

@keyframes cubeFloat {
  0%, 100% { transform: rotate(45deg) translateY(0); }
  50% { transform: rotate(45deg) translateY(-18px); }
}

.orb {
  width: 300px;
  height: 300px;
  top: 42%;
  right: 8%;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(0, 255, 204, 0.14), transparent 68%);
  filter: blur(8px);
  animation: orbPulse 5s ease-in-out infinite;
}

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

.crosshair {
  width: 130px;
  height: 130px;
  top: 16%;
  right: 40%;
  opacity: 0.4;
}

.crosshair::before,
.crosshair::after {
  content: '';
  position: absolute;
  background: var(--matrix);
  opacity: 0.5;
}

.crosshair::before {
  width: 100%;
  height: 1px;
  top: 50%;
  left: 0;
  animation: crossX 2.4s ease-in-out infinite;
}

.crosshair::after {
  width: 1px;
  height: 100%;
  left: 50%;
  top: 0;
  animation: crossY 2.4s ease-in-out infinite;
}

@keyframes crossX {
  0%, 100% { transform: scaleX(0.3); opacity: 0.3; }
  50% { transform: scaleX(1); opacity: 0.8; }
}

@keyframes crossY {
  0%, 100% { transform: scaleY(0.3); opacity: 0.3; }
  50% { transform: scaleY(1); opacity: 0.8; }
}

/* HUD side labels */
.hero-hud {
  position: absolute;
  right: 1.6rem;
  top: 50%;
  transform: translateY(-50%);
  display: flex;
  flex-direction: column;
  gap: 0.9rem;
  z-index: 1;
  font-family: var(--font-mono);
  font-size: clamp(0.64rem, 0.58rem + 0.2vw, 0.8rem);
  color: var(--muted);
  letter-spacing: 1.5px;
  writing-mode: vertical-rl;
  text-orientation: mixed;
  opacity: 0.6;
}

.hud-line { display: flex; align-items: center; gap: 0.4rem; }

.hud-dot {
  display: inline-block;
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--matrix);
  box-shadow: 0 0 8px rgba(0, 255, 204, 0.9);
  animation: blink 1.4s step-end infinite;
}

/* Scroll hint */
.scroll-hint {
  position: absolute;
  left: 50%;
  bottom: 1.4rem;
  transform: translateX(-50%);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.45rem;
  color: var(--muted);
  font-family: var(--font-mono);
  font-size: clamp(0.6rem, 0.55rem + 0.15vw, 0.72rem);
  letter-spacing: 3px;
  text-transform: uppercase;
  z-index: 1;
}

.mouse {
  width: 24px;
  height: 38px;
  border: 1.5px solid var(--muted);
  border-radius: 14px;
  display: flex;
  justify-content: center;
  padding-top: 6px;
}

.wheel {
  width: 3px;
  height: 8px;
  border-radius: 3px;
  background: var(--matrix);
  animation: wheelScroll 1.6s ease-in-out infinite;
}

@keyframes wheelScroll {
  0% { transform: translateY(0); opacity: 1; }
  70% { transform: translateY(10px); opacity: 0; }
  100% { transform: translateY(0); opacity: 0; }
}

/* ---------- Marquee ---------- */
.marquee {
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
  background: rgba(0, 255, 204, 0.03);
  overflow: hidden;
  padding-block: 0.85rem;
}

.marquee-track {
  display: flex;
  gap: 3rem;
  width: max-content;
  animation: marquee 26s linear infinite;
}

.marquee-track span {
  font-family: var(--font-head);
  font-weight: 600;
  font-size: clamp(0.82rem, 0.72rem + 0.3vw, 1rem);
  letter-spacing: 2px;
  color: var(--muted);
  white-space: nowrap;
}

.marquee-track i {
  font-style: normal;
  color: var(--matrix);
  margin-left: 3rem;
}

@keyframes marquee {
  to { transform: translateX(-50%); }
}

/* ---------- Sections ---------- */
.section {
  padding-block: clamp(3.4rem, 2rem + 5vw, 7rem);
}

.section-head {
  text-align: center;
  margin-bottom: clamp(2.2rem, 1.6rem + 2.6vw, 4rem);
}

.section-tag {
  font-family: var(--font-mono);
  color: var(--matrix);
  font-size: clamp(0.7rem, 0.6rem + 0.3vw, 0.9rem);
  letter-spacing: 3px;
  margin-bottom: 0.7rem;
}

.section-title {
  font-family: var(--font-head);
  font-size: clamp(1.7rem, 0.9rem + 2.6vw, 3.4rem);
  font-weight: 700;
  letter-spacing: -0.5px;
}

/* ---------- 3D scroll reveal ---------- */
[data-reveal] {
  opacity: 0;
  transform: rotateX(12deg) rotateY(-10deg) scale(0.92) translateY(42px);
  transform-style: preserve-3d;
  transition: opacity 0.85s ease, transform 0.85s var(--ease-out);
  transition-delay: calc(var(--d, 0) * 110ms);
  will-change: opacity, transform;
}

[data-reveal].in {
  opacity: 1;
  transform: none;
}

/* ---------- About dashboard ---------- */
.dash-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: clamp(0.9rem, 0.6rem + 1vw, 1.4rem);
  margin-bottom: 1.3rem;
}

.dash-tile {
  padding: clamp(1.2rem, 0.9rem + 1.4vw, 1.9rem);
  position: relative;
  overflow: hidden;
  transition: border-color 0.3s ease, transform 0.3s ease, box-shadow 0.3s ease;
}

.dash-tile::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 2px;
  background: linear-gradient(90deg, var(--matrix), var(--chart));
  transform: scaleX(0);
  transform-origin: left;
  transition: transform 0.4s var(--ease-out);
}

.dash-tile:hover {
  border-color: var(--line-strong);
  transform: translateY(-4px);
  box-shadow: 0 12px 34px rgba(0, 0, 0, 0.5);
}

.dash-tile:hover::before { transform: scaleX(1); }

.dash-label {
  font-family: var(--font-mono);
  font-size: clamp(0.6rem, 0.53rem + 0.2vw, 0.78rem);
  letter-spacing: 2.5px;
  color: var(--muted);
}

.dash-num {
  font-family: var(--font-head);
  font-size: clamp(1.9rem, 1rem + 2.6vw, 3.2rem);
  font-weight: 700;
  line-height: 1.15;
  margin-block: 0.35rem;
}

.dash-num em {
  font-style: normal;
  font-size: clamp(0.92rem, 0.8rem + 0.35vw, 1.2rem);
  color: var(--matrix);
  margin-left: 0.2rem;
  letter-spacing: 1px;
}

.dash-sub {
  font-size: clamp(0.74rem, 0.68rem + 0.2vw, 0.9rem);
  color: var(--muted);
}

/* ---------- Skills pills ---------- */
.pills-wrap {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: clamp(0.8rem, 0.5rem + 1vw, 1.3rem);
  max-width: 860px;
  margin-inline: auto;
}

.pill {
  padding: clamp(0.8rem, 0.65rem + 0.6vw, 1.05rem) clamp(1.1rem, 0.9rem + 0.9vw, 1.6rem);
  min-height: 48px;
  display: inline-flex;
  align-items: center;
  border-radius: 999px;
  transition: border-color 0.3s ease, box-shadow 0.3s ease, transform 0.3s ease, background 0.3s ease;
}

.pill-inner {
  display: inline-flex;
  align-items: center;
  gap: 0.6rem;
  font-family: var(--font-head);
  font-weight: 600;
  font-size: clamp(0.84rem, 0.74rem + 0.3vw, 1.05rem);
  letter-spacing: 1.5px;
  animation: pillFloat var(--float, 6s) ease-in-out infinite;
  animation-delay: var(--fd, 0s);
}

@keyframes pillFloat {
  0%, 100% { transform: translateY(0) rotate(-0.6deg); }
  50% { transform: translateY(-9px) rotate(0.6deg); }
}

.pill:hover {
  border-color: var(--matrix);
  box-shadow: 0 0 26px var(--matrix-dim), 6px 6px 0 0 rgba(0, 0, 0, 0.7);
  background: rgba(0, 255, 204, 0.05);
  transform: translateY(-3px);
}

.pill-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  flex-shrink: 0;
}

.dot-matrix {
  background: var(--matrix);
  box-shadow: 0 0 8px rgba(0, 255, 204, 0.9);
}

.dot-chart {
  background: var(--chart);
  box-shadow: 0 0 8px rgba(48, 105, 152, 0.9);
}

.dot-python {
  background: var(--python);
  box-shadow: 0 0 8px rgba(249, 211, 66, 0.9);
}

/* ---------- Bento projects ---------- */
.bento {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  /* Rows keep a tidy bento height but grow if card content needs it,
     so the longer project descriptions never get clipped. */
  grid-auto-rows: minmax(clamp(250px, 32vh, 350px), auto);
  gap: clamp(0.9rem, 0.6rem + 1vw, 1.4rem);
}

.bento-cell {
  position: relative;
  padding: clamp(1.3rem, 1rem + 1.4vw, 2rem);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  transition: border-color 0.3s ease, transform 0.3s ease;
}

.bento-cell:hover {
  border-color: var(--line-strong);
  transform: translateY(-4px);
}

.bento-main {
  grid-column: span 2;
  grid-row: span 2;
}

/* Spotlight border that follows the mouse */
.bento-glow {
  position: absolute;
  inset: 0;
  border-radius: inherit;
  background: radial-gradient(280px circle at var(--sx, 50%) var(--sy, 50%), rgba(0, 255, 204, 0.1), transparent 65%);
  opacity: 0;
  transition: opacity 0.35s ease;
  pointer-events: none;
  z-index: 0;
}

.bento-cell:hover .bento-glow {
  opacity: 1;
}

.bento-cell > *:not(.bento-glow) {
  position: relative;
  z-index: 1;
}

.bento-top {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 0.6rem;
  margin-bottom: 0.4rem;
}

/* Project tag chips */
.bento-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-top: 0.85rem;
}

.bento-tags li {
  font-family: var(--font-mono);
  font-size: clamp(0.58rem, 0.51rem + 0.18vw, 0.76rem);
  letter-spacing: 1.5px;
  padding: 0.3rem 0.7rem;
  border-radius: 4px;
  border: 1px solid var(--line);
  background: var(--panel-2);
  color: var(--muted);
  transition: color 0.25s ease, border-color 0.25s ease;
}

.bento-cell:hover .bento-tags li {
  color: var(--matrix);
  border-color: rgba(0, 255, 204, 0.32);
}

.live-badge {
  font-family: var(--font-mono);
  font-size: clamp(0.6rem, 0.53rem + 0.18vw, 0.78rem);
  color: var(--matrix);
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  letter-spacing: 2px;
}

.bento-cell h3 {
  font-family: var(--font-head);
  font-size: clamp(1.1rem, 0.9rem + 0.6vw, 1.5rem);
  font-weight: 700;
  letter-spacing: -0.3px;
}

.bento-main h3 { font-size: clamp(1.35rem, 1rem + 1.1vw, 2rem); }

.bento-cell p {
  color: var(--muted);
  font-size: clamp(0.86rem, 0.78rem + 0.22vw, 1rem);
  margin-top: 0.6rem;
  max-width: 46ch;
}

.bento-link {
  margin-top: auto;
  padding-top: 1.2rem;
  font-family: var(--font-mono);
  font-size: clamp(0.7rem, 0.63rem + 0.2vw, 0.86rem);
  color: var(--matrix);
  letter-spacing: 1px;
  transition: color 0.25s ease;
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
}

.bento-link:hover { color: var(--text); }

/* Mini candlestick chart */
.mini-chart {
  display: flex;
  align-items: flex-end;
  gap: 6px;
  height: clamp(64px, 9vh, 96px);
  margin-top: 1.3rem;
  padding: 0.6rem 0.8rem;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(0, 0, 0, 0.35);
  position: relative;
}

.mini-chart::after {
  content: '';
  position: absolute;
  left: 0;
  right: 0;
  bottom: 30%;
  height: 1px;
  background: rgba(0, 255, 204, 0.15);
}

.mc-candle {
  flex: 1;
  height: var(--h);
  border-radius: 2px;
  transform-origin: bottom;
  animation: candlePulse 2.6s ease-in-out infinite;
  animation-delay: var(--dl, 0s);
}

.mc-candle.up {
  background: linear-gradient(180deg, var(--matrix), rgba(0, 255, 204, 0.35));
  box-shadow: 0 0 10px rgba(0, 255, 204, 0.35);
}

.mc-candle.down {
  background: linear-gradient(180deg, var(--chart), rgba(0, 102, 255, 0.3));
  box-shadow: 0 0 10px rgba(0, 102, 255, 0.35);
}

@keyframes candlePulse {
  0%, 100% { transform: scaleY(0.86); }
  50% { transform: scaleY(1.1); }
}

/* Telegram bot mock */
.bot-chat {
  margin-top: 1.3rem;
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
  font-family: var(--font-mono);
  font-size: clamp(0.7rem, 0.63rem + 0.18vw, 0.84rem);
}

.bot-msg {
  align-self: flex-start;
  background: rgba(0, 255, 204, 0.06);
  border: 1px solid var(--matrix-dim);
  color: var(--matrix);
  padding: 0.55rem 0.9rem;
  border-radius: 10px 10px 10px 2px;
}

.bot-typing {
  display: flex;
  gap: 5px;
  padding: 0.6rem 0.9rem;
  align-self: flex-start;
  border: 1px solid var(--line);
  border-radius: 10px 10px 10px 2px;
}

.bot-typing i {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--muted);
  animation: typingDot 1.2s ease-in-out infinite;
}

.bot-typing i:nth-child(2) { animation-delay: 0.15s; }
.bot-typing i:nth-child(3) { animation-delay: 0.3s; }

@keyframes typingDot {
  0%, 100% { opacity: 0.3; transform: translateY(0); }
  50% { opacity: 1; transform: translateY(-3px); }
}

/* Code lines mock */
.code-lines {
  margin-top: 1.3rem;
  font-family: var(--font-mono);
  font-size: clamp(0.72rem, 0.64rem + 0.2vw, 0.86rem);
  color: var(--muted);
  display: flex;
  flex-direction: column;
  gap: 0.45rem;
  padding: 1rem;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(0, 0, 0, 0.35);
  overflow: hidden;
}

.c-green { color: var(--matrix); }
.c-blue { color: #6fa8ff; }
.c-dim { color: rgba(255, 255, 255, 0.28); }

/* ---------- Contact ---------- */
.contact-grid {
  display: grid;
  grid-template-columns: 1fr 1.15fr;
  gap: clamp(1.6rem, 1rem + 3vw, 3.4rem);
  align-items: start;
}

.contact-info h3 {
  font-family: var(--font-head);
  font-size: clamp(1.3rem, 1rem + 0.9vw, 1.9rem);
  margin-bottom: 1rem;
  letter-spacing: -0.3px;
}

.contact-info > p {
  color: var(--muted);
  margin-bottom: 2rem;
  max-width: 44ch;
  font-size: clamp(0.9rem, 0.83rem + 0.2vw, 1.02rem);
}

.contact-line {
  display: flex;
  align-items: center;
  gap: 1rem;
  padding: 1.05rem 0;
  border-bottom: 1px solid var(--line);
}

.contact-emoji {
  font-size: clamp(1.1rem, 0.95rem + 0.5vw, 1.4rem);
  width: 48px;
  height: 48px;
  flex-shrink: 0;
  display: grid;
  place-items: center;
  border-radius: 8px;
  background: var(--panel-2);
  border: 1px solid var(--line);
}

.contact-line strong {
  display: block;
  font-family: var(--font-mono);
  font-size: clamp(0.6rem, 0.55rem + 0.15vw, 0.74rem);
  color: var(--muted);
  letter-spacing: 2.5px;
}

.contact-line a,
.contact-line span:not(.contact-emoji) {
  color: var(--text);
  font-weight: 500;
  font-size: clamp(0.9rem, 0.83rem + 0.2vw, 1.02rem);
}

.contact-line a:hover { color: var(--matrix); }

/* ---------- Terminal contact form ---------- */
.terminal-panel {
  overflow: hidden;
  box-shadow: 0 0 0 1px rgba(0, 255, 204, 0.06), 0 24px 60px rgba(0, 0, 0, 0.55);
}

.t-head {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.85rem 1.1rem;
  background: rgba(255, 255, 255, 0.04);
  border-bottom: 1px solid var(--line);
}

.t-dot {
  width: 11px;
  height: 11px;
  border-radius: 50%;
}

.t-dot-red { background: #ff5f57; }
.t-dot-yellow { background: #febc2e; }
.t-dot-green { background: #28c840; }

.t-title {
  margin-left: auto;
  font-family: var(--font-mono);
  font-size: clamp(0.64rem, 0.58rem + 0.18vw, 0.8rem);
  color: var(--muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 60%;
}

/* VS Code style editor tab in the contact panel */
.vsc-tab {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  margin-left: 0.6rem;
  padding: 0.28rem 0.75rem;
  font-family: var(--font-mono);
  font-size: clamp(0.62rem, 0.56rem + 0.16vw, 0.76rem);
  color: var(--text);
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--line);
  border-bottom: none;
  border-radius: 6px 6px 0 0;
}

.vsc-tab i {
  font-style: normal;
  color: var(--muted);
  font-size: 0.8em;
}

.t-body {
  padding: clamp(1.1rem, 0.8rem + 1.4vw, 1.6rem);
  font-family: var(--font-mono);
  font-size: clamp(0.8rem, 0.72rem + 0.22vw, 0.95rem);
  color: #b9c4c2;
  display: flex;
  flex-direction: column;
  gap: 1.1rem;
}

.t-line { line-height: 1.5; }

.t-prompt {
  display: block;
  color: var(--matrix);
  margin-bottom: 0.4rem;
  letter-spacing: 1px;
  font-size: clamp(0.72rem, 0.64rem + 0.2vw, 0.85rem);
}

.t-field input,
.t-field textarea {
  width: 100%;
  padding: 0.8rem 1rem;
  min-height: 46px;
  border-radius: 6px;
  border: 1px solid var(--line);
  background: rgba(0, 0, 0, 0.45);
  color: var(--text);
  font-family: var(--font-mono);
  font-size: clamp(0.8rem, 0.72rem + 0.22vw, 0.95rem);
  resize: vertical;
  transition: border-color 0.3s ease, box-shadow 0.3s ease;
}

.t-field input:focus,
.t-field textarea:focus {
  outline: none;
  border-color: var(--matrix);
  box-shadow: 0 0 0 3px var(--matrix-dim), 0 0 18px rgba(0, 255, 204, 0.15);
}

.t-field input::placeholder,
.t-field textarea::placeholder {
  color: rgba(255, 255, 255, 0.22);
}

.t-log {
  font-size: clamp(0.72rem, 0.64rem + 0.2vw, 0.85rem);
  min-height: 1.3em;
  color: var(--muted);
}

.t-log.err { color: var(--danger); }
.t-log.ok { color: var(--matrix); }

/* Submit loading state */
.btn-loading {
  display: none;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  border: 2.5px solid rgba(4, 18, 15, 0.3);
  border-top-color: #04120f;
  animation: spin 0.7s linear infinite;
}

.contact-form-loading .btn-label { display: none; }
.contact-form-loading .btn-loading { display: inline-block; }

/* ---------- Footer ---------- */
.footer {
  border-top: 1px solid var(--line);
  padding-block: clamp(1.8rem, 1.2rem + 2vw, 2.8rem);
  background: rgba(0, 0, 0, 0.45);
}

.footer-inner {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.9rem;
  text-align: center;
}

.footer-mono {
  font-family: var(--font-mono);
  font-size: clamp(0.74rem, 0.66rem + 0.22vw, 0.88rem);
  color: var(--muted);
}

.footer-note {
  font-size: clamp(0.74rem, 0.66rem + 0.22vw, 0.88rem);
  color: var(--muted);
}

/* ---------- Live market ticker (fixed price tape at the very top) ---------- */
.ticker {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  height: var(--ticker-h);
  z-index: 900;
  background: rgba(8, 8, 8, 0.88);
  backdrop-filter: blur(14px) saturate(140%);
  -webkit-backdrop-filter: blur(14px) saturate(140%);
  border-bottom: 1px solid rgba(0, 255, 204, 0.18);
  overflow: hidden;
  font-family: var(--font-mono);
  font-size: clamp(0.62rem, 0.54rem + 0.22vw, 0.8rem);
  letter-spacing: 1px;
}

.ticker-track {
  display: flex;
  align-items: center;
  gap: 2.8rem;
  width: max-content;
  height: 100%;
  animation: marquee 34s linear infinite;
}

.tick { color: var(--muted); white-space: nowrap; }
.tick b { font-weight: 600; }
.tick .up { color: var(--matrix); text-shadow: 0 0 8px rgba(0, 255, 204, 0.5); }
.tick .down { color: var(--danger); text-shadow: 0 0 8px rgba(255, 77, 94, 0.5); }

/* ---------- About: operator file ---------- */
.about-layout {
  display: grid;
  grid-template-columns: 1.15fr 1fr;
  gap: clamp(0.9rem, 0.6rem + 1vw, 1.4rem);
  margin-bottom: clamp(0.9rem, 0.6rem + 1vw, 1.4rem);
}

.bio-card {
  position: relative;
  overflow: hidden;
  padding: clamp(1.4rem, 1rem + 2vw, 2.4rem);
  transform-style: preserve-3d;
  will-change: transform;
  transition: opacity 0.85s ease, transform 0.25s ease, border-color 0.3s ease;
}

.bio-card:hover { border-color: var(--line-strong); }

.bio-head {
  display: flex;
  align-items: center;
  gap: clamp(0.9rem, 0.7rem + 1vw, 1.4rem);
  flex-wrap: wrap;
  margin-bottom: 1.2rem;
}

.bio-avatar {
  width: clamp(58px, 7vw, 84px);
  height: clamp(58px, 7vw, 84px);
  flex-shrink: 0;
  border-radius: 18px;
  display: grid;
  place-items: center;
  font-family: var(--font-head);
  font-weight: 800;
  font-size: clamp(1.2rem, 1rem + 1vw, 1.7rem);
  color: #04120f;
  background: linear-gradient(120deg, var(--matrix), var(--chart));
  box-shadow: 0 0 30px rgba(0, 255, 204, 0.3);
}

.bio-id h3 {
  font-family: var(--font-head);
  font-size: clamp(1.25rem, 1rem + 1.1vw, 1.9rem);
  letter-spacing: -0.3px;
}

.bio-role {
  font-family: var(--font-mono);
  font-size: clamp(0.56rem, 0.5rem + 0.16vw, 0.72rem);
  letter-spacing: 1.5px;
  color: var(--matrix);
  margin-top: 0.3rem;
}

.bio-status {
  margin-left: auto;
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  font-family: var(--font-mono);
  font-size: clamp(0.6rem, 0.53rem + 0.18vw, 0.76rem);
  letter-spacing: 2px;
  color: var(--matrix);
  border: 1px solid var(--matrix-dim);
  background: var(--matrix-dim);
  padding: 0.35rem 0.8rem;
  border-radius: 999px;
}

.bio-text {
  color: var(--muted);
  font-size: clamp(0.9rem, 0.83rem + 0.2vw, 1.02rem);
}

.bio-text + .bio-text { margin-top: 0.9rem; }
.bio-text strong { color: var(--text); }

.bio-facts {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-top: 1.3rem;
}

.bio-fact {
  font-family: var(--font-mono);
  font-size: clamp(0.66rem, 0.6rem + 0.18vw, 0.8rem);
  padding: 0.38rem 0.8rem;
  border-radius: 4px;
  border: 1px solid var(--line);
  background: var(--panel-2);
  color: var(--muted);
}

.bio-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 1rem;
  margin-top: 1.7rem;
}

.about-side {
  display: flex;
  flex-direction: column;
  gap: clamp(0.9rem, 0.6rem + 1vw, 1.4rem);
}

.about-stats {
  grid-template-columns: repeat(2, 1fr);
  margin-bottom: 0;
}

.equity-card {
  padding: clamp(1.1rem, 0.9rem + 1vw, 1.5rem);
  transition: border-color 0.3s ease;
}

.equity-card:hover { border-color: var(--line-strong); }

.equity-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}

.equity-label {
  font-family: var(--font-mono);
  font-size: clamp(0.6rem, 0.53rem + 0.18vw, 0.76rem);
  letter-spacing: 2px;
  color: var(--muted);
}

.equity-value {
  font-family: var(--font-head);
  font-weight: 700;
  color: var(--matrix);
  text-shadow: 0 0 12px rgba(0, 255, 204, 0.5);
}

/* Simulated equity curve (SVG) */
.equity-chart {
  display: block;
  width: 100%;
  height: clamp(90px, 14vh, 140px);
  margin-top: 0.7rem;
}

.eq-area {
  fill: url(#eqFill);
  opacity: 0;
  transition: opacity 1.4s ease 0.4s;
}

.eq-line {
  fill: none;
  stroke: url(#eqStroke);
  stroke-width: 2.5;
  stroke-linecap: round;
  stroke-dasharray: 900;
  stroke-dashoffset: 900;
  transition: stroke-dashoffset 2.6s var(--ease-out);
}

.equity-card.in .eq-line { stroke-dashoffset: 0; }
.equity-card.in .eq-area { opacity: 1; }

.eq-dot {
  fill: var(--matrix);
  filter: drop-shadow(0 0 6px rgba(0, 255, 204, 0.9));
  animation: eqPulse 2s ease-in-out infinite;
}

@keyframes eqPulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.35; }
}

/* ---------- Interactive dev terminal ---------- */
.dev-terminal {
  max-width: 760px;
  margin-inline: auto;
  overflow: hidden;
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.5), 0 0 0 1px rgba(0, 255, 204, 0.06);
}

.dev-term-body {
  padding: clamp(1rem, 0.7rem + 1.2vw, 1.4rem);
  font-family: var(--font-mono);
}

.dev-term-output {
  height: clamp(190px, 30vh, 260px);
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
  font-size: clamp(0.76rem, 0.68rem + 0.22vw, 0.9rem);
  color: #b9c4c2;
  scrollbar-width: thin;
  scrollbar-color: rgba(0, 255, 204, 0.35) transparent;
}

.dev-term-line b { font-weight: 600; }
.dev-term-line.err { color: var(--danger); }

.dev-term-input-row {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  margin-top: 1rem;
  padding-top: 1rem;
  border-top: 1px solid var(--line);
  font-size: clamp(0.8rem, 0.72rem + 0.22vw, 0.95rem);
}

.dev-term-input-row label { color: var(--matrix); }

.dev-term-input-row input {
  flex: 1;
  background: transparent;
  border: none;
  outline: none;
  color: var(--text);
  font-family: var(--font-mono);
  font-size: inherit;
  caret-color: var(--matrix);
}

.dev-term-input-row input::placeholder {
  color: rgba(255, 255, 255, 0.22);
}

.term-progress {
  display: inline-block;
  width: 180px;
  height: 12px;
  border: 1px solid var(--matrix);
  border-radius: 4px;
  overflow: hidden;
  vertical-align: middle;
}

.term-progress i {
  display: block;
  height: 100%;
  width: 0;
  background: linear-gradient(90deg, var(--matrix), var(--chart));
  animation: termProgress 1.2s var(--ease-out) forwards;
}

@keyframes termProgress {
  to { width: 100%; }
}

/* ---------- Matrix mode (PYTHON easter egg) ---------- */
html.matrix-mode {
  --bg: #000000;
  --bg-2: #000000;
  --panel: rgba(0, 255, 0, 0.04);
  --panel-2: rgba(0, 255, 0, 0.08);
  --line: rgba(0, 255, 0, 0.22);
  --line-strong: rgba(0, 255, 0, 0.42);
  --text: #d4ffd4;
  --muted: #6eaa6e;
  --matrix: #00ff00;
  --chart: #00cc00;
  --matrix-dim: rgba(0, 255, 0, 0.14);
  --chart-dim: rgba(0, 220, 0, 0.16);
  --python: #ccff00;
  --python-dim: rgba(204, 255, 0, 0.16);
  --danger: #ff0033;
}

/* Falling code rain — visible only while matrix mode is on */
#rainCanvas {
  position: fixed;
  inset: 0;
  z-index: 1;
  pointer-events: none;
  display: none;
}

html.matrix-mode #rainCanvas {
  display: block;
}

/* CRT scanlines for the hacker vibe */
html.matrix-mode body::after {
  content: '';
  position: fixed;
  inset: 0;
  z-index: 9998;
  pointer-events: none;
  background: repeating-linear-gradient(0deg, rgba(0, 255, 0, 0.045) 0 1px, transparent 1px 3px);
}

.matrix-toast {
  position: fixed;
  bottom: 2.2rem;
  left: 50%;
  transform: translateX(-50%) translateY(20px);
  z-index: 6000;
  font-family: var(--font-mono);
  font-size: clamp(0.72rem, 0.65rem + 0.2vw, 0.86rem);
  letter-spacing: 3px;
  color: var(--matrix);
  background: rgba(0, 0, 0, 0.85);
  border: 1px solid var(--matrix);
  box-shadow: 0 0 24px var(--matrix-dim);
  padding: 0.7rem 1.4rem;
  border-radius: 8px;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.35s ease, transform 0.35s var(--ease-out);
}

.matrix-toast.show {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

/* ---------- Verified credentials strip ---------- */
.creds-row {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: clamp(1rem, 0.6rem + 1.4vw, 1.8rem);
  max-width: 900px;
  margin-inline: auto;
}

.cred-card {
  position: relative;
  display: flex;
  align-items: center;
  gap: clamp(0.9rem, 0.7rem + 1vw, 1.3rem);
  padding: clamp(1.1rem, 0.9rem + 1vw, 1.5rem);
  overflow: hidden;
  transition: transform 0.35s var(--ease-out), border-color 0.3s ease, box-shadow 0.3s ease;
}

.cred-card:hover {
  transform: translateY(-5px);
  border-color: rgba(0, 255, 204, 0.4);
  box-shadow: 0 16px 44px rgba(0, 0, 0, 0.55), 0 0 30px rgba(0, 255, 204, 0.1);
}

.badge-shine {
  position: absolute;
  top: -60%;
  left: -80%;
  width: 55%;
  height: 220%;
  background: linear-gradient(105deg, transparent, rgba(255, 255, 255, 0.07), transparent);
  transform: rotate(18deg);
  animation: shineSweep 4.2s ease-in-out infinite;
  pointer-events: none;
}

.cred-card:nth-child(2) .badge-shine { animation-delay: 2.1s; }

@keyframes shineSweep {
  0%, 55% { left: -80%; }
  85%, 100% { left: 130%; }
}

.cred-rim {
  width: clamp(58px, 6vw, 76px);
  height: clamp(58px, 6vw, 76px);
  flex-shrink: 0;
  border-radius: 50%;
  padding: 3px;
  background: conic-gradient(from 0deg, var(--matrix), var(--chart), rgba(255, 255, 255, 0.5), var(--chart), var(--matrix), var(--matrix));
  box-shadow: 0 0 24px rgba(0, 255, 204, 0.28), inset 0 0 12px rgba(0, 0, 0, 0.6);
  animation: badgeSpin 10s linear infinite;
  display: grid;
  place-items: center;
}

.rim-blue {
  background: conic-gradient(from 180deg, var(--chart), var(--matrix), rgba(255, 255, 255, 0.5), var(--matrix), var(--chart), var(--chart));
  box-shadow: 0 0 24px rgba(0, 102, 255, 0.3), inset 0 0 12px rgba(0, 0, 0, 0.6);
}

@keyframes badgeSpin {
  to { transform: rotate(360deg); }
}

.cred-core {
  width: 100%;
  height: 100%;
  border-radius: 50%;
  background: radial-gradient(circle at 32% 26%, #1d2b33, #0a0a0a 72%);
  display: grid;
  place-items: center;
  font-family: var(--font-head);
  font-weight: 800;
  font-size: clamp(0.95rem, 0.8rem + 0.6vw, 1.25rem);
  color: var(--matrix);
  text-shadow: 0 0 14px rgba(0, 255, 204, 0.8);
}

.core-blue {
  color: #6fa8ff;
  text-shadow: 0 0 14px rgba(0, 102, 255, 0.8);
  font-size: clamp(0.62rem, 0.55rem + 0.3vw, 0.78rem);
  letter-spacing: 1px;
}

.cred-info h3 {
  font-family: var(--font-head);
  font-size: clamp(1rem, 0.85rem + 0.6vw, 1.35rem);
  font-weight: 700;
  letter-spacing: 2px;
}

.cred-info p {
  font-family: var(--font-mono);
  font-size: clamp(0.6rem, 0.54rem + 0.18vw, 0.76rem);
  color: var(--muted);
  letter-spacing: 1.5px;
  margin-top: 0.3rem;
}

.badge-check {
  display: inline-block;
  margin-left: auto;
  flex-shrink: 0;
  font-family: var(--font-mono);
  font-size: clamp(0.6rem, 0.52rem + 0.18vw, 0.74rem);
  letter-spacing: 2px;
  color: var(--matrix);
  border: 1px solid rgba(0, 255, 204, 0.3);
  background: rgba(0, 255, 204, 0.08);
  padding: 0.35rem 0.9rem;
  border-radius: 999px;
}

/* ---------- The Journey (vertical timeline) ---------- */
.timeline-vertical {
  position: relative;
  max-width: 820px;
  margin-inline: auto;
}

.timeline-vertical::before {
  content: '';
  position: absolute;
  top: 0;
  bottom: 0;
  left: 50%;
  width: 2px;
  transform: translateX(-50%);
  background: linear-gradient(180deg, var(--matrix), var(--chart));
  box-shadow: 0 0 18px rgba(0, 255, 204, 0.45);
}

.tl-item {
  position: relative;
  display: grid;
  grid-template-columns: 1fr 76px 1fr;
  align-items: center;
  padding-block: 1.1rem;
}

.tl-node {
  grid-column: 2;
  grid-row: 1;
  justify-self: center;
  position: relative;
  z-index: 1;
}

.tl-dot {
  position: relative;
  display: block;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: var(--matrix);
  box-shadow: 0 0 16px rgba(0, 255, 204, 0.9);
  border: 3px solid #0a0a0a;
}

.tl-dot::after {
  content: '';
  position: absolute;
  inset: -9px;
  border-radius: 50%;
  border: 1px solid rgba(0, 255, 204, 0.5);
  animation: pulseRing 2.4s ease-out infinite;
}

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

.tl-card {
  grid-column: 3;
  grid-row: 1;
  padding: clamp(1.2rem, 0.9rem + 1.2vw, 1.7rem);
  transition: border-color 0.3s ease, transform 0.3s ease;
}

.tl-card:hover {
  border-color: rgba(0, 255, 204, 0.35);
  transform: translateY(-4px);
}

.tl-item:nth-child(odd) .tl-card {
  grid-column: 1;
  grid-row: 1;
  text-align: right;
}

.tl-phase {
  font-family: var(--font-mono);
  font-size: clamp(0.6rem, 0.53rem + 0.18vw, 0.76rem);
  letter-spacing: 2.5px;
  color: var(--matrix);
}

.tl-card h3 {
  font-family: var(--font-head);
  font-size: clamp(1.05rem, 0.85rem + 0.6vw, 1.4rem);
  margin-top: 0.35rem;
}

.tl-card p {
  color: var(--muted);
  font-size: clamp(0.86rem, 0.78rem + 0.2vw, 0.98rem);
  margin-top: 0.45rem;
}

.tl-card em {
  font-style: normal;
  color: var(--chart);
  font-size: 0.85em;
}

/* ---------- Footer socials ---------- */
.socials {
  display: flex;
  gap: 1rem;
  margin-top: 0.6rem;
}

.social {
  width: 46px;
  height: 46px;
  border-radius: 12px;
  display: grid;
  place-items: center;
  border: 1px solid var(--line);
  background: var(--panel);
  color: var(--muted);
  transition: color 0.3s ease, border-color 0.3s ease, box-shadow 0.3s ease, transform 0.3s ease;
  animation: socialFloat 5s ease-in-out infinite;
}

.social:nth-child(2) { animation-delay: -1.6s; }
.social:nth-child(3) { animation-delay: -3.2s; }
.social:nth-child(4) { animation-delay: -4.8s; }

.social:hover {
  color: var(--matrix);
  border-color: var(--matrix);
  box-shadow: 0 0 22px var(--matrix-dim);
  transform: translateY(-4px);
}

.social svg {
  width: 22px;
  height: 22px;
  fill: currentColor;
}

@keyframes socialFloat {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-5px); }
}

/* ---------- Reduced motion & no-js fallbacks ---------- */
.no-js .preloader { display: none; }
.no-js .line-inner { transform: none; }
.no-js .hero-anim { opacity: 1; transform: none; }
.no-js [data-reveal] { opacity: 1; transform: none; }

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *,
  *::before,
  *::after {
    animation-duration: 0.001s !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.001s !important;
  }
  [data-reveal], .line-inner, .hero-anim { opacity: 1 !important; transform: none !important; }
  #bgCanvas { display: none; }
}

/* ==========================================================================
   OMNI-DEVICE RESPONSIVE
   Category 1: Smartwatch < 320px
   Category 2: Mobile & touch 320–768px
   Category 3: Tablet 768–1024px
   Category 4: PC & 4K > 1024px  (the desktop defaults above)
   ========================================================================== */

/* --- Touch-friendly active states (mobile/tablet fallback for magnetic) --- */
@media (hover: none), (pointer: coarse) {
  .btn:active { transform: scale(0.97); }
  .pill:active { transform: translateY(-2px) scale(0.99); }
  .bento-cell:active { transform: translateY(-2px) scale(0.99); }
  .nav-link:active { color: var(--matrix); }
  .dash-tile:active { transform: translateY(-2px); }
}

/* --- CATEGORY 3 · Tablets: 768px – 1024px --- */
@media (min-width: 768px) and (max-width: 1023.98px) {
  .about-layout {
    grid-template-columns: 1fr;
  }

  .dash-grid {
    grid-template-columns: repeat(2, 1fr);
  }

  .bento {
    grid-template-columns: repeat(2, 1fr);
    grid-auto-rows: auto;
  }

  .bento-main {
    grid-column: span 2;
    grid-row: auto;
  }

  .contact-grid {
    grid-template-columns: 1fr;
  }

  .hero-hud { display: none; }

  /* Larger tap targets for fingers */
  .nav-link {
    padding: 0.7rem 1.05rem;
  }

  .btn {
    min-height: 52px;
  }

  .pill {
    min-height: 52px;
  }

  .t-field input,
  .t-field textarea {
    min-height: 50px;
  }
}

/* --- CATEGORY 2 · Mobile & touch: 320px – 768px --- */
@media (max-width: 767.98px) {
  .about-layout {
    grid-template-columns: 1fr;
  }

  .creds-row {
    grid-template-columns: 1fr;
  }

  .timeline-vertical::before {
    left: 19px;
  }

  .tl-item {
    grid-template-columns: 44px 1fr;
  }

  .tl-node {
    grid-column: 1;
  }

  .tl-card,
  .tl-item:nth-child(odd) .tl-card {
    grid-column: 2;
    text-align: left;
  }

  .navbar {
    padding-top: 10px;
  }

  .nav-dock {
    width: calc(100% - 20px);
    justify-content: space-between;
    border-radius: 14px;
    padding: 0.45rem 0.55rem 0.45rem 1rem;
    /* Solid bar: the full-screen overlay below carries the blur, and
       avoiding backdrop-filter here keeps the fixed overlay viewport-anchored. */
    background: rgba(10, 10, 10, 0.85);
    backdrop-filter: none;
    -webkit-backdrop-filter: none;
  }

  .nav-toggle {
    display: flex;
  }

  .nav-links {
    position: fixed;
    inset: 0;
    flex-direction: column;
    justify-content: center;
    gap: 2.2rem;
    background: rgba(10, 10, 10, 0.92);
    backdrop-filter: blur(24px);
    -webkit-backdrop-filter: blur(24px);
    transform: translateY(-100%);
    transition: transform 0.45s var(--ease-out);
    z-index: 1000;
  }

  .nav-links.open {
    transform: translateY(0);
  }

  .nav-indicator {
    display: none;
  }

  .nav-link {
    font-size: clamp(1.3rem, 1rem + 1.6vw, 1.6rem);
    font-family: var(--font-head);
    font-weight: 600;
    padding: 0.6rem 1.4rem;
  }

  .hero {
    padding-top: calc(var(--nav-h) + 0.5rem);
  }

  .dash-grid {
    grid-template-columns: repeat(2, 1fr);
  }

  .bento {
    grid-template-columns: 1fr;
    grid-auto-rows: auto;
  }

  .bento-main {
    grid-column: span 1;
  }

  .contact-grid {
    grid-template-columns: 1fr;
  }

  .hero-hud { display: none; }
  .scroll-hint { display: none; }

  /* Tone the decorative shapes down but keep the vibe */
  .hero-shapes { opacity: 0.4; }
  .ring-1 { right: -160px; }
  .ring-2 { right: -260px; }
  .cube { right: 10%; }
  .crosshair { right: 16%; }

  .hero-actions .btn {
    width: 100%;
  }

  .btn {
    min-height: 52px;
  }

  .marquee-track {
    animation-duration: 20s;
  }

  .section {
    padding-block: clamp(3rem, 2.2rem + 4vw, 4.6rem);
  }

  .t-title {
    max-width: 45%;
  }
}

/* --- CATEGORY 1 · Smartwatches: < 320px --- */
@media (max-width: 319.98px) {
  /* Battery: kill all animated decorative layers */
  #bgCanvas { display: none; }
  .bg-grid { display: none; }
  .hero-shapes { display: none; }
  .marquee { display: none; }
  .ticker { display: none; }

  :root {
    --ticker-h: 0;
  }

  :root {
    --nav-h: 56px;
  }

  .container {
    width: 94%;
  }

  .logo-sigil {
    display: none;
  }

  .logo {
    letter-spacing: 0.5px;
    gap: 0.3rem;
  }

  .section {
    padding-block: 2.4rem;
  }

  .section-head {
    margin-bottom: 1.6rem;
  }

  .section-title {
    letter-spacing: -0.2px;
  }

  /* Force every grid into a single 100% column */
  .dash-grid,
  .bento,
  .contact-grid {
    grid-template-columns: 1fr;
    gap: 0.85rem;
  }

  .dash-tile,
  .bento-cell {
    padding: 1.1rem;
  }

  .bento-cell h3 { letter-spacing: -0.2px; }

  .hero {
    min-height: 100svh;
    padding-top: 4rem;
  }

  .hero-inner {
    padding-block: 1.5rem 2.5rem;
  }

  .hero-badge {
    letter-spacing: 1px;
    padding: 0.35rem 0.6rem;
    margin-bottom: 1.1rem;
  }

  .hero-typing {
    margin-top: 1rem;
    min-height: 2.6em;
    align-items: flex-start;
    flex-wrap: wrap;
  }

  .hero-sub {
    margin-top: 0.9rem;
  }

  .hero-actions {
    margin-top: 1.8rem;
    gap: 0.9rem;
  }

  .pills-wrap {
    gap: 0.6rem;
  }

  .pill {
    min-height: 42px;
    padding: 0.65rem 0.95rem;
  }

  .loader-brackets {
    font-size: 1.7rem;
  }

  .loader-track {
    width: 160px;
  }

  .btn {
    padding: 0.85rem 1.2rem;
    min-height: 46px;
  }

  .contact-emoji {
    width: 40px;
    height: 40px;
  }

  .footer {
    padding-block: 1.6rem;
  }
}
