/* ============================================
   Portfolio — Dark mode · Purple & Magenta
   ============================================ */

:root {
  --bg-primary: #07070c;
  --bg-secondary: #0e0e16;
  --bg-card: #13131e;
  --bg-card-hover: #1a1a28;
  --bg-elevated: #1c1c2c;

  --purple-400: #a78bfa;
  --purple-500: #8b5cf6;
  --purple-600: #7c3aed;
  --magenta-400: #e879f9;
  --magenta-500: #d946ef;
  --magenta-600: #c026d3;

  --gradient-main: linear-gradient(135deg, var(--purple-500) 0%, var(--magenta-500) 100%);
  --gradient-subtle: linear-gradient(135deg, rgba(139, 92, 246, 0.18), rgba(217, 70, 239, 0.1));
  --gradient-glow: radial-gradient(ellipse at center, rgba(139, 92, 246, 0.3), transparent 70%);
  --gradient-section: linear-gradient(180deg, var(--bg-secondary) 0%, rgba(14, 14, 22, 0.5) 100%);

  --text-primary: #f4f4fa;
  --text-secondary: #a8a8c0;
  --text-muted: #6e6e88;

  --border: rgba(255, 255, 255, 0.07);
  --border-accent: rgba(139, 92, 246, 0.38);

  --font-sans: 'Inter', system-ui, -apple-system, sans-serif;
  --font-mono: 'JetBrains Mono', monospace;

  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 20px;
  --radius-full: 9999px;

  --shadow-card: 0 4px 24px rgba(0, 0, 0, 0.45);
  --shadow-glow: 0 0 40px rgba(139, 92, 246, 0.18), 0 0 64px rgba(217, 70, 239, 0.08);

  --nav-height: 72px;
  --container-padding: 24px;
  --section-padding: 100px;
  --transition: 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

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

html {
  scroll-behavior: smooth;
  scroll-padding-top: var(--nav-height);
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
  color-scheme: dark;
}

body {
  font-family: var(--font-sans);
  background-color: var(--bg-primary);
  background-image:
    radial-gradient(ellipse 90% 60% at 10% -5%, rgba(139, 92, 246, 0.14), transparent 55%),
    radial-gradient(ellipse 70% 50% at 95% 5%, rgba(217, 70, 239, 0.1), transparent 50%),
    radial-gradient(ellipse 60% 40% at 50% 105%, rgba(124, 58, 237, 0.08), transparent 55%);
  background-attachment: fixed;
  color: var(--text-primary);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  overflow-x: clip;
  min-width: 320px;
}

::selection {
  background: rgba(139, 92, 246, 0.4);
  color: var(--text-primary);
}

body.nav-open {
  overflow: hidden;
  touch-action: none;
}

.container {
  width: 100%;
  max-width: 1140px;
  margin: 0 auto;
  padding: 0 var(--container-padding);
}

a {
  color: inherit;
  text-decoration: none;
}

ul {
  list-style: none;
}

img {
  max-width: 100%;
  display: block;
}

.gradient-text {
  background: var(--gradient-main);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

/* ---- Navigation ---- */
.nav {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 100;
  height: var(--nav-height);
  background: rgba(7, 7, 12, 0.82);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border-bottom: 1px solid rgba(139, 92, 246, 0.12);
  transition: background var(--transition), box-shadow var(--transition), border-color var(--transition);
}

.nav--scrolled {
  background: rgba(7, 7, 12, 0.96);
  border-bottom-color: rgba(139, 92, 246, 0.2);
  box-shadow: 0 4px 30px rgba(0, 0, 0, 0.35), 0 0 40px rgba(139, 92, 246, 0.06);
}

.nav__inner {
  display: flex;
  align-items: center;
  justify-content: center;
  height: 100%;
}

.nav__links {
  display: flex;
  align-items: center;
  gap: 8px;
}

.nav__links a {
  padding: 8px 16px;
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--text-secondary);
  border-radius: var(--radius-sm);
  transition: color var(--transition), background var(--transition);
}

.nav__links a:hover {
  color: var(--purple-400);
  background: rgba(139, 92, 246, 0.1);
}

.nav__cta {
  background: var(--gradient-main) !important;
  color: white !important;
  padding: 8px 20px !important;
  border-radius: var(--radius-full) !important;
}

.nav__cta:hover {
  opacity: 0.9;
  transform: translateY(-1px);
}

.nav__toggle {
  display: none;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  gap: 5px;
  background: none;
  border: none;
  cursor: pointer;
  padding: 10px;
  min-width: 44px;
  min-height: 44px;
  -webkit-tap-highlight-color: transparent;
}

.nav__toggle span {
  display: block;
  width: 24px;
  height: 2px;
  background: var(--text-primary);
  border-radius: 2px;
  transition: var(--transition);
}

/* ---- Buttons ---- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 14px 28px;
  min-height: 48px;
  font-size: 0.9375rem;
  font-weight: 600;
  border-radius: var(--radius-full);
  border: none;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  transition: transform var(--transition), box-shadow var(--transition), opacity var(--transition);
}

.btn--primary {
  background: var(--gradient-main);
  color: white;
  box-shadow: 0 4px 20px rgba(139, 92, 246, 0.35);
}

.btn--primary:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 30px rgba(217, 70, 239, 0.4);
}

.btn--ghost {
  background: transparent;
  color: var(--text-primary);
  border: 1px solid var(--border-accent);
}

.btn--ghost:hover {
  background: rgba(139, 92, 246, 0.1);
  border-color: var(--purple-500);
}

.btn--full {
  width: 100%;
}

/* ---- Hero ---- */
.hero {
  position: relative;
  min-height: 100vh;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding: calc(var(--nav-height) + 40px) 0 112px;
  padding-bottom: max(112px, env(safe-area-inset-bottom, 0px));
  overflow-x: clip;
}

.hero__glow {
  position: absolute;
  border-radius: 50%;
  pointer-events: none;
  filter: blur(80px);
}

.hero__glow--1 {
  width: 600px;
  height: 600px;
  top: -200px;
  right: -100px;
  background: rgba(139, 92, 246, 0.22);
}

.hero__glow--2 {
  width: 500px;
  height: 500px;
  bottom: -150px;
  left: -150px;
  background: rgba(217, 70, 239, 0.16);
}

.hero__content {
  position: relative;
  z-index: 1;
}

.hero__layout {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 48px 64px;
  align-items: center;
}

.hero__main {
  min-width: 0;
}

.hero__photo {
  margin: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 14px;
  flex-shrink: 0;
}

.hero__photo-ring {
  position: relative;
  width: clamp(220px, 28vw, 300px);
  height: clamp(220px, 28vw, 300px);
  border-radius: 50%;
  padding: 4px;
  background: var(--gradient-main);
  box-shadow: 0 0 50px rgba(139, 92, 246, 0.25), 0 0 80px rgba(217, 70, 239, 0.12);
}

.hero__photo-ring img {
  width: 100%;
  height: 100%;
  border-radius: 50%;
  object-fit: cover;
  display: block;
  background: var(--bg-card);
  border: 3px solid var(--bg-primary);
}

.hero__photo--empty .hero__photo-ring img {
  opacity: 0;
}

.hero__photo-fallback {
  position: absolute;
  inset: 4px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: clamp(2.5rem, 6vw, 3.5rem);
  font-weight: 700;
  letter-spacing: 0.04em;
  background: linear-gradient(145deg, var(--bg-card), var(--bg-elevated));
  color: var(--purple-400);
  border: 3px solid var(--bg-primary);
}

.hero__photo:not(.hero__photo--empty) .hero__photo-fallback {
  display: none;
}

.hero__photo-hint {
  font-size: 0.6875rem;
  color: var(--text-muted);
  text-align: center;
  max-width: 220px;
  line-height: 1.5;
  transition: opacity var(--transition);
}

.hero__photo-hint code {
  font-family: var(--font-mono);
  font-size: 0.625rem;
  color: var(--magenta-400);
}

.hero__photo:not(.hero__photo--empty) .hero__photo-hint {
  opacity: 0;
  height: 0;
  overflow: hidden;
  margin: 0;
}

.hero__eyebrow {
  font-size: clamp(0.75rem, 2vw, 0.875rem);
  font-weight: 500;
  color: var(--purple-400);
  letter-spacing: 0.06em;
  text-transform: uppercase;
  margin-bottom: 20px;
  line-height: 1.5;
}

.hero__title {
  font-size: clamp(2.75rem, 7vw, 4.5rem);
  font-weight: 700;
  line-height: 1.1;
  letter-spacing: -0.03em;
  margin-bottom: 24px;
}

.hero__subtitle {
  font-size: clamp(1rem, 2.5vw, 1.2rem);
  color: var(--text-secondary);
  max-width: 620px;
  line-height: 1.7;
  margin-bottom: 40px;
}

.hero__actions {
  display: flex;
  flex-wrap: wrap;
  gap: 16px;
  margin-bottom: 64px;
}

.hero__stats {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 24px 32px;
  padding-top: 40px;
  margin-bottom: 24px;
  border-top: 1px solid rgba(139, 92, 246, 0.2);
}

.stat {
  min-width: 0;
}

.stat__value {
  display: block;
  font-size: 2rem;
  font-weight: 700;
  background: var(--gradient-main);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.stat__label {
  display: block;
  font-size: 0.75rem;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  line-height: 1.45;
  text-wrap: balance;
}

.hero__scroll {
  position: absolute;
  bottom: 32px;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  color: var(--text-muted);
  font-size: 0.75rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  pointer-events: none;
  z-index: 0;
}

.hero__scroll-line {
  width: 1px;
  height: 40px;
  background: linear-gradient(to bottom, var(--purple-500), transparent);
  animation: scrollPulse 2s ease-in-out infinite;
}

@keyframes scrollPulse {
  0%, 100% { opacity: 0.3; transform: scaleY(0.6); }
  50% { opacity: 1; transform: scaleY(1); }
}

/* ---- Sections ---- */
.section {
  padding: var(--section-padding) 0;
  position: relative;
}

.section--alt {
  background: var(--gradient-section);
}

.section--contact {
  background: var(--gradient-section);
  padding-bottom: 120px;
}

.section__header {
  max-width: 600px;
  margin-bottom: 56px;
}

.section__tag {
  display: inline-block;
  font-size: 0.8125rem;
  font-weight: 600;
  color: var(--magenta-400);
  text-transform: uppercase;
  letter-spacing: 0.1em;
  margin-bottom: 12px;
  padding: 4px 12px;
  background: rgba(217, 70, 239, 0.08);
  border: 1px solid rgba(217, 70, 239, 0.2);
  border-radius: var(--radius-full);
}

.section__title {
  font-size: clamp(2rem, 4vw, 2.75rem);
  font-weight: 700;
  letter-spacing: -0.02em;
  margin-bottom: 16px;
}

.section__desc {
  color: var(--text-secondary);
  font-size: clamp(0.9375rem, 2vw, 1.05rem);
  line-height: 1.7;
}

/* ---- Timeline (Experience) ---- */
.timeline {
  position: relative;
  padding-left: 32px;
}

.timeline::before {
  content: '';
  position: absolute;
  left: 7px;
  top: 8px;
  bottom: 8px;
  width: 2px;
  background: linear-gradient(to bottom, var(--purple-500), var(--magenta-500), transparent);
}

.timeline__item {
  position: relative;
  padding-bottom: 40px;
}

.timeline__item:last-child {
  padding-bottom: 0;
}

.timeline__marker {
  position: absolute;
  left: -32px;
  top: 8px;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: var(--bg-primary);
  border: 2px solid var(--purple-500);
  box-shadow: 0 0 12px rgba(139, 92, 246, 0.5);
}

.timeline__card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 28px 32px;
  transition: border-color var(--transition), box-shadow var(--transition), transform var(--transition);
}

.timeline__card:hover {
  border-color: var(--border-accent);
  box-shadow: var(--shadow-glow);
  transform: translateX(4px);
}

.timeline__meta {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 12px;
}

.timeline__meta time {
  font-family: var(--font-mono);
  font-size: 0.8125rem;
  color: var(--purple-400);
}

.timeline__badge {
  font-size: 0.6875rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  padding: 4px 10px;
  background: var(--gradient-subtle);
  border: 1px solid var(--border-accent);
  border-radius: var(--radius-full);
  color: var(--magenta-400);
}

.timeline__card h3 {
  font-size: 1.25rem;
  font-weight: 600;
  margin-bottom: 4px;
}

.timeline__company {
  font-size: 0.9375rem;
  color: var(--text-muted);
  margin-bottom: 16px;
}

.timeline__desc {
  color: var(--text-secondary);
  font-size: 0.9375rem;
  line-height: 1.7;
  margin-bottom: 20px;
}

.timeline__tags {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.timeline__tags li {
  font-family: var(--font-mono);
  font-size: 0.75rem;
  padding: 4px 12px;
  background: rgba(139, 92, 246, 0.1);
  border: 1px solid rgba(139, 92, 246, 0.2);
  border-radius: var(--radius-full);
  color: var(--purple-400);
}

/* ---- Skills ---- */
.skills-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 24px;
}

.skill-category {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 28px;
  transition: border-color var(--transition);
}

.skill-category:hover {
  border-color: var(--border-accent);
}

.skill-category__icon {
  width: 44px;
  height: 44px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--gradient-subtle);
  border-radius: var(--radius-md);
  margin-bottom: 16px;
  color: var(--purple-400);
}

.skill-category__icon svg {
  width: 22px;
  height: 22px;
}

.skill-category h3 {
  font-size: 1.05rem;
  font-weight: 600;
  margin-bottom: 20px;
}

.skill-bar {
  margin-bottom: 16px;
}

.skill-bar:last-child {
  margin-bottom: 0;
}

.skill-bar__header {
  display: flex;
  justify-content: space-between;
  font-size: 0.8125rem;
  margin-bottom: 8px;
  color: var(--text-secondary);
}

.skill-bar__header span:last-child {
  color: var(--purple-400);
  font-family: var(--font-mono);
}

.skill-bar__track {
  height: 6px;
  background: rgba(255, 255, 255, 0.06);
  border-radius: var(--radius-full);
  overflow: hidden;
}

.skill-bar__fill {
  height: 100%;
  width: 0;
  background: var(--gradient-main);
  border-radius: var(--radius-full);
  transition: width 1.2s cubic-bezier(0.4, 0, 0.2, 1);
}

.skill-bar__fill.animate {
  width: var(--width);
}

.skill-pills {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.skill-pills span {
  font-size: 0.8125rem;
  padding: 6px 14px;
  background: rgba(217, 70, 239, 0.08);
  border: 1px solid rgba(217, 70, 239, 0.15);
  border-radius: var(--radius-full);
  color: var(--text-secondary);
  transition: color var(--transition), border-color var(--transition);
}

.skill-pills span:hover {
  color: var(--magenta-400);
  border-color: rgba(217, 70, 239, 0.35);
}

/* ---- Cards (Academics) ---- */
.cards-grid {
  display: grid;
  gap: 24px;
}

.cards-grid--3 {
  grid-template-columns: repeat(2, 1fr);
  max-width: 800px;
}

.card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 32px;
  transition: border-color var(--transition), transform var(--transition), box-shadow var(--transition);
}

.card:hover {
  border-color: var(--border-accent);
  transform: translateY(-4px);
  box-shadow: var(--shadow-glow);
}

.card__icon {
  width: 48px;
  height: 48px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--gradient-subtle);
  border-radius: var(--radius-md);
  color: var(--purple-400);
  margin-bottom: 20px;
}

.card__icon svg {
  width: 24px;
  height: 24px;
}

.card__year {
  font-family: var(--font-mono);
  font-size: 0.75rem;
  color: var(--magenta-400);
  display: block;
  margin-bottom: 12px;
}

.card h3 {
  font-size: 1.125rem;
  font-weight: 600;
  margin-bottom: 6px;
}

.card__institution {
  font-size: 0.875rem;
  color: var(--purple-400);
  margin-bottom: 16px;
}

.card__desc {
  font-size: 0.875rem;
  color: var(--text-secondary);
  line-height: 1.7;
}

/* ---- Publications ---- */
.pub-row {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 24px;
  align-items: stretch;
}

.pub-card {
  display: flex;
  flex-direction: column;
  position: relative;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  overflow: hidden;
  transition: border-color var(--transition), box-shadow var(--transition), transform var(--transition);
}

.pub-card:hover {
  border-color: var(--border-accent);
  box-shadow: var(--shadow-glow);
  transform: translateY(-4px);
}

.pub-card__year {
  display: inline-block;
  font-family: var(--font-mono);
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--text-primary);
  background: rgba(139, 92, 246, 0.12);
  border: 1px solid var(--border-accent);
  padding: 4px 10px;
  border-radius: var(--radius-full);
  margin-bottom: 12px;
}

.pub-card__body {
  display: flex;
  flex-direction: column;
  flex: 1;
  padding: 20px;
  position: relative;
}

.pub-card__body h3 {
  font-size: 0.9375rem;
  font-weight: 600;
  line-height: 1.45;
  margin-bottom: 8px;
}

.pub-card__venue {
  font-size: 0.75rem;
  color: var(--magenta-400);
  margin-bottom: 10px;
}

.pub-card__abstract {
  font-size: 0.8125rem;
  color: var(--text-secondary);
  line-height: 1.65;
  flex: 1;
  margin-bottom: 12px;
}

.pub-card__link {
  font-size: 0.8125rem;
  font-weight: 500;
  color: var(--purple-400);
  margin-top: auto;
  transition: color var(--transition);
}

.pub-card__link:hover {
  color: var(--magenta-400);
}

/* ---- Certifications ---- */
.cert-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 20px;
}

.cert-grid--single {
  grid-template-columns: minmax(280px, 420px);
  justify-content: center;
}

.cert-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 28px;
  text-align: center;
  transition: border-color var(--transition), transform var(--transition), box-shadow var(--transition);
}

.cert-card:hover {
  border-color: var(--border-accent);
  transform: translateY(-4px);
  box-shadow: var(--shadow-glow);
}

.cert-card__badge {
  display: inline-block;
  font-family: var(--font-mono);
  font-size: 0.75rem;
  font-weight: 600;
  padding: 6px 14px;
  background: var(--gradient-main);
  color: white;
  border-radius: var(--radius-full);
  margin-bottom: 16px;
}

.cert-card h3 {
  font-size: 0.9375rem;
  font-weight: 600;
  margin-bottom: 6px;
  line-height: 1.4;
}

.cert-card p {
  font-size: 0.8125rem;
  color: var(--text-muted);
  margin-bottom: 12px;
}

.cert-card__date {
  font-family: var(--font-mono);
  font-size: 0.75rem;
  color: var(--purple-400);
}

/* ---- Contact ---- */
.contact-wrapper {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 64px;
  align-items: start;
}

.contact-details {
  display: flex;
  flex-direction: column;
  gap: 16px;
  margin-top: 32px;
}

.contact-detail {
  display: flex;
  align-items: flex-start;
  gap: 14px;
  font-size: 0.9375rem;
  color: var(--text-secondary);
  transition: color var(--transition);
  word-break: break-word;
  overflow-wrap: anywhere;
}

a.contact-detail:hover {
  color: var(--purple-400);
}

.contact-detail svg {
  width: 20px;
  height: 20px;
  flex-shrink: 0;
  color: var(--purple-400);
}

.contact-form {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 36px;
}

.form-group {
  margin-bottom: 20px;
}

.form-group label {
  display: block;
  font-size: 0.8125rem;
  font-weight: 500;
  color: var(--text-secondary);
  margin-bottom: 8px;
}

.form-group input,
.form-group textarea {
  width: 100%;
  padding: 14px 16px;
  font-family: var(--font-sans);
  font-size: 0.9375rem;
  color: var(--text-primary);
  background: var(--bg-primary);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  outline: none;
  transition: border-color var(--transition), box-shadow var(--transition);
  resize: vertical;
}

.form-group input::placeholder,
.form-group textarea::placeholder {
  color: var(--text-muted);
}

.form-group input:focus,
.form-group textarea:focus {
  border-color: var(--purple-500);
  box-shadow: 0 0 0 3px rgba(139, 92, 246, 0.2), 0 0 20px rgba(217, 70, 239, 0.08);
}

.form-note {
  margin-top: 12px;
  font-size: 0.875rem;
  text-align: center;
  min-height: 1.4em;
}

.form-note.success {
  color: #34d399;
}

.form-note.error {
  color: #f87171;
}

/* ---- Footer ---- */
.footer {
  padding: 32px 0;
  padding-bottom: max(32px, env(safe-area-inset-bottom, 0px));
  border-top: 1px solid rgba(139, 92, 246, 0.15);
  background: rgba(7, 7, 12, 0.6);
}

.footer__inner {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 0.8125rem;
  color: var(--text-muted);
}

/* ---- Animations (scroll reveal) ---- */
.reveal {
  opacity: 0;
  transform: translateY(24px);
  transition: opacity 0.7s ease, transform 0.7s ease;
}

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

/* ---- Responsive ---- */

/* Narrow desktop — stats sit in a tighter text column beside the photo */
@media (max-width: 1280px) and (min-width: 1101px) {
  .hero__stats {
    gap: 16px 20px;
  }

  .stat__value {
    font-size: 1.75rem;
  }

  .stat__label {
    font-size: 0.6875rem;
    letter-spacing: 0.04em;
  }
}

/* Large tablet & small desktop */
@media (max-width: 1100px) {
  .hero__layout {
    grid-template-columns: 1fr;
    gap: 40px;
    text-align: center;
  }

  .hero__main {
    display: flex;
    flex-direction: column;
    align-items: center;
  }

  .hero__subtitle {
    max-width: 100%;
  }

  .hero__actions {
    justify-content: center;
  }

  .hero__stats {
    justify-items: center;
    width: 100%;
    max-width: 720px;
    margin-inline: auto;
  }

  .hero__photo {
    order: -1;
  }

  .pub-row {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (max-width: 1024px) {
  :root {
    --section-padding: 80px;
  }

  .skills-grid {
    grid-template-columns: 1fr;
  }

  .cards-grid--3 {
    grid-template-columns: 1fr;
    max-width: none;
  }

  .contact-wrapper {
    grid-template-columns: 1fr;
    gap: 48px;
  }

  .section__header {
    margin-bottom: 40px;
  }
}

/* Tablet portrait */
@media (max-width: 768px) {
  :root {
    --nav-height: 64px;
    --container-padding: 20px;
    --section-padding: 64px;
  }

  .nav {
    padding-left: env(safe-area-inset-left, 0);
    padding-right: env(safe-area-inset-right, 0);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    background: rgba(7, 7, 12, 0.92);
  }

  .nav.nav--open {
    height: 100vh;
    height: 100dvh;
    overflow: hidden;
    backdrop-filter: none;
    -webkit-backdrop-filter: none;
    background: rgba(7, 7, 12, 0.98);
  }

  .nav__inner {
    position: relative;
    z-index: 2;
    justify-content: flex-end;
  }

  .nav__toggle {
    display: flex;
    position: relative;
    z-index: 3;
  }

  .nav__links {
    position: absolute;
    top: var(--nav-height);
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 1;
    flex-direction: column;
    align-items: stretch;
    gap: 4px;
    background: rgba(7, 7, 12, 0.98);
    padding: 16px var(--container-padding) max(24px, env(safe-area-inset-bottom, 0px));
    border-top: 1px solid var(--border);
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    overscroll-behavior: contain;
    transform: translateX(100%);
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
    transition: transform var(--transition), opacity var(--transition), visibility var(--transition);
  }

  .nav__links.open {
    transform: translateX(0);
    opacity: 1;
    visibility: visible;
    pointer-events: all;
  }

  .nav__links a {
    width: 100%;
    text-align: center;
    padding: 14px 16px;
    min-height: 48px;
    display: flex;
    align-items: center;
    justify-content: center;
    -webkit-tap-highlight-color: transparent;
  }

  .nav__links li {
    width: 100%;
  }

  .nav__toggle.active span:nth-child(1) {
    transform: rotate(45deg) translate(5px, 5px);
  }

  .nav__toggle.active span:nth-child(2) {
    opacity: 0;
  }

  .nav__toggle.active span:nth-child(3) {
    transform: rotate(-45deg) translate(5px, -5px);
  }

  .hero {
    padding-top: calc(var(--nav-height) + 24px);
    padding-bottom: 48px;
    min-height: auto;
  }

  .hero__glow--1 {
    width: 320px;
    height: 320px;
    top: -80px;
    right: -80px;
  }

  .hero__glow--2 {
    width: 280px;
    height: 280px;
    bottom: -60px;
    left: -80px;
  }

  .hero__actions {
    margin-bottom: 40px;
    width: 100%;
  }

  .hero__stats {
    gap: 20px 24px;
    padding-top: 32px;
    margin-bottom: 16px;
  }

  .stat__value {
    font-size: 1.75rem;
  }

  .hero__scroll {
    display: none;
  }

  .section--contact {
    padding-bottom: max(80px, env(safe-area-inset-bottom, 0px));
  }

  .timeline {
    padding-left: 20px;
  }

  .timeline::before {
    left: 5px;
  }

  .timeline__marker {
    left: -20px;
    width: 12px;
    height: 12px;
  }

  .timeline__card {
    padding: 20px;
  }

  .timeline__card:hover {
    transform: none;
  }

  .timeline__card h3 {
    font-size: 1.1rem;
  }

  .timeline__meta {
    flex-wrap: wrap;
  }

  .skill-category {
    padding: 22px;
  }

  .card {
    padding: 24px;
  }

  .pub-row {
    grid-template-columns: 1fr;
    gap: 20px;
  }

  .pub-card {
    min-width: 0;
  }

  .contact-form {
    padding: 24px;
  }

  .form-group input,
  .form-group textarea {
    font-size: 16px;
  }

  .footer__inner {
    flex-direction: column;
    gap: 8px;
    text-align: center;
  }
}

/* Mobile */
@media (max-width: 480px) {
  :root {
    --container-padding: 16px;
    --section-padding: 56px;
  }

  .hero__title {
    font-size: clamp(2rem, 10vw, 2.75rem);
  }

  .hero__photo-ring {
    width: clamp(180px, 50vw, 240px);
    height: clamp(180px, 50vw, 240px);
  }

  .hero__actions {
    flex-direction: column;
    gap: 12px;
  }

  .btn {
    width: 100%;
  }

  .hero__stats {
    grid-template-columns: 1fr;
    justify-items: center;
    gap: 20px;
  }

  .stat {
    text-align: center;
    max-width: 280px;
  }

  .section__header {
    margin-bottom: 32px;
  }

  .section__title {
    font-size: clamp(1.625rem, 7vw, 2rem);
  }

  .timeline__desc,
  .timeline__company {
    font-size: 0.875rem;
  }

  .skill-pills span {
    font-size: 0.75rem;
    padding: 5px 12px;
  }

  .pub-card__body {
    padding: 16px;
  }

  .pub-card__body h3 {
    font-size: 0.875rem;
  }

  .cert-grid--single {
    grid-template-columns: 1fr;
  }

  .cert-card {
    padding: 22px;
  }
}

/* Very small phones */
@media (max-width: 360px) {
  .hero__eyebrow {
    letter-spacing: 0.04em;
  }

  .timeline__tags li {
    font-size: 0.6875rem;
    padding: 3px 10px;
  }
}

/* Touch devices — reduce hover-only motion */
@media (hover: none) and (pointer: coarse) {
  .timeline__card:hover,
  .card:hover,
  .pub-card:hover,
  .cert-card:hover {
    transform: none;
  }

  .btn--primary:hover,
  .btn--ghost:hover {
    transform: none;
  }
}

/* Reduced motion preference */
@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }

  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }

  .reveal {
    opacity: 1;
    transform: none;
  }
}
