/* ============================================================
   RAIHAN UDDIN SUFAL — PORTFOLIO
   Custom CSS (supplements Tailwind CDN)
   ============================================================ */

/* ---------- FONTS ---------- */
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700;800;900&family=JetBrains+Mono:wght@400;500;600&display=swap');

/* ---------- ROOT & RESET ---------- */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

/* Prevent any element from causing horizontal overflow */
body, section, div, article, aside, header, footer, nav {
  max-width: 100%;
}

img, video, iframe, svg {
  max-width: 100%;
  height: auto;
}

/* Safe word wrapping globally */
p, h1, h2, h3, h4, h5, h6, span, a, li {
  overflow-wrap: break-word;
  word-break: break-word;
}

:root {
  --bg:          #060608;
  --surface:     #0e0e12;
  --surface-2:   #14141a;
  --border:      rgba(255,255,255,0.06);
  --border-h:    rgba(255,255,255,0.14);
  --accent:      #4f7df3;
  --accent-2:    #9166f8;
  --accent-3:    #23d9b7;
  --text-1:      #f2f2f5;
  --text-2:      #8b8b9a;
  --text-3:      #4a4a5a;
  --radius:      12px;
  --radius-lg:   20px;
  --glow-blue:   rgba(79,125,243,0.18);
  --glow-purple: rgba(145,102,248,0.15);
}

html {
  scroll-behavior: smooth;
  font-size: 16px;
  overflow-x: hidden; /* clips fixed-position overflow that body cannot clip */
}

body {
  font-family: 'Inter', system-ui, sans-serif;
  background-color: var(--bg);
  color: var(--text-1);
  line-height: 1.6;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
  transition: background-color 0.3s ease, color 0.3s ease;
}

/* ============================================================
   LIGHT THEME OVERRIDES
   ============================================================ */

body.light {
  --bg:          #f4f4f9;
  --surface:     #ffffff;
  --surface-2:   #ebebf3;
  --border:      rgba(0,0,0,0.07);
  --border-h:    rgba(0,0,0,0.14);
  --text-1:      #0f0f16;
  --text-2:      #50506a;
  --text-3:      #9898b4;
  --glow-blue:   rgba(79,125,243,0.07);
  --glow-purple: rgba(145,102,248,0.06);
}

body.light .bg-grid {
  background-image:
    linear-gradient(rgba(0,0,0,0.045) 1px, transparent 1px),
    linear-gradient(90deg, rgba(0,0,0,0.045) 1px, transparent 1px);
}

body.light .bg-glow-1 {
  background: radial-gradient(circle, rgba(79,125,243,0.07) 0%, transparent 70%);
}

body.light .bg-glow-2 {
  background: radial-gradient(circle, rgba(145,102,248,0.06) 0%, transparent 70%);
}

body.light .hero-noise { opacity: 0.01; }

body.light .nav-root.scrolled {
  background: rgba(244,244,249,0.90);
  border-bottom-color: rgba(0,0,0,0.08);
}

body.light .mobile-menu {
  background: rgba(244,244,249,0.99);
}

body.light .tech-pill {
  background: rgba(0,0,0,0.04);
  border-color: rgba(0,0,0,0.09);
  color: var(--text-2);
}

body.light .sys-impact {
  background: rgba(0,0,0,0.025);
  border-color: rgba(0,0,0,0.07);
}

body.light .timeline-period {
  background: rgba(0,0,0,0.03);
  border-color: rgba(0,0,0,0.08);
}

body.light .github-chart {
  background: rgba(0,0,0,0.02);
  border-color: rgba(0,0,0,0.07);
}

body.light .github-chart img {
  filter: brightness(0.88) saturate(1.1);
}

body.light .ai-inner::before {
  background: radial-gradient(circle at top right, rgba(145,102,248,0.04) 0%, transparent 60%);
}

body.light .contact-box {
  background: var(--surface);
  box-shadow: 0 4px 40px rgba(0,0,0,0.07);
}

body.light .stack-item:hover {
  box-shadow: 0 8px 24px rgba(0,0,0,0.10);
}

body.light .sys-card:hover,
body.light .next-card:hover {
  box-shadow: 0 16px 48px rgba(0,0,0,0.12);
}

body.light .timeline-dot {
  border-color: var(--bg);
}

body.light .stack-category-label {
  color: var(--text-2);
}

body.light .stack-category-label::after {
  background: var(--border-h);
}

/* Theme toggle button */
.theme-toggle {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 34px;
  height: 34px;
  border-radius: 8px;
  border: 1px solid var(--border-h);
  background: transparent;
  color: var(--text-2);
  cursor: pointer;
  transition: all 0.2s;
  flex-shrink: 0;
}

.theme-toggle:hover {
  background: rgba(128,128,128,0.08);
  color: var(--text-1);
  border-color: rgba(128,128,128,0.25);
}

.theme-toggle svg { transition: transform 0.4s ease; }
.theme-toggle:active svg { transform: rotate(30deg); }

/* ---------- SCROLLBAR ---------- */
::-webkit-scrollbar { width: 6px; }
::-webkit-scrollbar-track { background: var(--bg); }
::-webkit-scrollbar-thumb { background: var(--border-h); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: var(--text-3); }

/* ---------- SELECTION ---------- */
::selection { background: rgba(79,125,243,0.25); color: var(--text-1); }

/* ============================================================
   BACKGROUND LAYERS
   ============================================================ */

.bg-grid {
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  background-image:
    linear-gradient(rgba(255,255,255,0.018) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255,255,255,0.018) 1px, transparent 1px);
  background-size: 52px 52px;
}

.bg-glow-1 {
  position: fixed;
  top: -15vw;
  right: -15vw;
  width: min(700px, 80vw);
  height: min(700px, 80vw);
  background: radial-gradient(circle, rgba(79,125,243,0.12) 0%, transparent 70%);
  pointer-events: none;
  z-index: 0;
}

.bg-glow-2 {
  position: fixed;
  bottom: -15vw;
  left: -15vw;
  width: min(600px, 75vw);
  height: min(600px, 75vw);
  background: radial-gradient(circle, rgba(145,102,248,0.10) 0%, transparent 70%);
  pointer-events: none;
  z-index: 0;
}

/* ============================================================
   NAVIGATION
   ============================================================ */

.nav-root {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 100;
  transition: all 0.3s ease;
}

.nav-root.scrolled {
  background: rgba(6,6,8,0.88);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border-bottom: 1px solid var(--border);
}

.nav-inner {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 24px;
  height: 64px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.nav-logo {
  font-weight: 700;
  font-size: 1rem;
  letter-spacing: -0.02em;
  color: var(--text-1);
  text-decoration: none;
  display: flex;
  align-items: center;
  gap: 10px;
}

.nav-logo-mark {
  width: 34px;
  height: 34px;
  border-radius: 8px;
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 800;
  font-size: 0.75rem;
  color: #fff;
  letter-spacing: 0;
  flex-shrink: 0;
}

.nav-links {
  display: flex;
  align-items: center;
  gap: 6px;
  list-style: none;
}

.nav-links a {
  font-size: 0.82rem;
  font-weight: 500;
  color: var(--text-2);
  text-decoration: none;
  padding: 6px 12px;
  border-radius: 6px;
  transition: color 0.2s, background 0.2s;
  letter-spacing: 0.01em;
}

.nav-links a:hover {
  color: var(--text-1);
  background: rgba(255,255,255,0.05);
}

.nav-cta {
  font-size: 0.82rem;
  font-weight: 600;
  color: #fff !important;
  background: linear-gradient(135deg, var(--accent), var(--accent-2)) !important;
  padding: 7px 16px !important;
  border-radius: 8px !important;
}

.nav-cta:hover {
  opacity: 0.9;
  background: linear-gradient(135deg, var(--accent), var(--accent-2)) !important;
}

.hamburger {
  display: none;
  flex-direction: column;
  gap: 5px;
  cursor: pointer;
  padding: 6px;
  border-radius: 6px;
  transition: background 0.2s;
}

.hamburger:hover { background: rgba(255,255,255,0.05); }
.hamburger span {
  display: block;
  width: 22px;
  height: 2px;
  background: var(--text-2);
  border-radius: 2px;
  transition: all 0.3s;
}

/* Mobile nav */
.mobile-menu {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 99;
  background: rgba(6,6,8,0.98);
  backdrop-filter: blur(20px);
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 8px;
}

.mobile-menu.open { display: flex; }

.mobile-menu a {
  font-size: 1.4rem;
  font-weight: 600;
  color: var(--text-2);
  text-decoration: none;
  padding: 12px 32px;
  border-radius: 10px;
  transition: color 0.2s, background 0.2s;
  width: 280px;
  text-align: center;
}

.mobile-menu a:hover {
  color: var(--text-1);
  background: rgba(255,255,255,0.05);
}

.mobile-close {
  position: absolute;
  top: 20px;
  right: 24px;
  font-size: 1.5rem;
  color: var(--text-2);
  cursor: pointer;
  padding: 8px;
  border-radius: 8px;
  transition: background 0.2s;
  background: none;
  border: none;
}

.mobile-close:hover { background: rgba(255,255,255,0.08); color: var(--text-1); }

/* ============================================================
   SECTION COMMON
   ============================================================ */

section {
  position: relative;
  z-index: 1;
}

.container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 24px;
}

.section-label {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--accent);
  margin-bottom: 20px;
}

.section-label::before {
  content: '';
  display: block;
  width: 20px;
  height: 1px;
  background: var(--accent);
}

.section-title {
  font-size: clamp(2rem, 4vw, 3rem);
  font-weight: 800;
  letter-spacing: -0.03em;
  line-height: 1.1;
  color: var(--text-1);
  margin-bottom: 16px;
}

.section-sub {
  font-size: 1.05rem;
  color: var(--text-2);
  max-width: 540px;
  line-height: 1.7;
}

.gradient-text {
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.gradient-text-warm {
  background: linear-gradient(135deg, #f59e0b, #ef4444);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

/* ============================================================
   HERO
   ============================================================ */

#hero {
  min-height: 100vh;
  display: flex;
  align-items: center;
  padding-top: 64px;
  position: relative;
  overflow: hidden;
}

.hero-noise {
  position: absolute;
  inset: 0;
  opacity: 0.025;
  pointer-events: none;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 256 256' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='noise'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23noise)'/%3E%3C/svg%3E");
  background-size: 256px;
}

.hero-inner {
  width: 100%;
  padding: 80px 0 140px; /* extra bottom clears the absolute scroll-hint */
}

.hero-badge {
  display: inline-flex;
  align-items: flex-start;
  gap: 8px;
  padding: 6px 14px 6px 8px;
  background: rgba(79,125,243,0.08);
  border: 1px solid rgba(79,125,243,0.2);
  border-radius: 100px;
  font-size: 0.78rem;
  font-weight: 500;
  color: var(--accent);
  margin-bottom: 28px;
  max-width: 100%;
  white-space: normal;
  line-height: 1.4;
}

.hero-badge-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--accent-3);
  animation: pulse-dot 2s ease infinite;
}

@keyframes pulse-dot {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: 0.5; transform: scale(0.7); }
}

.hero-name {
  font-size: clamp(2.2rem, 8vw, 6rem);
  font-weight: 900;
  letter-spacing: -0.04em;
  line-height: 1.0;
  margin-bottom: 12px;
  color: var(--text-1);
}

.hero-role {
  font-size: clamp(1.1rem, 2.5vw, 1.6rem);
  font-weight: 600;
  color: var(--text-2);
  margin-bottom: 8px;
  letter-spacing: -0.01em;
}

.hero-typed-wrapper {
  font-size: clamp(1rem, 2vw, 1.25rem);
  font-weight: 500;
  color: var(--text-2);
  margin-bottom: 32px;
  min-height: 2em;
  display: flex;
  align-items: center;
  gap: 0;
}

.hero-typed-prefix { color: var(--text-3); margin-right: 8px; }

#typed-text {
  color: var(--accent);
  font-family: 'JetBrains Mono', monospace;
}

.cursor {
  display: inline-block;
  width: 2px;
  height: 1.1em;
  background: var(--accent);
  margin-left: 3px;
  vertical-align: middle;
  animation: blink 1s step-end infinite;
}

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

.hero-desc {
  font-size: 1.05rem;
  color: var(--text-2);
  max-width: 520px;
  line-height: 1.75;
  margin-bottom: 40px;
}

.hero-actions {
  display: flex;
  align-items: center;
  gap: 16px;
  flex-wrap: wrap;
}

.btn-primary {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 13px 26px;
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  color: #fff;
  font-size: 0.9rem;
  font-weight: 600;
  border-radius: 10px;
  text-decoration: none;
  transition: transform 0.2s, box-shadow 0.2s;
  box-shadow: 0 0 0 rgba(79,125,243,0);
  border: none;
  cursor: pointer;
}

.btn-primary:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 30px rgba(79,125,243,0.35);
}

.btn-ghost {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 12px 24px;
  background: transparent;
  color: var(--text-2);
  font-size: 0.9rem;
  font-weight: 500;
  border-radius: 10px;
  text-decoration: none;
  border: 1px solid var(--border-h);
  transition: all 0.2s;
  cursor: pointer;
}

.btn-ghost:hover {
  color: var(--text-1);
  background: rgba(255,255,255,0.04);
  border-color: rgba(255,255,255,0.2);
}

.hero-stats {
  display: flex;
  gap: 40px;
  margin-top: 60px;
  padding-top: 40px;
  border-top: 1px solid var(--border);
  flex-wrap: wrap;
}

.stat-item { }

.stat-number {
  font-size: 2rem;
  font-weight: 800;
  letter-spacing: -0.04em;
  color: var(--text-1);
  line-height: 1;
  margin-bottom: 4px;
}

.stat-label {
  font-size: 0.78rem;
  color: var(--text-3);
  font-weight: 500;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.hero-scroll-hint {
  position: absolute;
  bottom: 36px;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  text-decoration: none;
  animation: scroll-float 2.4s ease-in-out infinite;
  z-index: 2;
}

.scroll-label {
  font-size: 0.68rem;
  font-weight: 600;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--text-2);
  transition: color 0.2s;
}

.hero-scroll-hint:hover .scroll-label { color: var(--text-1); }

.scroll-mouse {
  width: 26px;
  height: 42px;
  border: 2px solid var(--border-h);
  border-radius: 13px;
  display: flex;
  justify-content: center;
  padding-top: 7px;
  transition: border-color 0.2s;
  background: rgba(255,255,255,0.03);
}

.hero-scroll-hint:hover .scroll-mouse {
  border-color: var(--accent);
  background: rgba(79,125,243,0.06);
}

.scroll-dot {
  width: 4px;
  height: 8px;
  background: var(--accent);
  border-radius: 2px;
  animation: scroll-dot 1.9s ease-in-out infinite;
}

@keyframes scroll-float {
  0%, 100% { transform: translateX(-50%) translateY(0); }
  50%       { transform: translateX(-50%) translateY(-7px); }
}

@keyframes scroll-dot {
  0%   { transform: translateY(0);    opacity: 1; }
  60%  { transform: translateY(12px); opacity: 0; }
  61%  { transform: translateY(0);    opacity: 0; }
  100% { transform: translateY(0);    opacity: 1; }
}

/* light mode adjustments */
body.light .scroll-mouse {
  border-color: rgba(0,0,0,0.18);
  background: rgba(0,0,0,0.02);
}

body.light .hero-scroll-hint:hover .scroll-mouse {
  border-color: var(--accent);
  background: rgba(79,125,243,0.06);
}

/* ============================================================
   ABOUT
   ============================================================ */

#about {
  padding: 120px 0;
}

.about-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 80px;
  align-items: center;
}

.about-highlights {
  display: flex;
  flex-direction: column;
  gap: 16px;
  margin-top: 36px;
}

.highlight-item {
  display: flex;
  align-items: flex-start;
  gap: 14px;
  padding: 18px 20px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  transition: border-color 0.2s, background 0.2s;
}

.highlight-item:hover {
  border-color: var(--border-h);
  background: var(--surface-2);
}

.highlight-icon {
  width: 36px;
  height: 36px;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  font-size: 1rem;
}

.highlight-text strong {
  display: block;
  font-size: 0.88rem;
  font-weight: 600;
  color: var(--text-1);
  margin-bottom: 2px;
}

.highlight-text span {
  font-size: 0.8rem;
  color: var(--text-2);
}

/* Numbers card */
.about-numbers {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 2px;
  border-radius: var(--radius-lg);
  overflow: hidden;
  border: 1px solid var(--border);
  background: var(--border);
}

.num-card {
  background: var(--surface);
  padding: 32px 28px;
  transition: background 0.2s;
}

.num-card:hover { background: var(--surface-2); }

.num-card-val {
  font-size: 2.4rem;
  font-weight: 800;
  letter-spacing: -0.04em;
  line-height: 1;
  margin-bottom: 8px;
}

.num-card-label {
  font-size: 0.8rem;
  color: var(--text-2);
  font-weight: 500;
  line-height: 1.4;
}

/* ============================================================
   SYSTEMS / PROJECTS
   ============================================================ */

#systems {
  padding: 120px 0;
  background: linear-gradient(to bottom, transparent, rgba(14,14,18,0.6), transparent);
}

.systems-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 20px;
  margin-top: 60px;
}

/* Featured (first) card spans 2 columns */
.sys-card-featured {
  grid-column: span 2;
}

.sys-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 32px;
  transition: border-color 0.25s, transform 0.25s, box-shadow 0.25s;
  position: relative;
  overflow: hidden;
  cursor: default;
  display: flex;
  flex-direction: column;
}

.sys-card::before {
  content: '';
  position: absolute;
  inset: 0;
  background: radial-gradient(ellipse at top left, var(--card-glow, transparent) 0%, transparent 60%);
  opacity: 0;
  transition: opacity 0.3s;
  pointer-events: none;
}

.sys-card:hover {
  border-color: var(--border-h);
  transform: translateY(-4px);
  box-shadow: 0 20px 60px rgba(0,0,0,0.4);
}

.sys-card:hover::before { opacity: 1; }

.sys-card-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  margin-bottom: 20px;
}

.sys-icon {
  width: 48px;
  height: 48px;
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.3rem;
  flex-shrink: 0;
}

.sys-status {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 0.68rem;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  padding: 4px 10px;
  border-radius: 100px;
  background: rgba(35,217,183,0.08);
  color: var(--accent-3);
  border: 1px solid rgba(35,217,183,0.15);
}

.sys-status-dot {
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: var(--accent-3);
}

.sys-name {
  font-size: 1.25rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  color: var(--text-1);
  margin-bottom: 8px;
}

.sys-desc {
  font-size: 0.88rem;
  color: var(--text-2);
  line-height: 1.65;
  flex: 1;
  margin-bottom: 24px;
}

.sys-tech-row {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 20px;
}

.tech-pill {
  font-size: 0.7rem;
  font-weight: 600;
  letter-spacing: 0.04em;
  padding: 4px 10px;
  border-radius: 100px;
  background: rgba(255,255,255,0.04);
  color: var(--text-2);
  border: 1px solid var(--border);
  font-family: 'JetBrains Mono', monospace;
}

.sys-impact {
  padding: 14px 16px;
  background: rgba(255,255,255,0.02);
  border: 1px solid var(--border);
  border-radius: 8px;
  font-size: 0.8rem;
  color: var(--text-2);
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: auto;
}

.sys-impact-icon { font-size: 1rem; }

/* ============================================================
   ENGINEERING APPROACH
   ============================================================ */

#approach {
  padding: 120px 0;
}

.approach-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 2px;
  margin-top: 60px;
  background: var(--border);
  border-radius: var(--radius-lg);
  overflow: hidden;
  border: 1px solid var(--border);
}

.approach-card {
  background: var(--surface);
  padding: 36px 28px;
  transition: background 0.2s;
  position: relative;
}

.approach-card:hover { background: var(--surface-2); }

.approach-card-num {
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.7rem;
  color: var(--text-3);
  font-weight: 500;
  letter-spacing: 0.06em;
  margin-bottom: 20px;
}

.approach-icon {
  font-size: 1.8rem;
  margin-bottom: 16px;
  display: block;
}

.approach-title {
  font-size: 1rem;
  font-weight: 700;
  color: var(--text-1);
  letter-spacing: -0.01em;
  margin-bottom: 10px;
}

.approach-desc {
  font-size: 0.82rem;
  color: var(--text-2);
  line-height: 1.65;
}

/* ============================================================
   AI / FORECASTING
   ============================================================ */

#ai-section {
  padding: 120px 0;
  position: relative;
}

.ai-glow {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 800px;
  height: 400px;
  background: radial-gradient(ellipse, rgba(145,102,248,0.08) 0%, transparent 70%);
  pointer-events: none;
}

.ai-inner {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 64px;
  position: relative;
  overflow: hidden;
}

.ai-inner::before {
  content: '';
  position: absolute;
  top: 0;
  right: 0;
  width: 400px;
  height: 400px;
  background: radial-gradient(circle at top right, rgba(145,102,248,0.07) 0%, transparent 60%);
  pointer-events: none;
}

.ai-layout {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 64px;
  align-items: center;
}

.ai-badge {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 5px 12px 5px 8px;
  background: rgba(145,102,248,0.1);
  border: 1px solid rgba(145,102,248,0.25);
  border-radius: 100px;
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: #b084f9;
  margin-bottom: 20px;
}

.ai-title {
  font-size: clamp(1.6rem, 3vw, 2.2rem);
  font-weight: 800;
  letter-spacing: -0.03em;
  line-height: 1.15;
  margin-bottom: 16px;
}

.ai-desc {
  font-size: 0.95rem;
  color: var(--text-2);
  line-height: 1.75;
  margin-bottom: 28px;
}

.ai-features {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.ai-feature {
  display: flex;
  align-items: center;
  gap: 12px;
  font-size: 0.88rem;
  color: var(--text-2);
}

.ai-feature-check {
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: rgba(145,102,248,0.12);
  border: 1px solid rgba(145,102,248,0.25);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  color: #b084f9;
  font-size: 0.65rem;
}

/* AI Flow Diagram */
.ai-flow {
  display: flex;
  flex-direction: column;
  gap: 0;
}

.flow-step {
  display: flex;
  align-items: flex-start;
  gap: 16px;
  position: relative;
}

.flow-step:not(:last-child)::after {
  content: '';
  position: absolute;
  left: 23px;
  top: 48px;
  width: 2px;
  height: 32px;
  background: linear-gradient(to bottom, var(--border-h), transparent);
}

.flow-icon-wrap {
  width: 46px;
  height: 46px;
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.1rem;
  flex-shrink: 0;
  border: 1px solid var(--border-h);
  background: var(--surface-2);
}

.flow-content {
  flex: 1;
  padding: 12px 0;
}

.flow-title {
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--text-1);
  margin-bottom: 3px;
}

.flow-desc {
  font-size: 0.78rem;
  color: var(--text-2);
  line-height: 1.5;
}

.flow-connector {
  height: 32px;
  display: flex;
  align-items: center;
  gap: 16px;
  margin-left: 23px;
}

.flow-arrow-line {
  width: 2px;
  height: 32px;
  background: linear-gradient(to bottom, rgba(145,102,248,0.4), rgba(145,102,248,0.1));
  margin: 0 auto;
}

/* ============================================================
   TECH STACK
   ============================================================ */

#stack {
  padding: 120px 0;
  background: linear-gradient(to bottom, transparent, rgba(14,14,18,0.4), transparent);
}

.stack-categories {
  display: flex;
  flex-direction: column;
  gap: 40px;
  margin-top: 60px;
}

.stack-category-label {
  font-size: 0.7rem;
  font-weight: 600;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--text-3);
  margin-bottom: 16px;
  display: flex;
  align-items: center;
  gap: 12px;
}

.stack-category-label::after {
  content: '';
  flex: 1;
  height: 1px;
  background: var(--border);
}

.stack-items {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.stack-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 18px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  font-size: 0.85rem;
  font-weight: 500;
  color: var(--text-2);
  transition: all 0.2s;
  cursor: default;
}

.stack-item:hover {
  border-color: var(--border-h);
  color: var(--text-1);
  background: var(--surface-2);
  transform: translateY(-2px);
  box-shadow: 0 8px 24px rgba(0,0,0,0.3);
}

.stack-item-icon {
  width: 24px;
  height: 24px;
  border-radius: 4px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.9rem;
  flex-shrink: 0;
}

/* ============================================================
   EXPERIENCE TIMELINE
   ============================================================ */

#experience {
  padding: 120px 0;
}

.timeline {
  position: relative;
  margin-top: 60px;
  padding-left: 32px;
}

.timeline::before {
  content: '';
  position: absolute;
  left: 0;
  top: 8px;
  bottom: 0;
  width: 1px;
  background: linear-gradient(to bottom, var(--accent), var(--border), transparent);
}

.timeline-item {
  position: relative;
  margin-bottom: 48px;
}

.timeline-item:last-child { margin-bottom: 0; }

.timeline-dot {
  position: absolute;
  left: -38px;
  top: 6px;
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: var(--accent);
  border: 2px solid var(--bg);
  box-shadow: 0 0 0 2px var(--accent);
}

.timeline-item:not(:first-child) .timeline-dot {
  background: var(--surface-2);
  border-color: var(--border-h);
  box-shadow: 0 0 0 2px var(--border);
}

.timeline-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 28px 32px;
  transition: border-color 0.2s, background 0.2s;
}

.timeline-card:hover {
  border-color: var(--border-h);
  background: var(--surface-2);
}

.timeline-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  margin-bottom: 12px;
  gap: 16px;
  flex-wrap: wrap;
}

.timeline-company {
  font-size: 1.05rem;
  font-weight: 700;
  letter-spacing: -0.01em;
  color: var(--text-1);
}

.timeline-period {
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.72rem;
  color: var(--text-3);
  font-weight: 500;
  white-space: nowrap;
  padding: 4px 10px;
  background: rgba(255,255,255,0.03);
  border: 1px solid var(--border);
  border-radius: 6px;
}

.timeline-role {
  font-size: 0.88rem;
  font-weight: 600;
  color: var(--accent);
  margin-bottom: 10px;
}

.timeline-desc {
  font-size: 0.85rem;
  color: var(--text-2);
  line-height: 1.65;
}

.timeline-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 14px;
}

.timeline-tag {
  font-size: 0.68rem;
  font-weight: 600;
  letter-spacing: 0.04em;
  padding: 3px 8px;
  border-radius: 4px;
  background: rgba(79,125,243,0.08);
  color: var(--accent);
  border: 1px solid rgba(79,125,243,0.15);
}

/* ============================================================
   GITHUB
   ============================================================ */

#github-section {
  padding: 120px 0;
  background: linear-gradient(to bottom, transparent, rgba(14,14,18,0.4), transparent);
}

.github-box {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 48px;
  text-align: center;
}

.github-avatar-wrap {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 72px;
  height: 72px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  margin-bottom: 20px;
  font-size: 2rem;
}

.github-handle {
  font-family: 'JetBrains Mono', monospace;
  font-size: 1.1rem;
  font-weight: 600;
  color: var(--text-1);
  margin-bottom: 8px;
}

.github-desc {
  font-size: 0.88rem;
  color: var(--text-2);
  margin-bottom: 32px;
}

.github-chart {
  border-radius: 10px;
  overflow: hidden;
  background: rgba(255,255,255,0.02);
  border: 1px solid var(--border);
  padding: 20px;
  display: flex;
  justify-content: center;
  margin-bottom: 32px;
}

.github-chart img {
  max-width: 100%;
  height: auto;
  filter: brightness(0.95);
}

.github-link {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 0.88rem;
  font-weight: 600;
  color: var(--accent);
  text-decoration: none;
  padding: 10px 20px;
  border-radius: 8px;
  border: 1px solid rgba(79,125,243,0.25);
  background: rgba(79,125,243,0.06);
  transition: all 0.2s;
}

.github-link:hover {
  background: rgba(79,125,243,0.12);
  border-color: rgba(79,125,243,0.4);
  transform: translateY(-1px);
}

/* ============================================================
   WHAT I'M BUILDING NEXT
   ============================================================ */

#next-section {
  padding: 120px 0;
}

.next-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 20px;
  margin-top: 60px;
}

.next-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 32px;
  transition: all 0.25s;
  position: relative;
  overflow: hidden;
}

.next-card::after {
  content: '';
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  height: 2px;
  background: linear-gradient(90deg, var(--accent), var(--accent-2));
  transform: scaleX(0);
  transition: transform 0.3s;
  transform-origin: left;
}

.next-card:hover {
  border-color: var(--border-h);
  transform: translateY(-4px);
  box-shadow: 0 16px 48px rgba(0,0,0,0.35);
}

.next-card:hover::after { transform: scaleX(1); }

.next-card-icon {
  font-size: 2rem;
  margin-bottom: 16px;
  display: block;
}

.next-card-title {
  font-size: 1.05rem;
  font-weight: 700;
  letter-spacing: -0.01em;
  color: var(--text-1);
  margin-bottom: 10px;
}

.next-card-desc {
  font-size: 0.85rem;
  color: var(--text-2);
  line-height: 1.65;
}

.next-card-tag {
  display: inline-flex;
  margin-top: 20px;
  font-size: 0.68rem;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  padding: 4px 10px;
  border-radius: 4px;
  background: rgba(79,125,243,0.08);
  color: var(--accent);
  border: 1px solid rgba(79,125,243,0.15);
}

/* ============================================================
   CONTACT
   ============================================================ */

#contact {
  padding: 120px 0 80px;
}

.contact-box {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 80px;
  text-align: center;
  position: relative;
  overflow: hidden;
}

.contact-box::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 1px;
  background: linear-gradient(90deg, transparent, var(--accent), var(--accent-2), transparent);
}

.contact-title {
  font-size: clamp(2rem, 4vw, 3.2rem);
  font-weight: 800;
  letter-spacing: -0.04em;
  margin-bottom: 16px;
}

.contact-sub {
  font-size: 1rem;
  color: var(--text-2);
  max-width: 440px;
  margin: 0 auto 40px;
  line-height: 1.7;
}

.contact-links {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 16px;
  flex-wrap: wrap;
}

.contact-link {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 14px 28px;
  border-radius: 10px;
  font-size: 0.9rem;
  font-weight: 600;
  text-decoration: none;
  transition: all 0.2s;
}

.contact-link-primary {
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  color: #fff;
}

.contact-link-primary:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 30px rgba(79,125,243,0.35);
}

.contact-link-ghost {
  background: transparent;
  color: var(--text-2);
  border: 1px solid var(--border-h);
}

.contact-link-ghost:hover {
  color: var(--text-1);
  border-color: rgba(255,255,255,0.2);
  background: rgba(255,255,255,0.04);
  transform: translateY(-2px);
}

/* ============================================================
   FOOTER
   ============================================================ */

footer {
  border-top: 1px solid var(--border);
  padding: 28px 0;
  position: relative;
  z-index: 1;
}

.footer-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 16px;
}

.footer-copy {
  font-size: 0.78rem;
  color: var(--text-3);
}

.footer-links {
  display: flex;
  gap: 20px;
}

.footer-links a {
  font-size: 0.78rem;
  color: var(--text-3);
  text-decoration: none;
  transition: color 0.2s;
}

.footer-links a:hover { color: var(--text-2); }

/* ============================================================
   ANIMATIONS
   ============================================================ */

.reveal {
  opacity: 0;
  transform: translateY(28px);
  transition: opacity 0.65s ease, transform 0.65s ease;
}

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

.reveal-delay-1 { transition-delay: 0.1s; }
.reveal-delay-2 { transition-delay: 0.2s; }
.reveal-delay-3 { transition-delay: 0.3s; }
.reveal-delay-4 { transition-delay: 0.4s; }
.reveal-delay-5 { transition-delay: 0.5s; }

.stagger-children > * {
  opacity: 0;
  transform: translateY(20px);
  transition: opacity 0.5s ease, transform 0.5s ease;
}

.stagger-children.visible > *:nth-child(1) { transition-delay: 0.05s; }
.stagger-children.visible > *:nth-child(2) { transition-delay: 0.12s; }
.stagger-children.visible > *:nth-child(3) { transition-delay: 0.19s; }
.stagger-children.visible > *:nth-child(4) { transition-delay: 0.26s; }
.stagger-children.visible > *:nth-child(5) { transition-delay: 0.33s; }
.stagger-children.visible > *:nth-child(6) { transition-delay: 0.40s; }
.stagger-children.visible > *:nth-child(7) { transition-delay: 0.47s; }

.stagger-children.visible > * {
  opacity: 1;
  transform: translateY(0);
}

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

/* ── Tablet landscape (≤1024px) ── */
@media (max-width: 1024px) {
  /* Nav — hide links, show hamburger at all tablet sizes */
  .nav-links { display: none; }
  .hamburger { display: flex; }
  .nav-inner { padding: 0 16px; }

  .systems-grid { grid-template-columns: repeat(2, 1fr); }
  .sys-card-featured { grid-column: span 2; }
  .approach-grid { grid-template-columns: repeat(2, 1fr); }
  .next-grid { grid-template-columns: repeat(2, 1fr); }
  .ai-layout { grid-template-columns: 1fr; gap: 40px; }
  .ai-inner { padding: 40px; }
  .contact-box { padding: 56px 40px; }
}

/* ── Tablet portrait / large mobile (≤768px) ── */
@media (max-width: 768px) {
  /* Hero */
  .hero-inner { padding: 56px 0 140px; }

  .hero-role {
    font-size: 0.88rem;
    line-height: 1.55;
    word-break: break-word;
  }

  /* Stats → clean 2×2 grid */
  .hero-stats {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px 28px;
    margin-top: 40px;
    padding-top: 32px;
  }
  .stat-number { font-size: 1.65rem; }

  /* About */
  .about-grid { grid-template-columns: 1fr; gap: 48px; }
  .about-numbers { grid-template-columns: repeat(2, 1fr); }

  /* Systems */
  .systems-grid { grid-template-columns: 1fr; }
  .sys-card-featured { grid-column: span 1; }
  .sys-card { padding: 24px; }

  /* Approach */
  .approach-grid { grid-template-columns: 1fr 1fr; }
  .approach-card { padding: 24px 18px; }

  /* Next */
  .next-grid { grid-template-columns: 1fr; }

  /* Timeline */
  .timeline { padding-left: 24px; }
  .timeline-dot { left: -30px; }
  .timeline-card { padding: 20px 20px; }
  .timeline-header { flex-direction: column; gap: 8px; }
  .timeline-period { align-self: flex-start; }

  /* AI */
  .ai-inner { padding: 32px 24px; }

  /* GitHub */
  .github-box { padding: 36px 24px; }
  .github-chart { padding: 12px; }
  .github-chart img { width: 100%; height: auto; }

  /* Contact */
  .contact-box { padding: 40px 24px; }
  .contact-links { flex-direction: column; align-items: center; }
  .contact-link { width: 100%; max-width: 320px; justify-content: center; }

  /* Footer */
  .footer-inner { flex-direction: column; text-align: center; }
}

/* ── Mobile (≤480px) ── */
@media (max-width: 480px) {
  .container { padding: 0 16px; }
  section { padding: 72px 0; }
  #hero { min-height: 100svh; }

  /* Hero */
  .hero-inner { padding: 44px 0 140px; }
  .hero-badge { font-size: 0.68rem; padding: 5px 12px 5px 7px; }
  .hero-desc { font-size: 0.9rem; margin-bottom: 24px; }
  .hero-actions { flex-direction: column; align-items: stretch; gap: 10px; }
  .btn-primary, .btn-ghost { justify-content: center; }

  /* Approach */
  .approach-grid { grid-template-columns: 1fr; }
  .approach-card { padding: 22px 18px; }

  /* About */
  .about-numbers { grid-template-columns: 1fr 1fr; }
  .num-card { padding: 22px 18px; }
  .num-card-val { font-size: 2rem; }

  /* Systems */
  .sys-card { padding: 20px; }
  .sys-card-header { flex-wrap: wrap; gap: 10px; }

  /* AI */
  .ai-inner { padding: 28px 18px; }
  .ai-title { font-size: 1.5rem; }

  /* Timeline */
  .timeline { padding-left: 20px; }
  .timeline-dot { left: -27px; width: 10px; height: 10px; top: 8px; }
  .timeline-card { padding: 16px; }
  .timeline-company { font-size: 0.95rem; }
  .timeline-desc { font-size: 0.82rem; }

  /* Next */
  .next-card { padding: 22px 18px; }

  /* GitHub */
  .github-box { padding: 28px 16px; }
  .github-handle { font-size: 0.95rem; }

  /* Contact */
  .contact-box { padding: 32px 18px; }
  .section-title { letter-spacing: -0.02em; }
}

/* ── Small phones (≤414px) — covers 320/375/390/414 ── */
@media (max-width: 414px) {
  /* Prevent any child from exceeding viewport width */
  * { max-width: 100%; }
  img, svg { max-width: 100%; height: auto; }

  .container { padding: 0 16px; }

  /* Nav: hide logo text so mark + toggle + hamburger fit */
  .nav-logo span { display: none; }

  /* Hero */
  .hero-name { font-size: clamp(1.9rem, 9vw, 2.6rem); }
  .hero-role {
    font-size: 0.8rem;
    line-height: 1.6;
    word-break: break-word;
  }
  .hero-badge { font-size: 0.7rem; padding: 5px 12px 5px 7px; }
  .hero-typed-wrapper { font-size: 0.85rem; }
  .hero-desc { font-size: 0.88rem; }
  .stat-number { font-size: 1.4rem; }
  .stat-label { font-size: 0.66rem; letter-spacing: 0.02em; }

  /* Cards */
  .sys-card, .next-card, .approach-card { padding: 16px; }
  .timeline-card { padding: 14px; }
  .ai-inner { padding: 22px 16px; }
  .ai-title { font-size: 1.35rem; }
  .contact-box { padding: 28px 16px; }
  .github-box { padding: 24px 14px; }
  .num-card { padding: 18px 14px; }
  .num-card-val { font-size: 1.8rem; }
}

/* ── Very small phones (≤360px) ── */
@media (max-width: 360px) {
  .container { padding: 0 12px; }
  .hero-name { font-size: clamp(1.7rem, 9vw, 2.2rem); }
  .hero-role { font-size: 0.75rem; }
  .stat-number { font-size: 1.25rem; }
  .stat-label { font-size: 0.62rem; }
  .sys-card, .next-card, .approach-card,
  .timeline-card, .ai-inner,
  .contact-box, .github-box { padding: 14px 12px; }
}
