/* ============================================
   Portfolio — global styles & theme tokens
   ============================================ */

:root {
  --font-sans: "Outfit", "DM Sans", system-ui, sans-serif;
  --font-mono: ui-monospace, "Cascadia Code", monospace;

  /* Light theme */
  --bg-base: #f4f6fb;
  --bg-elevated: rgba(255, 255, 255, 0.72);
  --bg-card: rgba(255, 255, 255, 0.55);
  --text-primary: #0f172a;
  --text-secondary: #475569;
  --text-muted: #64748b;
  --border-subtle: rgba(15, 23, 42, 0.08);
  --shadow-soft: 0 4px 24px rgba(15, 23, 42, 0.06);
  --shadow-glow: 0 0 80px rgba(99, 102, 241, 0.15);

  --gradient-hero: linear-gradient(135deg, #6366f1 0%, #8b5cf6 40%, #ec4899 100%);
  --gradient-mesh: radial-gradient(ellipse 80% 50% at 20% -10%, rgba(99, 102, 241, 0.22), transparent),
    radial-gradient(ellipse 60% 40% at 90% 10%, rgba(236, 72, 153, 0.18), transparent),
    radial-gradient(ellipse 50% 30% at 50% 100%, rgba(14, 165, 233, 0.12), transparent);
  --accent: #6366f1;
  --accent-soft: rgba(99, 102, 241, 0.12);
  --success: #16a34a;
  --error: #dc2626;

  --header-h: 4.25rem;
  --radius-lg: 1.25rem;
  --radius-md: 0.75rem;
  --radius-pill: 9999px;
  --transition: 0.35s cubic-bezier(0.4, 0, 0.2, 1);
  --blur-glass: 20px;
  /* Motion — mobile drawer / overlays (Material-style ease) */
  --ease-out-expo: cubic-bezier(0.16, 1, 0.3, 1);
  --nav-drawer-duration: 0.44s;
  --backdrop-duration: 0.36s;
}

/* Dark theme — toggled via [data-theme="dark"] on html */
[data-theme="dark"] {
  --bg-base: #0f1419;
  --bg-elevated: rgba(22, 30, 44, 0.94);
  --bg-card: rgba(28, 38, 56, 0.72);
  --text-primary: #f1f5f9;
  --text-secondary: #a8b3c4;
  --text-muted: #7c8a9e;
  --border-subtle: rgba(148, 163, 184, 0.16);
  --shadow-soft: 0 4px 28px rgba(0, 0, 0, 0.4);
  --shadow-glow: 0 0 72px rgba(99, 102, 241, 0.14);
  --gradient-mesh: radial-gradient(ellipse 80% 50% at 20% -10%, rgba(99, 102, 241, 0.14), transparent),
    radial-gradient(ellipse 60% 40% at 90% 10%, rgba(236, 72, 153, 0.1), transparent),
    radial-gradient(ellipse 50% 30% at 50% 100%, rgba(14, 165, 233, 0.07), transparent);
  --accent-soft: rgba(129, 140, 248, 0.14);
}

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

html {
  scroll-behavior: smooth;
  -webkit-text-size-adjust: 100%;
  overflow-x: clip;
}

@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}

body {
  margin: 0;
  font-family: var(--font-sans);
  font-size: 1.0625rem;
  line-height: 1.6;
  color: var(--text-primary);
  background-color: var(--bg-base);
  background-image: var(--gradient-mesh);
  background-attachment: fixed;
  min-height: 100vh;
  min-height: 100dvh;
  -webkit-font-smoothing: antialiased;
  overflow-x: clip;
}

@media (max-width: 768px) {
  body {
    background-attachment: scroll;
    font-size: 1rem;
  }
}

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

a {
  color: var(--accent);
  text-decoration: none;
  transition: color var(--transition), opacity var(--transition);
}

a:hover {
  opacity: 0.9;
}

button {
  font-family: inherit;
  cursor: pointer;
}

/* Glass panels */
.glass {
  background: var(--bg-card);
  backdrop-filter: blur(var(--blur-glass)) saturate(1.2);
  -webkit-backdrop-filter: blur(var(--blur-glass)) saturate(1.2);
  border: 1px solid var(--border-subtle);
  box-shadow: var(--shadow-soft);
  border-radius: var(--radius-lg);
}

[data-theme="dark"] .glass {
  box-shadow: var(--shadow-soft), inset 0 1px 0 rgba(255, 255, 255, 0.04);
}

.container {
  width: min(1120px, 100% - clamp(1.5rem, 7vw, 3rem));
  margin-inline: auto;
  padding-inline: max(1rem, env(safe-area-inset-left)) max(1rem, env(safe-area-inset-right));
}

.section {
  padding: clamp(4rem, 10vw, 7rem) 0;
}

.section-title {
  font-size: clamp(1.75rem, 4vw, 2.35rem);
  font-weight: 600;
  letter-spacing: -0.03em;
  margin: 0 0 0.75rem;
}

.section-lead {
  color: var(--text-secondary);
  font-size: 1.05rem;
  max-width: 36rem;
  margin: 0 0 1.5rem;
}

.section-head {
  margin-bottom: 2.5rem;
}

/* -------- Page loader -------- */
.page-loader {
  position: fixed;
  inset: 0;
  z-index: 10000;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--bg-base);
  transition: opacity 0.6s ease, visibility 0.6s ease;
}

.page-loader.hidden {
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
}

.loader-inner {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1rem;
}

.loader-ring {
  width: 48px;
  height: 48px;
  border: 3px solid var(--border-subtle);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 0.85s linear infinite;
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

.loader-text {
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--text-secondary);
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

/* -------- Header / Nav -------- */
.site-header {
  position: relative;
  z-index: 1200;
  height: var(--header-h);
  display: flex;
  align-items: center;
  background: var(--bg-elevated);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border-bottom: 1px solid var(--border-subtle);
}

@media (min-width: 769px) {
  .site-header {
    position: sticky;
    top: 0;
  }
}

.nav {
  display: flex;
  align-items: center;
  justify-content: flex-start;
  gap: clamp(0.65rem, 2vw, 1.5rem);
  width: 100%;
  flex-wrap: nowrap;
}

.logo {
  font-weight: 700;
  font-size: 1.25rem;
  color: var(--text-primary);
  letter-spacing: -0.02em;
  flex-shrink: 0;
  text-decoration: none;
  text-align: left;
  padding-left: clamp(0.35rem, 2vw, 0.75rem);
}

.logo:hover {
  opacity: 0.92;
}

.logo-dot {
  color: var(--accent);
}

.nav-end {
  display: flex;
  align-items: center;
  gap: 0.35rem;
  flex-shrink: 0;
  margin-left: auto;
}

.nav-links {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.15rem 0.25rem;
  flex: 1 1 auto;
  justify-content: flex-start;
  min-width: 0;
}

.nav-menu-heading {
  list-style: none;
  padding: 0.35rem 1rem 0.5rem;
  margin: 0;
  pointer-events: none;
}

.nav-menu-title {
  display: block;
  font-size: 0.6875rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.14em;
  color: var(--text-muted);
}

@media (min-width: 769px) {
  .nav-menu-heading {
    display: none !important;
  }
}

.nav-link {
  display: block;
  padding: 0.5rem 0.85rem;
  color: var(--text-secondary);
  font-size: 0.9375rem;
  font-weight: 500;
  border-radius: var(--radius-pill);
  transition: background var(--transition), color var(--transition);
}

.nav-link:hover {
  color: var(--text-primary);
  background: var(--accent-soft);
  opacity: 1;
}

.theme-toggle {
  width: 44px;
  height: 44px;
  border-radius: var(--radius-pill);
  border: 1px solid var(--border-subtle);
  background: var(--bg-card);
  display: grid;
  place-items: center;
  position: relative;
  flex-shrink: 0;
  transition: transform 0.2s ease, box-shadow var(--transition);
}

.theme-toggle:hover {
  transform: scale(1.05);
  box-shadow: var(--shadow-soft);
}

.theme-icon {
  position: absolute;
  font-size: 1.1rem;
  transition: opacity 0.25s ease, transform 0.25s ease;
}

[data-theme="dark"] .theme-icon-sun {
  opacity: 0;
  transform: rotate(-45deg) scale(0.5);
}

[data-theme="dark"] .theme-icon-moon {
  opacity: 1;
  transform: rotate(0) scale(1);
}

.theme-icon-moon {
  opacity: 0;
  transform: rotate(45deg) scale(0.5);
}

.nav-toggle {
  display: none;
  flex-direction: column;
  justify-content: center;
  gap: 6px;
  width: 44px;
  height: 44px;
  padding: 0;
  border: none;
  background: transparent;
  border-radius: var(--radius-md);
}

.nav-toggle span {
  display: block;
  width: 22px;
  height: 2px;
  background: var(--text-primary);
  border-radius: 2px;
  transition:
    transform 0.4s var(--ease-out-expo),
    opacity 0.22s ease;
  transform-origin: center;
}

.nav-toggle[aria-expanded="true"] span:nth-child(1) {
  transform: translateY(8px) rotate(45deg);
}

.nav-toggle[aria-expanded="true"] span:nth-child(2) {
  opacity: 0;
  transform: scaleX(0);
}

.nav-toggle[aria-expanded="true"] span:nth-child(3) {
  transform: translateY(-8px) rotate(-45deg);
}

@media (max-width: 768px) {
  :root {
    --header-h: 3.75rem;
  }

  /* Same glass bar as desktop: --bg-elevated + blur */
  .site-header {
    isolation: isolate;
    background: var(--bg-elevated);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    box-shadow: var(--shadow-soft);
    transition: background 0.25s ease, box-shadow 0.25s ease, border-color 0.25s ease;
  }

  [data-theme="dark"] .site-header {
    box-shadow: var(--shadow-soft);
  }

  .site-header.header-over-hero {
    background: transparent !important;
    box-shadow: none;
    border-bottom-color: transparent;
  }

  .site-header.header-over-hero .logo {
    color: #ffffff;
    text-shadow: 0 1px 3px rgba(0, 0, 0, 0.35);
  }

  .site-header.header-over-hero .logo-dot {
    color: #e0e7ff;
    text-shadow: 0 1px 3px rgba(0, 0, 0, 0.35);
  }

  .site-header.header-over-hero .nav-toggle span {
    background: #ffffff;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.25);
  }

  .site-header.header-over-hero .theme-toggle {
    border-color: rgba(255, 255, 255, 0.45);
    background: rgba(255, 255, 255, 0.12);
    color: #ffffff;
  }

  .nav {
    position: relative;
    z-index: 2;
    display: flex;
    flex-wrap: nowrap;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
    width: 100%;
  }

  .logo {
    min-width: 0;
    font-size: 1.125rem;
    flex: 1;
    text-align: left;
  }

  .nav-end {
    flex-shrink: 0;
    margin-left: 0;
  }

  .nav-links {
    flex: 0 0 0;
    min-width: 0;
    min-height: 0;
    margin: 0;
    padding: 0;
    border: none;
    align-self: center;
  }

  .nav-toggle {
    display: flex;
  }

  .theme-toggle {
    width: 42px;
    height: 42px;
  }

  /* Left drawer: GPU-friendly slide + fade */
  .nav-links {
    position: fixed;
    top: var(--header-h);
    bottom: 0;
    left: 0;
    right: auto;
    width: min(19rem, 88vw);
    z-index: 3;
    max-height: none;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    flex-direction: column;
    padding: 1rem 0.85rem max(1.25rem, env(safe-area-inset-bottom))
      max(1rem, env(safe-area-inset-left));
    gap: 0.125rem;
    /* Solid panel so labels & links always contrast (mesh + wrong colors hid text) */
    background-color: #ffffff;
    background-image: none;
    backdrop-filter: none;
    -webkit-backdrop-filter: none;
    border-right: 1px solid var(--border-subtle);
    border-radius: 0 var(--radius-lg) 0 0;
    box-shadow: 12px 0 48px rgba(15, 23, 42, 0.14);
    transform: translate3d(-100%, 0, 0);
    opacity: 0;
    pointer-events: none;
    visibility: hidden;
    transition:
      transform var(--nav-drawer-duration) var(--ease-out-expo),
      opacity calc(var(--nav-drawer-duration) * 0.85) var(--ease-out-expo),
      visibility 0s linear var(--nav-drawer-duration);
  }

  [data-theme="dark"] .nav-links {
    background-color: #0f1419;
    background-image: none;
    border-right-color: var(--border-subtle);
    box-shadow: 14px 0 56px rgba(0, 0, 0, 0.45);
  }

  .nav-links.is-open {
    z-index: 5000;
    transform: translate3d(0, 0, 0);
    opacity: 1;
    pointer-events: auto;
    visibility: visible;
    transition:
      transform var(--nav-drawer-duration) var(--ease-out-expo),
      opacity calc(var(--nav-drawer-duration) * 0.85) var(--ease-out-expo),
      visibility 0s;
  }

  /* Stagger slide only — avoid opacity on <li> (could leave links invisible on some devices) */
  .nav-links > li {
    opacity: 1;
    transform: translate3d(-14px, 0, 0);
    transition: transform 0.36s var(--ease-out-expo);
  }

  .nav-links.is-open > li {
    transform: translate3d(0, 0, 0);
  }

  .nav-links.is-open > li:nth-child(1) {
    transition-delay: 0.05s;
  }
  .nav-links.is-open > li:nth-child(2) {
    transition-delay: 0.09s;
  }
  .nav-links.is-open > li:nth-child(3) {
    transition-delay: 0.13s;
  }
  .nav-links.is-open > li:nth-child(4) {
    transition-delay: 0.17s;
  }
  .nav-links.is-open > li:nth-child(5) {
    transition-delay: 0.21s;
  }
  .nav-links.is-open > li:nth-child(6) {
    transition-delay: 0.25s;
  }
  .nav-links.is-open > li:nth-child(7) {
    transition-delay: 0.29s;
  }
  .nav-links.is-open > li:nth-child(8) {
    transition-delay: 0.33s;
  }

  .nav-menu-heading {
    padding: 0.5rem 1rem 0.35rem;
    border-bottom: 1px solid var(--border-subtle);
    margin-bottom: 0.25rem;
  }

  .nav-link {
    padding: 0.9rem 1rem;
    min-height: 48px;
    display: flex;
    align-items: center;
  }

  .nav-links .nav-link {
    color: var(--text-primary);
    font-weight: 600;
  }

  .nav-links .nav-link:hover,
  .nav-links .nav-link:focus-visible {
    color: var(--text-primary);
    background: var(--accent-soft);
    opacity: 1;
  }

  [data-theme="dark"] .nav-links .nav-link {
    color: var(--text-primary);
  }

  [data-theme="dark"] .nav-links .nav-link:hover,
  [data-theme="dark"] .nav-links .nav-link:focus-visible {
    color: var(--text-primary);
    background: var(--accent-soft);
  }

  .nav-menu-title {
    color: var(--text-muted);
    text-shadow: none;
  }

  [data-theme="dark"] .nav-menu-title {
    color: var(--text-muted);
    text-shadow: none;
  }

  /* Full-screen dim — opacity fade (no display flash) */
  .nav-backdrop {
    display: block;
    position: fixed;
    inset: 0;
    z-index: 1100;
    background: rgba(15, 23, 42, 0.48);
    backdrop-filter: none;
    -webkit-backdrop-filter: none;
    cursor: pointer;
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
    transition:
      opacity var(--backdrop-duration) var(--ease-out-expo),
      visibility 0s linear var(--backdrop-duration);
  }

  .nav-backdrop.is-active {
    opacity: 1;
    visibility: visible;
    pointer-events: auto;
    transition:
      opacity var(--backdrop-duration) var(--ease-out-expo),
      visibility 0s;
  }

  [data-theme="dark"] .nav-backdrop {
    background: rgba(6, 10, 18, 0.65);
  }

  /* Allow scrolling so the drawer can dismiss on scroll (see script.js) */
  body.nav-drawer-open {
    overflow: auto;
    touch-action: auto;
  }

  @media (prefers-reduced-motion: reduce) {
    .nav-links,
    .nav-links > li,
    .nav-backdrop,
    .nav-toggle span {
      transition-duration: 0.01ms !important;
      transition-delay: 0s !important;
    }

    .nav-links > li {
      transform: none;
    }
  }
}

@media (min-width: 769px) {
  .nav-backdrop {
    display: none !important;
  }

  body.nav-drawer-open {
    overflow: auto;
    touch-action: auto;
  }
}

/* Desktop: logo left, nav links centered in header, theme + menu right */
@media (min-width: 769px) {
  .nav {
    display: grid;
    grid-template-columns: minmax(5rem, 1fr) auto minmax(5rem, 1fr);
    align-items: center;
    column-gap: clamp(0.5rem, 2vw, 1.5rem);
    width: 100%;
  }

  .logo {
    grid-column: 1;
    justify-self: start;
    padding-left: clamp(0.4rem, 1.5vw, 0.85rem);
  }

  .nav-links {
    grid-column: 2;
    justify-self: center;
    justify-content: center;
    flex: none;
    flex-wrap: nowrap;
    min-width: 0;
  }

  .nav-end {
    grid-column: 3;
    justify-self: end;
    margin-left: 0;
  }
}

/* -------- Hero -------- */
.hero {
  position: relative;
  min-height: calc(100vh - var(--header-h));
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding-top: 2rem;
  overflow: hidden;
}

.hero-bg {
  position: absolute;
  inset: -20% -10% auto;
  height: 70%;
  background: var(--gradient-hero);
  opacity: 0.12;
  filter: blur(80px);
  border-radius: 50%;
  pointer-events: none;
}

[data-theme="dark"] .hero-bg {
  opacity: 0.2;
}

.hero-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: clamp(2rem, 6vw, 4rem);
  align-items: center;
  position: relative;
  z-index: 1;
}

@media (max-width: 900px) {
  .hero-grid {
    grid-template-columns: 1fr;
    text-align: center;
  }

  .hero-content .hero-actions,
  .hero-stats {
    justify-content: center;
  }

  .hero-content .section-lead,
  .hero-lead {
    margin-inline: auto;
  }
}

.eyebrow {
  font-size: 0.8125rem;
  font-weight: 600;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--accent);
  margin: 0 0 0.75rem;
}

.hero-name {
  font-size: clamp(2.5rem, 6vw, 3.75rem);
  font-weight: 700;
  letter-spacing: -0.04em;
  line-height: 1.08;
  margin: 0 0 0.5rem;
  background: linear-gradient(120deg, var(--text-primary), var(--text-secondary));
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

[data-theme="dark"] .hero-name {
  background: linear-gradient(120deg, #f8fafc, #a5b4fc);
  -webkit-background-clip: text;
  background-clip: text;
}

.hero-title {
  font-size: clamp(1.125rem, 2.5vw, 1.35rem);
  color: var(--text-secondary);
  margin: 0 0 1.25rem;
  min-height: 1.6em;
}

.typed-text {
  color: var(--accent);
  font-weight: 600;
}

.typed-cursor {
  display: inline;
  animation: blink 1s step-end infinite;
  color: var(--accent);
  margin-left: 2px;
}

@keyframes blink {
  50% {
    opacity: 0;
  }
}

.hero-lead {
  max-width: 32rem;
  color: var(--text-secondary);
  margin: 0 0 1.75rem;
}

.hero-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  margin-bottom: 2rem;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0.75rem 1.5rem;
  font-size: 0.9375rem;
  font-weight: 600;
  border-radius: var(--radius-pill);
  border: none;
  transition: transform 0.2s ease, box-shadow var(--transition), background var(--transition);
}

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

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

.btn:focus-visible,
.theme-toggle:focus-visible,
.nav-toggle:focus-visible,
.filter-btn:focus-visible,
.back-to-top:focus-visible,
.nav-link:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 3px;
}

.form-group input:focus-visible,
.form-group textarea:focus-visible {
  outline: none;
}

.btn-primary {
  background: var(--gradient-hero);
  color: #fff;
  box-shadow: 0 8px 24px rgba(99, 102, 241, 0.35);
}

.btn-primary:hover {
  box-shadow: 0 12px 32px rgba(99, 102, 241, 0.4);
  opacity: 1;
}

.btn-ghost {
  background: var(--bg-card);
  color: var(--text-primary);
  border: 1px solid var(--border-subtle);
}

.btn-sm {
  padding: 0.55rem 1.15rem;
  font-size: 0.875rem;
}

.btn-full {
  width: 100%;
}

.hero-stats {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-wrap: wrap;
  gap: 1.5rem;
}

.hero-stats li {
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
}

.hero-stats strong {
  font-size: 1.35rem;
  font-weight: 700;
  letter-spacing: -0.02em;
}

.hero-stats span {
  font-size: 0.8125rem;
  color: var(--text-muted);
}

.hero-visual {
  display: flex;
  justify-content: center;
}

.hero-card {
  position: relative;
  width: min(100%, 360px);
  padding: 2rem;
  overflow: hidden;
}

.hero-card-glow {
  position: absolute;
  inset: -40%;
  background: var(--gradient-hero);
  opacity: 0.25;
  filter: blur(48px);
  pointer-events: none;
}

.hero-card-inner {
  position: relative;
  z-index: 1;
}

.hero-card-tag {
  display: inline-block;
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--success);
  background: rgba(34, 197, 94, 0.15);
  padding: 0.35rem 0.75rem;
  border-radius: var(--radius-pill);
  margin-bottom: 1rem;
}

.hero-card-title {
  font-size: 2.5rem;
  font-weight: 700;
  margin: 0;
  letter-spacing: -0.03em;
}

.hero-card-sub {
  font-size: 1.25rem;
  color: var(--text-secondary);
  margin: 0 0 1.25rem;
}

.hero-card-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  justify-content: center;
}

.hero-card-stack {
  margin: 0;
  text-align: center;
  font-size: 0.8125rem;
  font-weight: 600;
  letter-spacing: 0.04em;
  color: var(--text-primary);
  padding: 0.5rem 1rem;
  border-radius: var(--radius-pill);
  background: var(--accent-soft);
  border: 1px solid var(--border-subtle);
}

.pill {
  font-size: 0.8125rem;
  font-weight: 500;
  padding: 0.4rem 0.85rem;
  border-radius: var(--radius-pill);
  background: var(--accent-soft);
  color: var(--text-primary);
  border: 1px solid var(--border-subtle);
}

.scroll-hint {
  position: absolute;
  bottom: 1.5rem;
  left: 50%;
  transform: translateX(-50%);
  width: 28px;
  height: 44px;
  border: 2px solid var(--border-subtle);
  border-radius: var(--radius-pill);
  display: flex;
  justify-content: center;
  padding-top: 8px;
  opacity: 0.6;
  transition: opacity var(--transition);
}

.scroll-hint:hover {
  opacity: 1;
}

.scroll-hint-line {
  width: 4px;
  height: 8px;
  background: var(--text-secondary);
  border-radius: 2px;
  animation: scroll-bounce 2s ease-in-out infinite;
}

@keyframes scroll-bounce {
  0%,
  100% {
    transform: translateY(0);
    opacity: 1;
  }
  50% {
    transform: translateY(10px);
    opacity: 0.4;
  }
}

@media (max-width: 900px) {
  .scroll-hint {
    display: none;
  }
}

/* -------- Scroll reveal (directional entrances) -------- */
.reveal {
  opacity: 0;
  transform: translate3d(0, 40px, 0);
  transition:
    opacity 0.78s cubic-bezier(0.22, 1, 0.36, 1),
    transform 0.78s cubic-bezier(0.22, 1, 0.36, 1);
}

.reveal-from-left {
  transform: translate3d(-52px, 28px, 0);
}

.reveal-from-right {
  transform: translate3d(52px, 28px, 0);
}

.reveal-from-bottom {
  transform: translate3d(0, 48px, 0);
}

.reveal.reveal-scale {
  transform: translate3d(0, 24px, 0) scale(0.96);
}

.reveal.is-visible {
  opacity: 1;
  transform: translate3d(0, 0, 0);
}

.reveal.reveal-scale.is-visible {
  transform: translate3d(0, 0, 0) scale(1);
}

/* Project cards: one vertical line — slide up only (no left/right zigzag) */
.projects-grid .project-card.reveal {
  transform: translate3d(0, 36px, 0);
}

.projects-grid .project-card.reveal.is-visible {
  opacity: 1;
  transform: translate3d(0, 0, 0);
}

.projects-grid .project-card.reveal:nth-child(1) {
  transition-delay: 0.04s;
}
.projects-grid .project-card.reveal:nth-child(2) {
  transition-delay: 0.1s;
}
.projects-grid .project-card.reveal:nth-child(3) {
  transition-delay: 0.16s;
}
.projects-grid .project-card.reveal:nth-child(4) {
  transition-delay: 0.22s;
}
.projects-grid .project-card.reveal:nth-child(5) {
  transition-delay: 0.28s;
}
.projects-grid .project-card.reveal:nth-child(6) {
  transition-delay: 0.34s;
}
.projects-grid .project-card.reveal:nth-child(7) {
  transition-delay: 0.4s;
}

/* Mobile: shorter, subtler scroll reveals (less floaty) */
@media (max-width: 768px) {
  .reveal {
    transform: translate3d(0, 22px, 0);
    transition-duration: 0.58s;
    transition-timing-function: var(--ease-out-expo);
  }

  .reveal-from-left {
    transform: translate3d(-18px, 14px, 0);
  }

  .reveal-from-right {
    transform: translate3d(18px, 14px, 0);
  }

  .reveal-from-bottom {
    transform: translate3d(0, 28px, 0);
  }

  .reveal.reveal-scale {
    transform: translate3d(0, 16px, 0) scale(0.98);
  }

  .projects-grid .project-card.reveal {
    transform: translate3d(0, 22px, 0);
  }

  .projects-grid .project-card.reveal:nth-child(1),
  .projects-grid .project-card.reveal:nth-child(2),
  .projects-grid .project-card.reveal:nth-child(3),
  .projects-grid .project-card.reveal:nth-child(4),
  .projects-grid .project-card.reveal:nth-child(5),
  .projects-grid .project-card.reveal:nth-child(6),
  .projects-grid .project-card.reveal:nth-child(7) {
    transition-delay: 0.06s;
  }

  /* First screen: keep hero readable even if scroll-reveal runs late */
  .hero .reveal,
  .hero .reveal.reveal-from-left,
  .hero .reveal.reveal-from-right,
  .hero .reveal.reveal-scale {
    opacity: 1;
    transform: translate3d(0, 0, 0) scale(1);
  }

  .hero {
    min-height: calc(100dvh - var(--header-h));
    padding-top: max(0.75rem, env(safe-area-inset-top, 0px));
    padding-bottom: 1.5rem;
  }
}

@media (prefers-reduced-motion: reduce) {
  .reveal,
  .reveal-from-left,
  .reveal-from-right,
  .reveal-from-bottom,
  .reveal.reveal-scale,
  .projects-grid .project-card.reveal {
    transition-duration: 0.01ms !important;
    transition-delay: 0s !important;
  }
}

/* -------- About -------- */
.about-grid {
  display: grid;
  grid-template-columns: 1fr 1.1fr;
  gap: clamp(2rem, 5vw, 4rem);
  align-items: center;
}

@media (max-width: 860px) {
  .about-grid {
    grid-template-columns: 1fr;
  }
}

.about-frame {
  padding: 1rem;
  max-width: 380px;
  margin-inline: auto;
}

.about-photo {
  aspect-ratio: 3 / 4;
  border-radius: var(--radius-lg);
  background: linear-gradient(145deg, var(--accent-soft), rgba(99, 102, 241, 0.08));
  position: relative;
  overflow: hidden;
}

.about-photo-img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center 22%;
  display: block;
}

.about-photo::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(180deg, transparent 50%, rgba(15, 23, 42, 0.2));
  pointer-events: none;
  z-index: 1;
}

.about-badge {
  margin-top: 1rem;
  text-align: center;
  font-size: 0.875rem;
  color: var(--text-secondary);
}

.about-list {
  margin: 1.25rem 0 1.5rem;
  padding-left: 1.15rem;
  color: var(--text-secondary);
}

.about-list li {
  margin-bottom: 0.4rem;
}

/* -------- Skills -------- */
.skills-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1.25rem;
}

@media (max-width: 960px) {
  .skills-grid {
    grid-template-columns: 1fr;
  }
}

.skill-card {
  padding: 1.5rem;
}

.skill-card-top {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin-bottom: 1.25rem;
}

.skill-card-top h3 {
  margin: 0;
  font-size: 1.125rem;
  font-weight: 600;
}

.skill-icon {
  font-size: 1.5rem;
  opacity: 0.85;
}

.skill-bars {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.skill-bar-label {
  display: flex;
  justify-content: space-between;
  font-size: 0.8125rem;
  color: var(--text-secondary);
  margin-bottom: 0.35rem;
}

.skill-bar-track {
  height: 8px;
  border-radius: var(--radius-pill);
  background: var(--border-subtle);
  overflow: hidden;
}

.skill-bar-fill {
  height: 100%;
  width: 0;
  border-radius: inherit;
  background: var(--gradient-hero);
  transition: width 1.1s cubic-bezier(0.22, 1, 0.36, 1);
}

.skill-bar.is-animated .skill-bar-fill {
  width: var(--target-width, 80%);
}

/* -------- Projects / filter -------- */
.filter-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-top: 1rem;
}

.filter-btn {
  padding: 0.45rem 1rem;
  font-size: 0.8125rem;
  font-weight: 600;
  border-radius: var(--radius-pill);
  border: 1px solid var(--border-subtle);
  background: var(--bg-card);
  color: var(--text-secondary);
  transition: background var(--transition), color var(--transition), border-color var(--transition), transform 0.2s;
}

.filter-btn:hover {
  color: var(--text-primary);
  border-color: var(--accent);
  transform: translateY(-1px);
}

.filter-btn.active {
  background: var(--accent-soft);
  color: var(--accent);
  border-color: rgba(99, 102, 241, 0.35);
}

.projects-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1.25rem;
}

@media (max-width: 960px) {
  .projects-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

/* Mobile / narrow: single column, straight vertical line */
@media (max-width: 768px) {
  .projects-grid {
    grid-template-columns: 1fr;
  }
}

.project-card {
  display: flex;
  flex-direction: column;
  overflow: hidden;
  transition: transform var(--transition), box-shadow var(--transition);
}

.project-card:hover {
  transform: translateY(-6px);
  box-shadow: var(--shadow-soft), var(--shadow-glow);
}

.project-card-image {
  --media-th: 180px;
  height: var(--media-th);
  background: linear-gradient(135deg, var(--proj-accent), #0f172a);
  position: relative;
  overflow: hidden;
}

.project-card-image img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  transition: transform 0.55s cubic-bezier(0.22, 1, 0.36, 1);
}

.project-card:hover .project-card-image img {
  transform: scale(1.06);
}

.project-card-image::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(
    180deg,
    transparent 20%,
    rgba(15, 23, 42, 0.15) 60%,
    rgba(15, 23, 42, 0.45)
  );
  pointer-events: none;
}

.project-card p.project-stack {
  font-size: 0.8125rem;
  font-weight: 600;
  color: var(--text-muted);
  margin: 0 0 0.65rem;
  letter-spacing: 0.04em;
  flex: 0 0 auto;
}

.project-card-body {
  padding: 1.25rem;
  flex: 1;
  display: flex;
  flex-direction: column;
}

.project-tag {
  font-size: 0.6875rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--accent);
  margin-bottom: 0.5rem;
}

.project-card h3 {
  margin: 0 0 0.35rem;
  font-size: 1.15rem;
  letter-spacing: -0.02em;
}

.project-card p {
  margin: 0 0 1rem;
  font-size: 0.9375rem;
  color: var(--text-secondary);
  flex: 1;
}

.project-links {
  display: flex;
  gap: 1rem;
}

.link-arrow {
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--text-primary);
}

.link-arrow::after {
  content: " →";
  transition: transform 0.2s;
  display: inline-block;
}

.link-arrow:hover::after {
  transform: translateX(4px);
}

.link-arrow.muted {
  color: var(--text-muted);
}

/* Hide filtered cards */
.project-card.is-hidden {
  display: none;
}

/* -------- Contact -------- */
.contact-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: clamp(2rem, 5vw, 3rem);
  align-items: start;
}

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

.contact-meta {
  list-style: none;
  margin: 1.5rem 0 0;
  padding: 0;
}

.contact-meta li {
  margin-bottom: 1rem;
}

.contact-meta strong {
  display: block;
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-muted);
  margin-bottom: 0.25rem;
}

.contact-meta a {
  font-weight: 600;
}

.contact-form {
  padding: 1.75rem;
}

.form-group {
  margin-bottom: 1.15rem;
}

.form-group label {
  display: block;
  font-size: 0.8125rem;
  font-weight: 600;
  margin-bottom: 0.4rem;
  color: var(--text-secondary);
}

.form-group input,
.form-group textarea {
  width: 100%;
  padding: 0.75rem 1rem;
  font-size: 1rem;
  font-family: inherit;
  color: var(--text-primary);
  background: var(--bg-base);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  transition: border-color var(--transition), box-shadow var(--transition);
}

.form-group input:focus,
.form-group textarea:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
}

.form-group input.invalid,
.form-group textarea.invalid {
  border-color: var(--error);
}

.form-error {
  display: block;
  min-height: 1.25rem;
  font-size: 0.8125rem;
  color: var(--error);
  margin-top: 0.25rem;
}

.form-honeypot {
  position: absolute;
  left: -9999px;
  width: 1px;
  height: 1px;
  opacity: 0;
  pointer-events: none;
}

.form-success {
  color: var(--success);
  font-weight: 600;
  font-size: 0.9375rem;
  margin: 0 0 1rem;
}

.form-success.is-error {
  color: var(--error);
}

/* -------- Footer -------- */
.site-footer {
  padding: 2.5rem 0;
  border-top: 1px solid var(--border-subtle);
  background: var(--bg-elevated);
  backdrop-filter: blur(12px);
}

.footer-inner {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 1.5rem;
}

.footer-brand p {
  margin: 0.35rem 0 0;
  font-size: 0.875rem;
  color: var(--text-muted);
}

.social-links {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-wrap: wrap;
  gap: 1.25rem;
}

.social-links a {
  font-size: 0.9375rem;
  font-weight: 600;
  color: var(--text-secondary);
}

.social-links a:hover {
  color: var(--accent);
}

/* -------- Back to top -------- */
.back-to-top {
  position: fixed;
  bottom: 1.5rem;
  right: 1.5rem;
  width: 48px;
  height: 48px;
  border-radius: var(--radius-pill);
  border: 1px solid var(--border-subtle);
  background: var(--bg-elevated);
  backdrop-filter: blur(12px);
  color: var(--text-primary);
  font-size: 1.25rem;
  display: grid;
  place-items: center;
  box-shadow: var(--shadow-soft);
  opacity: 0;
  visibility: hidden;
  transform: translateY(12px);
  transition: opacity 0.35s ease, visibility 0.35s ease, transform 0.35s ease;
  z-index: 900;
}

.back-to-top.is-visible {
  opacity: 1;
  visibility: visible;
  transform: translateY(0);
}

.back-to-top:hover {
  border-color: var(--accent);
  transform: translateY(-3px);
}

.back-to-top.is-visible:hover {
  transform: translateY(-3px);
}

/* -------- Mobile refinements -------- */
@media (max-width: 640px) {
  .section {
    padding: clamp(2.25rem, 8vw, 3.75rem) 0;
  }

  .section-head {
    margin-bottom: 1.75rem;
  }

  .section-lead {
    font-size: 1rem;
  }

  .hero {
    min-height: 0;
    padding-top: 1.25rem;
    padding-bottom: 2.5rem;
  }

  .hero-grid {
    gap: 1.5rem;
  }

  .hero-card {
    padding: 1.35rem;
    width: 100%;
    max-width: 400px;
  }

  .hero-card-title {
    font-size: clamp(1.65rem, 9vw, 2.25rem);
  }

  .hero-card-sub {
    font-size: 1.05rem;
  }

  .hero-stats {
    gap: 1rem 1.25rem;
  }

  .hero-stats li {
    flex: 1 1 auto;
    min-width: 5.5rem;
    text-align: center;
  }

  .hero-actions {
    flex-direction: column;
    align-items: stretch;
  }

  .hero-actions .btn {
    width: 100%;
    justify-content: center;
  }

  .btn {
    min-height: 48px;
    padding-inline: 1.25rem;
  }

  .project-card-body {
    padding: 1rem;
  }

  .project-card h3 {
    font-size: 1.05rem;
    line-height: 1.25;
  }

  .project-card p.project-stack {
    font-size: 0.75rem;
    line-height: 1.35;
    word-break: break-word;
  }

  .project-card-image {
    --media-th: 200px;
  }

  .link-arrow {
    display: inline-flex;
    align-items: center;
    min-height: 44px;
    padding-block: 0.25rem;
  }

  .filter-btn {
    min-height: 44px;
    padding: 0.5rem 1rem;
    font-size: 0.8125rem;
  }

  .skill-card {
    padding: 1.15rem;
  }

  .skill-bar-label {
    flex-wrap: wrap;
    gap: 0.25rem 0.5rem;
  }

  .contact-form {
    padding: 1.25rem;
  }

  .form-group input,
  .form-group textarea {
    font-size: 16px;
  }

  .footer-inner {
    flex-direction: column;
    text-align: center;
    justify-content: center;
    padding-bottom: max(0.5rem, env(safe-area-inset-bottom));
  }

  .social-links {
    justify-content: center;
  }

  .back-to-top {
    bottom: max(1rem, env(safe-area-inset-bottom));
    right: max(1rem, env(safe-area-inset-right));
    width: 46px;
    height: 46px;
  }

  .page-loader {
    padding: max(1rem, env(safe-area-inset-top)) max(1rem, env(safe-area-inset-right))
      max(1rem, env(safe-area-inset-bottom)) max(1rem, env(safe-area-inset-left));
  }
}

@media (max-width: 380px) {
  .hero-name {
    font-size: clamp(1.85rem, 11vw, 2.45rem);
  }

  .pill {
    font-size: 0.75rem;
    padding: 0.35rem 0.65rem;
  }

  .projects-grid {
    gap: 1rem;
  }
}
