/* ── Global / Tokens ── */

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

:root {
  /* ── Colors (Dark Mode Default) ── */
  --bg-primary:      #0a0a0b;
  --bg-secondary:    #121214;
  --bg-card:         #18181b;
  --nav-bg:          rgba(10, 10, 11, 0.85);
  --text-primary:    #f4f4f5;
  --text-muted:      #a1a1aa;
  --text-dim:        #52525b;

  /* Ruby/Crimson Accent */
  --accent:          #9b111e;
  --accent-rgb:      155, 17, 30;
  --accent-light:    rgba(155, 17, 30, 0.1);
  --accent-glow:     rgba(155, 17, 30, 0.2);
  --border:          rgba(255, 255, 255, 0.06);
  --border-hover:    rgba(255, 255, 255, 0.12);
  --border-accent:   rgba(155, 17, 30, 0.3);
  --tag-bg:          rgba(255, 255, 255, 0.05);

  /* ── Typography ── */
  --font-display:    'Lora', serif;
  --font-body:       'Inter', sans-serif;
  --font-mono:       'JetBrains Mono', monospace;

  /* ── Layout ── */
  --max-w: 1000px; /* Increased further to 1280px to fix zoom appearance */
  --pad-x: clamp(1rem, 5vw, 2rem);
  --section-spacing: clamp(3rem, 8vw, 6rem);

  /* ── Effects ── */
  --ease-premium:      cubic-bezier(0.25, 0.46, 0.45, 0.94);
  --ease-out-expo:     cubic-bezier(0.19, 1, 0.22, 1);
  --ease-in-out-quart: cubic-bezier(0.77, 0, 0.175, 1);

  --transition:        0.4s var(--ease-premium);
  --transition-smooth: 0.6s var(--ease-out-expo);
  --transition-bounce: 0.55s cubic-bezier(0.34, 1.56, 0.64, 1);
  --transition-snappy: 0.2s cubic-bezier(0.4, 0, 0.2, 1);

  --shadow-sm:      0 1px 2px 0 rgb(0 0 0 / 0.05);
  --glass-bg:       rgba(18, 18, 20, 0.7);
  --glass-border:   rgba(255, 255, 255, 0.08);
  --panel-shadow:   0 20px 50px rgba(0, 0, 0, 0.3);
  --shadow-md:      0 4px 6px -1px rgb(0 0 0 / 0.1), 0 2px 4px -2px rgb(0 0 0 / 0.1);
  --shadow-lg:      0 20px 40px rgba(0, 0, 0, 0.18);
  --shadow-lift:    0 8px 24px rgba(0, 0, 0, 0.2), 0 2px 8px rgba(0, 0, 0, 0.12);
  --shadow-premium: 0 25px 50px rgba(0, 0, 0, 0.22), 0 0 40px var(--accent-glow);
}

/* ══════════════════════════════════════════
   Light Theme — Fully redesigned palette
══════════════════════════════════════════ */
body.light {
  /* Warm off-white base — not harsh white */
  --bg-primary:    #f7f5f2;
  --bg-secondary:  #efece8;
  --bg-card:       #faf9f7;
  --nav-bg:        rgba(247, 245, 242, 0.88);

  /* High-contrast readable text */
  --text-primary:  #1a1714;
  --text-muted:    #4a4540;
  --text-dim:      #9e9790;

  /* Refined accent — deep ruby with better visibility on light bg */
  --accent:          #a01020;
  --accent-rgb:      160, 16, 32;
  --accent-light:    rgba(160, 16, 32, 0.07);
  --accent-glow:     rgba(160, 16, 32, 0.14);

  /* Subtle borders — soft, not stark */
  --border:          rgba(0, 0, 0, 0.07);
  --border-hover:    rgba(0, 0, 0, 0.13);
  --border-accent:   rgba(160, 16, 32, 0.22);
  --tag-bg:          rgba(0, 0, 0, 0.04);

  /* Elevated shadows for light mode depth */
  --shadow-sm:      0 1px 3px rgba(0,0,0,0.06), 0 1px 2px rgba(0,0,0,0.04);
  --shadow-md:      0 4px 12px rgba(0,0,0,0.08), 0 2px 4px rgba(0,0,0,0.05);
  --shadow-lg:      0 12px 28px rgba(0,0,0,0.1), 0 4px 8px rgba(0,0,0,0.06);
  --shadow-lift:    0 8px 20px rgba(0,0,0,0.1), 0 2px 6px rgba(0,0,0,0.06);
  --shadow-premium: 0 16px 40px rgba(0,0,0,0.12), 0 0 20px rgba(160,16,32,0.1);
  --glass-bg:       rgba(247, 245, 242, 0.75);
  --glass-border:   rgba(0, 0, 0, 0.08);
  --panel-shadow:   0 12px 32px rgba(0, 0, 0, 0.1);
}

/* ── Smooth scroll with high-quality feel ── */
html {
  scroll-behavior: auto !important; /* Managed by JS for speed */
  font-size: 12px !important; /* Aggressively reduced from 14px to fix the "zoomed" look */
  scroll-padding-top: 80px;
}

@media (min-width: 1400px) {
  html {
    font-size: 14px !important; 
  }
}

@media (min-width: 2000px) {
  html {
    font-size: 15px !important;
  }
}

@media (max-width: 768px) {
  html {
    font-size: 11px !important;
  }
}

/* Fix potential overflows causing mobile issues */
body {
  overflow-x: hidden !important;
  width: 100vw;
  position: relative;
}

body {
  font-family: var(--font-body);
  background: var(--bg-primary);
  color: var(--text-primary);
  line-height: 1.7;
  transition: background 0.5s var(--ease-premium), color 0.5s var(--ease-premium);
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
}

/* ── Subtle Texture ── */
body::before {
  content: "";
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 200 200' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='noiseFilter'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.65' numOctaves='3' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23noiseFilter)'/%3E%3C/svg%3E");
  opacity: 0.015;
  mix-blend-mode: overlay;
}

body.light::before {
  opacity: 0.025;
  mix-blend-mode: multiply;
}

/* Background Tech Animations Container */
.tech-bg-animations {
  position: absolute; /* ← was: fixed (caused it to span entire page); absolute keeps it inside #hero which has position:relative */
  inset: 0;
  z-index: 2; /* ← ADJUST: must be > 1 (body > * baseline) but below navbar z-index */
  pointer-events: none;
  overflow: hidden;
  user-select: none;
}

.tech-bg-element {
  position: absolute;
  font-family: var(--font-mono);
  font-size: 0.75rem;
  color: var(--accent);
  opacity: 0;
  white-space: nowrap;
  transition: opacity 1s ease, transform 1s ease;
}

body > * { position: relative; z-index: 1; }

/* ── Keyframes ── */
@keyframes reveal {
  from { opacity: 0; transform: translateY(28px); }
  to   { opacity: 1; transform: translateY(0); }
}

@keyframes revealScale {
  from { opacity: 0; transform: translateY(20px) scale(0.97); }
  to   { opacity: 1; transform: translateY(0) scale(1); }
}

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

@keyframes fadeUp {
  from { opacity: 0; transform: translateY(16px); }
  to   { opacity: 1; transform: translateY(0); }
}

@keyframes shimmer {
  0%   { background-position: -200% center; }
  100% { background-position: 200% center; }
}

/* ── Section base ── */
section {
  padding: var(--section-spacing) 0;
  scroll-margin-top: 80px;
}

.section-wrap {
  max-width: var(--max-w);
  margin: 0 auto;
  padding: 0 var(--pad-x);
}

.section-label {
  font-family: var(--font-mono);
  font-size: 0.72rem;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--accent);
  display: flex;
  align-items: center;
  gap: 1rem;
  margin-bottom: 1rem;
}

.section-label::after {
  content: "";
  height: 1px;
  width: 40px;
  background: var(--border-accent);
}

.section-heading {
  font-family: var(--font-display);
  font-size: clamp(2.5rem, 5vw, 4rem);
  font-weight: 500;
  line-height: 1.1;
  color: var(--text-primary);
  margin-bottom: 3rem;
}

/* ── Buttons ── */
.btn-primary {
  display: inline-flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.875rem 2rem;
  background: var(--accent);
  color: #fff;
  font-family: var(--font-body);
  font-size: 0.9rem;
  font-weight: 500;
  text-decoration: none;
  border-radius: 6px;
  border: none;
  cursor: pointer;
  transition: all var(--transition-smooth);
  box-shadow: 0 4px 12px var(--accent-glow), 0 1px 3px rgba(0,0,0,0.2);
  position: relative;
  overflow: hidden;
  will-change: transform, box-shadow;
  letter-spacing: 0.01em;
}

.btn-primary::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(120deg, transparent 30%, rgba(255,255,255,0.12) 50%, transparent 70%);
  background-size: 200% 100%;
  opacity: 0;
  transition: opacity 0.3s;
}

.btn-primary:hover {
  transform: translateY(-4px) scale(1.015);
  box-shadow: 0 16px 36px var(--accent-glow), 0 4px 12px rgba(0,0,0,0.15);
  filter: brightness(1.08);
}

.btn-primary:hover::after {
  opacity: 1;
  animation: shimmer 0.7s linear;
}

.btn-primary:active {
  transform: translateY(-1px) scale(0.97);
  transition: all var(--transition-snappy);
}

.btn-outline {
  display: inline-flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.875rem 2rem;
  background: transparent;
  color: var(--text-primary);
  font-family: var(--font-body);
  font-size: 0.9rem;
  font-weight: 500;
  text-decoration: none;
  border-radius: 6px;
  border: 1px solid var(--border-hover);
  cursor: pointer;
  transition: all var(--transition-smooth);
  will-change: transform, box-shadow, border-color;
  letter-spacing: 0.01em;
}

body.light .btn-outline {
  box-shadow: var(--shadow-sm);
}

.btn-outline:hover {
  border-color: var(--accent);
  color: var(--accent);
  background: var(--accent-light);
  transform: translateY(-4px) scale(1.015);
  box-shadow: 0 12px 28px var(--accent-glow);
}

.btn-outline:active {
  transform: translateY(-1px) scale(0.97);
  transition: all var(--transition-snappy);
}

/* ── Tag ── */
.tag {
    font-family: var(--font-mono);
    font-size: 0.85rem;          /* increased from 0.7 */
    padding: 0.5rem 1.1rem;      /* more breathing space */
    border-radius: 100px;
    background: var(--tag-bg);
    color: var(--text-muted);
    border: 1px solid var(--border);
    transition: all var(--transition-smooth);
    will-change: transform, box-shadow, border-color;
}

body.light .tag {
  box-shadow: 0 1px 3px rgba(0,0,0,0.05);
}

.tag:hover {
  border-color: var(--accent);
  color: var(--accent);
  background: var(--accent-light);
  transform: scale(1.08) translateY(-2px);
  box-shadow: 0 6px 14px var(--accent-glow);
}

/* ── Scrollbar ── */
::-webkit-scrollbar { width: 4px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border-hover); border-radius: 10px; }
::-webkit-scrollbar-thumb:hover { background: var(--accent); }

/* ── Scroll Progress Bar ── */
#scroll-progress {
  position: fixed;
  top: 0;
  left: 0;
  height: 2px;
  background: linear-gradient(90deg, var(--accent), rgba(var(--accent-rgb), 0.4));
  width: 0%;
  z-index: 9999;
  transition: width 0.1s linear;
  box-shadow: 0 0 8px var(--accent-glow);
}

/* ── Reveal Animations ── */
.reveal {
  opacity: 0;
  transform: translateY(30px);
  transition: opacity 0.85s var(--ease-out-expo),
              transform 0.85s var(--ease-out-expo);
  will-change: opacity, transform;
}

.reveal.active {
  opacity: 1;
  transform: translateY(0);
}

.reveal-scale {
  opacity: 0;
  transform: translateY(20px) scale(0.97);
  transition: opacity 0.85s var(--ease-out-expo),
              transform 0.85s var(--ease-out-expo);
  will-change: opacity, transform;
}

.reveal-scale.active {
  opacity: 1;
  transform: translateY(0) scale(1);
}

/* Stagger delays */
.reveal:nth-child(1), .reveal-scale:nth-child(1) { transition-delay: 0.05s; }
.reveal:nth-child(2), .reveal-scale:nth-child(2) { transition-delay: 0.15s; }
.reveal:nth-child(3), .reveal-scale:nth-child(3) { transition-delay: 0.25s; }
.reveal:nth-child(4), .reveal-scale:nth-child(4) { transition-delay: 0.35s; }
.reveal:nth-child(5), .reveal-scale:nth-child(5) { transition-delay: 0.45s; }
.reveal:nth-child(6), .reveal-scale:nth-child(6) { transition-delay: 0.55s; }
