/* =========================================================
   Haziq Ahmed Baig — Software QA Engineer Portfolio
   Design tokens + layout. Hand-written, zero framework.
   ========================================================= */

/* ---------- Design Tokens ---------- */
:root {
  /* palette */
  --base:        #F8FAFC;   /* near-white page */
  --surface:     #FFFFFF;   /* cards */
  --ink:         #0F172A;   /* deep slate text */
  --ink-2:       #334155;   /* secondary text */
  --ink-3:       #64748B;   /* muted */
  --line:        #E2E8F0;   /* borders */
  --line-2:      #CBD5E1;

  --primary:     #22D3EE;   /* sharp cyan accent */
  --primary-700: #06B6D4;
  --primary-ink: #0E7490;   /* readable cyan on light bg (AA text) */
  --primary-50:  #ECFEFF;

  --pass:        #16A34A;   /* pass green */
  --pass-50:     #ECFDF3;
  --warn:        #D97706;   /* attention */
  --warn-50:     #FEF6E7;
  --crit:        #DC2626;   /* critical */
  --crit-50:     #FEF2F2;

  /* dark hero */
  --dark:        #0F172A;
  --dark-2:      #1E293B;
  --dark-line:   #334155;
  --on-dark:     #E2E8F0;
  --on-dark-mut: #94A3B8;

  /* type */
  --display: "Space Grotesk", "Inter", system-ui, -apple-system, sans-serif;
  --sans: "Inter", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --mono: "JetBrains Mono", ui-monospace, "SFMono-Regular", Menlo, monospace;

  /* spacing / shape */
  --container: 1120px;
  --radius: 14px;
  --radius-sm: 8px;
  --shadow-sm: 0 1px 2px rgba(15,23,42,.06), 0 1px 3px rgba(15,23,42,.05);
  --shadow:    0 4px 6px -1px rgba(15,23,42,.07), 0 2px 4px -2px rgba(15,23,42,.06);
  --shadow-lg: 0 20px 25px -5px rgba(15,23,42,.08), 0 8px 10px -6px rgba(15,23,42,.05);

  --header-h: 68px;
}

/* ---------- Reset ---------- */
*, *::before, *::after { box-sizing: border-box; }
/* D2: prevent flex/grid children from forcing intrinsic min-width overflow */
* { min-width: 0; }
html { scroll-behavior: smooth; scroll-padding-top: calc(var(--header-h) + 12px); }
html, body { overflow-x: hidden; max-width: 100%; }
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  * { animation: none !important; transition: none !important; }
}
body {
  margin: 0;
  font-family: var(--sans);
  color: var(--ink);
  background: var(--base);
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}
img { max-width: 100%; display: block; }
/* D2: long unbroken tokens (URLs, addresses) must not push layout wide */
p, dd, li, td, .chip, .case-sub { overflow-wrap: anywhere; word-break: break-word; }
a { color: inherit; }
h1, h2, h3, h4, h5 { font-family: var(--display); line-height: 1.15; margin: 0; letter-spacing: -0.02em; }
.hero-title, .section-title, .metric-value, .case-title { font-family: var(--display); }
p { margin: 0; }
ul { margin: 0; padding: 0; list-style: none; }

/* visible focus everywhere */
a:focus-visible, button:focus-visible, input:focus-visible, textarea:focus-visible {
  outline: 3px solid var(--primary);
  outline-offset: 2px;
  border-radius: 4px;
}

.mono { font-family: var(--mono); font-weight: 500; }

.skip-link {
  position: absolute; left: -999px; top: 0;
  background: var(--primary); color: #fff; padding: 10px 16px;
  z-index: 200; border-radius: 0 0 8px 0; font-weight: 600;
}
.skip-link:focus { left: 0; }

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

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  font-family: var(--sans); font-weight: 600; font-size: 0.98rem;
  padding: 12px 22px; border-radius: var(--radius-sm);
  text-decoration: none; cursor: pointer; border: 1px solid transparent;
  transition: transform .12s ease, background .15s ease, border-color .15s ease, box-shadow .15s ease;
  white-space: nowrap;
}
.btn:active { transform: translateY(1px); }
.btn-primary { background: var(--primary); color: #fff; box-shadow: var(--shadow-sm); }
.btn-primary:hover { background: var(--primary-700); }
.btn-ghost { background: transparent; color: var(--ink); border-color: var(--line-2); }
.btn-ghost:hover { border-color: var(--ink); background: rgba(15,23,42,.03); }
.btn-sm { padding: 8px 16px; font-size: 0.9rem; }
.btn-block { width: 100%; }

/* on dark hero, ghost button is light */
.hero .btn-ghost { color: var(--on-dark); border-color: var(--dark-line); }
.hero .btn-ghost:hover { border-color: var(--on-dark); background: rgba(255,255,255,.06); }

/* ---------- Header / Nav ---------- */
.site-header {
  position: sticky; top: 0; z-index: 100;
  background: rgba(248,250,252,.85);
  backdrop-filter: saturate(180%) blur(10px);
  border-bottom: 1px solid transparent;
  transition: border-color .2s ease, background .2s ease, box-shadow .2s ease;
}
.site-header.scrolled {
  border-bottom-color: var(--line);
  box-shadow: var(--shadow-sm);
}
.header-inner { display: flex; align-items: center; justify-content: space-between; height: var(--header-h); }

.brand { display: flex; align-items: center; gap: 12px; text-decoration: none; font-weight: 700; }
.brand-mark {
  display: grid; place-items: center;
  width: 38px; height: 38px; border-radius: 9px;
  background: var(--ink); color: #fff;
  font-family: var(--mono); font-weight: 700; font-size: 0.95rem; letter-spacing: -0.04em;
}
.brand-text { display: flex; flex-direction: column; line-height: 1.1; font-size: 1rem; color: var(--ink); }
.brand-role { font-size: 0.72rem; font-weight: 500; color: var(--ink-3); font-family: var(--mono); }

.nav-menu { display: flex; align-items: center; gap: 4px; }
.nav-link {
  text-decoration: none; color: var(--ink-2); font-weight: 500; font-size: 0.95rem;
  padding: 8px 14px; border-radius: 8px; position: relative; transition: color .15s ease, background .15s ease;
}
.nav-link:hover { color: var(--ink); background: rgba(15,23,42,.04); }
.nav-link.active { color: var(--primary-ink); }
.nav-link.active::after {
  content: ""; position: absolute; left: 14px; right: 14px; bottom: 2px; height: 2px;
  background: var(--primary); border-radius: 2px;
}
.nav-cta { margin-left: 8px; }

.nav-toggle { display: none; }

/* ---------- Hero (dark) ---------- */
.hero {
  position: relative; overflow: hidden;
  background: radial-gradient(1200px 600px at 70% -10%, #1E293B 0%, #0F172A 55%);
  color: var(--on-dark);
  padding: clamp(72px, 12vw, 140px) 0 clamp(56px, 8vw, 96px);
}
.hero-grid-bg {
  position: absolute; inset: 0; pointer-events: none; opacity: .5;
  background-image:
    linear-gradient(to right, rgba(148,163,184,.07) 1px, transparent 1px),
    linear-gradient(to bottom, rgba(148,163,184,.07) 1px, transparent 1px);
  background-size: 48px 48px;
  mask-image: radial-gradient(1000px 500px at 60% 0%, #000 30%, transparent 80%);
}
.hero-inner { position: relative; max-width: 880px; }
.eyebrow {
  font-family: var(--mono); font-size: 0.82rem; font-weight: 500; letter-spacing: 0.02em;
  color: #67E8F9; margin-bottom: 18px;
  display: inline-flex; align-items: center; gap: 10px;
}
.eyebrow::before { content: ""; width: 28px; height: 1px; background: var(--primary); }
.hero-title {
  font-size: clamp(2.4rem, 6vw, 4.2rem); font-weight: 800; color: #fff;
  letter-spacing: -0.035em; margin-bottom: 22px;
}
.hero-subhead {
  font-size: clamp(1.05rem, 2vw, 1.3rem); color: var(--on-dark-mut);
  max-width: 660px; margin-bottom: 34px;
}
.hero-actions { display: flex; flex-wrap: wrap; gap: 14px; margin-bottom: 44px; }

.trust-strip {
  display: flex; flex-wrap: wrap; gap: 8px 10px;
  padding-top: 28px; border-top: 1px solid var(--dark-line);
}
.trust-strip li {
  font-family: var(--mono); font-size: 0.78rem; color: var(--on-dark);
  padding: 6px 12px; border: 1px solid var(--dark-line); border-radius: 999px;
  background: rgba(255,255,255,.03);
}

/* ---------- Metrics band ---------- */
.metrics { background: var(--ink); color: #fff; padding: 0; }
.metrics-grid {
  display: grid; grid-template-columns: repeat(4, 1fr);
  border-left: 1px solid var(--dark-line); border-right: 1px solid var(--dark-line);
}
.metric {
  padding: 34px 24px; text-align: center;
  border-right: 1px solid var(--dark-line);
  display: flex; flex-direction: column; gap: 6px; align-items: center;
}
.metric:last-child { border-right: none; }
.metric-value { font-size: clamp(2rem, 4vw, 2.8rem); font-weight: 800; color: #fff; letter-spacing: -0.03em; }
.metric-label { font-size: 0.85rem; color: var(--on-dark-mut); max-width: 180px; }

/* ---------- Sections (light) ---------- */
.section { padding: clamp(64px, 9vw, 110px) 0; }
.section-eyebrow {
  font-family: var(--mono); font-size: 0.8rem; font-weight: 600; color: var(--primary-ink);
  text-transform: lowercase; letter-spacing: 0.02em; margin-bottom: 14px;
  display: inline-flex; align-items: center; gap: 10px;
}
.section-eyebrow::before { content: ""; width: 24px; height: 1px; background: var(--primary); }
.section-title { font-size: clamp(1.8rem, 4vw, 2.7rem); font-weight: 800; color: var(--ink); margin-bottom: 18px; max-width: 760px; }
.section-lede { font-size: 1.08rem; color: var(--ink-2); max-width: 640px; margin-bottom: 48px; }

/* ---------- Pillars ---------- */
.pillars { padding: clamp(56px, 7vw, 88px) 0; background: var(--base); }
.pillars-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 18px; }
.pillar-card {
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 28px 24px; box-shadow: var(--shadow-sm);
  transition: transform .18s ease, box-shadow .18s ease, border-color .18s ease;
}
.pillar-card:hover { transform: translateY(-4px); box-shadow: var(--shadow-lg); border-color: var(--line-2); }
.pillar-num { font-family: var(--mono); font-size: 0.85rem; color: var(--primary-ink); font-weight: 600; }
.pillar-title { font-size: 1.15rem; font-weight: 700; margin: 12px 0 10px; }
.pillar-text { font-size: 0.94rem; color: var(--ink-2); }

/* ---------- About ---------- */
.about { background: var(--surface); }
.about-layout { display: grid; grid-template-columns: 1.2fr 1fr; gap: 48px; align-items: start; }
.about-body p { font-size: 1.08rem; color: var(--ink-2); margin-bottom: 20px; }
.about-body p:last-child { margin-bottom: 0; }
.philosophy {
  background: var(--ink); color: var(--on-dark); border-radius: var(--radius);
  padding: 32px 30px; box-shadow: var(--shadow);
}
.philosophy-label { margin-bottom: 20px; }
.philosophy-label .mono { color: #67E8F9; font-size: 0.85rem; }
.philosophy-list li { padding: 16px 0; border-bottom: 1px solid var(--dark-line); font-size: 0.98rem; color: var(--on-dark-mut); }
.philosophy-list li:last-child { border-bottom: none; padding-bottom: 0; }
.philosophy-list strong { color: #fff; display: block; margin-bottom: 4px; }

/* ---------- Skills ---------- */
.skills { background: var(--base); }
.skills-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 20px; }
.skill-group {
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 28px 26px; box-shadow: var(--shadow-sm);
}
.skill-group-title {
  font-size: 1.05rem; font-weight: 700; margin-bottom: 18px; color: var(--ink);
  padding-bottom: 12px; border-bottom: 1px solid var(--line);
  display: flex; align-items: center; gap: 10px;
}
.skill-group-title::before { content: ""; width: 9px; height: 9px; border-radius: 2px; background: var(--primary); }
.chip-list { display: flex; flex-wrap: wrap; gap: 8px; }
.chip {
  font-family: var(--mono); font-size: 0.8rem; color: var(--ink-2);
  padding: 6px 12px; border: 1px solid var(--line-2); border-radius: 999px;
  background: var(--base); transition: border-color .15s ease, color .15s ease, background .15s ease;
}
.chip:hover { border-color: var(--primary-700); color: var(--primary-ink); background: var(--primary-50); }
.skill-note { font-size: 0.82rem; color: var(--ink-3); margin-top: 12px; }

/* ---------- Case Studies ---------- */
.projects { background: var(--surface); }
.case {
  border: 1px solid var(--line); border-radius: var(--radius);
  padding: 32px; margin-bottom: 28px; box-shadow: var(--shadow-sm);
  background: var(--surface);
}
.case:last-child { margin-bottom: 0; }
.case-head {
  display: flex; align-items: flex-start; justify-content: space-between; gap: 18px;
  flex-wrap: wrap; padding-bottom: 24px; margin-bottom: 24px; border-bottom: 1px solid var(--line);
}
.case-index { font-size: 0.78rem; color: var(--primary-ink); font-weight: 600; display: block; margin-bottom: 8px; }
.case-sub { font-size: 0.8rem; color: var(--ink-3); margin-top: 6px; }
.case-title { font-size: 1.4rem; font-weight: 700; }
.result-chip {
  font-family: var(--mono); font-size: 0.78rem; font-weight: 600;
  color: var(--pass); background: var(--pass-50); border: 1px solid #BBF7D0;
  padding: 8px 14px; border-radius: 999px; white-space: nowrap;
}
.case-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 36px; align-items: start; }
.par-block { margin-bottom: 20px; }
.par-block:last-child { margin-bottom: 0; }
.par-label {
  font-family: var(--mono); font-size: 0.75rem; font-weight: 600; text-transform: uppercase;
  letter-spacing: 0.06em; color: var(--ink-3); margin-bottom: 6px;
}
.par-block p { font-size: 0.98rem; color: var(--ink-2); }

/* artifacts */
.artifact {
  margin: 0; background: var(--base); border: 1px solid var(--line);
  border-radius: var(--radius); padding: 20px;
}
.artifact-cap { font-family: var(--mono); font-size: 0.78rem; color: var(--ink-3); margin-bottom: 14px; }
.artifact-cap .mono { color: var(--primary-ink); }
.artifact-why { font-size: 0.83rem; color: var(--ink-3); margin-top: 14px; line-height: 1.5; }
.artifact-why .mono { color: var(--ink-2); font-weight: 600; }

/* test case / risk table */
.table-wrap { overflow-x: auto; border: 1px solid var(--line); border-radius: var(--radius-sm); background: var(--surface); }
.tc-table { width: 100%; border-collapse: collapse; font-size: 0.82rem; min-width: 460px; }
.tc-table th {
  text-align: left; font-family: var(--mono); font-size: 0.72rem; text-transform: uppercase;
  letter-spacing: 0.04em; color: var(--ink-3); padding: 10px 12px; border-bottom: 1px solid var(--line);
  background: var(--base);
}
.tc-table td { padding: 11px 12px; border-bottom: 1px solid var(--line); color: var(--ink-2); vertical-align: top; }
.tc-table tr:last-child td { border-bottom: none; }
.tc-table .mono { font-size: 0.78rem; color: var(--ink); }

.status { font-family: var(--mono); font-size: 0.72rem; font-weight: 600; padding: 3px 9px; border-radius: 999px; display: inline-block; }
.status-pass { color: var(--pass); background: var(--pass-50); border: 1px solid #BBF7D0; }
.status-warn { color: var(--warn); background: var(--warn-50); border: 1px solid #FDE68A; }

/* bug card */
.bug-card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-sm); padding: 18px; }
.bug-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 12px; }
.bug-id { font-size: 0.8rem; color: var(--ink-3); }
.severity { font-family: var(--mono); font-size: 0.72rem; font-weight: 700; padding: 4px 10px; border-radius: 6px; }
.severity-critical { color: var(--crit); background: var(--crit-50); border: 1px solid #FECACA; }
.severity-high { color: var(--warn); background: var(--warn-50); border: 1px solid #FDE68A; }
.bug-title { font-size: 0.98rem; font-weight: 700; color: var(--ink); margin-bottom: 14px; line-height: 1.35; }
.bug-meta { margin: 0; display: grid; gap: 12px; }
.bug-meta dt { font-family: var(--mono); font-size: 0.7rem; text-transform: uppercase; letter-spacing: 0.05em; color: var(--ink-3); margin-bottom: 3px; }
.bug-meta dd { margin: 0; font-size: 0.86rem; color: var(--ink-2); }
.bug-meta dd.mono { font-size: 0.78rem; }

/* code block */
.code-block { position: relative; margin-bottom: 16px; }
.code-block pre[class*="language-"] {
  margin: 0; border-radius: var(--radius-sm); font-size: 0.78rem; padding: 18px; max-height: 320px;
  border: 1px solid var(--dark-line);
}
.code-block code { font-family: var(--mono) !important; }
.copy-btn {
  position: absolute; top: 10px; right: 10px; z-index: 2;
  font-family: var(--mono); font-size: 0.72rem; font-weight: 600;
  background: rgba(255,255,255,.1); color: #E2E8F0; border: 1px solid rgba(255,255,255,.2);
  padding: 5px 11px; border-radius: 6px; cursor: pointer; transition: background .15s ease;
}
.copy-btn:hover { background: rgba(255,255,255,.2); }
.copy-btn.copied { color: #86EFAC; border-color: #16A34A; }

/* CI strip */
.ci-strip {
  display: flex; flex-wrap: wrap; align-items: center; gap: 8px;
  padding: 14px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-sm);
}
.ci-step { display: inline-flex; align-items: center; gap: 7px; font-family: var(--mono); font-size: 0.78rem; color: var(--ink-2); }
.ci-dot { width: 7px; height: 7px; border-radius: 50%; background: var(--pass); box-shadow: 0 0 0 3px var(--pass-50); }
.ci-ok { color: var(--pass); font-weight: 700; }
.ci-arrow { color: var(--ink-3); font-size: 0.85rem; }

/* ---------- Resume ---------- */
.resume { background: var(--base); }
.resume-inner { display: grid; grid-template-columns: 1.4fr 1fr; gap: 48px; align-items: center; }
.resume-actions { display: flex; flex-wrap: wrap; gap: 14px; margin-top: 8px; }
.resume-meta { background: var(--ink); color: var(--on-dark); border-radius: var(--radius); padding: 30px; box-shadow: var(--shadow); }
.meta-list li { padding: 14px 0; border-bottom: 1px solid var(--dark-line); font-size: 0.95rem; color: var(--on-dark); }
.meta-list li:last-child { border-bottom: none; }
.meta-list .mono { color: var(--on-dark-mut); font-size: 0.78rem; display: inline-block; min-width: 74px; }

/* ---------- Contact ---------- */
.contact { background: var(--surface); }
.contact-inner { display: grid; grid-template-columns: 1fr 1fr; gap: 56px; align-items: start; }
.contact-direct { display: flex; flex-direction: column; gap: 10px; margin: 28px 0; }
.contact-link {
  text-decoration: none; color: var(--ink); font-weight: 500; font-size: 0.98rem;
  display: flex; align-items: center; gap: 12px; padding: 10px 0; border-bottom: 1px solid var(--line);
  transition: color .15s ease;
}
.contact-link:hover { color: var(--primary-ink); }
.contact-link .mono { color: var(--ink-3); font-size: 0.78rem; min-width: 72px; }
.contact-cta-row { display: flex; flex-wrap: wrap; gap: 14px; }

/* form */
.contact-form {
  background: var(--base); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 32px; box-shadow: var(--shadow-sm);
}
.form-title { font-size: 1.15rem; font-weight: 700; margin-bottom: 22px; }
.field { margin-bottom: 18px; }
.field label { display: block; font-size: 0.88rem; font-weight: 600; color: var(--ink-2); margin-bottom: 7px; }
.req { color: var(--crit); }
.optional { color: var(--ink-3); font-weight: 400; }
.field input, .field textarea {
  width: 100%; font-family: var(--sans); font-size: 0.96rem; color: var(--ink);
  padding: 11px 14px; border: 1px solid var(--line-2); border-radius: var(--radius-sm);
  background: var(--surface); transition: border-color .15s ease, box-shadow .15s ease;
}
.field input::placeholder, .field textarea::placeholder { color: var(--ink-3); }
.field input:focus, .field textarea:focus { border-color: var(--primary); }
.field textarea { resize: vertical; min-height: 110px; }
.field.invalid input, .field.invalid textarea { border-color: var(--crit); background: var(--crit-50); }
.error-msg { color: var(--crit); font-size: 0.82rem; margin-top: 6px; min-height: 0; display: none; }
.field.invalid .error-msg { display: block; }

.hp-field { position: absolute; left: -9999px; width: 1px; height: 1px; overflow: hidden; }

.form-success {
  margin-top: 18px; padding: 14px 16px; border-radius: var(--radius-sm);
  background: var(--pass-50); border: 1px solid #BBF7D0; color: #166534;
  font-size: 0.92rem; font-weight: 500;
}

/* ---------- Footer ---------- */
.site-footer { background: var(--ink); color: var(--on-dark); padding: 48px 0; }
.footer-inner { display: flex; align-items: center; justify-content: space-between; gap: 24px; flex-wrap: wrap; }
.footer-brand { display: flex; align-items: center; gap: 12px; }
.footer-name { font-weight: 700; color: #fff; }
.footer-role { font-size: 0.82rem; color: var(--on-dark-mut); font-family: var(--mono); }
.footer-nav { display: flex; flex-wrap: wrap; gap: 18px; }
.footer-nav a { text-decoration: none; color: var(--on-dark-mut); font-size: 0.92rem; transition: color .15s ease; }
.footer-nav a:hover { color: #fff; }
.footer-micro { font-size: 0.8rem; color: var(--on-dark-mut); }

/* ---------- More projects (compact) ---------- */
.more-projects { margin-top: 36px; padding-top: 32px; border-top: 1px solid var(--line); }
.more-title { font-size: 1.15rem; font-weight: 700; margin-bottom: 20px; }
.more-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 16px; }
.more-card {
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-sm);
  padding: 18px 20px; box-shadow: var(--shadow-sm);
}
.more-name { display: block; font-family: var(--display); font-weight: 700; font-size: 1rem; color: var(--ink); }
.more-tag { display: inline-block; font-size: 0.72rem; color: var(--primary-ink); margin: 4px 0 8px; }
.more-card p { font-size: 0.88rem; color: var(--ink-2); }

/* ---------- Reveal animation ---------- */
.reveal { opacity: 0; transform: translateY(24px); transition: opacity .6s ease, transform .6s ease; }
.reveal.in { opacity: 1; transform: none; }
@media (prefers-reduced-motion: reduce) { .reveal { opacity: 1; transform: none; } }

/* =========================================================
   Responsive
   ========================================================= */
@media (max-width: 960px) {
  .metrics-grid { grid-template-columns: repeat(2, 1fr); }
  .metric:nth-child(2) { border-right: none; }
  .metric:nth-child(1), .metric:nth-child(2) { border-bottom: 1px solid var(--dark-line); }
  .pillars-grid { grid-template-columns: repeat(2, 1fr); }
  .about-layout { grid-template-columns: 1fr; gap: 32px; }
  .case-grid { grid-template-columns: 1fr; gap: 28px; }
  .more-grid { grid-template-columns: 1fr; }
  .resume-inner { grid-template-columns: 1fr; gap: 32px; }
  .contact-inner { grid-template-columns: 1fr; gap: 40px; }
}

@media (max-width: 760px) {
  /* mobile nav */
  .nav-toggle {
    display: inline-flex; flex-direction: column; gap: 5px; justify-content: center;
    width: 44px; height: 44px; background: transparent; border: 1px solid var(--line-2);
    border-radius: 10px; cursor: pointer; padding: 0; align-items: center;
  }
  .nav-toggle-bar { width: 20px; height: 2px; background: var(--ink); border-radius: 2px; transition: transform .2s ease, opacity .2s ease; }
  .nav-toggle[aria-expanded="true"] .nav-toggle-bar:nth-child(1) { transform: translateY(7px) rotate(45deg); }
  .nav-toggle[aria-expanded="true"] .nav-toggle-bar:nth-child(2) { opacity: 0; }
  .nav-toggle[aria-expanded="true"] .nav-toggle-bar:nth-child(3) { transform: translateY(-7px) rotate(-45deg); }

  .nav-menu {
    position: fixed; top: var(--header-h); left: 0; right: 0;
    flex-direction: column; align-items: stretch; gap: 4px;
    background: var(--surface); border-bottom: 1px solid var(--line);
    padding: 16px 24px 24px; box-shadow: var(--shadow-lg);
    transform: translateY(-12px); opacity: 0; pointer-events: none;
    transition: transform .2s ease, opacity .2s ease;
    max-height: calc(100vh - var(--header-h)); overflow-y: auto;
  }
  .nav-menu.open { transform: none; opacity: 1; pointer-events: auto; }
  .nav-link { padding: 12px 14px; font-size: 1rem; }
  .nav-link.active::after { display: none; }
  .nav-cta { margin: 8px 0 0; }
}

@media (max-width: 520px) {
  .container { padding: 0 18px; }
  /* D2: code blocks and result chips must never widen the page */
  .code-block pre[class*="language-"] { max-width: 100%; overflow-x: auto; }
  .result-chip { white-space: normal; }
  .case-head { gap: 12px; }
  .metrics-grid { grid-template-columns: 1fr; }
  .metric { border-right: none !important; border-bottom: 1px solid var(--dark-line); }
  .metric:last-child { border-bottom: none; }
  .pillars-grid, .skills-grid { grid-template-columns: 1fr; }
  .case { padding: 22px; }
  .contact-form { padding: 22px; }
  .hero-actions .btn, .resume-actions .btn, .contact-cta-row .btn { flex: 1 1 auto; }
}
