/* ============================================================
   RESET & ROOT VARIABLES
   ============================================================ */
*,
*::before,
*::after {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

:root {
  /* Colors */
  --black: #0A0A0A;
  --dark: #121212;
  --darker: #0D0D0D;
  --card: #161616;
  --card2: #1A1A1A;
  --red: #FF003C;
  --red2: #CC0030;
  --red-glow: rgba(255, 0, 60, 0.18);
  --red-faint: rgba(255, 0, 60, 0.07);
  --white: #F5F5F5;
  --muted: #888;
  --border: rgba(255, 255, 255, 0.07);
  --border-red: rgba(255, 0, 60, 0.3);

  /* Fonts */
  --font-mono: 'Share Tech Mono', monospace;
  --font-display: 'Syne', sans-serif;
  --font-body: 'DM Sans', sans-serif;

  /* Easing */
  --ease-out: cubic-bezier(0.16, 1, 0.3, 1);
  --ease-in-out: cubic-bezier(0.4, 0, 0.2, 1);
}

html {
  scroll-behavior: smooth;
  font-size: 16px;
  /* Better text rendering on mobile */
  -webkit-text-size-adjust: 100%;
}

body {
  background: var(--black);
  color: var(--white);
  font-family: var(--font-body);
  overflow-x: hidden;
  cursor: none;
  /* Prevent font scaling on orientation change */
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
}

body.loading {
  overflow: hidden;
}

/* ============================================================
   SCROLLBAR
   ============================================================ */
::-webkit-scrollbar {
  width: 6px;
  height: 6px;
}

::-webkit-scrollbar-track {
  background: var(--black);
}

::-webkit-scrollbar-thumb {
  background: var(--red);
  border-radius: 3px;
}

::-webkit-scrollbar-thumb:hover {
  background: var(--red2);
}

/* Firefox */
* {
  scrollbar-width: thin;
  scrollbar-color: var(--red) var(--black);
}

/* ============================================================
   CUSTOM CURSOR
   ============================================================ */
#cursor,
#cursor-ring {
  position: fixed;
  top: 0;
  left: 0;
  border-radius: 50%;
  pointer-events: none;
  z-index: 99999;
  transform: translate(-50%, -50%);
  will-change: transform;
}

#cursor {
  width: 12px;
  height: 12px;
  background: var(--red);
  box-shadow: 0 0 12px var(--red), 0 0 24px var(--red-glow);
  transition:
    transform 0.08s linear,
    width 0.2s var(--ease-out),
    height 0.2s var(--ease-out),
    background 0.2s;
}

#cursor-ring {
  width: 36px;
  height: 36px;
  border: 1px solid rgba(255, 0, 60, 0.5);
  z-index: 99998;
  transition:
    transform 0.18s var(--ease-out),
    width 0.25s var(--ease-out),
    height 0.25s var(--ease-out),
    opacity 0.2s;
}

body.cursor-hover #cursor {
  width: 20px;
  height: 20px;
  background: rgba(255, 0, 60, 0.7);
}

body.cursor-hover #cursor-ring {
  width: 52px;
  height: 52px;
  border-color: var(--red);
}

/* ============================================================
   PRELOADER
   ============================================================ */
#preloader {
  position: fixed;
  inset: 0;
  background: var(--black);
  z-index: 99997;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 32px;
  transition:
    opacity 0.8s var(--ease-out),
    visibility 0.8s;
}

#preloader.fade-out {
  opacity: 0;
  visibility: hidden;
}

.pre-shield {
  width: 80px;
  height: 80px;
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
}

.pre-shield svg {
  width: 100%;
  height: 100%;
  animation: shield-pulse 1.5s ease-in-out infinite;
}

.pre-ring,
.pre-ring2 {
  position: absolute;
  left: 50%;
  top: 50%;
  border-radius: 50%;
  pointer-events: none;
  transform: translate(-50%, -50%);
  transform-origin: center;
  will-change: transform;
}

.pre-ring {
  inset: -12px;
  border: 1px solid rgba(255, 0, 60, 0.3);
  border-top-color: var(--red);
  animation: spin 1.2s linear infinite;
}

.pre-ring2 {
  inset: -22px;
  border: 1px solid rgba(255, 0, 60, 0.1);
  border-bottom-color: rgba(255, 0, 60, 0.5);
  animation: spin 2s linear infinite reverse;
}

.pre-text {
  font-family: var(--font-mono);
  font-size: 0.75rem;
  color: var(--red);
  text-align: center;
  letter-spacing: 0.15em;
  min-height: 1.2em;
}

.pre-bar-wrap {
  width: min(260px, 80vw);
  height: 2px;
  background: rgba(255, 255, 255, 0.06);
  border-radius: 1px;
  overflow: hidden;
}

.pre-bar {
  height: 100%;
  background: var(--red);
  box-shadow: 0 0 10px var(--red);
  width: 0;
  border-radius: 1px;
  transition: width 2.5s var(--ease-out);
}

.pre-percent {
  font-family: var(--font-mono);
  font-size: 0.65rem;
  color: var(--muted);
  letter-spacing: 0.1em;
}

/* ============================================================
   CANVAS BACKGROUND
   ============================================================ */
#bg-canvas {
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
}

/* ============================================================
   NAVBAR
   ============================================================ */
nav {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 1000;
  padding: 0 clamp(20px, 5vw, 60px);
  height: 64px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: rgba(10, 10, 10, 0.7);
  backdrop-filter: blur(20px) saturate(1.5);
  -webkit-backdrop-filter: blur(20px) saturate(1.5);
  border-bottom: 1px solid var(--border);
  transition: background 0.3s;
}

.nav-logo {
  font-family: var(--font-mono);
  font-size: 1rem;
  color: var(--white);
  letter-spacing: 0.05em;
  text-decoration: none;
  display: flex;
  align-items: center;
  gap: 10px;
}

.nav-logo-dot {
  width: 8px;
  height: 8px;
  background: var(--red);
  border-radius: 50%;
  box-shadow: 0 0 8px var(--red);
  animation: pulse-dot 2s ease-in-out infinite;
}

.nav-links {
  display: flex;
  gap: 4px;
  list-style: none;
}

.nav-links a {
  font-family: var(--font-mono);
  font-size: 0.72rem;
  color: var(--muted);
  text-decoration: none;
  letter-spacing: 0.1em;
  padding: 6px 12px;
  border-radius: 4px;
  transition: color 0.2s, background 0.2s;
  position: relative;
}

.nav-links a:hover,
.nav-links a.active {
  color: var(--white);
}

.nav-links a.active::after {
  content: '';
  position: absolute;
  bottom: 2px;
  left: 50%;
  transform: translateX(-50%);
  width: 16px;
  height: 2px;
  background: var(--red);
  border-radius: 1px;
  box-shadow: 0 0 6px var(--red);
}

.nav-hamburger {
  display: none;
  flex-direction: column;
  gap: 5px;
  cursor: pointer;
  padding: 8px;
  background: none;
  border: none;
  z-index: 1001;
}

.nav-hamburger span {
  display: block;
  width: 24px;
  height: 2px;
  background: var(--white);
  border-radius: 1px;
  transition: transform 0.3s, opacity 0.3s;
}

.nav-hamburger.open span:nth-child(1) {
  transform: translateY(7px) rotate(45deg);
}

.nav-hamburger.open span:nth-child(2) {
  opacity: 0;
}

.nav-hamburger.open span:nth-child(3) {
  transform: translateY(-7px) rotate(-45deg);
}

.nav-mobile {
  display: none;
  position: fixed;
  inset: 64px 0 0;
  background: rgba(10, 10, 10, 0.97);
  backdrop-filter: blur(30px);
  -webkit-backdrop-filter: blur(30px);
  z-index: 999;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 40px 20px;
}

.nav-mobile.open {
  display: flex;
}

.nav-mobile a {
  font-family: var(--font-mono);
  font-size: 1rem;
  color: var(--muted);
  text-decoration: none;
  letter-spacing: 0.15em;
  padding: 12px 40px;
  border-radius: 6px;
  width: 100%;
  max-width: 300px;
  text-align: center;
  border: 1px solid transparent;
  transition: all 0.2s;
}

.nav-mobile a:hover {
  color: var(--white);
  border-color: var(--border-red);
  background: var(--red-faint);
}

/* ============================================================
   SHARED UTILITIES
   ============================================================ */
section {
  position: relative;
  z-index: 1;
}

.container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 clamp(20px, 5vw, 60px);
}

.section-pad {
  padding: 120px 0;
}

.section-label {
  font-family: var(--font-mono);
  font-size: 0.7rem;
  color: var(--red);
  letter-spacing: 0.25em;
  text-transform: uppercase;
  margin-bottom: 12px;
  display: flex;
  align-items: center;
  gap: 12px;
}

.section-label::before {
  content: '';
  width: 24px;
  height: 1px;
  background: var(--red);
}

.section-title {
  font-family: var(--font-display);
  font-size: clamp(2rem, 5vw, 3.2rem);
  font-weight: 800;
  line-height: 1.1;
  letter-spacing: -0.02em;
  margin-bottom: 16px;
}

.section-desc {
  color: var(--muted);
  font-size: 0.95rem;
  line-height: 1.7;
  max-width: 520px;
}

/* Reveal animations on scroll */
.reveal {
  opacity: 0;
  transform: translateY(30px);
  transition:
    opacity 0.7s var(--ease-out),
    transform 0.7s var(--ease-out);
}

.reveal.visible {
  opacity: 1;
  transform: translateY(0);
}

.reveal-d1 { transition-delay: 0.1s; }
.reveal-d2 { transition-delay: 0.2s; }
.reveal-d3 { transition-delay: 0.3s; }
.reveal-d4 { transition-delay: 0.4s; }
.reveal-d5 { transition-delay: 0.5s; }

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-family: var(--font-mono);
  font-size: 0.78rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  padding: 12px 24px;
  border-radius: 4px;
  text-decoration: none;
  border: none;
  cursor: pointer;
  transition: all 0.25s var(--ease-out);
  position: relative;
  overflow: hidden;
}

.btn::before {
  content: '';
  position: absolute;
  inset: 0;
  background: rgba(255, 255, 255, 0.05);
  transform: translateX(-100%);
  transition: transform 0.3s var(--ease-out);
}

.btn:hover::before {
  transform: translateX(0);
}

.btn-primary {
  background: var(--red);
  color: var(--white);
  box-shadow: 0 0 20px rgba(255, 0, 60, 0.3);
}

.btn-primary:hover {
  box-shadow: 0 0 32px rgba(255, 0, 60, 0.5);
  transform: translateY(-2px);
}

.btn-outline {
  background: transparent;
  color: var(--white);
  border: 1px solid var(--border);
}

.btn-outline:hover {
  border-color: var(--red);
  box-shadow: 0 0 16px var(--red-glow);
  transform: translateY(-2px);
}

.btn-ghost {
  background: transparent;
  color: var(--muted);
  border: 1px solid var(--border);
  font-size: 0.72rem;
  padding: 8px 16px;
}

.btn-ghost:hover {
  color: var(--white);
  border-color: var(--border-red);
}

/* Tag */
.tag {
  display: inline-block;
  font-family: var(--font-mono);
  font-size: 0.65rem;
  letter-spacing: 0.08em;
  color: var(--red);
  background: var(--red-faint);
  border: 1px solid var(--border-red);
  padding: 3px 10px;
  border-radius: 3px;
}

/* ============================================================
   HERO
   ============================================================ */
#home {
  min-height: 100vh;
  display: flex;
  align-items: center;
  padding-top: 64px;
  overflow: hidden;
}

.hero-wrap {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 80px;
  align-items: center;
  width: 100%;
  padding: 80px 0;
}

.hero-left {
  max-width: 640px;
}

.hero-greeting {
  font-family: var(--font-mono);
  font-size: 0.75rem;
  color: var(--red);
  letter-spacing: 0.2em;
  margin-bottom: 24px;
  display: flex;
  align-items: center;
  gap: 12px;
  opacity: 0;
  animation: fadeUp 0.8s 0.3s var(--ease-out) forwards;
}

.hero-greeting::before {
  content: '';
  width: 30px;
  height: 1px;
  background: var(--red);
}

.hero-name {
  font-family: var(--font-display);
  font-size: clamp(2.8rem, 7vw, 5rem);
  font-weight: 800;
  letter-spacing: -0.03em;
  line-height: 1.0;
  margin-bottom: 16px;
  opacity: 0;
  animation: fadeUp 0.8s 0.45s var(--ease-out) forwards;
}

.hero-name span {
  color: var(--red);
}

.hero-roles {
  font-family: var(--font-display);
  font-size: clamp(1rem, 2.5vw, 1.4rem);
  font-weight: 600;
  color: var(--muted);
  margin-bottom: 28px;
  opacity: 0;
  animation: fadeUp 0.8s 0.6s var(--ease-out) forwards;
}

.hero-typed-wrap {
  font-family: var(--font-mono);
  font-size: 0.9rem;
  color: var(--white);
  min-height: 1.5em;
  margin-bottom: 40px;
  display: flex;
  align-items: center;
  gap: 8px;
  opacity: 0;
  animation: fadeUp 0.8s 0.75s var(--ease-out) forwards;
}

.hero-typed-prefix {
  color: var(--red);
}

.hero-cursor {
  display: inline-block;
  width: 2px;
  height: 1em;
  background: var(--red);
  animation: blink 1s infinite;
  margin-left: 2px;
}

.hero-buttons {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  opacity: 0;
  animation: fadeUp 0.8s 0.9s var(--ease-out) forwards;
}

.hero-right {
  opacity: 0;
  animation: fadeIn 1s 0.6s var(--ease-out) forwards;
}

.hero-avatar-wrap {
  position: relative;
  display: flex;
  justify-content: center;
  align-items: center;
}

.hero-avatar {
  width: 300px;
  height: 300px;
  border-radius: 50%;
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  z-index: 2;
  border: 3px solid var(--red);
}

.hero-profile-img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center;
  transition: transform 0.5s ease;
}

/* Decorative rings around avatar */
.hero-ring1,
.hero-ring2,
.hero-ring3 {
  position: absolute;
  border-radius: 50%;
  pointer-events: none;
  will-change: transform;
  transform-origin: center;
}

.hero-ring1 {
  inset: -8px;
  border: 1.5px solid transparent;
  border-top-color: var(--red);
  border-right-color: var(--red);
  animation: spin 4s linear infinite;
  z-index: 3;
}

.hero-ring2 {
  inset: -18px;
  border: 1px solid rgba(255, 0, 60, 0.2);
  border-bottom-color: rgba(255, 0, 60, 0.5);
  animation: spin 7s linear infinite reverse;
  z-index: 3;
}

.hero-ring3 {
  inset: -32px;
  border: 1px dashed rgba(255, 0, 60, 0.08);
  animation: spin 12s linear infinite;
  z-index: 1;
}

.hero-glow {
  position: absolute;
  inset: -20px;
  background: radial-gradient(circle, rgba(255, 0, 60, 0.12) 0%, transparent 70%);
  border-radius: 50%;
  z-index: 1;
  animation: shield-pulse 3s ease-in-out infinite;
}

.hero-scroll {
  position: absolute;
  bottom: 40px;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  font-family: var(--font-mono);
  font-size: 0.6rem;
  letter-spacing: 0.2em;
  color: var(--muted);
  text-decoration: none;
  opacity: 0;
  animation: fadeIn 1s 1.5s forwards;
}

.hero-scroll-line {
  width: 1px;
  height: 40px;
  background: linear-gradient(to bottom, var(--red), transparent);
  animation: scroll-line 2s ease-in-out infinite;
}

/* ============================================================
   ABOUT
   ============================================================ */
#about {
  background: var(--darker);
}

.about-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 80px;
  align-items: start;
}

.about-text p {
  color: var(--muted);
  font-size: 0.95rem;
  line-height: 1.8;
  margin-bottom: 16px;
}

.about-text p strong {
  color: var(--white);
  font-weight: 500;
}

.about-highlight {
  margin-top: 32px;
  padding: 20px 24px;
  border: 1px solid var(--border-red);
  border-radius: 6px;
  background: var(--red-faint);
  font-family: var(--font-mono);
  font-size: 0.78rem;
  color: var(--red);
  letter-spacing: 0.05em;
  line-height: 1.8;
}

.stats-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}

.stat-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 28px 24px;
  transition: all 0.3s var(--ease-out);
  position: relative;
  overflow: hidden;
}

.stat-card::before {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(135deg, var(--red-faint), transparent);
  opacity: 0;
  transition: opacity 0.3s;
}

.stat-card:hover {
  border-color: var(--border-red);
  transform: translateY(-4px);
  box-shadow: 0 12px 32px rgba(0, 0, 0, 0.4), 0 0 0 1px var(--border-red);
}

.stat-card:hover::before {
  opacity: 1;
}

.stat-number {
  font-family: var(--font-display);
  font-size: 2.4rem;
  font-weight: 800;
  color: var(--red);
  line-height: 1;
  margin-bottom: 6px;
}

.stat-label {
  font-family: var(--font-mono);
  font-size: 0.68rem;
  color: var(--muted);
  letter-spacing: 0.15em;
  text-transform: uppercase;
}

/* ============================================================
   SKILLS
   ============================================================ */
.skills-categories {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 48px;
}

.cat-btn {
  font-family: var(--font-mono);
  font-size: 0.68rem;
  letter-spacing: 0.1em;
  padding: 8px 18px;
  border-radius: 4px;
  background: var(--card);
  border: 1px solid var(--border);
  color: var(--muted);
  cursor: pointer;
  transition: all 0.2s;
}

.cat-btn.active,
.cat-btn:hover {
  border-color: var(--red);
  color: var(--white);
  background: var(--red-faint);
}

.skills-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
  gap: 16px;
}

.skill-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 24px 16px;
  text-align: center;
  cursor: pointer;
  transition: all 0.3s var(--ease-out);
  position: relative;
  overflow: hidden;
}

.skill-card::after {
  content: '';
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  height: 2px;
  background: var(--red);
  transform: scaleX(0);
  transition: transform 0.3s var(--ease-out);
}

.skill-card:hover {
  border-color: var(--border-red);
  transform: translateY(-6px) scale(1.02);
  box-shadow: 0 16px 40px rgba(0, 0, 0, 0.4), 0 0 20px var(--red-glow);
}

.skill-card:hover::after {
  transform: scaleX(1);
}

.skill-icon {
  font-size: 2rem;
  margin-bottom: 12px;
}

.skill-name {
  font-family: var(--font-mono);
  font-size: 0.72rem;
  color: var(--white);
  letter-spacing: 0.05em;
  margin-bottom: 8px;
}

.skill-level {
  width: 100%;
  height: 2px;
  background: rgba(255, 255, 255, 0.06);
  border-radius: 1px;
  overflow: hidden;
}

.skill-level-fill {
  height: 100%;
  background: var(--red);
  border-radius: 1px;
  transition: width 1s var(--ease-out);
  width: 0;
}

.skill-card.animated .skill-level-fill {
  width: var(--level);
}

/* ============================================================
   PROJECTS
   ============================================================ */
#projects {
  background: var(--darker);
}

.projects-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(340px, 1fr));
  gap: 24px;
}

.proj-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 10px;
  overflow: hidden;
  cursor: pointer;
  transition: all 0.35s var(--ease-out);
  display: flex;
  flex-direction: column;
}

.proj-card:hover {
  border-color: var(--border-red);
  transform: translateY(-8px);
  box-shadow:
    0 24px 60px rgba(0, 0, 0, 0.5),
    0 0 0 1px var(--border-red),
    0 0 40px var(--red-glow);
}

.proj-img {
  height: 180px;
  background: var(--card2);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 3rem;
  position: relative;
  overflow: hidden;
}

.proj-img-overlay {
  position: absolute;
  inset: 0;
  background: linear-gradient(to bottom, transparent, rgba(10, 10, 10, 0.8));
}

.proj-img-grid {
  position: absolute;
  inset: 0;
  background-image:
    linear-gradient(rgba(255, 0, 60, 0.04) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 0, 60, 0.04) 1px, transparent 1px);
  background-size: 24px 24px;
}

.proj-body {
  padding: 24px;
  flex: 1;
  display: flex;
  flex-direction: column;
}

.proj-name {
  font-family: var(--font-display);
  font-size: 1.1rem;
  font-weight: 700;
  margin-bottom: 10px;
}

.proj-desc {
  color: var(--muted);
  font-size: 0.85rem;
  line-height: 1.6;
  margin-bottom: 16px;
  flex: 1;
}

.proj-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 20px;
}

.proj-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

/* ============================================================
   GITHUB
   ============================================================ */
.github-layout {
  display: grid;
  grid-template-columns: 300px 1fr;
  gap: 40px;
  align-items: start;
}

.github-profile-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 32px 24px;
  text-align: center;
}

.github-avatar {
  width: 80px;
  height: 80px;
  border-radius: 50%;
  background: var(--card2);
  margin: 0 auto 16px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 2.2rem;
  border: 2px solid var(--border-red);
}

.github-username {
  font-family: var(--font-mono);
  font-size: 0.85rem;
  color: var(--red);
  margin-bottom: 6px;
}

.github-bio {
  font-size: 0.82rem;
  color: var(--muted);
  margin-bottom: 24px;
  line-height: 1.5;
}

.github-stats {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  margin-bottom: 24px;
}

.gh-stat {
  background: var(--card2);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 14px 10px;
  text-align: center;
}

.gh-stat-num {
  font-family: var(--font-display);
  font-size: 1.4rem;
  font-weight: 700;
  color: var(--red);
}

.gh-stat-label {
  font-family: var(--font-mono);
  font-size: 0.6rem;
  color: var(--muted);
  letter-spacing: 0.1em;
  margin-top: 2px;
}

.contrib-graph {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 28px;
  margin-bottom: 24px;
  /* Allow horizontal scroll on small screens */
  overflow-x: auto;
}

.contrib-title {
  font-family: var(--font-mono);
  font-size: 0.7rem;
  color: var(--muted);
  letter-spacing: 0.1em;
  margin-bottom: 16px;
}

.contrib-cells {
  display: grid;
  grid-template-columns: repeat(52, 1fr);
  gap: 3px;
  min-width: 700px; /* Ensures graph is readable on mobile */
}

.contrib-cell {
  aspect-ratio: 1;
  border-radius: 2px;
  background: var(--card2);
  transition: background 0.2s;
}

.contrib-cell:hover {
  outline: 1px solid rgba(255, 0, 60, 0.5);
}

.contrib-cell[data-level="1"] { background: rgba(255, 0, 60, 0.2); }
.contrib-cell[data-level="2"] { background: rgba(255, 0, 60, 0.4); }
.contrib-cell[data-level="3"] { background: rgba(255, 0, 60, 0.65); }
.contrib-cell[data-level="4"] { background: var(--red); }

.repos-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}

.repo-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 20px;
  transition: all 0.25s var(--ease-out);
  cursor: pointer;
}

.repo-card:hover {
  border-color: var(--border-red);
  transform: translateY(-3px);
}

.repo-name {
  font-family: var(--font-mono);
  font-size: 0.82rem;
  color: var(--red);
  margin-bottom: 8px;
}

.repo-desc {
  font-size: 0.78rem;
  color: var(--muted);
  line-height: 1.5;
  margin-bottom: 16px;
}

.repo-meta {
  display: flex;
  gap: 16px;
  flex-wrap: wrap;
}

.repo-lang {
  display: flex;
  align-items: center;
  gap: 6px;
  font-family: var(--font-mono);
  font-size: 0.68rem;
  color: var(--muted);
}

.repo-lang-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--red);
}

.repo-stars {
  font-family: var(--font-mono);
  font-size: 0.68rem;
  color: var(--muted);
}

/* ============================================================
   EXPERIENCE (TIMELINE)
   ============================================================ */
#experience {
  background: var(--darker);
}

.timeline {
  position: relative;
  padding-left: 48px;
}

.timeline::before {
  content: '';
  position: absolute;
  left: 8px;
  top: 0;
  bottom: 0;
  width: 1px;
  background: linear-gradient(to bottom, var(--red), rgba(255, 0, 60, 0.1));
}

.timeline-item {
  position: relative;
  margin-bottom: 56px;
}

.timeline-item:last-child {
  margin-bottom: 0;
}

.timeline-dot {
  position: absolute;
  left: -44px;
  top: 4px;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: var(--black);
  border: 2px solid var(--red);
  box-shadow: 0 0 10px var(--red);
  transition: background 0.3s;
}

.timeline-item:hover .timeline-dot {
  background: var(--red);
}

.timeline-date {
  font-family: var(--font-mono);
  font-size: 0.68rem;
  color: var(--red);
  letter-spacing: 0.15em;
  margin-bottom: 8px;
}

.timeline-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 24px;
  transition: all 0.3s var(--ease-out);
}

.timeline-card:hover {
  border-color: var(--border-red);
  transform: translateX(6px);
  box-shadow: 0 0 24px var(--red-glow);
}

.timeline-title {
  font-family: var(--font-display);
  font-size: 1.05rem;
  font-weight: 700;
  margin-bottom: 8px;
}

.timeline-desc {
  color: var(--muted);
  font-size: 0.85rem;
  line-height: 1.6;
}

/* ============================================================
   CERTIFICATIONS
   ============================================================ */
.certs-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 20px;
}

.cert-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 28px 24px;
  transition: all 0.3s var(--ease-out);
  position: relative;
  overflow: hidden;
}

.cert-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 2px;
  background: linear-gradient(90deg, var(--red), transparent);
  transform: scaleX(0);
  transform-origin: left;
  transition: transform 0.4s var(--ease-out);
}

.cert-card:hover {
  border-color: var(--border-red);
  transform: translateY(-6px);
  box-shadow: 0 16px 40px rgba(0, 0, 0, 0.4), 0 0 20px var(--red-glow);
}

.cert-card:hover::before {
  transform: scaleX(1);
}

.cert-icon {
  font-size: 2rem;
  margin-bottom: 16px;
}

.cert-name {
  font-family: var(--font-display);
  font-size: 1rem;
  font-weight: 700;
  margin-bottom: 6px;
}

.cert-provider {
  font-family: var(--font-mono);
  font-size: 0.68rem;
  color: var(--red);
  letter-spacing: 0.1em;
  margin-bottom: 12px;
}

.cert-date {
  font-family: var(--font-mono);
  font-size: 0.65rem;
  color: var(--muted);
}

/* ============================================================
   BLOG
   ============================================================ */
#blog {
  background: var(--darker);
}

.blog-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 24px;
}

.blog-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 10px;
  overflow: hidden;
  cursor: pointer;
  transition: all 0.3s var(--ease-out);
}

.blog-card:hover {
  border-color: var(--border-red);
  transform: translateY(-6px);
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.5), 0 0 30px var(--red-glow);
}

.blog-header {
  padding: 32px 24px 24px;
  background: linear-gradient(135deg, var(--card2), var(--card));
  position: relative;
}

.blog-number {
  position: absolute;
  top: 20px;
  right: 24px;
  font-family: var(--font-display);
  font-size: 3rem;
  font-weight: 800;
  color: rgba(255, 0, 60, 0.06);
  line-height: 1;
}

.blog-tag {
  margin-bottom: 14px;
}

.blog-title {
  font-family: var(--font-display);
  font-size: 1.05rem;
  font-weight: 700;
  line-height: 1.3;
}

.blog-body {
  padding: 20px 24px 24px;
}

.blog-excerpt {
  color: var(--muted);
  font-size: 0.82rem;
  line-height: 1.6;
  margin-bottom: 16px;
}

.blog-meta {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
}

.blog-date {
  font-family: var(--font-mono);
  font-size: 0.65rem;
  color: var(--muted);
}

.blog-read {
  font-family: var(--font-mono);
  font-size: 0.65rem;
  color: var(--red);
  display: flex;
  align-items: center;
  gap: 6px;
  transition: gap 0.2s;
}

.blog-card:hover .blog-read {
  gap: 10px;
}

/* ============================================================
   CONTACT
   ============================================================ */
.contact-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: var(--card);
  padding: 16px;
  border-radius: 8px;
  border: 1px solid var(--border);
  transition: all 0.3s ease;
}

.contact-item:hover {
  border-color: var(--red);
  transform: translateX(5px);
}

.contact-link-info,
.contact-static-info {
  display: flex;
  align-items: center;
  gap: 16px;
  text-decoration: none;
  color: inherit;
  flex-grow: 1;
  min-width: 0; /* Prevent overflow on long text */
}

.contact-link-info:hover .contact-value {
  color: var(--red);
}

.contact-copy {
  background: transparent;
  border: 1px solid var(--border);
  color: var(--muted);
  padding: 6px 12px;
  border-radius: 4px;
  font-family: var(--font-mono);
  font-size: 0.75rem;
  cursor: pointer;
  transition: all 0.3s;
  white-space: nowrap;
  margin-left: 12px;
  /* Better touch target */
  min-height: 36px;
}

.contact-copy:hover {
  border-color: var(--red);
  color: var(--red);
}

.contact-copy.copied {
  border-color: var(--red);
  color: var(--red);
}

/* ============================================================
   FOOTER
   ============================================================ */
footer {
  background: var(--darker);
  border-top: 1px solid var(--border);
  padding: 48px 0;
}

.footer-inner {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 20px;
  text-align: center;
}

.footer-name {
  font-family: var(--font-display);
  font-size: 1.4rem;
  font-weight: 800;
  letter-spacing: -0.02em;
}

.footer-name span {
  color: var(--red);
}

.footer-quote {
  font-family: var(--font-mono);
  font-size: 0.75rem;
  color: var(--muted);
  letter-spacing: 0.08em;
  max-width: 90%;
}

.footer-socials {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
  justify-content: center;
}

.footer-social {
  width: 36px;
  height: 36px;
  border-radius: 6px;
  border: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--muted);
  text-decoration: none;
  font-size: 1rem;
  transition: all 0.2s;
}

.footer-social:hover {
  border-color: var(--red);
  color: var(--white);
  background: var(--red-faint);
}

.footer-copy {
  font-family: var(--font-mono);
  font-size: 0.6rem;
  color: rgba(136, 136, 136, 0.5);
  letter-spacing: 0.1em;
}

/* ============================================================
   BLOG MODAL
   ============================================================ */
.modal-overlay {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.85);
  z-index: 10000;
  justify-content: center;
  align-items: center;
  padding: 20px;
  box-sizing: border-box;
  opacity: 0;
  transition: opacity 0.3s ease;
}

.modal-overlay.active {
  display: flex;
  opacity: 1;
}

.modal-content {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 12px;
  width: 100%;
  max-width: 800px;
  max-height: 90vh;
  display: flex;
  flex-direction: column;
  position: relative;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.6);
  transform: translateY(-20px);
  transition: transform 0.3s ease;
}

.modal-overlay.active .modal-content {
  transform: translateY(0);
}

.modal-close {
  position: absolute;
  top: 16px;
  right: 16px;
  background: transparent;
  border: none;
  color: var(--muted);
  font-size: 1.5rem;
  cursor: pointer;
  z-index: 10;
  transition: color 0.2s;
  line-height: 1;
  padding: 4px 8px;
  min-width: 32px;
  min-height: 32px;
}

.modal-close:hover {
  color: var(--red);
}

.modal-header {
  padding: 32px 24px 24px;
  background: linear-gradient(135deg, var(--card2), var(--card));
  position: relative;
  border-bottom: 1px solid var(--border);
}

.modal-meta {
  display: flex;
  align-items: center;
  gap: 16px;
  margin-bottom: 12px;
  flex-wrap: wrap;
}

.modal-number {
  font-family: var(--font-display);
  font-size: 2rem;
  font-weight: 800;
  color: rgba(255, 0, 60, 0.15);
  line-height: 1;
}

.modal-tag {
  font-family: var(--font-mono);
  font-size: 0.75rem;
  color: var(--red);
  text-transform: uppercase;
  letter-spacing: 0.1em;
}

.modal-title {
  font-family: var(--font-display);
  font-size: 1.4rem;
  font-weight: 700;
  line-height: 1.3;
  margin: 0;
  padding-right: 40px;
}

.modal-body {
  padding: 24px;
  overflow-y: auto;
  flex-grow: 1;
  color: var(--white);
  line-height: 1.7;
}

.modal-body::-webkit-scrollbar {
  width: 8px;
}

.modal-body::-webkit-scrollbar-track {
  background: var(--darker);
  border-radius: 4px;
}

.modal-body::-webkit-scrollbar-thumb {
  background: var(--border-red);
  border-radius: 4px;
}

.modal-body::-webkit-scrollbar-thumb:hover {
  background: var(--red);
}

.modal-body h3 {
  font-size: 1.2rem;
  margin-top: 24px;
  margin-bottom: 12px;
}

.modal-body h4 {
  font-size: 1.1rem;
  margin-top: 20px;
  margin-bottom: 10px;
}

.modal-body p {
  margin-bottom: 16px;
  color: var(--muted);
}

.modal-body ul,
.modal-body ol {
  margin-bottom: 16px;
  padding-left: 24px;
  color: var(--muted);
}

.modal-body li {
  margin-bottom: 8px;
}

.modal-body pre {
  background: var(--darker);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 16px;
  overflow-x: auto;
  margin-bottom: 16px;
}

.modal-body code {
  font-family: var(--font-mono);
  font-size: 0.85rem;
  color: var(--red);
}

/* ============================================================
   UTILITIES
   ============================================================ */
.text-red {
  color: var(--red);
}

.font-mono {
  font-family: var(--font-mono);
}

.hidden {
  display: none !important;
}

/* ============================================================
   GLOBAL KEYFRAMES
   ============================================================ */
@keyframes spin {
  from { transform: rotate(0deg); }
  to { transform: rotate(360deg); }
}

@keyframes pulse-dot {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: 0.5; transform: scale(0.7); }
}

@keyframes blink {
  0%, 100% { opacity: 1; }
  50% { opacity: 0; }
}

@keyframes fadeUp {
  from { opacity: 0; transform: translateY(24px); }
  to { opacity: 1; transform: translateY(0); }
}

@keyframes fadeIn {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: translateY(0); }
}

@keyframes shield-pulse {
  0%, 100% { opacity: 0.5; transform: scale(1); }
  50% { opacity: 0.8; transform: scale(1.05); }
}

@keyframes scroll-line {
  0% { transform: scaleY(0); transform-origin: top; }
  50% { transform: scaleY(1); transform-origin: top; }
  51% { transform-origin: bottom; }
  100% { transform: scaleY(0); transform-origin: bottom; }
}

/* ============================================================
   RESPONSIVE BREAKPOINTS
   - 1024px: Tablets landscape
   - 900px : Tablets portrait
   - 768px : Mobile landscape / large phones
   - 480px : Mobile portrait
   ============================================================ */

/* Tablet landscape & smaller desktops */
@media (max-width: 1024px) {
  .github-layout,
  .repos-grid {
    grid-template-columns: 1fr;
  }

    .hero-wrap {
    grid-template-columns: 1fr;
    justify-items: center;
    text-align: center;
    gap: clamp(32px, 6vw, 48px);
  }
    .hero-left {
    max-width: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
  }
  .hero-greeting {
    justify-content: center;
  }

  .hero-typed-wrap {
    justify-content: center;
  }

  .hero-buttons {
    justify-content: center;
  }

  .hero-right {
    order: -1; /* Avatar on top */
  }

}

/* Tablet portrait */
@media (max-width: 900px) {
  .hero-wrap {
    gap: 40px;
    padding: 60px 0;
  }

  /* Move avatar above text on tablets */
  .hero-right {
    order: -1;
  }

  .hero-avatar {
    width: 220px;
    height: 220px;
  }

  .hero-ring1 { inset: -6px; }
  .hero-ring2 { inset: -14px; }
  .hero-ring3 { inset: -24px; }
  .hero-glow { inset: -15px; }

  .about-grid {
    grid-template-columns: 1fr;
    gap: 48px;
  }
}

/* Mobile landscape / large phones */
@media (max-width: 768px) {
  /* Hide desktop nav, show hamburger */
  .nav-links {
    display: none;
  }

  .nav-hamburger {
    display: flex;
  }

  /* Reduce section padding */
  .section-pad {
    padding: 60px 0;
  }

  /* Single column layouts */
  .projects-grid,
  .certs-grid,
  .blog-grid,
  .repos-grid {
    grid-template-columns: 1fr;
  }

  /* Keep 2 columns for compactness */
  .stats-grid {
    grid-template-columns: repeat(2, 1fr);
  }

  .skills-grid {
    grid-template-columns: repeat(auto-fill, minmax(110px, 1fr));
    gap: 12px;
  }

  /* Disable custom cursor on touch devices */
  #cursor,
  #cursor-ring {
    display: none;
  }

  body {
    cursor: auto;
  }

  /* Hero avatar scaling */
  .hero-avatar {
    width: 200px;
    height: 200px;
  }

  .hero-ring1 { inset: -6px; }
  .hero-ring2 { inset: -12px; }
  .hero-ring3 { inset: -22px; }
  .hero-glow { inset: -15px; }

  /* Modal: bottom sheet style */
  .modal-overlay {
    align-items: flex-end;
    padding: 0;
  }

  .modal-content {
    max-height: 92vh;
    border-radius: 20px 20px 0 0;
    margin: 0;
  }

  .modal-header {
    padding: 24px 20px 16px;
  }

  .modal-number {
    font-size: 1.5rem;
  }

  .modal-title {
    font-size: 1.2rem;
    padding-right: 36px;
  }

  .modal-body {
    padding: 20px;
  }

  /* Timeline: tighter spacing */
  .timeline {
    padding-left: 36px;
  }

  .timeline-dot {
    left: -32px;
    width: 14px;
    height: 14px;
  }

  /* Preloader: compact */
  #preloader {
    gap: 24px;
  }

  .pre-shield {
    width: 64px;
    height: 64px;
  }

  .pre-ring { inset: -10px; }
  .pre-ring2 { inset: -18px; }

  .pre-text {
    font-size: 0.7rem;
    width: 90%;
    margin: 0 auto;
  }
}

/* Mobile portrait */
@media (max-width: 480px) {
    .hero-wrap {
    padding: 24px 0 60px;
    gap: 28px;
  }

    .hero-greeting {
    font-size: 0.65rem;
    letter-spacing: 0.15em;
    margin-bottom: 12px;
    gap: 8px;
  }

    .hero-greeting::before {
    width: 16px;
  }

    .hero-name {
    font-size: clamp(1.8rem, 11vw, 2.4rem);
    margin-bottom: 10px;
  }

    .hero-roles {
    font-size: 0.9rem;
    margin-bottom: 14px;
  }

    .hero-typed-wrap {
    font-size: 0.75rem;
    margin-bottom: 20px;
  }

  .hero-avatar {
    width: 160px;
    height: 160px;
    border-width: 2px;
  }

  .hero-ring1 { inset: -4px; }
  .hero-ring2 { inset: -10px; }
  .hero-ring3 { inset: -18px; }
  .hero-glow { inset: -10px; }

  .hero-avatar-wrap {
    padding: 15px;
  }

  .hero-buttons {
    flex-direction: column;
    width: 100%;
    gap: 10px;
  }

    .hero-buttons .btn {
    width: 100%;
    justify-content: center;
    padding: 14px 20px;
  }

  /* Full-width buttons for better tap targets */
  .btn {
    justify-content: center;
    width: 100%;
    padding: 14px 20px;
  }

  /* Stack stats vertically on tiny screens */
  .stats-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 10px;
  }

  .stat-card {
    padding: 20px 14px;
  }

  .stat-number {
    font-size: 1.8rem;
  }

  /* Compact skill cards */
  .skills-grid {
    grid-template-columns: repeat(auto-fill, minmax(90px, 1fr));
    gap: 10px;
  }

  .skill-card {
    padding: 18px 10px;
  }

  .skill-icon {
    font-size: 1.6rem;
  }

  /* Contact: stack copy button below text */
  .contact-item {
    flex-direction: column;
    align-items: stretch;
    gap: 12px;
  }

  .contact-copy {
    margin-left: 0;
    align-self: flex-start;
  }

  /* Footer */
  .footer-quote {
    font-size: 0.7rem;
  }

  /* Preloader */
  #preloader {
    gap: 20px;
  }

  .pre-shield {
    width: 50px;
    height: 50px;
  }

  .pre-ring { inset: -8px; }
  .pre-ring2 { inset: -14px; }

  .pre-text {
    font-size: 0.65rem;
    line-height: 1.4;
    padding: 0 10px;
  }

  .pre-percent {
    font-size: 0.55rem;
  }

  /* Timeline */
  .timeline-card {
    padding: 18px;
  }

  /* Hero scroll hint - hide on very small screens to save space */
  .hero-scroll {
    bottom: 20px;
    display: none;
    font-size: 0.55rem;
  }

  .hero-scroll-line {
    height: 30px;
  }
  @media (max-width: 360px) {
  .hero-name {
    font-size: 1.6rem;
  }

  .hero-greeting {
    font-size: 0.6rem;
  }
}
  .hero-ring1 { inset: -4px; }
  .hero-ring2 { inset: -10px; }
  .hero-ring3 { inset: -18px; }
  .hero-glow { inset: -10px; }

}

/* ============================================================
   ACCESSIBILITY — Reduced motion preference
   ============================================================ */
@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
}

/* ============================================================
   PRINT STYLES
   ============================================================ */
@media print {
  #preloader,
  #cursor,
  #cursor-ring,
  #bg-canvas,
  .hero-scroll,
  nav,
  footer {
    display: none !important;
  }

  body {
    background: white;
    color: black;
  }
}