/* ==========================================================================
   Juliet Mallare — Portfolio
   Warm cream, soft blue accent, rounded cards.
   Plain CSS. No build tools.
   ========================================================================== */

:root {
  --bg:           #faf6ee;
  --bg-alt:       #f3ede1;
  --surface:      #fffef9;
  --border:       #ece5d5;
  --border-strong:#d8cdb6;
  --text:         #1a1813;
  --text-muted:   #625a4e;
  --accent:       #3d4fdb;
  --accent-soft:  #e9edff;
  --accent-warm:  #c98a4b;

  --radius:       14px;
  --radius-lg:    20px;

  --shadow-sm: 0 1px 2px rgba(30, 20, 10, 0.05);
  --shadow-md: 0 8px 24px rgba(30, 20, 10, 0.08);
  --shadow-lg: 0 18px 48px rgba(30, 20, 10, 0.10);

  --container: 900px;
  --nav-height: 60px;

  --font-body:    'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  --font-display: 'Fraunces', Georgia, 'Times New Roman', serif;

  /* Motion — purposeful, formal, quick. Ease-out for entry, per UX guidance. */
  --ease-out:   cubic-bezier(0.22, 0.61, 0.36, 1);
  --ease-inout: cubic-bezier(0.65, 0, 0.35, 1);
  --dur-fast:   180ms;
  --dur-base:   260ms;
  --dur-slow:   400ms;
}

/* --------------------------------------------------------------------------
   Reset
   -------------------------------------------------------------------------- */

*,
*::before,
*::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  scroll-behavior: smooth;
  scroll-padding-top: calc(var(--nav-height) + 16px);
  /* iOS Safari: prevent text auto-inflation on rotate */
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
}

body {
  font-family: var(--font-body);
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
  font-size: 16px;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  /* iOS: kill the 300ms tap delay + double-tap zoom on controls */
  touch-action: manipulation;
  /* Guard against accidental horizontal scroll from safe-area content */
  overflow-x: hidden;
  /* Respect notch / home-indicator insets (requires viewport-fit=cover) */
  padding-left: env(safe-area-inset-left);
  padding-right: env(safe-area-inset-right);
}

img { max-width: 100%; display: block; }

a { color: var(--accent); }

:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 3px;
  border-radius: 4px;
}

/* --------------------------------------------------------------------------
   Layout helpers
   -------------------------------------------------------------------------- */

.container {
  max-width: var(--container);
  margin: 0 auto;
  padding: 0 24px;
}

.fade-up {
  opacity: 0;
  transform: translateY(12px);
  transition: opacity var(--dur-slow) var(--ease-out),
              transform var(--dur-slow) var(--ease-out);
}

.fade-up.visible {
  opacity: 1;
  transform: none;
}

/* Staggered children — section content cascades in sequence, not all at once. */
.stagger > * {
  opacity: 0;
  transform: translateY(12px);
  transition: opacity var(--dur-slow) var(--ease-out),
              transform var(--dur-slow) var(--ease-out);
}

.stagger.visible > * {
  opacity: 1;
  transform: none;
}

.stagger.visible > *:nth-child(1) { transition-delay: 0ms; }
.stagger.visible > *:nth-child(2) { transition-delay: 70ms; }
.stagger.visible > *:nth-child(3) { transition-delay: 140ms; }
.stagger.visible > *:nth-child(4) { transition-delay: 210ms; }
.stagger.visible > *:nth-child(5) { transition-delay: 280ms; }
.stagger.visible > *:nth-child(6) { transition-delay: 350ms; }

/* Hero entrance — choreographed cascade on load. */
.hero-enter {
  opacity: 0;
  transform: translateY(14px);
  animation: heroEnter 0.6s var(--ease-out) forwards;
}

.hero-enter-1 { animation-delay: 0.05s; }
.hero-enter-2 { animation-delay: 0.16s; }
.hero-enter-3 { animation-delay: 0.27s; }
.hero-enter-4 { animation-delay: 0.38s; }
.hero-enter-5 { animation-delay: 0.49s; }

@keyframes heroEnter {
  to { opacity: 1; transform: none; }
}

/* --------------------------------------------------------------------------
   Navigation
   -------------------------------------------------------------------------- */

.nav {
  position: sticky;
  top: 0;
  z-index: 50;
  background: rgba(250, 246, 238, 0.85);
  backdrop-filter: saturate(180%) blur(12px);
  -webkit-backdrop-filter: saturate(180%) blur(12px);
  border-bottom: 1px solid transparent;
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.nav.scrolled {
  border-bottom-color: var(--border);
  box-shadow: var(--shadow-sm);
}

.nav-inner {
  max-width: var(--container);
  margin: 0 auto;
  padding: 14px 24px;
  /* Inset top padding for the notch in landscape / status bar area */
  padding-top: calc(14px + env(safe-area-inset-top));
  display: flex;
  align-items: center;
  gap: 16px;
  min-height: var(--nav-height);
}

.nav-brand {
  margin-right: auto;
  font-weight: 700;
  font-size: 15px;
  color: var(--text);
  text-decoration: none;
  letter-spacing: -0.01em;
}

.nav-links {
  list-style: none;
  display: flex;
  gap: 2px;
  align-items: center;
  order: 2;
}

.nav-actions {
  order: 3;
}

.nav-links a {
  display: inline-flex;
  align-items: center;
  min-height: 44px;                /* WCAG 2.5.5 touch target */
  text-decoration: none;
  color: var(--text-muted);
  font-size: 14px;
  font-weight: 500;
  padding: 8px 12px;
  border-radius: 8px;
  transition: color 0.15s ease, background 0.15s ease;
}

@media (hover: hover) and (pointer: fine) {
  .nav-links a:hover {
    color: var(--text);
    background: rgba(0, 0, 0, 0.04);
  }
}

.nav-links a.active {
  color: var(--accent);
  background: var(--accent-soft);
}

.nav-links .nav-cta {
  color: var(--accent);
  font-weight: 600;
}

.nav-toggle {
  display: none;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 5px;
  background: none;
  border: none;
  cursor: pointer;
  padding: 8px;
  width: 44px;                     /* WCAG 2.5.5 touch target */
  height: 44px;
  border-radius: 8px;
  color: var(--text);
}

.nav-toggle span {
  display: block;
  width: 20px;
  height: 2px;
  background: var(--text);
  border-radius: 2px;
  transition: transform 0.2s ease, opacity 0.2s ease;
}

/* Hamburger → X animation when the menu is open. */
.nav-toggle.is-active span:nth-child(1) {
  transform: translateY(7px) rotate(45deg);
}

.nav-toggle.is-active span:nth-child(2) {
  opacity: 0;
  transform: scaleX(0);
}

.nav-toggle.is-active span:nth-child(3) {
  transform: translateY(-7px) rotate(-45deg);
}

/* --------------------------------------------------------------------------
   Hero
   -------------------------------------------------------------------------- */

.hero {
  position: relative;
  padding: 96px 0 56px;
  overflow: hidden;
  background: linear-gradient(180deg, var(--bg) 0%, var(--bg-alt) 100%);
  border-bottom: 1px solid var(--border);
  /* iOS: stable, non-jumping hero height as the Safari toolbar collapses.
     svh = small viewport (toolbar visible); dvh = dynamic. Fallback chain. */
  min-height: 100vh;
  min-height: 100svh;
}

@supports (height: 100dvh) {
  .hero {
    min-height: 100dvh;
  }
}

.hero::before {
  content: "";
  position: absolute;
  top: -220px;
  right: -120px;
  width: 560px;
  height: 560px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(61, 79, 219, 0.16) 0%, rgba(61, 79, 219, 0) 66%);
  pointer-events: none;
  z-index: 0;
}

.hero::after {
  content: "";
  position: absolute;
  bottom: -180px;
  left: -140px;
  width: 460px;
  height: 460px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(201, 138, 75, 0.18) 0%, rgba(201, 138, 75, 0) 66%);
  pointer-events: none;
  z-index: 0;
}

.hero > .container {
  position: relative;
  z-index: 1;
}

.hero-grid {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 44px;
  align-items: center;
  margin-bottom: 56px;
}

.hero-photo {
  width: 168px;
  height: 168px;
  border-radius: 50%;
  background: linear-gradient(140deg, var(--accent) 0%, #5a3fb8 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 44px;
  font-weight: 800;
  color: #ffffff;
  border: 4px solid var(--surface);
  box-shadow: 0 0 0 6px var(--surface), var(--shadow-lg);
  letter-spacing: -0.02em;
}

.hero-eyebrow {
  font-size: 12px;
  font-weight: 700;
  color: var(--accent);
  text-transform: uppercase;
  letter-spacing: 0.1em;
  margin-bottom: 8px;
}

.hero-text h1 {
  font-family: var(--font-display);
  font-size: clamp(34px, 5.5vw, 50px);
  font-weight: 600;
  letter-spacing: -0.025em;
  line-height: 1.08;
  margin-bottom: 12px;
}

.hero-subtitle {
  font-size: 17px;
  color: var(--text-muted);
  max-width: 500px;
  margin-bottom: 10px;
  line-height: 1.5;
}

.hero-location {
  font-size: 13px;
  color: var(--text-muted);
  margin-bottom: 22px;
}

.hero-actions {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

.btn {
  display: inline-block;
  padding: 12px 22px;
  border-radius: 10px;
  font-size: 14px;
  font-weight: 600;
  text-decoration: none;
  border: 1px solid transparent;
  cursor: pointer;
  transition: transform 0.15s ease, box-shadow 0.15s ease,
              background 0.15s ease, border-color 0.15s ease;
}

.btn-primary {
  background: var(--accent);
  color: #fff;
  box-shadow: 0 2px 10px rgba(77, 107, 254, 0.28);
}

@media (hover: hover) and (pointer: fine) {
  .btn-primary:hover {
    transform: translateY(-1px);
    box-shadow: 0 6px 18px rgba(77, 107, 254, 0.38);
  }
}

.btn-outline {
  background: var(--surface);
  color: var(--text);
  border-color: var(--border-strong);
}

@media (hover: hover) and (pointer: fine) {
  .btn-outline:hover {
    transform: translateY(-1px);
    border-color: var(--text);
    box-shadow: var(--shadow-sm);
  }
}

/* Stats strip ------------------------------------------------------------- */

.stats {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 30px 24px;
  box-shadow: var(--shadow-md);
}

.stat { text-align: center; }

.stat-number {
  font-family: var(--font-display);
  font-size: 34px;
  font-weight: 600;
  color: var(--accent);
  letter-spacing: -0.02em;
  line-height: 1.2;
  font-variant-numeric: tabular-nums;
}

.stat-label {
  font-size: 11px;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.07em;
  font-weight: 600;
  margin-top: 6px;
}

/* --------------------------------------------------------------------------
   Sections
   -------------------------------------------------------------------------- */

.section {
  padding: 76px 0;
}

.section-alt {
  background: var(--bg-alt);
}

.section-title {
  font-family: var(--font-display);
  font-size: 28px;
  font-weight: 600;
  letter-spacing: -0.018em;
  margin-bottom: 32px;
  position: relative;
  display: inline-block;
  padding-bottom: 12px;
}

.section-title::after {
  content: "";
  position: absolute;
  left: 0;
  bottom: 0;
  width: 44px;
  height: 3px;
  background: linear-gradient(90deg, var(--accent) 0%, var(--accent-warm) 100%);
  border-radius: 2px;
}

/* About ------------------------------------------------------------------- */

.about-text {
  font-size: 16px;
  max-width: 720px;
  color: var(--text);
}

.about-text p {
  margin-bottom: 16px;
  line-height: 1.75;
}

.about-text p:last-child {
  margin-bottom: 0;
}

/* Timeline ---------------------------------------------------------------- */

.timeline {
  position: relative;
  padding-left: 34px;
}

.timeline::before {
  content: "";
  position: absolute;
  left: 8px;
  top: 10px;
  bottom: 10px;
  width: 2px;
  background: var(--border-strong);
  border-radius: 2px;
}

.timeline-item {
  position: relative;
  margin-bottom: 28px;
  opacity: 0;
  transform: translateY(14px);
  transition: opacity 0.55s ease, transform 0.55s ease;
}

.timeline-item.visible {
  opacity: 1;
  transform: none;
}

.timeline-item:last-child {
  margin-bottom: 0;
}

.timeline-dot {
  position: absolute;
  left: -34px;
  top: 24px;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: var(--accent);
  border: 3px solid var(--surface);
  box-shadow: 0 0 0 4px var(--accent-soft);
  z-index: 1;
}

.timeline-body {
  background: var(--surface);
  border: 1px solid var(--border);
  border-left: 3px solid var(--border-strong);
  border-radius: var(--radius);
  padding: 24px 26px;
  box-shadow: var(--shadow-sm);
  transition: transform 0.2s ease, box-shadow 0.2s ease, border-color 0.2s ease;
}

@media (hover: hover) and (pointer: fine) {
  .timeline-body:hover {
    transform: translateX(4px);
    border-left-color: var(--accent);
    box-shadow: var(--shadow-md);
  }
}

.timeline-body h3 {
  font-size: 16px;
  font-weight: 700;
  margin-bottom: 3px;
  letter-spacing: -0.01em;
}

.timeline-company {
  font-size: 14px;
  font-weight: 600;
  color: var(--accent);
  margin-bottom: 3px;
}

.timeline-date {
  font-size: 12px;
  color: var(--text-muted);
  margin-bottom: 12px;
}

.timeline-body > p {
  font-size: 14px;
  color: var(--text);
  line-height: 1.65;
}

/* Skills ------------------------------------------------------------------ */

.skills-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 18px;
  /* Grid items default to min-width:auto, which blocks shrinking below
     content width and causes horizontal overflow. Zero it out. */
  min-width: 0;
}

.skills-grid > *,
.edu-grid > *,
.contact-grid > * {
  min-width: 0;
}

.skills-col {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 24px;
  box-shadow: var(--shadow-sm);
}

.skills-col h3 {
  font-size: 12px;
  font-weight: 700;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.09em;
  margin-bottom: 14px;
}

.skills-col ul {
  list-style: none;
}

.skills-col li {
  font-size: 14px;
  padding: 9px 0;
  color: var(--text);
  border-bottom: 1px solid var(--border);
}

.skills-col li:last-child {
  border-bottom: none;
  padding-bottom: 0;
}

/* Education --------------------------------------------------------------- */

.edu-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 18px;
}

.edu-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 26px;
  box-shadow: var(--shadow-sm);
}

.edu-label {
  font-size: 11px;
  font-weight: 700;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.09em;
  margin-bottom: 10px;
}

.edu-card h3 {
  font-size: 17px;
  font-weight: 700;
  margin-bottom: 8px;
  line-height: 1.3;
  letter-spacing: -0.01em;
}

.edu-sub {
  font-size: 14px;
  color: var(--text-muted);
  margin-bottom: 3px;
}

.edu-sub a {
  color: var(--accent);
  text-decoration: none;
  font-weight: 600;
}

@media (hover: hover) and (pointer: fine) {
  .edu-sub a:hover {
    text-decoration: underline;
  }
}

/* Contact ----------------------------------------------------------------- */

.contact-lede {
  font-size: 16px;
  color: var(--text-muted);
  margin-bottom: 26px;
  max-width: 520px;
}

.contact-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}

.contact-card {
  display: block;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 26px;
  text-decoration: none;
  color: inherit;
  box-shadow: var(--shadow-sm);
  transition: transform 0.15s ease, border-color 0.15s ease, box-shadow 0.15s ease;
}

@media (hover: hover) and (pointer: fine) {
  .contact-card:hover {
    transform: translateY(-2px);
    border-color: var(--accent);
    box-shadow: var(--shadow-md);
  }
}

.contact-label {
  font-size: 11px;
  font-weight: 700;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.09em;
  margin-bottom: 8px;
}

.contact-value {
  font-size: 16px;
  font-weight: 600;
  color: var(--accent);
}

/* Footer ------------------------------------------------------------------ */

.footer {
  background: var(--bg-alt);
  padding: 34px 0;
  border-top: 1px solid var(--border);
  text-align: center;
}

.footer p {
  font-size: 13px;
  color: var(--text-muted);
}

.footer-small {
  margin-top: 6px;
  font-size: 12px;
}

/* --------------------------------------------------------------------------
   Reduced motion
   -------------------------------------------------------------------------- */

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }

  *,
  *::before,
  *::after {
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.001ms !important;
    transition-delay: 0ms !important;
  }

  .hero-enter,
  .fade-up,
  .stagger > * {
    opacity: 1 !important;
    transform: none !important;
  }

  .timeline-item.visible .timeline-dot {
    animation: none !important;
  }
}

/* --------------------------------------------------------------------------
   Theme toggle
   -------------------------------------------------------------------------- */

.nav-actions {
  display: flex;
  align-items: center;
  gap: 6px;
}

.theme-toggle {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: none;
  border: none;
  padding: 0;
  cursor: pointer;
  border-radius: 999px;
  min-width: 44px;                 /* WCAG 2.5.5 touch target */
  min-height: 44px;
}

.theme-toggle-track {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 58px;
  height: 30px;
  padding: 0 7px;
  border-radius: 999px;
  background: var(--bg-alt);
  border: 1px solid var(--border-strong);
  color: var(--text-muted);
  transition: background 0.25s ease, border-color 0.25s ease;
}

@media (hover: hover) and (pointer: fine) {
  .theme-toggle:hover .theme-toggle-track {
    border-color: var(--accent);
  }
}

.theme-icon {
  position: relative;
  z-index: 1;
  transition: color 0.25s ease, opacity 0.25s ease;
}

.theme-icon-sun { color: var(--accent-warm); }
.theme-icon-moon { color: var(--text-muted); opacity: 0.55; }

.theme-toggle-knob {
  position: absolute;
  top: 3px;
  left: 3px;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: var(--surface);
  box-shadow: var(--shadow-sm);
  transition: transform 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}

[data-theme="dark"] .theme-toggle-knob {
  transform: translateX(28px);
}

[data-theme="dark"] .theme-icon-sun { color: var(--text-muted); opacity: 0.55; }
[data-theme="dark"] .theme-icon-moon { color: var(--accent); opacity: 1; }

@media (prefers-reduced-motion: reduce) {
  .theme-toggle-knob { transition: none; }
}

/* --------------------------------------------------------------------------
   Hero photo (real image with monogram fallback)
   -------------------------------------------------------------------------- */

.hero-photo img {
  width: 100%;
  height: 100%;
  border-radius: 50%;
  object-fit: cover;
}

.hero-photo-fallback {
  align-items: center;
  justify-content: center;
  width: 100%;
  height: 100%;
}

/* --------------------------------------------------------------------------
   Dark mode
   -------------------------------------------------------------------------- */

[data-theme="dark"] {
  --bg:           #14120e;
  --bg-alt:       #1c1915;
  --surface:      #211d18;
  --border:       #322c24;
  --border-strong:#443c31;
  --text:         #f3ede2;
  --text-muted:   #a99e8c;
  --accent:       #8ba0ff;
  --accent-soft:  #232a44;
  --accent-warm:  #d9a066;

  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.30);
  --shadow-md: 0 8px 24px rgba(0, 0, 0, 0.40);
  --shadow-lg: 0 18px 48px rgba(0, 0, 0, 0.50);
}

[data-theme="dark"] .nav {
  background: rgba(20, 18, 14, 0.85);
}

@media (hover: hover) and (pointer: fine) {
  [data-theme="dark"] .nav-links a:hover {
    background: rgba(255, 255, 255, 0.06);
  }
}

[data-theme="dark"] .nav-links a.active {
  background: var(--accent-soft);
}

[data-theme="dark"] .hero-photo {
  border-color: var(--surface);
}

[data-theme="dark"] .btn-outline {
  background: var(--surface);
}

@media (hover: hover) and (pointer: fine) {
  [data-theme="dark"] .btn-outline:hover {
    border-color: var(--text-muted);
  }
}

/* --------------------------------------------------------------------------
   Print
   -------------------------------------------------------------------------- */

@media print {
  :root {
    --bg: #ffffff;
    --bg-alt: #ffffff;
    --surface: #ffffff;
    --text: #000000;
    --text-muted: #333333;
    --border: #cccccc;
    --border-strong: #999999;
    --accent: #1a1a1a;
  }

  .nav,
  .hero-actions,
  .theme-toggle,
  .nav-toggle,
  .hero::before,
  .hero::after {
    display: none !important;
  }

  .fade-up,
  .timeline-item {
    opacity: 1 !important;
    transform: none !important;
  }

  body {
    font-size: 11pt;
  }

  .section {
    padding: 16px 0;
    page-break-inside: avoid;
  }

  .timeline-body,
  .skills-col,
  .edu-card,
  .contact-card {
    box-shadow: none;
    border: 1px solid var(--border);
    page-break-inside: avoid;
  }

  .timeline-item:hover .timeline-body {
    transform: none;
  }

  a {
    color: #000000;
    text-decoration: none;
  }

  .scroll-progress,
  .to-top {
    display: none !important;
  }
}

/* --------------------------------------------------------------------------
   Scroll progress + back to top
   -------------------------------------------------------------------------- */

.scroll-progress {
  position: absolute;
  left: 0;
  bottom: -1px;
  height: 2px;
  width: 0;
  background: linear-gradient(90deg, var(--accent) 0%, var(--accent-warm) 100%);
  transition: width 0.1s linear;
}

.to-top {
  position: fixed;
  right: calc(24px + env(safe-area-inset-right));
  bottom: calc(24px + env(safe-area-inset-bottom));
  z-index: 40;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 46px;
  height: 46px;
  border-radius: 50%;
  border: 1px solid var(--border-strong);
  background: var(--surface);
  color: var(--accent);
  cursor: pointer;
  box-shadow: var(--shadow-md);
  transition: transform 0.15s ease, box-shadow 0.15s ease, border-color 0.15s ease;
}

@media (hover: hover) and (pointer: fine) {
  .to-top:hover {
    transform: translateY(-2px);
    border-color: var(--accent);
    box-shadow: var(--shadow-lg);
  }
}

.to-top[hidden] {
  display: none;
}

/* --------------------------------------------------------------------------
   Responsive
   -------------------------------------------------------------------------- */

@media (max-width: 760px) {
  .nav-toggle { display: flex; }

  .nav-links {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    flex-direction: column;
    align-items: stretch;
    gap: 2px;
    background: var(--surface);
    padding: 10px 16px 16px;
    border-bottom: 1px solid var(--border);
    box-shadow: var(--shadow-md);
    transform: translateY(-140%);
    transition: transform 0.28s ease;
    z-index: 40;
  }

  .nav-links.open {
    transform: translateY(0);
  }

  /* Optional dim backdrop behind the open menu (mobile only). */
  .nav-links.open::before {
    content: "";
    position: fixed;
    inset: var(--nav-height) 0 0 0;
    background: rgba(20, 18, 14, 0.35);
    z-index: -1;
    pointer-events: none;
  }

  /* Body scroll-lock while the menu is open (iOS-safe). */
  body.nav-open {
    overflow: hidden;
  }

  .nav-links a {
    padding: 12px 10px;
    font-size: 15px;
    border-radius: 8px;
  }

  .nav-actions {
    gap: 8px;
  }

  .hero {
    padding: 48px 0 32px;
  }

  .hero-grid {
    grid-template-columns: 1fr;
    gap: 22px;
    text-align: left;
  }

  .hero-photo {
    width: 88px;
    height: 88px;
    font-size: 26px;
  }

  .hero-subtitle { font-size: 15px; }

  /* Single-column stacking on phones — prevents horizontal overflow
     from 3-up (skills) and 2-up (education, contact) desktop grids. */
  .skills-grid,
  .edu-grid,
  .contact-grid {
    grid-template-columns: 1fr;
  }

  .stats {
    grid-template-columns: 1fr;
    gap: 4px;
    padding: 18px 16px;
  }

  .stat {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 4px;
    border-bottom: 1px solid var(--border);
  }

  .stat:last-child {
    border-bottom: none;
  }

  .stat-number {
    font-size: 28px;
  }

  .stat-label {
    margin-top: 0;
    text-align: right;
  }
}
