/* =========================================================
   Hafiz Ghufran — Portfolio
   Table of contents
   1. Tokens & reset      6. Skills           11. Footer
   2. Layout & buttons    7. Projects         12. Utilities
   3. Header              8. Services         13. Animations
   4. Hero                9. Call to action   14. Responsive
   5. About              10. Contact          15. Reduced motion
   ========================================================= */

/* ---------- 1. Tokens & reset ---------- */
:root {
  --bg: #050914;
  --ink: #e8eefb;
  --muted: #93a4c2;
  --faint: #5d6f8f;
  --cyan: #22d3ee;
  --blue: #3b82f6;
  --grad: linear-gradient(135deg, var(--cyan), var(--blue));
  --glass: rgba(255, 255, 255, 0.045);
  --line: rgba(140, 190, 255, 0.16);
  --danger: #f87171;
  --ok: #4ade80;
  --radius: 20px;
  --radius-sm: 12px;
  --header-h: 72px;
  --ease: cubic-bezier(0.22, 0.8, 0.24, 1);
  --font-head: 'Sora', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
  --font-body: 'Manrope', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
  --font-mono: 'JetBrains Mono', ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
}

*, *::before, *::after { box-sizing: border-box; }

html {
  background: var(--bg);
  -webkit-text-size-adjust: 100%;
}

@media (prefers-reduced-motion: no-preference) {
  html { scroll-behavior: smooth; }
}

body {
  margin: 0;
  font-family: var(--font-body);
  font-size: 1rem;
  line-height: 1.7;
  color: var(--ink);
  overflow-x: hidden;
}

/* Ambient background: glows + faint grid */
body::before {
  content: "";
  position: fixed;
  inset: 0;
  z-index: -1;
  pointer-events: none;
  background:
    radial-gradient(55rem 38rem at 88% -8%, rgba(34, 211, 238, 0.13), transparent 62%),
    radial-gradient(50rem 40rem at -12% 18%, rgba(59, 130, 246, 0.16), transparent 62%),
    linear-gradient(rgba(140, 190, 255, 0.04) 1px, transparent 1px) 0 0 / 52px 52px,
    linear-gradient(90deg, rgba(140, 190, 255, 0.04) 1px, transparent 1px) 0 0 / 52px 52px;
  -webkit-mask-image: linear-gradient(to bottom, #000 0%, #000 60%, rgba(0, 0, 0, 0.35) 100%);
          mask-image: linear-gradient(to bottom, #000 0%, #000 60%, rgba(0, 0, 0, 0.35) 100%);
}

h1, h2, h3, p, ul { margin: 0; }
ul { padding: 0; list-style: none; }
img { display: block; max-width: 100%; height: auto; }
a { color: inherit; text-decoration: none; }
button, input, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }

h1, h2, h3 {
  font-family: var(--font-head);
  line-height: 1.15;
  letter-spacing: -0.02em;
}

:focus-visible {
  outline: 2px solid var(--cyan);
  outline-offset: 3px;
  border-radius: 6px;
}

.icon {
  width: 1.15em;
  height: 1.15em;
  flex: none;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

/* ---------- 2. Layout & buttons ---------- */
.container { width: min(1180px, 100% - 2.5rem); margin-inline: auto; }

.section {
  padding-block: clamp(4rem, 9vw, 7rem);
  scroll-margin-top: calc(var(--header-h) - 10px);
}

.section-head { max-width: 620px; margin-bottom: clamp(2rem, 5vw, 3.25rem); }
.section-head p { color: var(--muted); margin-top: 0.9rem; }
.section-title { font-size: clamp(2rem, 4.6vw, 3rem); font-weight: 700; }

.grad-text {
  background: var(--grad);
  -webkit-background-clip: text;
          background-clip: text;
  -webkit-text-fill-color: transparent;
  color: transparent;
}

.glass {
  position: relative;
  background: var(--glass);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  -webkit-backdrop-filter: blur(14px);
          backdrop-filter: blur(14px);
  transition: transform 0.35s var(--ease), border-color 0.35s, box-shadow 0.35s;
}

.glass::before {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: inherit;
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.3s;
  background: radial-gradient(380px circle at var(--mx, 50%) var(--my, 0%), rgba(34, 211, 238, 0.12), transparent 45%);
}

@media (hover: hover) {
  .glass:hover { transform: translateY(-4px); border-color: rgba(34, 211, 238, 0.4); box-shadow: 0 24px 50px -24px rgba(34, 211, 238, 0.35); }
  .glass:hover::before { opacity: 1; }
}

.icon-box {
  display: inline-grid;
  place-items: center;
  width: 48px;
  height: 48px;
  border-radius: 14px;
  color: var(--cyan);
  font-size: 1.35rem;
  background: linear-gradient(145deg, rgba(34, 211, 238, 0.16), rgba(59, 130, 246, 0.1));
  border: 1px solid rgba(34, 211, 238, 0.22);
}
.icon-box.ok { color: var(--ok); background: rgba(74, 222, 128, 0.1); border-color: rgba(74, 222, 128, 0.28); }

.btn {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.55rem;
  padding: 0.85rem 1.5rem;
  border: 1px solid transparent;
  border-radius: 999px;
  font-weight: 700;
  font-size: 0.95rem;
  line-height: 1.2;
  white-space: nowrap;
  overflow: hidden;
  isolation: isolate;
  transition: transform 0.25s var(--ease), box-shadow 0.25s, background 0.25s, border-color 0.25s;
}
.btn .icon { transition: transform 0.25s var(--ease); }
.btn:active { transform: scale(0.97); }

.btn-primary {
  color: #03101f;
  background: var(--grad);
  box-shadow: 0 10px 28px -10px rgba(34, 211, 238, 0.65);
}
.btn-primary::after {
  content: "";
  position: absolute;
  inset: 0;
  z-index: -1;
  background: linear-gradient(110deg, transparent 30%, rgba(255, 255, 255, 0.45) 50%, transparent 70%);
  transform: translateX(-120%);
  transition: transform 0.6s var(--ease);
}

.btn-ghost {
  color: var(--ink);
  background: rgba(255, 255, 255, 0.04);
  border-color: var(--line);
}

@media (hover: hover) {
  .btn-primary:hover { transform: translateY(-2px); box-shadow: 0 16px 34px -10px rgba(34, 211, 238, 0.8); }
  .btn-primary:hover::after { transform: translateX(120%); }
  .btn-ghost:hover { transform: translateY(-2px); border-color: var(--cyan); background: rgba(34, 211, 238, 0.08); }
  .btn:hover .slide { transform: translateX(4px); }
}

.btn-sm { padding: 0.6rem 1.05rem; font-size: 0.85rem; }
.btn-lg { padding: 1.05rem 2rem; font-size: 1.02rem; }

/* ---------- 3. Header ---------- */
.skip-link {
  position: fixed;
  top: -60px;
  left: 1rem;
  z-index: 300;
  padding: 0.6rem 1rem;
  border-radius: 10px;
  background: var(--cyan);
  color: #03101f;
  font-weight: 700;
  transition: top 0.2s;
}
.skip-link:focus { top: 1rem; }

.progress {
  position: fixed;
  top: 0;
  left: 0;
  z-index: 250;
  width: 100%;
  height: 3px;
  background: var(--grad);
  transform: scaleX(0);
  transform-origin: left;
}

.site-header {
  position: sticky;
  top: 0;
  z-index: 200;
  transition: background 0.3s, border-color 0.3s, box-shadow 0.3s;
  border-bottom: 1px solid transparent;
}
.site-header.is-scrolled {
  background: rgba(5, 9, 20, 0.74);
  -webkit-backdrop-filter: blur(18px) saturate(140%);
          backdrop-filter: blur(18px) saturate(140%);
  border-bottom-color: var(--line);
  box-shadow: 0 10px 30px -20px #000;
}

.header-inner {
  position: relative;
  display: flex;
  align-items: center;
  height: var(--header-h);
  gap: 1rem;
}

.logo {
  display: inline-grid;
  place-items: center;
  width: 44px;
  height: 44px;
  border-radius: 13px;
  font-family: var(--font-head);
  font-weight: 700;
  font-size: 1.05rem;
  letter-spacing: 0.02em;
  color: var(--cyan);
  background: linear-gradient(145deg, rgba(34, 211, 238, 0.16), rgba(59, 130, 246, 0.12));
  border: 1px solid rgba(34, 211, 238, 0.35);
  transition: transform 0.3s var(--ease), box-shadow 0.3s;
}
@media (hover: hover) {
  .logo:hover { transform: rotate(-6deg) scale(1.05); box-shadow: 0 0 24px rgba(34, 211, 238, 0.4); }
}

.nav-menu { margin-left: auto; }
.nav-menu ul { display: flex; gap: 0.25rem; }

.nav-link {
  position: relative;
  display: block;
  padding: 0.5rem 0.9rem;
  font-size: 0.93rem;
  font-weight: 600;
  color: var(--muted);
  transition: color 0.25s;
}
.nav-link::after {
  content: "";
  position: absolute;
  left: 0.9rem;
  right: 0.9rem;
  bottom: 2px;
  height: 2px;
  border-radius: 2px;
  background: var(--grad);
  transform: scaleX(0);
  transition: transform 0.3s var(--ease);
}
.nav-link:hover, .nav-link.is-active { color: var(--ink); }
.nav-link.is-active::after, .nav-link:hover::after { transform: scaleX(1); }

.header-actions { display: flex; align-items: center; gap: 0.75rem; }

.nav-toggle {
  display: none;
  width: 44px;
  height: 44px;
  padding: 0;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.04);
  position: relative;
}
.nav-toggle span {
  position: absolute;
  left: 12px;
  right: 12px;
  height: 2px;
  border-radius: 2px;
  background: var(--ink);
  transition: transform 0.3s var(--ease), opacity 0.2s, top 0.3s var(--ease);
}
.nav-toggle span:nth-child(1) { top: 15px; }
.nav-toggle span:nth-child(2) { top: 21px; }
.nav-toggle span:nth-child(3) { top: 27px; }
.nav-toggle[aria-expanded="true"] span:nth-child(1) { top: 21px; transform: rotate(45deg); }
.nav-toggle[aria-expanded="true"] span:nth-child(2) { opacity: 0; }
.nav-toggle[aria-expanded="true"] span:nth-child(3) { top: 21px; transform: rotate(-45deg); }

/* ---------- 4. Hero ---------- */
.hero { padding-block: clamp(2rem, 6vw, 4.5rem) clamp(3.5rem, 8vw, 6.5rem); scroll-margin-top: 0; }

.hero-grid {
  display: grid;
  grid-template-columns: 1.05fr 0.95fr;
  align-items: center;
  gap: clamp(2.5rem, 6vw, 4.5rem);
}

.pill {
  display: inline-flex;
  align-items: center;
  gap: 0.6rem;
  padding: 0.45rem 1rem 0.45rem 0.85rem;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.045);
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--muted);
}

.pulse, i.pulse {
  position: relative;
  display: inline-block;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--ok);
}
.pulse::after {
  content: "";
  position: absolute;
  inset: -4px;
  border-radius: 50%;
  border: 2px solid var(--ok);
  opacity: 0;
  animation: ping 2s ease-out infinite;
}

.hero h1 {
  margin-top: 1.4rem;
  font-size: clamp(2.6rem, 6.4vw, 4.75rem);
  font-weight: 700;
  letter-spacing: -0.035em;
  line-height: 1.04;
}
.hero h1 .grad-text { display: block; padding-bottom: 0.08em; }

.hero-role {
  margin-top: 1rem;
  font-family: var(--font-head);
  font-size: clamp(1.15rem, 2.4vw, 1.55rem);
  font-weight: 500;
  color: var(--cyan);
}

.hero-desc { margin-top: 1.1rem; max-width: 50ch; font-size: 1.08rem; color: var(--muted); }

.hero-actions { display: flex; flex-wrap: wrap; gap: 0.9rem; margin-top: 2rem; }

.hero-meta {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  margin-top: 2rem;
  font-size: 0.9rem;
  color: var(--faint);
}

.hero-visual { position: relative; padding: 1.5rem 0; }

.hero-badges li { list-style: none; }
.badge {
  position: absolute;
  z-index: 2;
  display: inline-flex;
  align-items: center;
  gap: 0.55rem;
  padding: 0.5rem 0.95rem;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: rgba(10, 18, 38, 0.72);
  -webkit-backdrop-filter: blur(12px);
          backdrop-filter: blur(12px);
  font-family: var(--font-mono);
  font-size: 0.8rem;
  font-weight: 500;
  box-shadow: 0 14px 30px -14px #000;
  animation: float 6s ease-in-out infinite;
}
.badge i { width: 8px; height: 8px; border-radius: 50%; }
.b1 { top: 9%; left: 0; }
.b2 { top: 20%; right: 0; animation-delay: -1.5s; }
.b3 { bottom: 20%; left: 1%; animation-delay: -3s; }
.b4 { bottom: 9%; right: 4%; animation-delay: -4.5s; }

/* Hero portrait with gradient ring */
.hero-photo {
  position: relative;
  z-index: 1;
  width: min(420px, 82%);
  margin-inline: auto;
  aspect-ratio: 1;
  padding: 5px;
  border-radius: 50%;
  background: conic-gradient(from 210deg, var(--cyan), var(--blue), rgba(59, 130, 246, 0.15), var(--cyan));
  box-shadow: 0 0 70px -10px rgba(34, 211, 238, 0.45), 0 30px 60px -24px #000;
}
.hero-photo::after {
  content: "";
  position: absolute;
  inset: -14px;
  border-radius: 50%;
  border: 1px dashed rgba(34, 211, 238, 0.3);
  pointer-events: none;
}
.hero-photo img {
  width: 100%;
  height: 100%;
  border-radius: 50%;
  object-fit: cover;
  border: 4px solid var(--bg);
}

/* ---------- 5. About ---------- */
.about-grid {
  display: grid;
  grid-template-columns: 1.1fr 0.9fr;
  gap: clamp(2rem, 6vw, 4.5rem);
  align-items: center;
}
.about-copy p { margin-top: 1.1rem; color: var(--muted); max-width: 60ch; }
.about-copy .section-title { margin-bottom: 1.4rem; }
.about-copy .btn { margin-top: 1.8rem; }

.stats { display: grid; grid-template-columns: repeat(2, 1fr); gap: 1rem; }
.stat { padding: 1.4rem; }
.stat h3 { margin-top: 1rem; font-size: 1rem; font-weight: 600; letter-spacing: -0.01em; }
.stat p { margin-top: 0.3rem; font-size: 0.86rem; color: var(--muted); line-height: 1.5; }

/* ---------- 6. Skills ---------- */
.skills-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 1.1rem; }
.skill { padding: 1.4rem; display: flex; flex-direction: column; gap: 1rem; }
.skill-top { display: flex; align-items: center; justify-content: space-between; gap: 0.5rem; }
.skill-level { font-size: 0.75rem; font-weight: 700; color: var(--cyan); text-align: right; }
.skill h3 { font-size: 1.02rem; font-weight: 600; letter-spacing: -0.01em; flex: 1; }
.bar { height: 7px; border-radius: 99px; background: rgba(255, 255, 255, 0.08); overflow: hidden; }
.bar span { display: block; height: 100%; width: var(--level); border-radius: inherit; background: var(--grad); box-shadow: 0 0 14px rgba(34, 211, 238, 0.5); }

.js .skill .bar span { width: 0; transition: width 1.3s var(--ease) 0.25s; }
.js .skill.is-visible .bar span { width: var(--level); }

/* ---------- 7. Projects ---------- */
.filters { display: flex; flex-wrap: wrap; gap: 0.6rem; margin-bottom: 2rem; }
.filter-btn {
  padding: 0.55rem 1.2rem;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.04);
  color: var(--muted);
  font-size: 0.88rem;
  font-weight: 700;
  transition: color 0.25s, background 0.25s, border-color 0.25s, transform 0.2s;
}
.filter-btn:active { transform: scale(0.96); }
@media (hover: hover) { .filter-btn:hover { color: var(--ink); border-color: var(--cyan); } }
.filter-btn.is-active { color: #03101f; background: var(--grad); border-color: transparent; }

.projects-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 1.4rem; }
.project { display: flex; flex-direction: column; overflow: hidden; }
.project[hidden] { display: none; }
.project.is-filtered-in { animation: revealUp 0.55s var(--ease) backwards; }

.project-media {
  position: relative;
  aspect-ratio: 16 / 10;
  overflow: hidden;
  border-bottom: 1px solid var(--line);
  background: #0b1226;
}
.project-media::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(180deg, transparent 55%, rgba(5, 9, 20, 0.55));
  pointer-events: none;
}
.project-media img { width: 100%; height: 100%; object-fit: cover; transition: transform 0.7s var(--ease), opacity 0.6s; }
.js .project-media img:not(.is-loaded) { opacity: 0; }
@media (hover: hover) { .project:hover .project-media img { transform: scale(1.05); } }

.project-body { display: flex; flex: 1; flex-direction: column; gap: 0.85rem; padding: 1.4rem; }
.tag {
  align-self: flex-start;
  padding: 0.25rem 0.75rem;
  border-radius: 999px;
  font-size: 0.75rem;
  font-weight: 700;
  color: var(--cyan);
  background: rgba(34, 211, 238, 0.1);
  border: 1px solid rgba(34, 211, 238, 0.25);
}
.project h3 { font-size: 1.28rem; font-weight: 600; }
.project-body > p { color: var(--muted); font-size: 0.94rem; line-height: 1.65; }
.chips { display: flex; flex-wrap: wrap; gap: 0.4rem; }
.chips li {
  padding: 0.2rem 0.6rem;
  border-radius: 8px;
  font-family: var(--font-mono);
  font-size: 0.72rem;
  color: #b6c6e3;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.07);
}
.project-actions { display: flex; flex-wrap: wrap; gap: 0.6rem; margin-top: auto; padding-top: 0.6rem; }

/* ---------- 8. Services ---------- */
.services-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 1.1rem; }
.service { padding: 1.7rem; }
.service h3 { margin-top: 1.2rem; font-size: 1.12rem; font-weight: 600; }
.service p { margin-top: 0.6rem; color: var(--muted); font-size: 0.94rem; line-height: 1.65; }

/* ---------- 9. Call to action ---------- */
.cta-section { padding-block: clamp(1rem, 3vw, 2rem); }
.cta-box {
  position: relative;
  overflow: hidden;
  text-align: center;
  padding: clamp(2.75rem, 7vw, 5rem) 1.5rem;
  border-radius: 28px;
  border: 1px solid transparent;
  background:
    linear-gradient(160deg, #0a1a36, #06101f) padding-box,
    linear-gradient(135deg, rgba(34, 211, 238, 0.7), rgba(59, 130, 246, 0.25) 55%, rgba(34, 211, 238, 0.5)) border-box;
  box-shadow: 0 40px 90px -40px rgba(34, 211, 238, 0.35);
}
.cta-box::before {
  content: "";
  position: absolute;
  inset: -40% 20% auto;
  height: 80%;
  background: radial-gradient(closest-side, rgba(34, 211, 238, 0.22), transparent);
  pointer-events: none;
}
.cta-brace {
  position: absolute;
  right: 4%;
  bottom: -0.25em;
  font-family: var(--font-mono);
  font-size: clamp(6rem, 18vw, 13rem);
  font-weight: 500;
  line-height: 1;
  color: rgba(34, 211, 238, 0.06);
  pointer-events: none;
  user-select: none;
}
.cta-box h2 { position: relative; font-size: clamp(1.9rem, 5vw, 3.2rem); font-weight: 700; }
.cta-box p { position: relative; margin: 1rem 0 2rem; font-size: 1.15rem; color: var(--muted); }
.cta-box .btn { position: relative; }

/* ---------- 10. Contact ---------- */
.contact-grid { display: grid; grid-template-columns: 0.85fr 1.15fr; gap: clamp(2rem, 5vw, 3.5rem); align-items: start; }

.info-list { display: grid; gap: 1.4rem; }
.info-list li { display: flex; align-items: center; gap: 1rem; }
.info-list h3 { font-size: 0.85rem; font-weight: 600; color: var(--faint); letter-spacing: 0; }
.info-list a, .info-list p { font-weight: 600; word-break: break-word; }
.info-list a { transition: color 0.2s; }
.info-list a:hover { color: var(--cyan); }

.contact-buttons { display: flex; flex-wrap: wrap; gap: 0.7rem; margin-top: 2.2rem; }

.contact-form { padding: clamp(1.4rem, 4vw, 2.2rem); display: grid; gap: 1.1rem; }
.contact-form:hover { transform: none; }
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 1.1rem; }
.field { display: grid; gap: 0.4rem; }
.field label { font-size: 0.86rem; font-weight: 700; }
.field input, .field textarea {
  width: 100%;
  padding: 0.85rem 1rem;
  border-radius: var(--radius-sm);
  border: 1px solid var(--line);
  background: rgba(5, 9, 20, 0.6);
  font-size: 0.97rem;
  transition: border-color 0.2s, box-shadow 0.2s, background 0.2s;
}
.field textarea { resize: vertical; min-height: 130px; }
.field input::placeholder, .field textarea::placeholder { color: var(--faint); }
.field input:focus, .field textarea:focus {
  outline: none;
  border-color: var(--cyan);
  box-shadow: 0 0 0 4px rgba(34, 211, 238, 0.14);
  background: rgba(5, 9, 20, 0.85);
}
.field.has-error input, .field.has-error textarea { border-color: var(--danger); }
.field.has-error input:focus, .field.has-error textarea:focus { box-shadow: 0 0 0 4px rgba(248, 113, 113, 0.16); }
.error { min-height: 1.2em; font-size: 0.8rem; line-height: 1.4; color: var(--danger); }
.contact-form .btn { justify-self: start; }
.form-status { font-size: 0.92rem; color: var(--ok); min-height: 1.2em; }
.form-status.is-error { color: var(--danger); }

/* ---------- 11. Footer ---------- */
.site-footer { margin-top: clamp(2rem, 5vw, 4rem); border-top: 1px solid var(--line); background: rgba(3, 6, 14, 0.55); }
.footer-grid {
  display: grid;
  grid-template-columns: 1.2fr 1.4fr auto;
  gap: 2rem;
  align-items: center;
  padding-block: 2.6rem;
}
.footer-brand { display: flex; align-items: center; gap: 1rem; }
.footer-brand p { color: var(--muted); font-weight: 600; }
.footer-links { display: flex; flex-wrap: wrap; gap: 0.4rem 1.3rem; }
.footer-links a { font-size: 0.92rem; color: var(--muted); transition: color 0.2s; }
.footer-links a:hover { color: var(--cyan); }
.socials { display: flex; gap: 0.6rem; }
.socials a {
  display: grid;
  place-items: center;
  width: 42px;
  height: 42px;
  border-radius: 12px;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.04);
  color: var(--muted);
  font-size: 1.1rem;
  transition: color 0.2s, border-color 0.2s, transform 0.25s var(--ease), background 0.2s;
}
.socials a:hover { color: var(--cyan); border-color: var(--cyan); background: rgba(34, 211, 238, 0.08); transform: translateY(-3px); }
.footer-bottom {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 0.5rem 1.5rem;
  padding-block: 1.3rem 1.8rem;
  border-top: 1px solid var(--line);
  font-size: 0.85rem;
  color: var(--faint);
}

/* ---------- 12. Utilities ---------- */
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  margin: -1px;
  padding: 0;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.to-top {
  position: fixed;
  right: 1.25rem;
  bottom: 1.25rem;
  z-index: 150;
  display: grid;
  place-items: center;
  width: 48px;
  height: 48px;
  padding: 0;
  border: 0;
  border-radius: 50%;
  color: #03101f;
  font-size: 1.15rem;
  background: var(--grad);
  box-shadow: 0 12px 30px -8px rgba(34, 211, 238, 0.6);
  opacity: 0;
  visibility: hidden;
  transform: translateY(16px);
  transition: opacity 0.3s, transform 0.3s var(--ease), visibility 0.3s;
}
.to-top.is-visible { opacity: 1; visibility: visible; transform: none; }
@media (hover: hover) { .to-top.is-visible:hover { transform: translateY(-4px); } }

.toast {
  position: fixed;
  left: 50%;
  bottom: 1.5rem;
  z-index: 300;
  max-width: calc(100% - 2rem);
  padding: 0.8rem 1.3rem;
  border-radius: 14px;
  border: 1px solid var(--line);
  background: rgba(10, 18, 38, 0.92);
  -webkit-backdrop-filter: blur(14px);
          backdrop-filter: blur(14px);
  font-size: 0.92rem;
  font-weight: 600;
  text-align: center;
  box-shadow: 0 20px 40px -16px #000;
  opacity: 0;
  visibility: hidden;
  transform: translate(-50%, 16px);
  transition: opacity 0.3s, transform 0.3s var(--ease), visibility 0.3s;
}
.toast.is-visible { opacity: 1; visibility: visible; transform: translate(-50%, 0); }

/* ---------- 13. Animations ---------- */
.js .reveal:not(.is-visible) { opacity: 0; }
.reveal.is-visible { animation: revealUp 0.8s var(--ease) var(--d, 0s) backwards; }

.stagger > :nth-child(2) { --d: 0.07s; }
.stagger > :nth-child(3) { --d: 0.14s; }
.stagger > :nth-child(4) { --d: 0.21s; }
.stagger > :nth-child(5) { --d: 0.07s; }
.stagger > :nth-child(6) { --d: 0.14s; }
.stagger > :nth-child(7) { --d: 0.21s; }
.stagger > :nth-child(8) { --d: 0.28s; }
.projects-grid > :nth-child(2) { --d: 0.08s; }
.projects-grid > :nth-child(3) { --d: 0.16s; }

@keyframes revealUp { from { opacity: 0; transform: translateY(26px); } to { opacity: 1; transform: none; } }
@keyframes float { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(-9px); } }
@keyframes ping { 0% { transform: scale(0.6); opacity: 0.7; } 80%, 100% { transform: scale(1.7); opacity: 0; } }

/* ---------- 14. Responsive ---------- */
@media (max-width: 1080px) {
  .skills-grid { grid-template-columns: repeat(2, 1fr); }
  .projects-grid { grid-template-columns: repeat(2, 1fr); }
  .services-grid { grid-template-columns: repeat(2, 1fr); }
  .footer-grid { grid-template-columns: 1fr 1fr; }
  .socials { grid-column: 1 / -1; }
}

@media (max-width: 900px) {
  :root { --header-h: 66px; }

  .nav-toggle { display: inline-block; }
  .header-actions { margin-left: auto; }

  .nav-menu {
    position: absolute;
    top: calc(100% + 6px);
    left: 0;
    right: 0;
    margin: 0;
    padding: 0.6rem;
    border-radius: 18px;
    border: 1px solid var(--line);
    background: rgba(7, 13, 28, 0.94);
    -webkit-backdrop-filter: blur(20px);
            backdrop-filter: blur(20px);
    box-shadow: 0 30px 60px -20px #000;
    opacity: 0;
    visibility: hidden;
    transform: translateY(-10px);
    transition: opacity 0.25s, transform 0.3s var(--ease), visibility 0.25s;
  }
  .nav-menu.is-open { opacity: 1; visibility: visible; transform: none; }
  .nav-menu ul { flex-direction: column; gap: 0; }
  .nav-link { padding: 0.9rem 1rem; border-radius: 12px; font-size: 1rem; }
  .nav-link::after { display: none; }
  .nav-link:hover, .nav-link.is-active { background: rgba(34, 211, 238, 0.09); color: var(--cyan); }

  .hero-grid, .about-grid, .contact-grid { grid-template-columns: 1fr; }
  .hero-visual { max-width: 560px; width: 100%; margin-inline: auto; }
  .hero-photo { width: min(340px, 74%); }
}

@media (max-width: 640px) {
  .container { width: min(1180px, 100% - 2rem); }
  .skills-grid, .projects-grid, .services-grid { grid-template-columns: 1fr; }
  .stats { gap: 0.8rem; }
  .stat { padding: 1.1rem; }
  .form-row { grid-template-columns: 1fr; }
  .footer-grid { grid-template-columns: 1fr; gap: 1.5rem; }
  .footer-bottom { flex-direction: column; }

  .hero-actions .btn { flex: 1 1 auto; }
  .contact-buttons .btn { flex: 1 1 auto; }
  .contact-form .btn { justify-self: stretch; }

  /* badges become a tidy row under the photo */
  .hero-visual { padding-bottom: 0; }
  .hero-badges { display: flex; flex-wrap: wrap; justify-content: center; gap: 0.5rem; margin-top: 1.6rem; padding: 0; }
  .badge { position: static; animation: none; }

  .header-actions .btn-sm { padding: 0.55rem 0.9rem; }
}

@media (max-width: 380px) {
  .stats { grid-template-columns: 1fr; }
}

/* ---------- 15. Reduced motion ---------- */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-delay: 0s !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    transition-delay: 0s !important;
    scroll-behavior: auto !important;
  }
  .badge { animation: none !important; }
}