/* =========================================================
   M. Usman Mazhar — Online CV
   ========================================================= */

:root {
  --navy: #1f3a5f;
  --navy-deep: #152a46;
  --blue: #2d7fc1;
  --blue-soft: #e8f1fa;
  --accent: #f59e0b;
  --accent-soft: #fdf3e3;

  --bg: #f7f9fc;
  --bg-alt: #eef3f9;
  --surface: #ffffff;
  --text: #1c2533;
  --text-muted: #5b6878;
  --border: #dce4ee;
  --shadow: 0 1px 2px rgba(20, 40, 70, .05), 0 8px 24px rgba(20, 40, 70, .07);
  --shadow-lg: 0 2px 4px rgba(20, 40, 70, .06), 0 18px 40px rgba(20, 40, 70, .12);

  --radius: 14px;
  --radius-sm: 8px;
  --nav-h: 68px;
  --font: 'Lato', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
  --mono: 'JetBrains Mono', ui-monospace, Menlo, Consolas, monospace;
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --blue: #5aa6e6;
    --blue-soft: #16273d;
    --accent: #fbbf24;
    --accent-soft: #2c2414;
    --bg: #0d1520;
    --bg-alt: #111c2a;
    --surface: #152233;
    --text: #e4ebf3;
    --text-muted: #9aa9bb;
    --border: #22344a;
    --shadow: 0 1px 2px rgba(0, 0, 0, .3), 0 8px 24px rgba(0, 0, 0, .25);
    --shadow-lg: 0 2px 4px rgba(0, 0, 0, .3), 0 18px 40px rgba(0, 0, 0, .4);
    color-scheme: dark;
  }
}

:root[data-theme="dark"] {
  --blue: #5aa6e6;
  --blue-soft: #16273d;
  --accent: #fbbf24;
  --accent-soft: #2c2414;
  --bg: #0d1520;
  --bg-alt: #111c2a;
  --surface: #152233;
  --text: #e4ebf3;
  --text-muted: #9aa9bb;
  --border: #22344a;
  --shadow: 0 1px 2px rgba(0, 0, 0, .3), 0 8px 24px rgba(0, 0, 0, .25);
  --shadow-lg: 0 2px 4px rgba(0, 0, 0, .3), 0 18px 40px rgba(0, 0, 0, .4);
  color-scheme: dark;
}

/* ---------- Base ---------- */
*, *::before, *::after { box-sizing: border-box; }
html { scroll-behavior: smooth; scroll-padding-top: calc(var(--nav-h) + 12px); }
body {
  margin: 0;
  font-family: var(--font);
  font-size: 17px;
  line-height: 1.65;
  color: var(--text);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}
img, svg { display: block; }
a { color: var(--blue); text-decoration: none; }
a:hover { text-decoration: underline; }
h1, h2, h3 { line-height: 1.2; margin: 0; }
p { margin: 0 0 1em; }
ul, ol { margin: 0; padding: 0; list-style: none; }
button { font: inherit; cursor: pointer; }
:focus-visible { outline: 2px solid var(--blue); outline-offset: 3px; border-radius: 4px; }

.container { width: 100%; max-width: 1140px; margin: 0 auto; padding: 0 24px; }
.muted { color: var(--text-muted); font-style: italic; }

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 12px 22px; border-radius: 999px;
  font-weight: 700; font-size: 15px; border: 2px solid transparent;
  transition: transform .2s, box-shadow .2s, background .2s, color .2s;
}
.btn:hover { text-decoration: none; transform: translateY(-2px); }
.btn--primary { background: var(--blue); color: #fff; box-shadow: 0 6px 18px rgba(45, 127, 193, .35); }
.btn--primary:hover { box-shadow: 0 10px 24px rgba(45, 127, 193, .45); }
.btn--ghost { border-color: var(--border); color: var(--text); background: var(--surface); }
.btn--ghost:hover { border-color: var(--blue); color: var(--blue); }
.btn--light { background: #fff; color: var(--navy); }
.btn--outline-light { border-color: rgba(255, 255, 255, .5); color: #fff; }
.btn--outline-light:hover { border-color: #fff; }

.icon-btn {
  width: 40px; height: 40px; border-radius: 50%;
  display: grid; place-items: center;
  background: transparent; border: 1px solid var(--border); color: var(--text);
  transition: border-color .2s, color .2s;
}
.icon-btn:hover { border-color: var(--blue); color: var(--blue); }

/* ---------- Nav ---------- */
.nav {
  position: fixed; inset: 0 0 auto; z-index: 50; height: var(--nav-h);
  background: color-mix(in srgb, var(--bg) 82%, transparent);
  backdrop-filter: saturate(160%) blur(12px);
  -webkit-backdrop-filter: saturate(160%) blur(12px);
  border-bottom: 1px solid transparent;
  transition: border-color .3s, box-shadow .3s;
}
.nav.is-scrolled { border-bottom-color: var(--border); box-shadow: 0 4px 20px rgba(0, 0, 0, .04); }
.nav__inner { height: 100%; display: flex; align-items: center; justify-content: space-between; gap: 16px; }
.nav__logo { display: flex; align-items: center; gap: 10px; color: var(--text); font-weight: 900; }
.nav__logo:hover { text-decoration: none; }
.nav__logo-mark {
  width: 38px; height: 38px; border-radius: 10px; display: grid; place-items: center;
  background: linear-gradient(135deg, var(--navy), var(--blue)); color: #fff; font-size: 14px; letter-spacing: .5px;
}
.nav__links { display: flex; gap: 4px; }
.nav__links a {
  color: var(--text-muted); font-weight: 700; font-size: 15px;
  padding: 8px 14px; border-radius: 999px; transition: color .2s, background .2s;
}
.nav__links a:hover, .nav__links a.is-active { color: var(--blue); background: var(--blue-soft); text-decoration: none; }
.nav__actions { display: flex; gap: 8px; align-items: center; }

.icon-moon { display: none; }
:root[data-theme="dark"] .icon-sun { display: none; }
:root[data-theme="dark"] .icon-moon { display: block; }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .icon-sun { display: none; }
  :root:not([data-theme="light"]) .icon-moon { display: block; }
}

.nav__burger { display: none; flex-direction: column; gap: 4px; }
.nav__burger span { width: 16px; height: 2px; background: currentColor; border-radius: 2px; transition: transform .3s, opacity .3s; }
.nav__burger[aria-expanded="true"] span:nth-child(1) { transform: translateY(6px) rotate(45deg); }
.nav__burger[aria-expanded="true"] span:nth-child(2) { opacity: 0; }
.nav__burger[aria-expanded="true"] span:nth-child(3) { transform: translateY(-6px) rotate(-45deg); }

/* ---------- Hero ---------- */
.hero {
  position: relative;
  padding: calc(var(--nav-h) + 64px) 0 56px;
  background:
    radial-gradient(900px 500px at 85% -10%, color-mix(in srgb, var(--blue) 16%, transparent), transparent 70%),
    radial-gradient(700px 400px at -10% 30%, color-mix(in srgb, var(--accent) 10%, transparent), transparent 70%);
}
.hero__inner { display: grid; grid-template-columns: 1.1fr .9fr; gap: 56px; align-items: center; }
.hero__eyebrow {
  display: inline-flex; align-items: center; gap: 8px;
  font-size: 14px; font-weight: 700; color: var(--text-muted);
  background: var(--surface); border: 1px solid var(--border);
  padding: 6px 14px; border-radius: 999px; margin-bottom: 22px;
}
.dot { width: 8px; height: 8px; border-radius: 50%; background: #22c55e; box-shadow: 0 0 0 0 rgba(34, 197, 94, .6); animation: pulse 2s infinite; }
@keyframes pulse { 70% { box-shadow: 0 0 0 8px rgba(34, 197, 94, 0); } 100% { box-shadow: 0 0 0 0 rgba(34, 197, 94, 0); } }

.hero__title { font-size: clamp(2.4rem, 5.5vw, 4rem); font-weight: 900; letter-spacing: -1px; }
.hero__role {
  font-size: clamp(1.25rem, 2.6vw, 1.75rem); font-weight: 700; color: var(--blue);
  margin: 10px 0 20px; min-height: 1.4em;
}
.caret { animation: blink 1s step-end infinite; margin-left: 2px; font-weight: 400; }
@keyframes blink { 50% { opacity: 0; } }
.hero__lead { font-size: 1.1rem; color: var(--text-muted); max-width: 560px; }
.hero__lead strong { color: var(--text); }
.hero__cta { display: flex; flex-wrap: wrap; gap: 12px; margin: 28px 0 24px; }
.hero__meta { display: flex; flex-wrap: wrap; gap: 8px 22px; color: var(--text-muted); font-size: 15px; }
.hero__meta li { display: flex; align-items: center; gap: 6px; }
.hero__meta a { color: inherit; }

/* Portrait */
.hero__card { display: flex; justify-content: center; }
.portrait { position: relative; margin: 0; width: min(100%, 380px); }
.portrait::before {
  content: ""; position: absolute; inset: -14px -14px 14px 14px; border-radius: 28px;
  background: linear-gradient(135deg, var(--blue), var(--navy)); opacity: .9; z-index: 0;
}
.portrait__frame {
  position: relative; z-index: 1; aspect-ratio: 1; border-radius: 24px; overflow: hidden;
  background: var(--surface); box-shadow: var(--shadow-lg); border: 4px solid var(--surface);
}
.portrait__frame img { width: 100%; height: 100%; object-fit: cover; }
.portrait__chip {
  position: absolute; z-index: 2; display: flex; align-items: center; gap: 10px;
  background: var(--surface); border: 1px solid var(--border); border-radius: 14px;
  padding: 10px 14px; box-shadow: var(--shadow-lg); animation: float 5s ease-in-out infinite;
}
.portrait__chip span:last-child { display: flex; flex-direction: column; line-height: 1.25; }
.portrait__chip strong { font-size: 14px; }
.portrait__chip small { font-size: 12px; color: var(--text-muted); white-space: nowrap; }
.portrait__chip--top { top: 28px; left: -44px; }
.portrait__chip--bottom { bottom: 24px; right: -36px; animation-delay: -2.5s; }
.portrait__chip-icon {
  width: 32px; height: 32px; border-radius: 9px; display: grid; place-items: center;
  background: var(--blue-soft); color: var(--blue);
}
.portrait__chip-num { font-size: 1.5rem; font-weight: 900; color: var(--accent); }
@keyframes float { 50% { transform: translateY(-8px); } }

/* Stats */
.stats {
  margin-top: 64px;
  display: grid; grid-template-columns: repeat(4, 1fr);
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); box-shadow: var(--shadow); overflow: hidden;
}
.stat { padding: 26px 16px; text-align: center; border-right: 1px solid var(--border); }
.stat:last-child { border-right: 0; }
.stat__num { display: block; font-size: 2.2rem; font-weight: 900; color: var(--blue); line-height: 1.1; }
.stat__label { font-size: 14px; color: var(--text-muted); }

/* ---------- Sections ---------- */
.section { padding: 96px 0; }
.section--alt { background: var(--bg-alt); }
.section__head { margin-bottom: 44px; }
.section__kicker {
  display: inline-block; font-family: var(--mono); font-size: 13px; font-weight: 500;
  color: var(--blue); letter-spacing: .5px; margin-bottom: 8px; text-transform: uppercase;
}
.section__kicker--light { color: #9fd0ff; }
.section__title { font-size: clamp(1.9rem, 3.6vw, 2.6rem); font-weight: 900; letter-spacing: -.5px; }

/* ---------- About ---------- */
.about { display: grid; grid-template-columns: 1.4fr 1fr; gap: 48px; align-items: start; }
.about__text p { color: var(--text-muted); }
.about__text strong { color: var(--text); }
.about__highlights { display: grid; gap: 14px; }
.highlight {
  display: flex; gap: 16px; padding: 18px;
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  transition: transform .25s, box-shadow .25s, border-color .25s;
}
.highlight:hover { transform: translateX(4px); box-shadow: var(--shadow); border-color: var(--blue); }
.highlight__icon {
  flex: none; width: 44px; height: 44px; border-radius: 12px; display: grid; place-items: center;
  background: var(--blue-soft); color: var(--blue);
}
.highlight h3 { font-size: 1rem; margin-bottom: 2px; }
.highlight p { margin: 0; font-size: 15px; color: var(--text-muted); line-height: 1.5; }

/* ---------- Skills ---------- */
.skills { display: grid; grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); gap: 20px; }
.skill-card {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 24px; transition: transform .25s, box-shadow .25s;
}
.skill-card:hover { transform: translateY(-4px); box-shadow: var(--shadow-lg); }
.skill-card h3 { font-size: 1.1rem; margin-bottom: 14px; color: var(--navy); }
:root[data-theme="dark"] .skill-card h3 { color: var(--text); }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .skill-card h3 { color: var(--text); } }
.skill-card--accent { background: var(--accent-soft); border-color: color-mix(in srgb, var(--accent) 40%, transparent); }
.skill-card--accent h3::after { content: " ✦"; color: var(--accent); }

.tags { display: flex; flex-wrap: wrap; gap: 8px; }
.tags li {
  font-size: 14px; padding: 5px 12px; border-radius: 999px;
  background: var(--bg); border: 1px solid var(--border); color: var(--text-muted);
}
.tags .tag--strong { background: var(--blue-soft); border-color: transparent; color: var(--blue); font-weight: 700; }
.skill-card--accent .tags li { background: var(--surface); }
.skill-card--accent .tags .tag--strong { background: var(--accent); color: #2a1b00; }

/* ---------- Timeline ---------- */
.timeline { position: relative; padding-left: 36px; }
.timeline::before {
  content: ""; position: absolute; left: 9px; top: 8px; bottom: 8px; width: 2px;
  background: linear-gradient(var(--blue), var(--border));
}
.timeline__item { position: relative; margin-bottom: 28px; }
.timeline__marker {
  position: absolute; left: -36px; top: 26px; width: 20px; height: 20px; border-radius: 50%;
  background: var(--surface); border: 4px solid var(--blue);
}
.timeline__item:first-child .timeline__marker { background: var(--blue); box-shadow: 0 0 0 6px var(--blue-soft); }
.timeline__card {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 24px 28px; box-shadow: var(--shadow);
}
.timeline__head { display: flex; justify-content: space-between; gap: 16px; align-items: flex-start; flex-wrap: wrap; margin-bottom: 14px; }
.timeline__head h3 { font-size: 1.25rem; color: var(--blue); }
.timeline__company { margin: 4px 0 0; color: var(--text-muted); font-weight: 700; font-size: 15px; }
.timeline__date {
  font-family: var(--mono); font-size: 13px; white-space: nowrap;
  background: var(--blue-soft); color: var(--blue); padding: 5px 12px; border-radius: 999px;
}
.timeline__list li { position: relative; padding-left: 22px; margin-bottom: 8px; color: var(--text-muted); font-size: 16px; }
.timeline__list li::before {
  content: ""; position: absolute; left: 2px; top: .62em;
  border-left: 7px solid var(--blue); border-top: 5px solid transparent; border-bottom: 5px solid transparent;
}
.timeline__list strong { color: var(--text); }

.education {
  display: flex; gap: 20px; align-items: center; margin-top: 40px;
  background: var(--surface); border: 1px solid var(--border); border-left: 4px solid var(--accent);
  border-radius: var(--radius); padding: 24px 28px; box-shadow: var(--shadow);
}
.education__icon { flex: none; width: 56px; height: 56px; border-radius: 14px; display: grid; place-items: center; background: var(--accent-soft); color: var(--accent); }
.education .section__kicker { margin-bottom: 2px; color: var(--accent); }
.education h3 { font-size: 1.2rem; }
.education p { margin: 2px 0 0; color: var(--text-muted); }

/* ---------- Projects ---------- */
.filters { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 32px; }
.filter {
  padding: 8px 18px; border-radius: 999px; font-size: 15px; font-weight: 700;
  border: 1px solid var(--border); background: var(--surface); color: var(--text-muted);
  transition: all .2s;
}
.filter:hover { border-color: var(--blue); color: var(--blue); }
.filter.is-active { background: var(--blue); border-color: var(--blue); color: #fff; }

.projects { display: grid; grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); gap: 20px; }
.project {
  display: flex; flex-direction: column;
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 24px; transition: transform .25s, box-shadow .25s, border-color .25s, opacity .3s;
}
.project:hover { transform: translateY(-4px); box-shadow: var(--shadow-lg); border-color: var(--blue); }
.project.is-hidden { display: none; }
.project__top { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; margin-bottom: 10px; }
.project h3 { font-size: 1.15rem; }
.project > p { color: var(--text-muted); font-size: 15.5px; flex: 1; }
.badge {
  flex: none; font-size: 12px; font-weight: 700; text-transform: uppercase; letter-spacing: .5px;
  padding: 3px 10px; border-radius: 999px; background: var(--bg-alt); color: var(--text-muted); border: 1px solid var(--border);
}
.badge--nda { background: var(--navy); color: #fff; border-color: var(--navy); }
.project__tech { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 14px; }
.project__tech li {
  font-family: var(--mono); font-size: 12px; padding: 3px 9px; border-radius: 6px;
  background: var(--blue-soft); color: var(--blue);
}
.project__links { display: flex; flex-wrap: wrap; gap: 6px 14px; padding-top: 14px; border-top: 1px dashed var(--border); font-size: 14.5px; }
.project__links a { font-weight: 700; word-break: break-all; }
.project__links a::after { content: " ↗"; font-weight: 400; }

/* ---------- Clients ---------- */
.clients { display: grid; grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); gap: 14px; }
.client {
  display: flex; flex-direction: column; justify-content: center; min-height: 96px;
  padding: 18px 20px; border-radius: var(--radius);
  background: var(--surface); border: 1px solid var(--border);
  transition: transform .25s, border-color .25s;
}
.client:hover { transform: translateY(-3px); border-color: var(--blue); }
.client strong { font-size: 1rem; }
.client span { font-size: 13.5px; color: var(--text-muted); }

/* ---------- Contact ---------- */
.contact { padding-top: 40px; }
.contact__box {
  position: relative; overflow: hidden;
  background: linear-gradient(135deg, var(--navy-deep), var(--navy) 50%, #24599a);
  color: #fff; border-radius: 24px; padding: 64px 56px; text-align: center;
  box-shadow: var(--shadow-lg);
}
.contact__box::before {
  content: ""; position: absolute; width: 420px; height: 420px; border-radius: 50%;
  background: radial-gradient(rgba(90, 166, 230, .35), transparent 70%);
  top: -160px; right: -120px; pointer-events: none;
}
.contact__title { font-size: clamp(1.8rem, 3.6vw, 2.6rem); font-weight: 900; margin-bottom: 12px; position: relative; }
.contact__lead { color: #c8d7ea; max-width: 600px; margin: 0 auto 36px; position: relative; }
.contact__layout { display: grid; grid-template-columns: 1.6fr 1fr; gap: 24px; align-items: start; position: relative; text-align: left; }
.contact__grid { display: grid; grid-template-columns: 1fr; gap: 14px; position: relative; }
.contact__item--static:hover { transform: none; background: rgba(255, 255, 255, .08); }

/* Contact form */
.contact-form {
  background: var(--surface); color: var(--text);
  border-radius: var(--radius); padding: 28px; box-shadow: var(--shadow-lg);
}
.contact-form__title { font-size: 1.2rem; margin-bottom: 18px; }
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.field { display: flex; flex-direction: column; margin-bottom: 16px; }
.field label { font-size: 14px; font-weight: 700; margin-bottom: 6px; }
.field label span[aria-hidden] { color: #e5484d; }
.field .optional { font-weight: 400; color: var(--text-muted); }
.field input, .field select, .field textarea {
  font: inherit; font-size: 15px; color: var(--text);
  background: var(--bg); border: 1px solid var(--border); border-radius: var(--radius-sm);
  padding: 11px 14px; width: 100%; transition: border-color .2s, box-shadow .2s;
}
.field textarea { resize: vertical; min-height: 130px; }
.field input:focus, .field select:focus, .field textarea:focus {
  outline: none; border-color: var(--blue); box-shadow: 0 0 0 3px color-mix(in srgb, var(--blue) 22%, transparent);
}
.field.has-error input, .field.has-error select, .field.has-error textarea { border-color: #e5484d; }
.field__error { color: #e5484d; font-size: 13px; min-height: 0; margin-top: 4px; }
.field__error:empty { display: none; }
.hp { position: absolute !important; left: -9999px; width: 1px; height: 1px; overflow: hidden; }

.contact-form__submit { width: 100%; justify-content: center; border: 0; }
.contact-form__submit:disabled { opacity: .7; cursor: wait; transform: none; }
.spinner {
  display: none; width: 16px; height: 16px; border-radius: 50%;
  border: 2px solid rgba(255, 255, 255, .4); border-top-color: #fff; animation: spin .7s linear infinite;
}
.contact-form.is-sending .spinner { display: inline-block; }
@keyframes spin { to { transform: rotate(360deg); } }

.form-status { margin: 14px 0 0; font-size: 14.5px; font-weight: 700; text-align: center; }
.form-status:empty { display: none; }
.form-status.is-success { color: #16a34a; }
.form-status.is-error { color: #e5484d; }
.contact__item {
  display: flex; align-items: center; gap: 14px; text-align: left;
  padding: 18px 20px; border-radius: var(--radius);
  background: rgba(255, 255, 255, .08); border: 1px solid rgba(255, 255, 255, .15); color: #fff;
  transition: background .2s, transform .2s;
}
.contact__item:hover { background: rgba(255, 255, 255, .15); transform: translateY(-3px); text-decoration: none; }
.contact__item svg { flex: none; color: #9fd0ff; }
.contact__item span { display: flex; flex-direction: column; font-weight: 700; font-size: 15px; word-break: break-all; }
.contact__item small { font-weight: 400; color: #9fb4cc; font-size: 12px; text-transform: uppercase; letter-spacing: .6px; }
.contact__actions { display: flex; justify-content: center; flex-wrap: wrap; gap: 12px; margin-top: 32px; position: relative; }

/* ---------- Footer ---------- */
.footer { padding: 32px 0; color: var(--text-muted); font-size: 14px; }
.footer__inner { display: flex; justify-content: space-between; align-items: center; gap: 16px; flex-wrap: wrap; }
.footer p { margin: 0; }
.footer__links { display: flex; gap: 20px; flex-wrap: wrap; }
.footer__links a { color: var(--text-muted); font-weight: 700; }
.footer__links a:hover { color: var(--blue); }

/* ---------- Toast ---------- */
.toast {
  position: fixed; left: 50%; bottom: 24px; transform: translate(-50%, 20px);
  background: var(--text); color: var(--bg); padding: 10px 20px; border-radius: 999px;
  font-size: 14px; font-weight: 700; opacity: 0; pointer-events: none; transition: all .3s; z-index: 100;
}
.toast.is-visible { opacity: 1; transform: translate(-50%, 0); }

/* ---------- Reveal on scroll ---------- */
.js .reveal { opacity: 0; transform: translateY(24px); transition: opacity .7s ease, transform .7s ease; }
.js .reveal.is-visible { opacity: 1; transform: none; }

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { animation: none !important; transition: none !important; }
  .js .reveal { opacity: 1; transform: none; }
}

/* ---------- Responsive ---------- */
@media (max-width: 980px) {
  .hero__inner { grid-template-columns: 1fr; gap: 40px; }
  .hero__card { order: -1; }
  .portrait { width: min(100%, 320px); }
  .about { grid-template-columns: 1fr; }
  .about__highlights { grid-template-columns: 1fr 1fr; }
}

@media (max-width: 860px) {
  .nav__burger { display: flex; }
  .nav__links {
    position: fixed; top: var(--nav-h); left: 0; right: 0;
    flex-direction: column; gap: 2px; padding: 12px 16px 20px;
    background: var(--bg); border-bottom: 1px solid var(--border); box-shadow: var(--shadow);
    transform: translateY(-12px); opacity: 0; visibility: hidden; transition: all .25s;
  }
  .nav__links.is-open { transform: none; opacity: 1; visibility: visible; }
  .nav__links a { padding: 12px 14px; border-radius: var(--radius-sm); }
  .contact__layout { grid-template-columns: 1fr; }
}

@media (max-width: 640px) {
  body { font-size: 16px; }
  .container { padding: 0 16px; }
  .section { padding: 68px 0; }
  .hero { padding-top: calc(var(--nav-h) + 36px); }
  .portrait { width: 220px; }
  .portrait::before { inset: -8px -8px 8px 8px; border-radius: 22px; }
  .portrait__frame { border-radius: 18px; }
  .portrait__chip--top { left: -36px; top: 14px; padding: 7px 10px; }
  .portrait__chip--bottom { right: -36px; bottom: 12px; padding: 7px 10px; }
  .portrait__chip small { display: none; }
  .portrait__chip-icon { width: 26px; height: 26px; }
  .portrait__chip-num { font-size: 1.15rem; }
  .stats { grid-template-columns: 1fr 1fr; margin-top: 44px; }
  .stat:nth-child(2) { border-right: 0; }
  .stat:nth-child(-n+2) { border-bottom: 1px solid var(--border); }
  .about__highlights { grid-template-columns: 1fr; }
  .skills, .projects { grid-template-columns: 1fr; }
  .timeline { padding-left: 26px; }
  .timeline::before { left: 5px; }
  .timeline__marker { left: -28px; width: 16px; height: 16px; border-width: 3px; }
  .timeline__card { padding: 20px; }
  .education { flex-direction: column; align-items: flex-start; padding: 20px; }
  .contact__box { padding: 44px 16px; border-radius: 18px; }
  .contact-form { padding: 20px; }
  .form-row { grid-template-columns: 1fr; gap: 0; }
  .nav__logo-text { display: none; }
}

/* ---------- Print: a clean CV ---------- */
@media print {
  .nav, .portrait__chip, .hero__cta, .filters, .contact__actions, .contact-form, .footer, .toast { display: none !important; }
  body { background: #fff; color: #000; font-size: 12px; }
  .section, .hero { padding: 16px 0; background: none; }
  .js .reveal { opacity: 1; transform: none; }
  .contact__box { background: none; color: #000; box-shadow: none; padding: 0; text-align: left; }
  .contact__item { color: #000; border-color: #ccc; }
  .project, .skill-card, .timeline__card { break-inside: avoid; box-shadow: none; }
}
