/* ============ ROOT VARIABLES ============ */
:root {
  --bg-primary: #fafbfc;
  --bg-secondary: #f4f6f8;
  --panel-bg: rgba(255, 255, 255, 0.92);
  --border-color: #e2e8f0;
  --text-primary: #0d1117;
  --text-muted: #475569;
  --accent-navy: #0e1f45;
  --accent-navy-hover: #14284a;
  --accent-red: #c8102e;
  --accent-red-hover: #a80d26;
}
.dark {
  --bg-primary: #0a0f17;
  --bg-secondary: #11161f;
  --panel-bg: rgba(17, 22, 31, 0.85);
  --border-color: #1e2530;
  --text-primary: #f5f7fa;
  --text-muted: #8b949e;
  --accent-navy: #6b9bd8;
  --accent-navy-hover: #8aabd6;
  --accent-red: #e84a58;
  --accent-red-hover: #f07a86;
}

/* ============ BASE ============ */
html { scroll-behavior: smooth; -webkit-text-size-adjust: 100%; }
*, *::before, *::after { box-sizing: border-box; }

body {
  font-family: 'Inter', sans-serif;
  background-color: var(--bg-primary);
  color: var(--text-primary);
  transition: background-color 0.4s ease, color 0.4s ease;
  overflow-x: hidden;
  font-feature-settings: 'cv02','cv03','cv04','cv11';
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  line-height: 1.6;
}

/* ============ LENIS SMOOTH SCROLL ============ */
html.lenis, html.lenis body {
  height: auto;
}
.lenis.lenis-smooth {
  scroll-behavior: auto !important;
}
.lenis.lenis-smooth [data-lenis-prevent] {
  overscroll-behavior: contain;
}
.lenis.lenis-stopped {
  overflow: hidden;
}
.lenis.lenis-scrolling iframe {
  pointer-events: none;
}

/* ============ TYPOGRAPHY ============ */
h1, h2, h3, h4, h5, h6 {
  font-family: 'Sora', sans-serif;
  letter-spacing: -0.03em;
  font-weight: 700;
  line-height: 1.15;
  font-style: normal;
}
h1 { font-weight: 800; line-height: 1.05; }
h2 { font-weight: 800; }
h3 { font-weight: 700; letter-spacing: -0.02em; line-height: 1.25; }

.hero-h1 {
  font-size: clamp(2.25rem, 5.5vw, 4.75rem);
  line-height: 1.05;
  letter-spacing: -0.04em;
  font-style: normal;
}
.section-h2 {
  font-size: clamp(1.75rem, 4.5vw, 2.75rem);
  line-height: 1.15;
  letter-spacing: -0.03em;
}
.text-gradient {
  display: inline-block;
  font-style: normal;
}

/* ============ LABEL PILL ============ */
.label-pill {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.4rem 0.9rem;
  border-radius: 999px;
  border: 1px solid rgba(14, 31, 69, 0.15);
  background: rgba(255, 255, 255, 0.6);
  color: #0e1f45;
  font-size: 10px;
  font-family: 'JetBrains Mono', monospace;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  backdrop-filter: blur(8px);
  white-space: nowrap;
}
@media (min-width: 640px) {
  .label-pill { font-size: 11px; letter-spacing: 0.15em; padding: 0.4rem 1rem; }
}
.dark .label-pill {
  background: rgba(107, 155, 216, 0.08);
  border-color: rgba(107, 155, 216, 0.25);
  color: #8aabd6;
}
.label-pill::before {
  content: '';
  width: 5px; height: 5px;
  border-radius: 50%;
  background: #c8102e;
  flex-shrink: 0;
}
.dark .label-pill::before { background: #e84a58; }

.section-divider {
  width: 40px;
  height: 2px;
  background: #c8102e;
  border-radius: 2px;
  margin: 1rem auto 0;
}
@media (min-width: 640px) {
  .section-divider { width: 48px; margin-top: 1.25rem; }
}

/* ============ BUTTONS ============ */
.btn-primary {
  background: #0e1f45;
  color: #ffffff;
  border-radius: 0.5rem;
  transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
  letter-spacing: 0.05em;
  box-shadow: 0 1px 2px rgba(14, 31, 69, 0.15);
  font-family: 'Inter', sans-serif;
  font-weight: 700;
  white-space: nowrap;
}
.btn-primary:hover {
  background: #14284a;
  transform: translateY(-1px);
  box-shadow: 0 8px 20px rgba(14, 31, 69, 0.25);
}
.dark .btn-primary { background: #6b9bd8; color: #0a0f17; }
.dark .btn-primary:hover { background: #8aabd6; box-shadow: 0 8px 20px rgba(107, 155, 216, 0.3); }

.btn-secondary {
  background: transparent;
  color: var(--text-primary);
  border: 1.5px solid rgba(14, 31, 69, 0.2);
  border-radius: 0.5rem;
  transition: all 0.25s ease;
  letter-spacing: 0.05em;
  font-weight: 700;
  white-space: nowrap;
}
.btn-secondary:hover {
  border-color: #0e1f45;
  background: rgba(14, 31, 69, 0.03);
}
.dark .btn-secondary { border-color: rgba(107, 155, 216, 0.3); }
.dark .btn-secondary:hover { border-color: #6b9bd8; background: rgba(107, 155, 216, 0.08); }

/* ============ LOGO ============ */
.logo-box {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 4px;
  background: #ffffff;
  border: 1px solid #e2e8f0;
  border-radius: 12px;
  box-shadow: 0 2px 8px rgba(14, 31, 69, 0.06);
  transition: all 0.3s ease;
}
@media (min-width: 640px) {
  .logo-box { padding: 5px; border-radius: 13px; }
}
@media (min-width: 1024px) {
  .logo-box { padding: 6px; border-radius: 14px; }
}
.logo-box:hover {
  transform: translateY(-1px);
  box-shadow: 0 6px 16px rgba(14, 31, 69, 0.12);
  border-color: rgba(14, 31, 69, 0.2);
}
.dark .logo-box {
  background: rgba(255,255,255,0.96);
  border-color: rgba(107, 155, 216, 0.25);
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.4);
}
.dark .logo-box:hover { box-shadow: 0 6px 18px rgba(107, 155, 216, 0.3); }

.nav-logo {
  height: 28px;
  width: auto;
  max-width: 120px;
  object-fit: contain;
  display: block;
}
@media (min-width: 640px) {
  .nav-logo { height: 34px; max-width: 150px; }
}
@media (min-width: 1024px) {
  .nav-logo { height: 42px; max-width: 180px; }
}
.logo-fallback {
  display: none;
  font-family: 'Sora', sans-serif;
  font-size: 16px;
  font-weight: 800;
  letter-spacing: -0.03em;
  white-space: nowrap;
}
@media (min-width: 640px) { .logo-fallback { font-size: 18px; } }
@media (min-width: 1024px) { .logo-fallback { font-size: 20px; } }

/* ============ GLASS ============ */
.glass-panel {
  background: var(--panel-bg);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border-color);
}
.glass-card {
  background: rgba(255, 255, 255, 0.55);
  backdrop-filter: blur(10px);
  border: 1px solid rgba(14, 31, 69, 0.08);
  transition: all 0.3s ease;
}
.dark .glass-card {
  background: rgba(17, 22, 31, 0.5);
  border: 1px solid rgba(107, 155, 216, 0.12);
}
.glass-card:hover {
  border-color: rgba(14, 31, 69, 0.2);
  box-shadow: 0 8px 24px rgba(14, 31, 69, 0.06);
}
.dark .glass-card:hover {
  border-color: rgba(107, 155, 216, 0.25);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.3);
}

/* ============ ICON BOX ============ */
.icon-box {
  width: 44px; height: 44px;
  border-radius: 0.5rem;
  display: flex; align-items: center; justify-content: center;
  background: #0e1f45;
  color: #ffffff;
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.15), 0 2px 6px rgba(14,31,69,0.15);
  border: 1px solid rgba(14,31,69,0.4);
  flex-shrink: 0;
}
@media (min-width: 640px) { .icon-box { width: 50px; height: 50px; } }
@media (min-width: 1024px) { .icon-box { width: 56px; height: 56px; } }
.icon-box.crimson {
  background: #c8102e;
  border-color: rgba(200,16,46,0.5);
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.15), 0 2px 6px rgba(200,16,46,0.2);
}
.dark .icon-box { background: #6b9bd8; color: #0a0f17; border-color: rgba(107,155,216,0.4); }
.dark .icon-box.crimson { background: #e84a58; border-color: rgba(232,74,88,0.5); }

/* ============ SCROLLBAR ============ */
::-webkit-scrollbar { width: 8px; }
::-webkit-scrollbar-track { background: var(--bg-primary); }
::-webkit-scrollbar-thumb { background: #c5ced8; border-radius: 4px; }
.dark ::-webkit-scrollbar-thumb { background: #2a3340; }
::-webkit-scrollbar-thumb:hover { background: #0e1f45; }
.dark ::-webkit-scrollbar-thumb:hover { background: #6b9bd8; }

/* ============ CUSTOM CURSOR ============ */
#heroCanvas {
  position: absolute; top: 0; left: 0;
  width: 100%; height: 100%;
  pointer-events: none; z-index: 0; opacity: 0.45;
}
@media (hover: hover) and (pointer: fine) {
  body, a, button, input, select, textarea { cursor: none !important; }
}
#customCursor {
  position: fixed; top: 0; left: 0;
  width: 20px; height: 20px;
  pointer-events: none; z-index: 9999;
  transform: translate(-2px, -2px);
  transition: transform 0.08s ease-out;
  display: none;
}
@media (hover: hover) and (pointer: fine) {
  #customCursor { display: block; width: 22px; height: 22px; }
}
#customCursor.hover { transform: translate(-2px, -2px) scale(1.15); }

/* ============ ANIMATIONS ============ */
@keyframes pulseGlow {
  0%, 100% { opacity: 0.35; }
  50% { opacity: 0.6; }
}
.animate-pulse-glow { animation: pulseGlow 5s infinite ease-in-out; }

@keyframes countFadeIn {
  from { opacity: 0; transform: translateY(6px); }
  to { opacity: 1; transform: translateY(0); }
}
.animate-count { animation: countFadeIn 0.8s ease-out; }

/* ============ MARQUEE ============ */
@keyframes marqueeLeft { 0% { transform: translateX(0); } 100% { transform: translateX(-50%); } }
@keyframes marqueeRight { 0% { transform: translateX(-50%); } 100% { transform: translateX(0); } }
.marquee-track { display: flex; width: max-content; gap: 0.5rem; }
@media (min-width: 640px) { .marquee-track { gap: 0.75rem; } }
.marquee-track.left { animation: marqueeLeft 45s linear infinite; }
.marquee-track.right { animation: marqueeRight 50s linear infinite; }
.marquee-wrap:hover .marquee-track { animation-play-state: paused; }
.marquee-mask {
  mask-image: linear-gradient(to right, transparent 0%, black 10%, black 90%, transparent 100%);
  -webkit-mask-image: linear-gradient(to right, transparent 0%, black 10%, black 90%, transparent 100%);
}
.marquee-chip {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.4rem 0.75rem;
  border-radius: 0.5rem;
  background: rgba(255, 255, 255, 0.65);
  border: 1px solid rgba(14, 31, 69, 0.1);
  font-size: 10px;
  font-weight: 600;
  color: #334155;
  white-space: nowrap;
  cursor: pointer;
  transition: all 0.3s ease;
  font-family: 'JetBrains Mono', monospace;
  letter-spacing: 0.02em;
}
@media (min-width: 640px) {
  .marquee-chip { font-size: 0.72rem; padding: 0.5rem 1rem; gap: 0.5rem; }
}
.dark .marquee-chip {
  background: rgba(17, 22, 31, 0.6);
  border-color: rgba(107, 155, 216, 0.15);
  color: #cbd5e1;
}
.marquee-chip:hover {
  transform: translateY(-2px);
  border-color: #0e1f45;
  box-shadow: 0 6px 16px rgba(14, 31, 69, 0.12);
  color: #0e1f45;
}
.dark .marquee-chip:hover {
  border-color: #6b9bd8;
  color: #8aabd6;
  box-shadow: 0 6px 16px rgba(107, 155, 216, 0.15);
}
.marquee-chip .chip-icon { width: 11px; height: 11px; flex-shrink: 0; }
@media (min-width: 640px) { .marquee-chip .chip-icon { width: 13px; height: 13px; } }
.marquee-chip .chip-badge {
  font-size: 8px;
  padding: 1px 5px;
  border-radius: 3px;
  background: rgba(200, 16, 46, 0.1);
  color: #c8102e;
  font-weight: 700;
  letter-spacing: 0.08em;
}
@media (min-width: 640px) { .marquee-chip .chip-badge { font-size: 9px; padding: 1px 6px; } }
.dark .marquee-chip .chip-badge { background: rgba(232, 74, 88, 0.15); color: #f07a86; }

/* ============ CONFETTI ============ */
.confetti {
  position: fixed;
  width: 8px; height: 8px;
  pointer-events: none;
  z-index: 9999;
  border-radius: 2px;
  animation: confettiFall 2.5s ease-out forwards;
}
@keyframes confettiFall {
  0% { opacity: 1; transform: translateY(0) rotate(0deg); }
  100% { opacity: 0; transform: translateY(600px) rotate(720deg); }
}

/* ============ MODAL ============ */
:root {
  --modal-bg: #ffffff;
  --modal-border: #e2e8f0;
  --modal-header-grad: linear-gradient(180deg, #ffffff 0%, #f4f6f8 100%);
  --modal-title: #0e1f45;
  --modal-navy: #0e1f45;
  --modal-navy-hover: #14284a;
  --modal-red: #c8102e;
  --modal-divider: #e2e8f0;
  --modal-field-bg: #ffffff;
  --modal-field-border: #e2e8f0;
  --modal-field-text: #0f172a;
  --modal-result-bg: linear-gradient(135deg, rgba(14,31,69,0.04), rgba(14,31,69,0.02));
  --modal-result-border: rgba(14,31,69,0.2);
}
.dark {
  --modal-bg: #11161f;
  --modal-border: #1e2530;
  --modal-header-grad: linear-gradient(180deg, #11161f 0%, #14284a 100%);
  --modal-title: #ffffff;
  --modal-navy: #6b9bd8;
  --modal-navy-hover: #8aabd6;
  --modal-red: #e84a58;
  --modal-divider: #1e2530;
  --modal-field-bg: #0a0f17;
  --modal-field-border: #1e2530;
  --modal-field-text: #f5f7fa;
  --modal-result-bg: linear-gradient(135deg, rgba(107,155,216,0.06), rgba(20,40,74,0.1));
  --modal-result-border: rgba(107,155,216,0.25);
}
.modal-shell {
  background: var(--modal-bg);
  border: 1px solid var(--modal-border);
  border-radius: 1rem;
  color: #334155;
  box-shadow: 0 30px 70px rgba(14, 31, 69, 0.2);
  max-height: calc(100vh - 2rem);
  overflow-y: auto;
}
.dark .modal-shell { color: #cbd5e1; }
.modal-header {
  background: var(--modal-header-grad);
  border-bottom: 1px solid var(--modal-border);
  position: relative;
}
.modal-header::after {
  content: '';
  position: absolute;
  left: 1rem; right: 1rem; bottom: -1px;
  height: 2px;
  border-radius: 2px;
  background: linear-gradient(to right, var(--modal-navy) 0%, var(--modal-navy) 60%, var(--modal-red) 60%, var(--modal-red) 100%);
  opacity: 0.85;
}
@media (min-width: 640px) {
  .modal-header::after { left: 1.5rem; right: 1.5rem; }
}
.modal-title {
  color: var(--modal-title);
  font-family: 'Sora', sans-serif;
  font-weight: 800;
  letter-spacing: -0.03em;
  font-size: 15px;
  font-style: normal;
}
@media (min-width: 640px) { .modal-title { font-size: 18px; } }
.modal-label {
  color: #64748b;
  font-weight: 600;
  letter-spacing: 0.08em;
  font-size: 9px;
}
@media (min-width: 640px) { .modal-label { font-size: 10px; } }
.dark .modal-label { color: #8b949e; }
.modal-select, .modal-input {
  background: var(--modal-field-bg);
  border: 1px solid var(--modal-field-border);
  color: var(--modal-field-text);
  border-radius: 0.5rem;
  padding: 0.6rem 0.75rem;
  font-size: 11px;
  width: 100%;
  transition: all 0.2s;
  font-family: 'JetBrains Mono', monospace;
}
@media (min-width: 640px) {
  .modal-select, .modal-input { padding: 0.7rem 0.85rem; font-size: 12px; }
}
.modal-select:focus, .modal-input:focus {
  outline: none;
  border-color: var(--modal-navy);
  box-shadow: 0 0 0 3px rgba(14, 31, 69, 0.08);
}
.dark .modal-select:focus, .dark .modal-input:focus { box-shadow: 0 0 0 3px rgba(107, 155, 216, 0.12); }
.modal-result-box {
  background: var(--modal-result-bg);
  border: 1px solid var(--modal-result-border);
  border-radius: 0.5rem;
}
.modal-btn-primary {
  background: var(--modal-navy);
  color: #ffffff;
  border-radius: 0.5rem;
  transition: all 0.2s;
  letter-spacing: 0.05em;
  font-weight: 700;
}
.modal-btn-primary:hover { background: var(--modal-navy-hover); transform: translateY(-1px); }
.dark .modal-btn-primary { color: #0a0f17; }
.modal-btn-secondary {
  background: #f4f6f8;
  color: #334155;
  border: 1px solid var(--modal-divider);
  border-radius: 0.5rem;
  transition: all 0.2s;
  font-weight: 600;
}
.modal-btn-secondary:hover { background: #e8edf2; }
.dark .modal-btn-secondary { background: #0a0f17; color: #cbd5e1; border-color: #1e2530; }
.dark .modal-btn-secondary:hover { background: #1e2530; }
.modal-accent-dot {
  display: inline-block; width: 5px; height: 5px; border-radius: 50%;
  background: var(--modal-red); margin-right: 6px; vertical-align: middle;
}
.modal-tag {
  background: rgba(14, 31, 69, 0.06);
  color: var(--modal-navy);
  font-weight: 700;
  letter-spacing: 0.08em;
  font-size: 8px;
}
@media (min-width: 640px) { .modal-tag { font-size: 9px; } }
.dark .modal-tag { background: rgba(107, 155, 216, 0.12); }

/* ============ PORTFOLIO ============ */
.port-thumb {
  width: 100%; aspect-ratio: 16 / 9;
  object-fit: cover;
  border-radius: 0.5rem;
  border: 1px solid rgba(14,31,69,0.08);
  background: #f4f6f8;
  transition: transform 0.5s ease;
}
.dark .port-thumb { border-color: rgba(107,155,216,0.12); background: #11161f; }
.port-thumb-wrap { overflow: hidden; border-radius: 0.5rem; }
.port-thumb-wrap:hover .port-thumb { transform: scale(1.04); }
.port-thumb-fallback {
  width: 100%; aspect-ratio: 16 / 9;
  border-radius: 0.5rem;
  display: flex; align-items: center; justify-content: center;
  background: linear-gradient(135deg, #0e1f45 0%, #14284a 55%, #c8102e 100%);
  color: #ffffff;
  font-family: 'Sora', sans-serif;
  font-weight: 800;
  font-size: 1.25rem;
  letter-spacing: 0.08em;
  position: relative;
  overflow: hidden;
}
@media (min-width: 640px) { .port-thumb-fallback { font-size: 1.75rem; } }
.port-thumb-fallback::before {
  content: '';
  position: absolute; inset: 0;
  background: radial-gradient(circle at 30% 30%, rgba(255,255,255,0.18) 0%, transparent 55%);
}

.status-live {
  background: rgba(200, 16, 46, 0.08);
  color: #c8102e;
  font-weight: 700;
  letter-spacing: 0.08em;
  font-size: 9px;
  padding: 2px 7px;
  border-radius: 3px;
  white-space: nowrap;
}
@media (min-width: 640px) { .status-live { font-size: 10px; padding: 2px 8px; } }
.dark .status-live { background: rgba(232, 74, 88, 0.15); color: #f07a86; }

kbd {
  font-family: 'JetBrains Mono', monospace;
  font-size: 9px;
  padding: 1px 5px;
  border-radius: 3px;
  background: rgba(255,255,255,0.1);
  border: 1px solid rgba(255,255,255,0.15);
  color: #cbd5e1;
  white-space: nowrap;
}
@media (min-width: 640px) { kbd { font-size: 10px; padding: 2px 6px; } }

/* ============ FLUID FONT HELPERS ============ */
.hero-stats-num { font-size: 1.25rem; font-family: 'Sora', sans-serif; font-weight: 700; letter-spacing: -0.03em; line-height: 1.1; }
@media (min-width: 640px) { .hero-stats-num { font-size: 1.5rem; } }
@media (min-width: 1024px) { .hero-stats-num { font-size: 1.875rem; } }

.terminal-min-h { min-height: 220px; }
@media (min-width: 640px) { .terminal-min-h { min-height: 240px; } }

.break-anywhere { word-break: break-word; overflow-wrap: anywhere; }