/* Design system: tokens */
:root {
  --bg: #070b14;
  --bg-elev: rgba(255, 255, 255, 0.06);
  --bg-elev-2: rgba(255, 255, 255, 0.08);
  --text: rgba(255, 255, 255, 0.92);
  --muted: rgba(255, 255, 255, 0.72);
  --subtle: rgba(255, 255, 255, 0.56);
  --border: rgba(255, 255, 255, 0.14);
  --shadow: 0 18px 50px rgba(0, 0, 0, 0.45);

  --accent: #6d5efc;
  --accent-2: #36d1dc;
  --accent-warm: #f7b733;
  /* Shared purple → cyan (hero accent + back-to-top icon / frame) */
  --accent-gradient: linear-gradient(90deg, rgb(109, 94, 252), rgb(54, 209, 220));
  --accent-gradient-border: linear-gradient(135deg, rgb(109, 94, 252), rgb(54, 209, 220));
  --to-top-fill: rgba(14, 18, 32, 0.96);
  --to-top-fill-hover: rgba(22, 26, 44, 0.99);

  --radius-sm: 12px;
  --radius-md: 18px;
  --radius-lg: 26px;

  --container: 1120px;
  --header-h: 72px;

  --ease: cubic-bezier(0.2, 0.8, 0.2, 1);
}

@media (prefers-color-scheme: light) {
  :root {
    --bg: #f7f8fb;
    --bg-elev: rgba(10, 20, 40, 0.04);
    --bg-elev-2: rgba(10, 20, 40, 0.06);
    --text: rgba(10, 20, 40, 0.92);
    --muted: rgba(10, 20, 40, 0.72);
    --subtle: rgba(10, 20, 40, 0.56);
    --border: rgba(10, 20, 40, 0.12);
    --shadow: 0 18px 50px rgba(10, 20, 40, 0.12);
  }
}

/* Base */
*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
  scroll-padding-top: calc(var(--header-h) + 18px);
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
}

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

body {
  margin: 0;
  min-height: 100vh;
  min-height: 100dvh;
  font-family: Inter, system-ui, -apple-system, Segoe UI, Roboto, Arial, sans-serif;
  color: var(--text);
  background: radial-gradient(1200px 600px at 30% -10%, rgba(109, 94, 252, 0.24), transparent 60%),
    radial-gradient(900px 520px at 85% 10%, rgba(54, 209, 220, 0.18), transparent 55%),
    var(--bg);
  line-height: 1.55;
  overflow-x: hidden;
}

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

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

button {
  font: inherit;
}

::selection {
  background: rgba(109, 94, 252, 0.35);
}

.container {
  width: 100%;
  max-width: var(--container);
  padding-left: max(18px, env(safe-area-inset-left));
  padding-right: max(18px, env(safe-area-inset-right));
  margin: 0 auto;
}

/* Text robustness on tiny screens / long strings */
p,
li,
a,
span,
div {
  overflow-wrap: anywhere;
  word-break: normal;
}

.skip-link {
  position: absolute;
  left: 12px;
  top: 10px;
  padding: 10px 12px;
  border-radius: 10px;
  background: rgba(0, 0, 0, 0.8);
  color: #fff;
  transform: translateY(-200%);
  transition: transform 220ms var(--ease);
  z-index: 9999;
}

.skip-link:focus {
  transform: translateY(0);
  outline: 2px solid rgba(255, 255, 255, 0.7);
  outline-offset: 2px;
}

/* Header / Nav */
.site-header {
  position: sticky;
  top: 0;
  z-index: 50;
  height: var(--header-h);
  display: grid;
  align-items: center;
  background: rgba(7, 11, 20, 0.6);
  backdrop-filter: blur(16px);
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
  padding-top: env(safe-area-inset-top);
}

@media (prefers-color-scheme: light) {
  .site-header {
    background: rgba(247, 248, 251, 0.7);
  }
}

html.scrolled .site-header {
  border-bottom-color: var(--border);
}

.header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}

.brand-mark {
  width: 40px;
  height: 40px;
  border-radius: 12px;
  display: grid;
  place-items: center;
  font-weight: 800;
  letter-spacing: -0.04em;
  background: linear-gradient(135deg, rgba(109, 94, 252, 1), rgba(54, 209, 220, 1));
  color: rgba(255, 255, 255, 0.96);
  box-shadow: 0 10px 26px rgba(109, 94, 252, 0.22);
}

.brand-text {
  font-weight: 700;
  letter-spacing: -0.02em;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.nav-toggle {
  display: none;
  border: 1px solid var(--border);
  background: var(--bg-elev);
  border-radius: 12px;
  padding: 10px 12px;
  cursor: pointer;
}

.nav-toggle-bars {
  display: block;
  width: 20px;
  height: 2px;
  background: currentColor;
  position: relative;
  border-radius: 999px;
}

.nav-toggle-bars::before,
.nav-toggle-bars::after {
  content: "";
  position: absolute;
  left: 0;
  width: 20px;
  height: 2px;
  background: currentColor;
  border-radius: 999px;
}

.nav-toggle-bars::before {
  top: -6px;
}
.nav-toggle-bars::after {
  top: 6px;
}

.site-nav {
  display: flex;
  align-items: center;
  gap: 10px;
}

.nav-link {
  padding: 12px 10px; /* touch target */
  border-radius: 12px;
  color: var(--muted);
  transition: background 180ms var(--ease), color 180ms var(--ease);
}

.nav-link:hover {
  background: var(--bg-elev);
  color: var(--text);
}

.nav-cta {
  margin-left: 6px;
  padding: 12px 12px; /* touch target */
  border-radius: 12px;
  border: 1px solid rgba(109, 94, 252, 0.5);
  background: linear-gradient(180deg, rgba(109, 94, 252, 0.22), rgba(109, 94, 252, 0.1));
  color: var(--text);
  font-weight: 650;
  transition: transform 180ms var(--ease), box-shadow 180ms var(--ease), border-color 180ms var(--ease);
}

.nav-cta:hover {
  transform: translateY(-1px);
  border-color: rgba(109, 94, 252, 0.8);
  box-shadow: 0 12px 28px rgba(109, 94, 252, 0.18);
}

/* Hero */
.hero {
  position: relative;
  padding: 32px 0 12px;
}

.hero-bg {
  position: absolute;
  inset: 0;
  pointer-events: none;
  background: radial-gradient(700px 520px at 15% 20%, rgba(247, 183, 51, 0.12), transparent 65%),
    radial-gradient(820px 620px at 70% 0%, rgba(54, 209, 220, 0.12), transparent 58%);
  opacity: 0.9;
}

.hero-grid {
  display: grid;
  align-items: center;
  grid-template-columns: 1.3fr 0.9fr;
  gap: 22px;
  position: relative;
}

.eyebrow {
  color: var(--subtle);
  margin: 0 0 10px;
  font-weight: 600;
  letter-spacing: 0.02em;
}

.hero-title {
  margin: 0;
  font-size: clamp(2.05rem, 3.4vw, 3.2rem);
  letter-spacing: -0.04em;
  line-height: 1.06;
}

/* Gradient text: span must contain only text (no <br> inside) for consistent clip on iOS/Android WebKit */
.hero-accent {
  display: inline;
  background-color: transparent;
  background-image: var(--accent-gradient);
  background-repeat: no-repeat;
  background-size: 100% 100%;
  background-position: 0 0;
  /* Fallback if clipping is unsupported (avoids invisible text) */
  color: rgb(109, 94, 252);
  -webkit-box-decoration-break: clone;
  box-decoration-break: clone;
}

@supports (-webkit-background-clip: text) or (background-clip: text) {
  .hero-accent {
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
    -webkit-text-fill-color: transparent;
    /* Layer promotion: fixes missing/wrong gradient paint on some mobile viewports */
    transform: translate3d(0, 0, 0);
    -webkit-font-smoothing: antialiased;
  }
}

@media (forced-colors: active) {
  .hero-accent {
    background-image: none;
    transform: none;
    color: LinkText;
    -webkit-text-fill-color: LinkText;
  }
}

.hero-subtitle {
  margin: 14px 0 0;
  max-width: 62ch;
  color: var(--muted);
  font-size: clamp(1.03rem, 1.25vw, 1.14rem);
}

.hero-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 18px;
}

.hero-metrics {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
  margin-top: 18px;
}

.metric {
  padding: 12px 12px;
  border-radius: var(--radius-md);
  border: 1px solid var(--border);
  background: var(--bg-elev);
}

.metric-value {
  font-weight: 750;
  letter-spacing: -0.02em;
}

.metric-label {
  color: var(--subtle);
  font-size: 0.92rem;
  margin-top: 2px;
}

.hero-card {
  border-radius: var(--radius-lg);
  border: 1px solid var(--border);
  background: linear-gradient(180deg, var(--bg-elev-2), var(--bg-elev));
  box-shadow: var(--shadow);
  overflow: hidden;
}

.hero-photo {
  aspect-ratio: 1 / 1;
  background: radial-gradient(420px 320px at 30% 30%, rgba(109, 94, 252, 0.22), transparent 60%),
    radial-gradient(420px 320px at 70% 70%, rgba(54, 209, 220, 0.18), transparent 60%);
  display: grid;
  place-items: center;
  padding: 18px;
}

.hero-photo img {
  border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, 0.16);
  box-shadow: 0 18px 60px rgba(0, 0, 0, 0.35);
  width: min(260px, 80%);
  height: auto;
}

.hero-card-body {
  padding: 14px 16px 16px;
}

.hero-name {
  margin: 0;
  font-weight: 800;
  letter-spacing: -0.02em;
}

.hero-role {
  margin: 6px 0 0;
  color: var(--muted);
}

.hero-links {
  display: flex;
  gap: 10px;
  margin-top: 12px;
}

.icon-link {
  width: 42px;
  height: 42px;
  border-radius: 14px;
  display: grid;
  place-items: center;
  border: 1px solid var(--border);
  background: var(--bg-elev);
  color: var(--text);
  transition: transform 180ms var(--ease), background 180ms var(--ease);
}

.icon-link:hover {
  transform: translateY(-1px);
  background: var(--bg-elev-2);
}

.hero-availability {
  margin: 12px 0 0;
  color: var(--subtle);
  font-size: 0.94rem;
}

/* Sections */
.section {
  padding: 62px 0;
}

.section-alt {
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.02), transparent 20%),
    linear-gradient(180deg, transparent, rgba(255, 255, 255, 0.02));
  border-top: 1px solid rgba(255, 255, 255, 0.06);
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
}

.section-head {
  display: grid;
  gap: 10px;
  margin-bottom: 18px;
}

.section-title {
  margin: 0;
  font-size: clamp(1.55rem, 2.1vw, 2.05rem);
  letter-spacing: -0.03em;
}

.section-lead {
  margin: 0;
  color: var(--muted);
  max-width: 78ch;
}

.card {
  border-radius: var(--radius-lg);
  border: 1px solid var(--border);
  background: var(--bg-elev);
  padding: 18px;
}

.card-title {
  margin: 0 0 10px;
  letter-spacing: -0.02em;
}

.card-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 12px;
}

.bullets {
  margin: 0;
  padding-left: 1.15rem;
  color: rgba(255, 255, 255, 0.82);
}

.bullets li::marker {
  color: rgba(109, 94, 252, 0.95);
  font-size: 1.1em;
}

.bullets li {
  margin: 8px 0;
}

.bullets.compact li {
  margin: 6px 0;
}

@media (prefers-color-scheme: light) {
  .bullets {
    color: rgba(10, 20, 40, 0.78);
  }
  .bullets li::marker {
    color: rgba(109, 94, 252, 0.95);
  }
}

.about-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 14px;
}

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 12px 14px; /* >=44px height on most font sizes */
  border-radius: 14px;
  border: 1px solid var(--border);
  cursor: pointer;
  white-space: nowrap;
  transition: transform 180ms var(--ease), background 180ms var(--ease), border-color 180ms var(--ease), box-shadow 180ms var(--ease);
}

.btn:focus-visible,
.nav-link:focus-visible,
.nav-cta:focus-visible,
.icon-link:focus-visible,
.profile-link:focus-visible,
.to-top:focus-visible {
  outline: 2px solid rgba(109, 94, 252, 0.75);
  outline-offset: 2px;
}

.btn:hover {
  transform: translateY(-1px);
}

.btn:active {
  transform: translateY(0);
}

.btn-primary {
  border-color: rgba(109, 94, 252, 0.65);
  background: linear-gradient(135deg, rgba(109, 94, 252, 0.95), rgba(54, 209, 220, 0.85));
  color: rgba(255, 255, 255, 0.96);
  box-shadow: 0 16px 36px rgba(109, 94, 252, 0.18);
}

.btn-secondary {
  border-color: rgba(255, 255, 255, 0.18);
  background: var(--bg-elev-2);
  color: var(--text);
}

.btn-live {
  border-color: rgba(16, 185, 129, 0.7);
  background: linear-gradient(135deg, #10b981, #06b6d4);
  color: rgba(255, 255, 255, 0.96);
  box-shadow: 0 16px 36px rgba(16, 185, 129, 0.22);
}

.btn-ghost {
  border-color: rgba(255, 255, 255, 0.2);
  background: rgba(255, 255, 255, 0.1);
  color: var(--text);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.12);
}

.btn-ghost:hover {
  background: rgba(255, 255, 255, 0.14);
  border-color: rgba(255, 255, 255, 0.28);
}

@media (prefers-color-scheme: light) {
  .btn-ghost {
    border-color: rgba(10, 20, 40, 0.14);
    background: rgba(10, 20, 40, 0.06);
    box-shadow: 0 8px 20px rgba(10, 20, 40, 0.06);
  }

  .btn-ghost:hover {
    background: rgba(10, 20, 40, 0.09);
    border-color: rgba(10, 20, 40, 0.2);
  }
}

/* Projects */
.projects-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
  margin-top: 14px;
}

.project-card {
  border-radius: var(--radius-lg);
  border: 1px solid var(--border);
  background: linear-gradient(180deg, var(--bg-elev-2), var(--bg-elev));
  padding: 18px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  min-height: 300px;
  height: 100%;
}

.project-card .project-desc {
  flex: 1;
}

.project-top {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}

.project-title {
  margin: 0;
  letter-spacing: -0.02em;
}

.project-desc {
  margin: 0;
  color: var(--muted);
}

.project-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 2px;
  align-items: center;
}

.project-actions .btn {
  /* Keep buttons visually consistent across different project cards */
  min-width: 170px;
  min-height: 46px;
  padding: 12px 14px;
  border-radius: 14px;
  font-size: 1rem;
  font-weight: 650;
  line-height: 1.1;
  text-align: center;
}

/* Two CTAs (Live demo + Code) share the row; single-button cards stay unchanged */
.project-actions-dual {
  width: 100%;
}

.project-actions-dual .btn {
  flex: 1 1 calc(50% - 5px);
  min-width: 0;
}

.project-details summary {
  cursor: pointer;
  color: var(--text);
  font-weight: 650;
  list-style: none;
}

.project-details summary::-webkit-details-marker {
  display: none;
}

.project-details summary::after {
  content: " +";
  color: var(--subtle);
}

.project-details[open] summary::after {
  content: " −";
}

.project-details {
  border-top: 1px solid rgba(255, 255, 255, 0.08);
  padding-top: 10px;
}

/* Tags */
.tags,
.project-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.tag {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 7px 10px;
  border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, 0.14);
  background: rgba(255, 255, 255, 0.06);
  color: var(--muted);
  font-size: 0.92rem;
}

/* Skills / Contact */
.skills-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
  margin-top: 14px;
}

.contact-grid {
  display: grid;
  grid-template-columns: 1.2fr 0.8fr;
  gap: 14px;
  margin-top: 14px;
}

.contact-list {
  list-style: none;
  padding: 0;
  margin: 0;
  display: grid;
  gap: 10px;
}

.contact-list li {
  display: grid;
  grid-template-columns: 110px 1fr;
  gap: 10px;
  align-items: baseline;
}

.contact-k {
  color: var(--subtle);
  font-weight: 650;
}

.contact-v {
  color: var(--text);
  text-decoration: underline;
  text-decoration-color: rgba(109, 94, 252, 0.35);
  text-underline-offset: 3px;
  cursor: pointer;
  -webkit-tap-highlight-color: rgba(109, 94, 252, 0.2);
  touch-action: manipulation;
}

.contact-v:hover {
  text-decoration-color: rgba(109, 94, 252, 0.8);
}

.contact-v[href^="tel:"] {
  /* Ensure tel: links stay clickable (some layouts accidentally block taps) */
  position: relative;
  z-index: 1;
}

.profile-links {
  display: grid;
  gap: 10px;
}

.profile-link {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 12px;
  border-radius: 14px;
  border: 1px solid var(--border);
  background: var(--bg-elev);
  color: var(--text);
  transition: transform 180ms var(--ease), background 180ms var(--ease);
}

.profile-link:hover {
  transform: translateY(-1px);
  background: var(--bg-elev-2);
}

.fineprint {
  margin: 12px 0 0;
  color: var(--subtle);
}

/* Footer */
.site-footer {
  padding: 26px 0 max(26px, env(safe-area-inset-bottom));
}

.footer-inner {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  gap: 14px;
  border-top: 1px solid rgba(255, 255, 255, 0.08);
  padding-top: 18px;
}

.footer-copy {
  margin: 0;
  color: var(--subtle);
  max-width: 36em;
  text-wrap: balance;
}

/* Back to top: gradient frame (always visible; avoids native button border bugs) + same accent as .hero-accent */
.to-top {
  position: fixed;
  z-index: 60;
  right: max(16px, env(safe-area-inset-right));
  bottom: max(16px, env(safe-area-inset-bottom));
  width: 48px;
  height: 48px;
  border-radius: 16px;
  margin: 0;
  padding: 0;
  -webkit-appearance: none;
  appearance: none;
  border: 2px solid transparent;
  box-sizing: border-box;
  /* Solid underlay: shows if multi-layer clip fails (common on mobile WebKit) */
  background-color: rgb(14, 18, 32);
  background-image: linear-gradient(var(--to-top-fill), var(--to-top-fill)), var(--accent-gradient-border);
  background-origin: border-box;
  -webkit-background-clip: padding-box, border-box;
  background-clip: padding-box, border-box;
  box-shadow: var(--shadow);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  -webkit-tap-highlight-color: transparent;
  transition: transform 120ms var(--ease), background-image 180ms var(--ease), box-shadow 180ms var(--ease);
}

.to-top:hover {
  background-image: linear-gradient(var(--to-top-fill-hover), var(--to-top-fill-hover)),
    linear-gradient(135deg, rgb(130, 118, 255), rgb(78, 228, 236));
  box-shadow:
    0 0 0 1px rgba(109, 94, 252, 0.35),
    var(--shadow);
}

.to-top:active {
  transform: translateY(1px);
}

.to-top i {
  font-size: 1rem;
  line-height: 1;
  background: var(--accent-gradient);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  -webkit-text-fill-color: transparent;
}

.to-top:hover i {
  background: linear-gradient(90deg, rgb(130, 118, 255), rgb(78, 228, 236));
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  -webkit-text-fill-color: transparent;
}

@media (prefers-color-scheme: light) {
  .to-top {
    --to-top-fill: rgba(255, 255, 255, 0.99);
    --to-top-fill-hover: #ffffff;
    background-color: #ffffff;
    background-image: linear-gradient(var(--to-top-fill), var(--to-top-fill)), var(--accent-gradient-border);
    background-origin: border-box;
    -webkit-background-clip: padding-box, border-box;
    background-clip: padding-box, border-box;
    box-shadow: var(--shadow);
  }

  .to-top:hover {
    background-image: linear-gradient(var(--to-top-fill-hover), var(--to-top-fill-hover)),
      linear-gradient(135deg, rgb(130, 118, 255), rgb(78, 228, 236));
  }
}

/* Touch / coarse pointer: explicit inner fill + icon (multi-layer clip & gradient text often fail on mobile WebKit) */
@media (hover: none), (any-pointer: coarse) {
  .to-top {
    background-color: rgb(14, 18, 32);
    background-image: linear-gradient(rgb(14, 18, 32), rgb(14, 18, 32)), var(--accent-gradient-border);
    -webkit-background-clip: padding-box, border-box;
    background-clip: padding-box, border-box;
  }

  .to-top:active {
    background-image: linear-gradient(rgb(22, 26, 44), rgb(22, 26, 44)),
      linear-gradient(135deg, rgb(130, 118, 255), rgb(78, 228, 236));
  }

  .to-top i {
    background: none;
    -webkit-background-clip: border-box;
    background-clip: border-box;
    color: var(--accent);
    -webkit-text-fill-color: var(--accent);
  }

  .to-top:hover i {
    background: none;
    color: rgb(130, 118, 255);
    -webkit-text-fill-color: rgb(130, 118, 255);
  }
}

@media (prefers-color-scheme: light) and (hover: none),
  (prefers-color-scheme: light) and (any-pointer: coarse) {
  .to-top {
    background-color: #ffffff;
    background-image: linear-gradient(#ffffff, #ffffff), var(--accent-gradient-border);
  }

  .to-top:active {
    background-image: linear-gradient(#f8fafc, #f8fafc),
      linear-gradient(135deg, rgb(130, 118, 255), rgb(78, 228, 236));
  }

  .to-top i,
  .to-top:hover i {
    color: var(--accent);
    -webkit-text-fill-color: var(--accent);
  }
}

@media (forced-colors: active) {
  .to-top {
    border: 2px solid ButtonText;
    background: ButtonFace;
    background-image: none;
    box-shadow: none;
  }

  .to-top i {
    background: none;
    -webkit-text-fill-color: ButtonText;
    color: ButtonText;
  }
}

/* [hidden] must win: .to-top { display: inline-flex } otherwise overrides UA and the button stays visible at scroll 0 (common on mobile) */
.to-top[hidden] {
  display: none !important;
  visibility: hidden;
  pointer-events: none;
}

/* Responsive — fluid grids and safe areas across viewports */
.hero-grid,
.about-grid,
.skills-grid,
.projects-grid,
.contact-grid,
.hero-copy,
.hero-card,
.card,
.project-card {
  min-width: 0;
}

@media (min-width: 1400px) {
  :root {
    --container: 1200px;
  }
}

@media (max-width: 920px) {
  /* Stacked hero: profile → headline lines → everything else */
  .hero-grid {
    display: flex;
    flex-direction: column;
    gap: 22px;
  }

  .hero-copy {
    display: contents;
  }

  .hero-card {
    order: 1;
    max-width: 520px;
    width: 100%;
    margin-inline: auto;
  }

  .eyebrow {
    order: 2;
  }

  .hero-title {
    order: 3;
    margin-top: 0;
  }

  .hero-subtitle {
    order: 4;
  }

  .hero-actions {
    order: 5;
    flex-wrap: nowrap;
    gap: 10px;
  }

  .hero-metrics {
    order: 6;
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .hero-actions .btn {
    flex: 1 1 0;
    min-width: 0;
    min-height: 48px;
    padding: 13px 12px;
    font-size: clamp(0.88rem, 3.5vw, 1rem);
    font-weight: 650;
    line-height: 1.15;
    white-space: nowrap;
  }

  .metric {
    padding: 10px 8px;
  }

  .metric-value {
    font-size: clamp(0.78rem, 2.8vw, 0.95rem);
  }

  .metric-label {
    font-size: clamp(0.68rem, 2.4vw, 0.85rem);
  }

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

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

@media (max-width: 760px) {
  .nav-toggle {
    display: inline-flex;
    align-items: center;
    justify-content: center;
  }

  .site-nav {
    position: fixed;
    inset: var(--header-h) 10px auto 10px;
    display: grid;
    gap: 8px;
    padding: 12px;
    border-radius: 18px;
    border: 1px solid var(--border);
    background: rgba(7, 11, 20, 0.88);
    backdrop-filter: blur(16px);
    transform: translateY(-12px);
    opacity: 0;
    pointer-events: none;
    transition: transform 200ms var(--ease), opacity 200ms var(--ease);
  }

  @media (prefers-color-scheme: light) {
    .site-nav {
      background: rgba(247, 248, 251, 0.9);
    }
  }

  .site-nav[data-open="true"] {
    transform: translateY(0);
    opacity: 1;
    pointer-events: auto;
  }

  .nav-link,
  .nav-cta {
    width: 100%;
    justify-content: center;
    text-align: center;
  }

  .section {
    padding: 48px 0;
  }

  .hero {
    padding: 24px 0 8px;
  }
}

@media (max-width: 520px) {
  .hero-title {
    font-size: clamp(1.72rem, 7.5vw, 2.05rem);
  }

  .card-actions,
  .project-actions {
    flex-direction: column;
    align-items: stretch;
  }

  .card-actions .btn,
  .project-actions .btn {
    width: 100%;
    white-space: normal;
    min-width: 0;
  }

  .project-actions-dual .btn {
    flex: 1 1 auto;
    width: 100%;
  }

  .project-top {
    flex-direction: column;
    align-items: flex-start;
  }

  .section {
    padding: 40px 0;
  }
}

@media (max-width: 460px) {
  .contact-list li {
    grid-template-columns: 1fr;
  }

  .contact-k {
    font-size: 0.95rem;
  }

  .brand-text {
    font-size: 0.92rem;
  }
}

@media (max-width: 360px) {
  .container {
    padding-left: max(12px, env(safe-area-inset-left));
    padding-right: max(12px, env(safe-area-inset-right));
  }

  .brand-mark {
    width: 36px;
    height: 36px;
    font-size: 0.9rem;
  }
}

@media (max-height: 520px) and (orientation: landscape) {
  .hero {
    padding-top: 16px;
  }

  .section {
    padding: 32px 0;
  }

  .site-nav {
    max-height: calc(100dvh - var(--header-h) - 24px);
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
  }
}

@media (hover: none) and (pointer: coarse) {
  /* Reduce “hover lift” on touch to avoid accidental jumps */
  .btn:hover,
  .icon-link:hover,
  .profile-link:hover,
  .nav-cta:hover {
    transform: none;
  }
}

@media (prefers-reduced-motion: reduce) {
  * {
    transition: none !important;
  }
}

::selection {
  background: rgba(109, 94, 252, 0.35);
}

