/* =====================================================
   Phong Hoang — Personal Site
   Design system: modern professional, cloud/tech-flavored
   ===================================================== */

:root {
  /* Palette */
  --bg:           #ffffff;
  --bg-soft:      #f6f8fb;
  --bg-dark:      #0b1220;
  --bg-dark-2:    #0f172a;
  --surface:      #ffffff;
  --border:       #e6eaf0;
  --border-soft:  #eef1f5;
  --text:         #0f172a;
  --text-soft:    #475569;
  --text-mute:    #64748b;
  --text-light:   #cbd5e1;
  --accent:       #2563eb;
  --accent-hover: #1d4ed8;
  --accent-soft:  #dbeafe;
  --accent-light: #eef4ff;
  --success:      #10b981;

  /* Typography */
  --font-sans: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  --font-mono: 'JetBrains Mono', ui-monospace, SFMono-Regular, Menlo, monospace;

  /* Sizing */
  --radius-sm: 8px;
  --radius:    14px;
  --radius-lg: 20px;
  --shadow-sm: 0 1px 2px rgba(15, 23, 42, 0.04), 0 1px 3px rgba(15, 23, 42, 0.05);
  --shadow:    0 4px 12px -2px rgba(15, 23, 42, 0.06), 0 8px 24px -4px rgba(15, 23, 42, 0.08);
  --shadow-lg: 0 12px 36px -8px rgba(15, 23, 42, 0.12), 0 24px 48px -12px rgba(15, 23, 42, 0.18);

  --max-width: 1180px;
  --pad-x:     clamp(20px, 4vw, 48px);

  /* Theme-dependent surface tints */
  --nav-bg:          rgba(255, 255, 255, 0.85);
  --nav-bg-scrolled: rgba(255, 255, 255, 0.95);
  --nav-mobile-bg:   rgba(255, 255, 255, 0.98);
  --hero-glow:       rgba(37, 99, 235, 0.18);

  color-scheme: light;
}

/* =====================================================
   Dark theme overrides
   ===================================================== */
[data-theme="dark"] {
  --bg:           #0b1220;
  --bg-soft:      #0f172a;
  --bg-dark:      #060912;
  --bg-dark-2:    #03060f;
  --surface:      #131c30;
  --border:       #1f2a44;
  --border-soft:  #182239;
  --text:         #f1f5f9;
  --text-soft:    #cbd5e1;
  --text-mute:    #94a3b8;
  --text-light:   #cbd5e1;
  --accent:       #60a5fa;
  --accent-hover: #3b82f6;
  --accent-soft:  #93c5fd;
  --accent-light: rgba(96, 165, 250, 0.14);

  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.35), 0 1px 3px rgba(0, 0, 0, 0.25);
  --shadow:    0 4px 12px -2px rgba(0, 0, 0, 0.45), 0 8px 24px -4px rgba(0, 0, 0, 0.35);
  --shadow-lg: 0 12px 36px -8px rgba(0, 0, 0, 0.55), 0 24px 48px -12px rgba(0, 0, 0, 0.45);

  --nav-bg:          rgba(11, 18, 32, 0.72);
  --nav-bg-scrolled: rgba(11, 18, 32, 0.92);
  --nav-mobile-bg:   rgba(11, 18, 32, 0.98);
  --hero-glow:       rgba(96, 165, 250, 0.24);

  color-scheme: dark;
}

/* Smooth color transitions only during an explicit theme toggle.
   Avoids transitions firing on initial page load. */
.theme-transitioning,
.theme-transitioning *,
.theme-transitioning *::before,
.theme-transitioning *::after {
  transition: background-color 0.3s ease,
              color 0.3s ease,
              border-color 0.3s ease,
              box-shadow 0.3s ease !important;
}

/* Skip-to-content link (visible only on keyboard focus) */
.skip-link {
  position: fixed;   /* fixed = viewport-relative, not body-relative */
  top: -100px;       /* concrete px, not %, so body containing-block bug can't fire */
  left: 16px;
  background: var(--accent);
  color: #fff;
  padding: 8px 18px;
  border-radius: 0 0 var(--radius-sm) var(--radius-sm);
  font-size: 0.9rem;
  font-weight: 600;
  text-decoration: none;
  z-index: 999;
  transition: top .2s;
}
.skip-link:focus { top: 0; outline: 3px solid var(--accent-hover); outline-offset: 2px; }

/* =====================================================
   Reset & Base
   ===================================================== */
*, *::before, *::after { box-sizing: border-box; }
html { scroll-behavior: smooth; -webkit-text-size-adjust: 100%; }
/* Prevent horizontal page scroll on html — safer than body (avoids
   body becoming a containing block that breaks position:sticky + skip-link) */
html { overflow-x: hidden; }
body {
  margin: 0;
  font-family: var(--font-sans);
  font-size: 16px;
  line-height: 1.6;
  color: var(--text);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}
img { max-width: 100%; display: block; }
a  { color: var(--accent); text-decoration: none; transition: color .2s; }
a:hover { color: var(--accent-hover); }
ul { padding-left: 1.2rem; }

.container {
  width: 100%;
  max-width: var(--max-width);
  margin: 0 auto;
  padding-left: var(--pad-x);
  padding-right: var(--pad-x);
}

/* =====================================================
   Navigation
   ===================================================== */
.nav {
  position: sticky;
  top: 0;
  z-index: 100;
  background: var(--nav-bg);
  backdrop-filter: saturate(180%) blur(14px);
  -webkit-backdrop-filter: saturate(180%) blur(14px);
  border-bottom: 1px solid transparent;
  transition: background .2s, border-color .2s, box-shadow .2s;
}
.nav.scrolled {
  background: var(--nav-bg-scrolled);
  border-bottom-color: var(--border);
  box-shadow: var(--shadow-sm);
}
.nav-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 68px;
}
.nav-logo {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  font-weight: 700;
  font-size: 1.05rem;
  letter-spacing: -0.01em;
  color: var(--text);
  text-decoration: none;
  line-height: 1;
  transition: transform .2s;
  flex-shrink: 0;
}
.nav-logo:hover { color: var(--text); transform: translateY(-1px); }
.nav-logo-img { transition: transform .25s ease; }
/* Logo rotation only on true pointer devices — avoids Safari mobile clipping */
@media (hover: hover) and (pointer: fine) {
  .nav-logo:hover .nav-logo-img { transform: rotate(-6deg) scale(1.05); }
}

/* nav-right holds only theme-toggle + hamburger — no overflow needed */
.nav-right {
  display: flex;
  align-items: center;
  gap: 16px;
  flex-shrink: 0;
}
.nav-logo-img {
  height: 38px;
  width: auto;
  display: block;
  /* Crisp downscaling on HiDPI */
  image-rendering: -webkit-optimize-contrast;
}
.nav-logo-text {
  display: inline-block;
}
@media (max-width: 480px) {
  .nav-logo-text { display: none; }
}

.nav-links {
  display: flex;
  gap: 28px;
  align-items: center;
}
.nav-links a {
  color: var(--text-soft);
  font-size: 0.92rem;
  font-weight: 500;
  position: relative;
  padding: 6px 0;
}
.nav-links a:hover { color: var(--text); }
.nav-links a::after {
  content: "";
  position: absolute;
  left: 0; right: 0; bottom: 0;
  height: 2px;
  background: var(--accent);
  transform: scaleX(0);
  transform-origin: left;
  transition: transform .2s;
}
.nav-links a:hover::after  { transform: scaleX(1); }
.nav-links a.active        { color: var(--text); }
.nav-links a.active::after { transform: scaleX(1); }

.nav-toggle {
  display: none;
  background: transparent;
  border: 0;
  padding: 8px;
  cursor: pointer;
  flex-direction: column;
  gap: 5px;
}
.nav-toggle span {
  display: block;
  width: 24px;
  height: 2px;
  background: var(--text);
  transition: transform .25s, opacity .25s, background .2s;
}

/* Theme toggle button */
.theme-toggle {
  position: relative;
  width: 38px;
  height: 38px;
  padding: 0;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: transparent;
  color: var(--text-soft);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: color .2s, border-color .2s, background .2s, transform .2s;
  flex-shrink: 0;
}
.theme-toggle:hover {
  color: var(--accent);
  border-color: var(--accent);
  transform: translateY(-1px);
}
.theme-toggle:active { transform: translateY(0); }
.theme-toggle svg {
  width: 18px;
  height: 18px;
  transition: transform .35s cubic-bezier(0.22, 1, 0.36, 1), opacity .25s;
}
.theme-toggle .icon-sun  { display: none; }
.theme-toggle .icon-moon { display: block; }
[data-theme="dark"] .theme-toggle .icon-sun  { display: block; }
[data-theme="dark"] .theme-toggle .icon-moon { display: none; }
.theme-toggle:hover svg { transform: rotate(15deg); }

/* =====================================================
   Hero
   ===================================================== */
.hero {
  overflow: hidden;
  padding: clamp(60px, 8vw, 100px) 0 clamp(40px, 6vw, 80px);
  background:
    radial-gradient(ellipse 80% 50% at 30% 0%, rgba(37, 99, 235, 0.08), transparent 60%),
    linear-gradient(180deg, var(--bg) 0%, var(--bg-soft) 100%);
}
.hero-inner {
  display: grid;
  grid-template-columns: 1.4fr 1fr;
  gap: clamp(32px, 6vw, 80px);
  align-items: center;
}

.eyebrow {
  font-size: 0.85rem;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--accent);
  margin: 0 0 16px;
  display: inline-flex;
  align-items: center;
  gap: 8px;
}
.eyebrow::before {
  content: "";
  display: inline-block;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--success);
  box-shadow: 0 0 0 4px rgba(16, 185, 129, 0.18);
  animation: pulse 2.4s infinite;
}
@keyframes pulse {
  0%, 100% { box-shadow: 0 0 0 4px rgba(16, 185, 129, 0.18); }
  50%      { box-shadow: 0 0 0 7px rgba(16, 185, 129, 0.05); }
}

.hero h1 {
  font-size: clamp(2.4rem, 5.5vw, 4rem);
  font-weight: 800;
  letter-spacing: -0.03em;
  line-height: 1.05;
  margin: 0 0 12px;
}
.hero-role {
  font-size: clamp(1.1rem, 2vw, 1.4rem);
  font-weight: 500;
  color: var(--text-soft);
  margin: 0 0 24px;
}
.hero-summary {
  font-size: 1.05rem;
  line-height: 1.7;
  color: var(--text-soft);
  margin: 0 0 32px;
  max-width: 580px;
}
.hero-summary strong { color: var(--text); font-weight: 600; }

.hero-cta {
  display: flex;
  gap: 12px;
  margin-bottom: 48px;
  flex-wrap: wrap;
}

.btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 12px 22px;
  border-radius: var(--radius);
  font-size: 0.95rem;
  font-weight: 600;
  text-decoration: none;
  transition: transform .15s, background .2s, box-shadow .2s, color .2s;
  cursor: pointer;
  border: 0;
  font-family: inherit;
}
.btn-primary {
  background: var(--accent);
  color: #fff;
  box-shadow: 0 4px 14px -2px rgba(37, 99, 235, 0.4);
}
.btn-primary:hover {
  background: var(--accent-hover);
  color: #fff;
  transform: translateY(-1px);
  box-shadow: 0 6px 18px -2px rgba(37, 99, 235, 0.5);
}
.btn-ghost {
  background: transparent;
  color: var(--text);
  border: 1px solid var(--border);
}
.btn-ghost:hover {
  background: var(--bg-soft);
  border-color: var(--text-soft);
}

.hero-stats {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 16px;
  max-width: 580px;
}
.stat {
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.stat-num {
  font-size: clamp(1.5rem, 2.6vw, 2rem);
  font-weight: 800;
  letter-spacing: -0.02em;
  color: var(--text);
  line-height: 1;
}
.stat-label {
  font-size: 0.78rem;
  color: var(--text-mute);
  font-weight: 500;
  line-height: 1.3;
}

/* Hero photo */
.hero-photo-wrap {
  position: relative;
  display: flex;
  justify-content: center;
  align-items: center;
}
.hero-photo-frame {
  position: relative;
  width: clamp(240px, 28vw, 360px);
  aspect-ratio: 1;
  border-radius: 24px;
  overflow: hidden;
  background: linear-gradient(135deg, var(--accent) 0%, #7c3aed 100%);
  padding: 4px;
  box-shadow: var(--shadow-lg);
  z-index: 2;
}
.hero-photo {
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: 20px;
}
.hero-photo-glow {
  position: absolute;
  inset: -20%;
  background: radial-gradient(circle, var(--hero-glow) 0%, transparent 60%);
  z-index: 1;
  filter: blur(40px);
}

/* =====================================================
   Section base
   ===================================================== */
.section {
  padding: clamp(64px, 10vw, 120px) 0;
}
.section-light { background: var(--bg-soft); }
.section-dark {
  background: var(--bg-dark);
  color: var(--text-light);
}
.section-eyebrow {
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--accent);
  margin: 0 0 12px;
}
.eyebrow-light { color: var(--accent-soft); }
.section-title {
  font-size: clamp(2rem, 3.6vw, 2.6rem);
  font-weight: 800;
  letter-spacing: -0.025em;
  line-height: 1.15;
  margin: 0 0 40px;
}
.section-title-light { color: #fff; }
.section-lead {
  font-size: 1.1rem;
  color: var(--text-soft);
  max-width: 720px;
  margin: 0 0 48px;
  line-height: 1.7;
}

/* =====================================================
   About
   ===================================================== */
.about-grid {
  display: grid;
  grid-template-columns: 1.6fr 1fr;
  gap: 48px;
  align-items: start;
}
.about-text p {
  font-size: 1.04rem;
  line-height: 1.8;
  color: var(--text-soft);
  margin: 0 0 18px;
}
.about-text strong { color: var(--text); font-weight: 600; }

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 28px;
  box-shadow: var(--shadow-sm);
  position: sticky;
  top: 100px;
}
.card h3 {
  margin: 0 0 18px;
  font-size: 0.85rem;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--text-mute);
}
.kv {
  list-style: none;
  padding: 0;
  margin: 0;
}
.kv li {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px 0;
  border-bottom: 1px solid var(--border-soft);
  font-size: 0.94rem;
}
.kv li:last-child { border-bottom: 0; }
.kv span  { color: var(--text-mute); }
.kv strong { color: var(--text); font-weight: 600; }
.status-dot {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: var(--success) !important;
}
.status-dot::before {
  content: "";
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--success);
  box-shadow: 0 0 0 3px rgba(16, 185, 129, 0.2);
}

/* =====================================================
   Experience timeline
   ===================================================== */
.timeline {
  display: flex;
  flex-direction: column;
  gap: 24px;
  position: relative;
}
.job {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 32px;
  transition: transform .2s, box-shadow .2s, border-color .2s;
}
.job:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow);
  border-color: var(--accent-soft);
}
.job-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 12px;
  flex-wrap: wrap;
}
.job-date {
  font-family: var(--font-mono);
  font-size: 0.82rem;
  color: var(--text-mute);
  font-weight: 500;
}
.job-tag {
  font-size: 0.74rem;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  background: var(--accent-light);
  color: var(--accent);
  padding: 4px 10px;
  border-radius: 999px;
}
.job-role {
  font-size: 1.25rem;
  font-weight: 700;
  letter-spacing: -0.01em;
  margin: 0 0 4px;
  color: var(--text);
}
.job-company {
  margin: 0 0 18px;
  font-size: 0.98rem;
  color: var(--text-soft);
  font-weight: 500;
}
.job-loc { color: var(--text-mute); font-weight: 400; }
.job-bullets {
  list-style: none;
  padding: 0;
  margin: 0;
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.job-bullets li {
  position: relative;
  padding-left: 22px;
  font-size: 0.97rem;
  line-height: 1.65;
  color: var(--text-soft);
}
.job-bullets li::before {
  content: "";
  position: absolute;
  left: 0;
  top: 11px;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--accent);
}
.job-bullets strong { color: var(--text); font-weight: 600; }

/* =====================================================
   Skills
   ===================================================== */
.skills-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 20px;
}
.skill-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 28px;
  transition: transform .2s, border-color .2s, box-shadow .2s;
}
.skill-card:hover {
  transform: translateY(-2px);
  border-color: var(--accent-soft);
  box-shadow: var(--shadow);
}
.skill-card h3 {
  margin: 0 0 12px;
  font-size: 1.05rem;
  font-weight: 700;
  letter-spacing: -0.01em;
  color: var(--text);
}
.skill-card p {
  margin: 0;
  font-size: 0.94rem;
  line-height: 1.7;
  color: var(--text-soft);
}
.skill-card-accent {
  background: linear-gradient(135deg, var(--accent) 0%, #7c3aed 100%);
  color: #fff;
  border-color: transparent;
}
.skill-card-accent h3 { color: #fff; }
.skill-card-accent p  { color: rgba(255, 255, 255, 0.9); }
.skill-card-accent strong { color: #fff; }
.skill-card-accent:hover { transform: translateY(-2px); border-color: transparent; }

/* =====================================================
   Certifications
   ===================================================== */
.cert-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 14px;
  margin-bottom: 56px;
}
.cert {
  background: var(--surface);
  border: 1px solid var(--border);
  border-left: 3px solid var(--accent);
  border-radius: var(--radius-sm);
  padding: 18px 20px;
  transition: transform .15s, border-color .15s, box-shadow .15s;
}
.cert:hover {
  transform: translateX(4px);
  box-shadow: var(--shadow-sm);
}
.cert-name {
  font-weight: 700;
  font-size: 1rem;
  color: var(--text);
  margin-bottom: 4px;
}
.cert-desc {
  font-size: 0.85rem;
  color: var(--text-mute);
}

.education {
  background: var(--bg-soft);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 28px 32px;
}
.education h3 {
  margin: 0 0 16px;
  font-size: 0.85rem;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--text-mute);
}
.education ul {
  list-style: none;
  padding: 0;
  margin: 0;
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.education li {
  font-size: 0.96rem;
  color: var(--text-soft);
}
.education strong { color: var(--text); }

/* =====================================================
   Creative
   ===================================================== */
.creative-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 20px;
}
.creative-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 28px;
}
.creative-card h3 {
  margin: 0 0 10px;
  font-size: 1.05rem;
  font-weight: 700;
}
.creative-card p {
  margin: 0;
  font-size: 0.94rem;
  color: var(--text-soft);
  line-height: 1.7;
}

/* Selected projects */
.projects-block {
  margin-top: 56px;
}
.projects-heading {
  font-size: 0.85rem;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--text-mute);
  margin: 0 0 20px;
}
.projects-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 16px;
}
.project-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 22px 24px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  cursor: pointer;
  transition: transform .2s, border-color .2s, box-shadow .2s;
}
.project-card:hover,
.project-card:focus-visible {
  transform: translateY(-3px);
  border-color: var(--accent-soft);
  box-shadow: var(--shadow);
  outline: none;
}
.project-tag {
  font-size: 0.7rem;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--accent);
}
.project-title {
  font-size: 1rem;
  font-weight: 700;
  letter-spacing: -0.01em;
  color: var(--text);
  margin: 0;
}
.project-desc {
  font-size: 0.9rem;
  line-height: 1.6;
  color: var(--text-soft);
  margin: 0;
}
.project-more {
  margin-top: 4px;
  font-size: 0.84rem;
  font-weight: 600;
  color: var(--accent);
  display: inline-flex;
  align-items: center;
  gap: 4px;
  transition: gap .2s;
}
.project-more::after {
  content: '→';
  display: inline-block;
  transition: transform .2s;
}
.project-card:hover .project-more::after,
.project-card:focus-visible .project-more::after { transform: translateX(4px); }

/* =====================================================
   Project detail modal
   ===================================================== */
.modal-overlay {
  position: fixed;
  inset: 0;
  z-index: 300;
  background: rgba(0, 0, 0, 0.55);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  opacity: 0;
  transition: opacity 0.25s ease;
}
.modal-overlay[hidden] { display: none; }
.modal-overlay.open    { opacity: 1; }

.modal-dialog {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 40px 44px;
  max-width: 580px;
  width: 100%;
  position: relative;
  box-shadow: var(--shadow-lg);
  transform: translateY(20px) scale(0.97);
  transition: transform 0.35s cubic-bezier(0.22, 1, 0.36, 1);
  max-height: 90vh;
  overflow-y: auto;
}
.modal-overlay.open .modal-dialog { transform: none; }

@media (max-width: 600px) {
  .modal-dialog { padding: 28px 24px; }
}

.modal-close {
  position: absolute;
  top: 16px;
  right: 16px;
  width: 36px;
  height: 36px;
  padding: 0;
  border-radius: 50%;
  border: 1px solid var(--border);
  background: transparent;
  color: var(--text-mute);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: color .2s, border-color .2s, background .2s;
}
.modal-close svg { width: 16px; height: 16px; }
.modal-close:hover {
  color: var(--text);
  border-color: var(--text-soft);
  background: var(--bg-soft);
}

.modal-tag {
  display: block;
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--accent);
  margin-bottom: 10px;
}
.modal-title {
  font-size: 1.55rem;
  font-weight: 800;
  letter-spacing: -0.02em;
  line-height: 1.15;
  color: var(--text);
  margin: 0 36px 24px 0;
}
.modal-body { display: flex; flex-direction: column; gap: 20px; }
.modal-section-label {
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--text-mute);
  margin: 0 0 6px;
}
.modal-section p {
  font-size: 0.97rem;
  line-height: 1.75;
  color: var(--text-soft);
  margin: 0;
}
.modal-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}
.modal-chip {
  font-size: 0.82rem;
  font-weight: 500;
  background: var(--accent-light);
  color: var(--accent);
  padding: 4px 14px;
  border-radius: 999px;
}

/* Modal project image */
.modal-image-wrap {
  margin: 0 -44px 24px;
  background: var(--bg-soft);
}
.modal-image {
  width: 100%;
  max-height: 480px;
  object-fit: contain;
  display: block;
}
.modal-image--cover {
  max-height: 300px;
  object-fit: cover;
}
@media (max-width: 600px) {
  .modal-image-wrap { margin: 0 -24px 20px; }
}

/* Watch on YouTube button */
.modal-yt-btn {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  margin-top: 8px;
  padding: 11px 20px;
  background: #ff0000;
  color: #fff;
  border-radius: var(--radius);
  font-size: 0.92rem;
  font-weight: 600;
  text-decoration: none;
  transition: background .2s, transform .15s, box-shadow .2s;
  box-shadow: 0 4px 12px -2px rgba(255, 0, 0, 0.35);
}
.modal-yt-btn svg {
  width: 18px;
  height: 18px;
  flex-shrink: 0;
}
.modal-yt-btn:hover {
  background: #cc0000;
  color: #fff;
  transform: translateY(-1px);
  box-shadow: 0 6px 16px -2px rgba(255, 0, 0, 0.45);
}

/* =====================================================
   Contact
   ===================================================== */
.section-dark .section-title { color: #fff; }
.contact-inner {
  text-align: center;
}
.contact-lead {
  font-size: 1.1rem;
  color: var(--text-light);
  max-width: 600px;
  margin: 0 auto 48px;
  line-height: 1.7;
}
.contact-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 16px;
  max-width: 800px;
  margin: 0 auto 32px;
}
.contact-card {
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 24px 20px;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: var(--radius);
  color: #fff;
  text-align: center;
  transition: background .2s, border-color .2s, transform .2s;
}
.contact-card:hover {
  background: rgba(255, 255, 255, 0.08);
  border-color: var(--accent);
  transform: translateY(-2px);
  color: #fff;
}
.contact-label {
  font-size: 0.78rem;
  font-weight: 600;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--accent-soft);
}
.contact-value {
  font-size: 1.02rem;
  font-weight: 500;
  /* Long URLs/emails can be tight in narrow cards.
     Allow break only at "natural" points (slashes, hyphens, @), not mid-word. */
  overflow-wrap: anywhere;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.contact-fineprint {
  font-size: 0.88rem;
  color: var(--text-mute);
  max-width: 600px;
  margin: 0 auto;
}

/* =====================================================
   Footer
   ===================================================== */
.footer {
  background: var(--bg-dark-2);
  color: var(--text-light);
  padding: 32px 0;
  border-top: 1px solid rgba(255, 255, 255, 0.08);
}
.footer-inner {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 0.88rem;
  color: var(--text-mute);
  flex-wrap: wrap;
  gap: 12px;
}

/* =====================================================
   Responsive
   ===================================================== */
@media (max-width: 900px) {
  .hero-inner       { grid-template-columns: 1fr; text-align: left; }
  .hero-photo-wrap  { order: -1; margin-bottom: 8px; }
  .hero-photo-frame { width: clamp(180px, 50vw, 260px); }
  .hero-stats       { grid-template-columns: repeat(2, 1fr); }
  .about-grid       { grid-template-columns: 1fr; }
  .card             { position: static; }
  /* Reduce heavy section padding on tablets */
  .section          { padding: clamp(48px, 8vw, 120px) 0; }
}

@media (max-width: 720px) {
  /* Remove backdrop-filter from nav on mobile — the nav's blur creates a ghost
     rendering artifact at y=68px (where nav-links is fixed) in Chrome/Edge,
     appearing as a strike line over the logo. Nav is 98% opaque on mobile
     so the blur effect is not needed here. */
  .nav {
    backdrop-filter: none;
    -webkit-backdrop-filter: none;
  }

  .nav-links {
    position: fixed;
    top: 68px;
    left: 0;
    right: 0;
    background: var(--nav-mobile-bg);
    flex-direction: column;
    padding: 24px var(--pad-x) 32px;
    gap: 8px;
    border-bottom: 1px solid var(--border);
    transform: translateY(-110%);
    /* visibility:hidden makes the closed menu fully invisible —
       background, border, and shadow don't render even though the
       element's transformed geometry still overlaps the nav bar area */
    visibility: hidden;
    transition: transform .25s, visibility 0s .25s;
    box-shadow: var(--shadow);
  }
  .nav-links.open {
    transform: translateY(0);
    visibility: visible;
    transition: transform .25s, visibility 0s 0s;
  }
  .nav-links a    { padding: 10px 0; font-size: 1rem; }
  .nav-links a::after { display: none; }
  .hero-stats     { grid-template-columns: repeat(2, 1fr); }
  .nav-toggle     { display: flex; }
  .nav-toggle.open span:nth-child(1) { transform: translateY(7px) rotate(45deg); }
  .nav-toggle.open span:nth-child(2) { opacity: 0; }
  .nav-toggle.open span:nth-child(3) { transform: translateY(-7px) rotate(-45deg); }
  .footer-inner   { flex-direction: column; text-align: center; }
  /* Job meta wraps more gracefully on narrow screens */
  .job-meta       { flex-direction: column; align-items: flex-start; gap: 6px; }
}

/* =====================================================
   Small phones (≤ 480px)
   ===================================================== */
@media (max-width: 480px) {
  /* Section spacing */
  .section    { padding: 40px 0; }
  .hero       { padding: 40px 0 32px; }

  /* Hero: stack CTA buttons full-width, tighten stats */
  .hero-cta .btn      { flex: 0 1 100%; justify-content: center; }
  .hero-cta           { gap: 10px; margin-bottom: 28px; }
  .hero-stats         { gap: 10px; }
  .stat-num           { font-size: 1.35rem; }
  .hero-summary       { font-size: 0.98rem; }

  /* Cards — reduce padding so content breathes */
  .job                { padding: 20px; }
  .job-bullets li     { padding-left: 16px; font-size: 0.94rem; }
  .skill-card         { padding: 18px 20px; }
  .cert               { padding: 14px 16px; }
  .creative-card      { padding: 18px 20px; }
  .project-card       { padding: 16px 18px; }
  .card               { padding: 20px; }
  .education          { padding: 20px; }
  .contact-card       { padding: 18px 16px; }

  /* Contact value: allow wrapping instead of clipping on narrow cards */
  .contact-value {
    white-space: normal;
    overflow: visible;
    text-overflow: clip;
    word-break: break-word;
    font-size: 0.9rem;
  }

  /* Section titles slightly smaller */
  .section-title      { font-size: 1.7rem; margin-bottom: 28px; }

  /* Timeline role title */
  .job-role           { font-size: 1.1rem; }

  /* Skill/cert grid: force single column so cards don't feel cramped */
  .skills-grid,
  .cert-grid,
  .creative-grid,
  .projects-grid      { grid-template-columns: 1fr; }

  /* Modal: tighter fit on small phones */
  .modal-overlay      { padding: 12px; }
  .modal-dialog       { padding: 20px 16px; border-radius: var(--radius); }
  .modal-image-wrap   { margin: 0 -16px 16px; }
  .modal-title        { font-size: 1.2rem; margin: 0 48px 18px 0; }
  .modal-section p    { font-size: 0.92rem; }
  .modal-yt-btn       { width: 100%; justify-content: center; }
  .modal-body         { gap: 16px; }
}

/* =====================================================
   Profile Video
   ===================================================== */
.section-subtitle {
  font-size: 1.05rem;
  color: var(--text-soft);
  max-width: 640px;
  margin: -24px 0 40px;
  line-height: 1.7;
}
.video-wrapper {
  max-width: 960px;
  margin: 0 auto;
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: 0 20px 60px -10px rgba(0, 0, 0, 0.35);
  background: #000;
  aspect-ratio: 16 / 9;
  /* Override default reveal translateY with a scale+fade for a more cinematic feel */
  transition: opacity 0.9s cubic-bezier(0.22, 1, 0.36, 1),
              transform 0.9s cubic-bezier(0.22, 1, 0.36, 1) !important;
}
.video-wrapper:not(.in) {
  opacity: 0;
  transform: scale(0.97) translateY(24px);
}
.video-wrapper.in {
  opacity: 1;
  transform: scale(1) translateY(0);
}
.video-wrapper video {
  width: 100%;
  height: 100%;
  display: block;
  object-fit: cover;
}

/* =====================================================
   Creative enhancements — scroll progress, hovers, mouse glow
   ===================================================== */

/* 1. Scroll progress bar */
#scroll-progress {
  position: fixed;
  top: 0;
  left: 0;
  width: 0%;
  height: 3px;
  background: linear-gradient(90deg, var(--accent), #7c3aed, #06b6d4);
  z-index: 9999;
  transition: width 0.1s linear;
  pointer-events: none;
}

/* 2. Hero mouse-follow glow — CSS var updated by JS */
.hero {
  position: relative;
}
.hero::after {
  content: '';
  position: absolute;
  inset: 0;
  background: radial-gradient(
    500px circle at var(--mouse-x, -999px) var(--mouse-y, -999px),
    rgba(37, 99, 235, 0.07) 0%,
    transparent 70%
  );
  pointer-events: none;
  z-index: 0;
}
[data-theme="dark"] .hero::after {
  background: radial-gradient(
    500px circle at var(--mouse-x, -999px) var(--mouse-y, -999px),
    rgba(96, 165, 250, 0.09) 0%,
    transparent 70%
  );
}
/* Push hero children above the glow layer */
.hero-inner { position: relative; z-index: 1; }

/* 3. Primary button shimmer sweep */
.btn-primary {
  overflow: hidden;
}
.btn-primary::after {
  content: '';
  position: absolute;
  top: 0;
  left: -80%;
  width: 50%;
  height: 100%;
  background: linear-gradient(90deg, transparent, rgba(255,255,255,0.22), transparent);
  transform: skewX(-18deg);
  transition: left 0.55s ease;
  pointer-events: none;
}
.btn-primary:hover::after { left: 150%; }

/* 4. Job card — blue left accent bar slides in on hover */
.job:hover {
  box-shadow: inset 3px 0 0 var(--accent), var(--shadow);
}

/* 5. Creative card hover — was completely missing */
.creative-card {
  transition: transform .2s, border-color .2s, box-shadow .2s;
}
.creative-card:hover {
  transform: translateY(-3px);
  border-color: var(--accent-soft);
  box-shadow: var(--shadow);
}

/* 6. Skill card — stronger glow on hover */
.skill-card:hover {
  border-color: var(--accent);
  box-shadow: 0 0 0 1px var(--accent), var(--shadow);
}

/* 7. Contact card icon — bounce up on hover */
.contact-icon {
  font-size: 1.6rem;
  display: block;
  margin-bottom: 6px;
  transition: transform 0.35s cubic-bezier(0.34, 1.56, 0.64, 1);
  line-height: 1;
}
.contact-card:hover .contact-icon {
  transform: translateY(-5px) scale(1.15);
}

/* =====================================================
   Animations — hero entrance, scroll reveal, photo float
   ===================================================== */

/* Hero entrance: stagger the text children, fade/scale the photo */
.hero-text > * {
  opacity: 0;
  transform: translateY(18px);
  animation: heroIn 0.75s cubic-bezier(0.22, 1, 0.36, 1) forwards;
}
.hero-text > *:nth-child(1) { animation-delay: 0.05s; }
.hero-text > *:nth-child(2) { animation-delay: 0.14s; }
.hero-text > *:nth-child(3) { animation-delay: 0.22s; }
.hero-text > *:nth-child(4) { animation-delay: 0.30s; }
.hero-text > *:nth-child(5) { animation-delay: 0.38s; }
.hero-text > *:nth-child(6) { animation-delay: 0.46s; }
@keyframes heroIn {
  to { opacity: 1; transform: none; }
}

.hero-photo-wrap {
  opacity: 0;
  transform: scale(0.94);
  animation: heroPhotoIn 0.9s cubic-bezier(0.22, 1, 0.36, 1) 0.2s forwards;
}
@keyframes heroPhotoIn {
  to { opacity: 1; transform: none; }
}

/* Slow gentle float on the framed hero photo */
.hero-photo-frame {
  animation: photoFloat 7s ease-in-out 1.2s infinite;
}
@keyframes photoFloat {
  0%, 100% { transform: translateY(0); }
  50%      { transform: translateY(-10px); }
}

/* Pulse the soft glow behind the photo */
.hero-photo-glow {
  animation: glowPulse 6s ease-in-out infinite;
}
@keyframes glowPulse {
  0%, 100% { transform: scale(1);   opacity: 0.85; }
  50%      { transform: scale(1.1); opacity: 1; }
}

/* Scroll reveal — single elements */
.reveal {
  opacity: 0;
  transform: translateY(22px);
  transition: opacity 0.7s cubic-bezier(0.22, 1, 0.36, 1),
              transform 0.7s cubic-bezier(0.22, 1, 0.36, 1);
  will-change: opacity, transform;
}
.reveal.in {
  opacity: 1;
  transform: none;
}

/* Scroll reveal — staggered children */
.reveal-stagger > * {
  opacity: 0;
  transform: translateY(18px);
  transition: opacity 0.6s cubic-bezier(0.22, 1, 0.36, 1),
              transform 0.6s cubic-bezier(0.22, 1, 0.36, 1);
  will-change: opacity, transform;
}
.reveal-stagger.in > *               { opacity: 1; transform: none; }
.reveal-stagger.in > *:nth-child(1)  { transition-delay: 0.05s; }
.reveal-stagger.in > *:nth-child(2)  { transition-delay: 0.12s; }
.reveal-stagger.in > *:nth-child(3)  { transition-delay: 0.19s; }
.reveal-stagger.in > *:nth-child(4)  { transition-delay: 0.26s; }
.reveal-stagger.in > *:nth-child(5)  { transition-delay: 0.33s; }
.reveal-stagger.in > *:nth-child(6)  { transition-delay: 0.40s; }
.reveal-stagger.in > *:nth-child(7)  { transition-delay: 0.47s; }
.reveal-stagger.in > *:nth-child(8)  { transition-delay: 0.54s; }
.reveal-stagger.in > *:nth-child(9)  { transition-delay: 0.61s; }
.reveal-stagger.in > *:nth-child(10) { transition-delay: 0.68s; }
.reveal-stagger.in > *:nth-child(11) { transition-delay: 0.75s; }
.reveal-stagger.in > *:nth-child(12) { transition-delay: 0.82s; }

/* Honor system preference: kill all motion if requested */
@media (prefers-reduced-motion: reduce) {
  .hero-text > *,
  .hero-photo-wrap,
  .hero-photo-frame,
  .hero-photo-glow,
  .reveal,
  .reveal-stagger > * {
    animation: none !important;
    opacity: 1 !important;
    transform: none !important;
    transition: none !important;
  }
  .eyebrow::before { animation: none !important; }
}
