/* ==========================================================================
   Saidumar Raxmonov — portfolio
   Order: tokens → base → layout → components → pages → overlays/effects →
   motion → responsive
   Colour tokens are the original neutral light/dark theme, unchanged.
   ========================================================================== */

/* ---------- Tokens ---------- */
:root {
  --background: 0 0% 100%;
  --foreground: 0 0% 3.9%;
  --card: 0 0% 100%;
  --card-foreground: 0 0% 3.9%;
  --primary: 0 0% 9%;
  --primary-foreground: 0 0% 98%;
  --secondary: 0 0% 96.1%;
  --secondary-foreground: 0 0% 9%;
  --muted: 0 0% 96.1%;
  --muted-foreground: 0 0% 45.1%;
  --accent: 0 0% 96.1%;
  --accent-foreground: 0 0% 9%;
  --destructive: 0 84.2% 60.2%;
  --destructive-foreground: 0 0% 98%;
  --border: 0 0% 89.8%;
  --input: 0 0% 89.8%;
  --ring: 0 0% 3.9%;
  --surface: 0 0% 98%;
  --success: 152 39% 36%;

  --radius: 0.5rem;
  --radius-sm: 0.625rem;
  --radius-md: 0.875rem;
  --radius-lg: 1.25rem;
  --radius-xl: 1.75rem;

  --font-sans: "Archivo", ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --font-mono: "JetBrains Mono", ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;

  --container: 76rem;
  --gutter: clamp(1.25rem, 4vw, 2.5rem);
  --header-h: 4.25rem;
  --section-y: clamp(5rem, 11vw, 8.5rem);

  --ease-out: cubic-bezier(0.22, 1, 0.36, 1);
  --ease-in-out: cubic-bezier(0.65, 0, 0.35, 1);

  color-scheme: light;
}

.dark {
  --background: 0 0% 3.9%;
  --foreground: 0 0% 98%;
  --card: 0 0% 3.9%;
  --card-foreground: 0 0% 98%;
  --primary: 0 0% 98%;
  --primary-foreground: 0 0% 9%;
  --secondary: 0 0% 14.9%;
  --secondary-foreground: 0 0% 98%;
  --muted: 0 0% 14.9%;
  --muted-foreground: 0 0% 63.9%;
  --accent: 0 0% 14.9%;
  --accent-foreground: 0 0% 98%;
  --destructive: 0 62.8% 50%;
  --destructive-foreground: 0 0% 98%;
  --border: 0 0% 14.9%;
  --input: 0 0% 18%;
  --ring: 0 0% 83.1%;
  --surface: 0 0% 6.5%;
  --success: 152 45% 55%;

  color-scheme: dark;
}

/* ---------- Base ---------- */
*,
*::before,
*::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
  scroll-behavior: smooth;
  scroll-padding-top: calc(var(--header-h) + 1rem);
}

body {
  min-height: 100vh;
  overflow-x: hidden;
  overflow-x: clip;
  font-family: var(--font-sans);
  font-size: 1.0625rem;
  line-height: 1.6;
  color: hsl(var(--foreground));
  background-color: hsl(var(--background));
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
  -webkit-tap-highlight-color: transparent;
}

img,
svg {
  display: block;
  max-width: 100%;
}

a {
  color: inherit;
}

button,
input,
textarea {
  font: inherit;
  color: inherit;
}

ul,
ol {
  list-style: none;
}

h1,
h2,
h3 {
  line-height: 1.1;
  text-wrap: balance;
}

p {
  text-wrap: pretty;
}

::selection {
  color: hsl(var(--background));
  background: hsl(var(--foreground));
}

:focus-visible {
  outline: 2px solid hsl(var(--ring));
  outline-offset: 3px;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.skip-link {
  position: fixed;
  top: 0.75rem;
  left: 0.75rem;
  z-index: 200;
  padding: 0.7rem 1rem;
  border-radius: var(--radius-sm);
  background: hsl(var(--foreground));
  color: hsl(var(--background));
  font-weight: 600;
  text-decoration: none;
  transform: translateY(-200%);
}

.skip-link:focus {
  transform: none;
}

.invert-on-light {
  filter: invert(1);
}

.dark .invert-on-light {
  filter: none;
}

/* ---------- Layout ---------- */
.container {
  width: 100%;
  max-width: calc(var(--container) + var(--gutter) * 2);
  margin-inline: auto;
  padding-inline: var(--gutter);
}

.section {
  padding-block: var(--section-y);
}

.section--alt {
  background: hsl(var(--surface));
  border-block: 1px solid hsl(var(--border));
}

.section-head {
  display: grid;
  gap: 1.25rem;
  margin-bottom: clamp(2.5rem, 6vw, 4.5rem);
}

.section-title {
  max-width: 18ch;
  font-size: clamp(2.15rem, 5.2vw, 3.9rem);
  font-weight: 800;
  font-stretch: 112%;
  line-height: 1.02;
  letter-spacing: -0.035em;
}

.section-note {
  color: hsl(var(--muted-foreground));
}

.block-title {
  margin-bottom: 1.75rem;
  font-size: clamp(1.5rem, 2.6vw, 1.95rem);
  font-weight: 750;
  font-stretch: 108%;
  letter-spacing: -0.02em;
}

/* ---------- Scroll progress ---------- */
.scroll-progress {
  position: fixed;
  inset: 0 0 auto;
  z-index: 70;
  height: 2px;
  pointer-events: none;
}

.scroll-progress span {
  display: block;
  height: 100%;
  background: hsl(var(--foreground));
  transform: scaleX(0);
  transform-origin: 0 50%;
}

/* ---------- Header / navigation ---------- */
.site-header {
  position: fixed;
  inset: 0 0 auto;
  z-index: 50;
  height: var(--header-h);
  border-bottom: 1px solid transparent;
  transition:
    transform 0.5s var(--ease-out),
    background-color 0.3s ease,
    border-color 0.3s ease;
}

.site-header.is-scrolled {
  background: hsl(var(--background) / 0.78);
  border-bottom-color: hsl(var(--border));
  -webkit-backdrop-filter: saturate(1.4) blur(14px);
  backdrop-filter: saturate(1.4) blur(14px);
}

.site-header.is-hidden {
  transform: translateY(-100%);
}

.menu-open .site-header {
  background: transparent;
  border-bottom-color: transparent;
  -webkit-backdrop-filter: none;
  backdrop-filter: none;
  transform: none;
}

.nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  height: 100%;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 0.65rem;
  text-decoration: none;
  border-radius: var(--radius-sm);
}

.brand__logo {
  width: 2.25rem;
  height: 2.25rem;
  border-radius: 0.6rem;
  box-shadow: 0 0 0 1px hsl(var(--border));
}

.brand__label {
  color: hsl(var(--muted-foreground));
  font-size: 0.75rem;
  font-weight: 800;
  letter-spacing: 0.16em;
}

.nav__links {
  position: relative;
  display: none;
  align-items: center;
  gap: 0.25rem;
  padding: 0.3rem;
  border: 1px solid hsl(var(--border));
  border-radius: 999px;
  background: hsl(var(--background) / 0.5);
}

.nav__link {
  position: relative;
  display: block;
  padding: 0.5rem 1rem;
  border-radius: 999px;
  color: hsl(var(--muted-foreground));
  font-size: 0.9375rem;
  font-weight: 500;
  text-decoration: none;
  transition: color 0.2s ease, background-color 0.2s ease;
}

.nav__link:hover {
  color: hsl(var(--foreground));
}

.nav__link.is-active {
  color: hsl(var(--background));
  background: hsl(var(--foreground));
}

/* Pill that slides to the hovered link (position comes from JS) */
.nav__links::before {
  content: "";
  position: absolute;
  top: 0.3rem;
  bottom: 0.3rem;
  left: 0;
  width: var(--hw, 0);
  border-radius: 999px;
  background: hsl(var(--accent));
  opacity: 0;
  transform: translateX(var(--hx, 0));
  transition: transform 0.45s var(--ease-out), width 0.45s var(--ease-out), opacity 0.25s ease;
}

.nav__links.is-hovering::before {
  opacity: 1;
}

.nav__actions {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.nav__phone {
  display: none;
  align-items: center;
  gap: 0.5rem;
  padding: 0.5rem 0.25rem;
  color: hsl(var(--muted-foreground));
  font-size: 0.875rem;
  font-weight: 500;
  font-variant-numeric: tabular-nums;
  text-decoration: none;
  transition: color 0.2s ease;
}

.nav__phone svg {
  width: 1rem;
  height: 1rem;
}

.nav__phone:hover {
  color: hsl(var(--foreground));
}

.icon-btn {
  position: relative;
  display: inline-grid;
  place-items: center;
  width: 2.75rem;
  height: 2.75rem;
  border: 1px solid hsl(var(--border));
  border-radius: 999px;
  background: hsl(var(--background) / 0.5);
  color: hsl(var(--foreground));
  cursor: pointer;
  transition: background-color 0.2s ease, border-color 0.2s ease;
}

.icon-btn:hover {
  background: hsl(var(--accent));
}

.theme-toggle svg {
  position: absolute;
  width: 1.1rem;
  height: 1.1rem;
  transition: transform 0.5s var(--ease-out), opacity 0.3s ease;
}

.theme-toggle__moon {
  opacity: 0;
  transform: rotate(90deg) scale(0.4);
}

.dark .theme-toggle__sun {
  opacity: 0;
  transform: rotate(-90deg) scale(0.4);
}

.dark .theme-toggle__moon {
  opacity: 1;
  transform: none;
}

.menu-toggle__bar {
  position: absolute;
  left: 50%;
  top: 50%;
  width: 1.1rem;
  height: 1.5px;
  margin-left: -0.55rem;
  border-radius: 2px;
  background: currentColor;
  transition: transform 0.45s var(--ease-out);
}

.menu-toggle__bar:first-child {
  transform: translateY(-3.5px);
}

.menu-toggle__bar:last-child {
  transform: translateY(3.5px);
}

.menu-toggle[aria-expanded="true"] .menu-toggle__bar:first-child {
  transform: rotate(45deg);
}

.menu-toggle[aria-expanded="true"] .menu-toggle__bar:last-child {
  transform: rotate(-45deg);
}

/* ---------- Mobile menu ---------- */
.mobile-menu {
  position: fixed;
  inset: 0;
  z-index: 45;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 2rem;
  padding: calc(var(--header-h) + 2rem) var(--gutter) calc(2rem + env(safe-area-inset-bottom));
  overflow-y: auto;
  background: hsl(var(--background));
  clip-path: inset(0 0 100% 0);
  visibility: hidden;
  transition:
    clip-path 0.6s var(--ease-in-out),
    visibility 0s linear 0.6s;
}

.mobile-menu.is-open {
  clip-path: inset(0 0 0 0);
  visibility: visible;
  transition:
    clip-path 0.6s var(--ease-in-out),
    visibility 0s linear 0s;
}

.mobile-menu__list {
  display: grid;
  gap: 0.25rem;
}

.mobile-menu__list li {
  overflow: hidden;
}

.mobile-menu__link {
  display: block;
  padding: 0.35rem 0;
  font-size: clamp(2.4rem, 12vw, 3.6rem);
  font-weight: 800;
  font-stretch: 118%;
  line-height: 1.05;
  letter-spacing: -0.035em;
  text-decoration: none;
  color: hsl(var(--muted-foreground));
  transition: color 0.2s ease;
}

.mobile-menu__link.is-active,
.mobile-menu__link:hover {
  color: hsl(var(--foreground));
}

.mobile-menu__footer {
  display: grid;
  gap: 1rem;
  padding-top: 1.5rem;
  border-top: 1px solid hsl(var(--border));
}

.mobile-menu__phone {
  font-size: 1.25rem;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  text-decoration: none;
}

.mobile-menu__socials {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem 1.25rem;
}

.mobile-menu__socials a {
  padding: 0.35rem 0;
  color: hsl(var(--muted-foreground));
  text-decoration: none;
}

.menu-open,
.menu-open body {
  overflow: hidden;
}

/* ---------- Buttons ---------- */
.btn {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.55rem;
  min-height: 2.875rem;
  padding: 0.75rem 1.35rem;
  border: 1px solid transparent;
  border-radius: 999px;
  font-size: 0.9375rem;
  font-weight: 600;
  line-height: 1;
  text-decoration: none;
  white-space: nowrap;
  cursor: pointer;
  transition:
    transform 0.35s var(--ease-out),
    background-color 0.25s ease,
    border-color 0.25s ease,
    color 0.25s ease,
    box-shadow 0.35s var(--ease-out),
    translate 0.6s var(--ease-out);
}

.btn:active {
  transform: scale(0.97);
}

.btn--lg {
  min-height: 3.25rem;
  padding: 0.95rem 1.75rem;
  font-size: 1rem;
}

.btn--block {
  width: 100%;
}

.btn--primary {
  background: hsl(var(--foreground));
  color: hsl(var(--background));
}

.btn--primary:hover {
  box-shadow: 0 0.75rem 2rem -0.75rem hsl(var(--foreground) / 0.45);
  transform: translateY(-2px);
}

.btn--outline {
  border-color: hsl(var(--border));
  background: hsl(var(--background) / 0.4);
  color: hsl(var(--foreground));
}

.btn--outline:hover {
  border-color: hsl(var(--foreground) / 0.4);
  background: hsl(var(--accent));
}

.btn__icon {
  width: 1rem;
  height: 1rem;
  flex: none;
  transition: transform 0.35s var(--ease-out);
}

.btn:hover .btn__icon {
  transform: translate(2px, -2px);
}

.btn:disabled,
.btn[aria-busy="true"] {
  cursor: progress;
  opacity: 0.7;
  transform: none;
  box-shadow: none;
}

.btn__spinner {
  display: none;
  width: 1rem;
  height: 1rem;
  border: 2px solid currentColor;
  border-right-color: transparent;
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
}

.btn[aria-busy="true"] .btn__spinner {
  display: block;
}

.btn[aria-busy="true"] .btn__icon {
  display: none;
}

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

/* ---------- Tags ---------- */
.tags {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.tag {
  padding: 0.3rem 0.75rem;
  border: 1px solid hsl(var(--border));
  border-radius: 999px;
  color: hsl(var(--muted-foreground));
  font-size: 0.8125rem;
  font-weight: 500;
  white-space: nowrap;
}

.status-pill {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.4rem 0.85rem;
  border: 1px solid hsl(var(--border));
  border-radius: 999px;
  font-size: 0.875rem;
  font-weight: 600;
  color: hsl(var(--foreground));
}

.status-pill::before {
  content: "";
  width: 0.45rem;
  height: 0.45rem;
  border-radius: 50%;
  background: hsl(var(--success));
}

/* ==========================================================================
   Home
   ========================================================================== */

/* ---------- Hero ---------- */
.hero {
  position: relative;
  isolation: isolate;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  min-height: 100svh;
  padding-top: calc(var(--header-h) + clamp(1.25rem, 4vh, 3rem));
  padding-bottom: clamp(2rem, 6vh, 4rem);
  overflow: hidden;
  overflow: clip;
}

/* Set by JS when the hero fits the viewport: it stays put while the page body slides over it. */
.hero.is-pinned {
  position: sticky;
  top: 0;
}

.hero.is-pinned.is-covered {
  visibility: hidden;
}

.hero__bg,
.page-hero__bg {
  position: absolute;
  inset: 0;
  z-index: -1;
  overflow: hidden;
  pointer-events: none;
}

/* Inner pages: keep the texture behind the title, not behind long text */
.page-hero__bg {
  height: min(100%, 30rem);
}

.hero__grid {
  position: absolute;
  inset: 0;
  background-image:
    linear-gradient(hsl(var(--foreground) / 0.06) 1px, transparent 1px),
    linear-gradient(90deg, hsl(var(--foreground) / 0.06) 1px, transparent 1px);
  background-size: 4rem 4rem;
  background-position: center top;
  -webkit-mask-image: radial-gradient(ellipse 75% 65% at 50% 35%, #000 25%, transparent 75%);
  mask-image: radial-gradient(ellipse 75% 65% at 50% 35%, #000 25%, transparent 75%);
}

/* Animated dot field (canvas). Replaces the static grid once it is running. */
.dots {
  position: absolute;
  inset: 0;
  display: none;
  width: 100%;
  height: 100%;
  -webkit-mask-image: radial-gradient(ellipse 85% 80% at 50% 40%, #000 30%, transparent 85%);
  mask-image: radial-gradient(ellipse 85% 80% at 50% 40%, #000 30%, transparent 85%);
}

.has-field .dots {
  display: block;
}

.has-field .hero__grid {
  display: none;
}

.hero__glow {
  position: absolute;
  top: -25vmax;
  right: -20vmax;
  width: 60vmax;
  height: 60vmax;
  border-radius: 50%;
  background: radial-gradient(circle, hsl(var(--foreground) / 0.09), transparent 62%);
}

.hero__inner {
  display: grid;
  flex: 1;
  align-items: center;
  gap: clamp(2.75rem, 7vw, 4rem);
  transform-origin: 50% 35%;
}

.hero__copy {
  display: grid;
  gap: clamp(1.1rem, 2.8vh, 1.75rem);
  justify-items: start;
  min-width: 0;
}

.hero__badge {
  padding: 0.45rem 0.95rem;
  border: 1px solid hsl(var(--border));
  border-radius: 999px;
  background: hsl(var(--background) / 0.6);
  color: hsl(var(--muted-foreground));
  font-size: 0.875rem;
  font-weight: 500;
  -webkit-backdrop-filter: blur(6px);
  backdrop-filter: blur(6px);
}

.hero__title {
  width: 100%;
  font-size: clamp(3rem, 13.4vw, 7.5rem);
  font-weight: 800;
  font-stretch: 125%;
  line-height: 0.92;
  letter-spacing: -0.045em;
}

.hero__line {
  display: block;
  white-space: nowrap;
}

.hero__desc {
  max-width: 40ch;
  color: hsl(var(--muted-foreground));
  font-size: clamp(1.125rem, 1.5vw, 1.3rem);
  line-height: 1.5;
}

.hero__actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
}

.hero__phone {
  color: hsl(var(--muted-foreground));
  font-weight: 500;
  font-variant-numeric: tabular-nums;
  text-decoration: none;
  border-bottom: 1px solid hsl(var(--border));
  padding-bottom: 0.15rem;
  transition: color 0.2s ease, border-color 0.2s ease;
}

.hero__phone:hover {
  color: hsl(var(--foreground));
  border-color: hsl(var(--foreground));
}

/* ---------- Scene: phone + code ("hot reload") ---------- */
.scene {
  position: relative;
  container-type: inline-size;
  perspective: 1500px;
}

/* --u is the scene's design unit: everything inside scales with it. */
.scene__stage {
  --u: 0.8rem;
  position: relative;
  display: grid;
  justify-items: center;
  transform-style: preserve-3d;
  transform: rotateX(calc(var(--rx, 0) * 1deg)) rotateY(calc(var(--ry, 0) * 1deg));
}

.scene__item {
  transform-style: preserve-3d;
}

/* translateZ (not z-index) decides what is in front inside a 3D scene */
.scene__item--code {
  width: 100%;
  max-width: 20.5rem;
  margin-top: -2.75rem;
  transform: translateZ(4rem);
}

.phone {
  --phone-body: #0d0d0d;
  position: relative;
  width: calc(var(--u) * 17);
  height: calc(var(--u) * 35);
  padding: calc(var(--u) * 0.55);
  border-radius: calc(var(--u) * 2.8);
  background: var(--phone-body);
  font-size: var(--u);
  box-shadow:
    inset 0 0 0 1px rgb(255 255 255 / 0.16),
    0 0 0 1px rgb(0 0 0 / 0.6),
    1px 1px 0 1px #2c2c2c,
    2px 2px 0 1px #262626,
    3px 3px 0 1px #1f1f1f,
    2.5rem 3rem 5rem -1.5rem rgb(0 0 0 / 0.55);
  transform: rotateY(-15deg) rotateX(6deg) rotateZ(1.5deg);
}

.dark .phone {
  --phone-body: #1c1c1c;
}

.phone__screen {
  position: relative;
  display: flex;
  flex-direction: column;
  height: 100%;
  overflow: hidden;
  border-radius: 2.3em;
  background: hsl(var(--background));
  color: hsl(var(--foreground));
}

.phone__screen::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(180deg, transparent, hsl(var(--foreground) / 0.16), transparent);
  transform: translateY(-101%);
  pointer-events: none;
}

.phone.is-reloaded .phone__screen::after {
  animation: sweep 0.9s ease-out;
}

@keyframes sweep {
  to {
    transform: translateY(101%);
  }
}

.phone__status {
  display: flex;
  flex: none;
  align-items: center;
  justify-content: space-between;
  height: 2.8em;
  padding: 0.35em 1.5em 0;
}

.phone__time {
  font-size: 0.72em;
  font-weight: 700;
}

.phone__island {
  width: 4.6em;
  height: 1.35em;
  border-radius: 999px;
  background: #000;
  box-shadow: inset 0 0 0 1px rgb(255 255 255 / 0.08);
}

.phone__signal {
  display: flex;
  align-items: flex-end;
  gap: 0.14em;
  height: 0.7em;
}

.phone__signal i {
  width: 0.2em;
  border-radius: 1px;
  background: currentColor;
}

.phone__signal i:nth-child(1) { height: 40%; }
.phone__signal i:nth-child(2) { height: 60%; }
.phone__signal i:nth-child(3) { height: 80%; }
.phone__signal i:nth-child(4) { height: 100%; }

.app {
  display: flex;
  flex: 1;
  flex-direction: column;
  gap: 0.7em;
  min-height: 0;
  padding: 0.9em 1em 0;
}

.app__head {
  display: flex;
  align-items: center;
  gap: 0.7em;
}

.app__avatar {
  flex: none;
  width: 3.1em;
  height: 3.1em;
  border-radius: 0.95em;
  box-shadow: 0 0 0 1px hsl(var(--border));
}

.app__title {
  display: grid;
  min-width: 0;
  line-height: 1.25;
}

.app__title strong {
  font-size: 0.95em;
  font-weight: 800;
  letter-spacing: -0.01em;
  white-space: nowrap;
}

.app__title span {
  color: hsl(var(--muted-foreground));
  font-size: 0.68em;
}

.app__chips {
  display: flex;
  gap: 0.35em;
}

.app__chips li {
  padding: 0.4em 1em;
  border: 1px solid hsl(var(--border));
  border-radius: 999px;
  font-size: 0.66em;
  font-weight: 600;
  line-height: 1.3;
}

.app__chips li:first-child {
  border-color: hsl(var(--foreground));
  background: hsl(var(--foreground));
  color: hsl(var(--background));
}

.app__label {
  width: fit-content;
  margin-top: 0.5em;
  color: hsl(var(--muted-foreground));
  font-size: 0.68em;
  font-weight: 700;
  line-height: 1.3;
}

.app__card {
  display: flex;
  align-items: center;
  gap: 0.7em;
  padding: 0.6em;
  border: 1px solid hsl(var(--border));
  border-radius: 1em;
  background: hsl(var(--surface));
}

.app__thumb {
  display: grid;
  flex: none;
  place-items: center;
  width: 3em;
  height: 3em;
  border-radius: 0.75em;
  color: #fff;
}

.app__thumb b {
  font-size: 0.95em;
  font-weight: 800;
  letter-spacing: -0.04em;
}

.app__thumb svg {
  width: 1.45em;
  height: 1.45em;
}

.app__card--mono .app__thumb {
  background: linear-gradient(135deg, hsl(var(--foreground)), hsl(var(--muted-foreground)));
  color: hsl(var(--background));
}

.app__card--green .app__thumb {
  background: linear-gradient(135deg, #2f7355, #66b393);
}

.app__card--blue .app__thumb {
  background: linear-gradient(135deg, #1f4f9e, #6ea0ee);
}

.app__card div {
  display: grid;
  min-width: 0;
  line-height: 1.3;
}

.app__card strong {
  font-size: 0.8em;
  font-weight: 700;
}

.app__card div span {
  overflow: hidden;
  color: hsl(var(--muted-foreground));
  font-size: 0.62em;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.phone__tabs {
  display: flex;
  flex: none;
  align-items: center;
  justify-content: space-around;
  height: 3.1em;
  margin-top: auto;
  border-top: 1px solid hsl(var(--border));
}

.phone__tabs i {
  width: 1.15em;
  height: 1.15em;
  border: 0.13em solid hsl(var(--muted-foreground) / 0.6);
  border-radius: 0.36em;
}

.phone__tabs i:first-child {
  border-color: hsl(var(--foreground));
  background: hsl(var(--foreground));
}

.phone__home {
  flex: none;
  width: 5.4em;
  height: 0.28em;
  margin: 0.35em auto 0.5em;
  border-radius: 999px;
  background: hsl(var(--foreground) / 0.85);
}

/* Widgets are "built" one by one as the matching code line is typed. */
.motion .phone [data-widget] {
  transition: opacity 0.5s ease, filter 0.5s ease, transform 0.7s var(--ease-out);
}

.motion .phone [data-widget]:not(.is-built) {
  opacity: 0.14;
  filter: blur(0.3em) grayscale(1);
  transform: scale(0.93);
}

.phone [data-widget].is-flash {
  animation: repaint 0.8s ease-out;
}

@keyframes repaint {
  from {
    outline: 0.12em solid hsl(var(--success));
    outline-offset: 0.15em;
  }

  to {
    outline: 0.12em solid transparent;
    outline-offset: 0.6em;
  }
}

/* ---------- Code card ---------- */
.code-card {
  width: 100%;
  overflow: hidden;
  border: 1px solid hsl(var(--border));
  border-radius: 1.5em;
  background: hsl(var(--surface));
  font-family: var(--font-mono);
  font-size: 0.6875rem;
  line-height: 1.75;
  box-shadow: 0 1.5rem 3rem -1.5rem rgb(0 0 0 / 0.4);
}

.code-card__bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1em;
  padding: 0.8em 1.3em;
  border-bottom: 1px solid hsl(var(--border));
  color: hsl(var(--muted-foreground));
  font-size: 0.92em;
}

.code-card__file {
  display: inline-flex;
  align-items: center;
  gap: 0.6em;
  color: hsl(var(--foreground));
}

.code-card__file::before {
  content: "";
  width: 0.6em;
  height: 0.6em;
  border-radius: 2px;
  background: #0175c2;
}

.code-card__status {
  display: inline-flex;
  align-items: center;
  gap: 0.5em;
  transition: color 0.3s ease;
}

.code-card__status.is-done {
  color: hsl(var(--success));
}

.code-card__status.is-done::before {
  content: "";
  width: 0.55em;
  height: 0.55em;
  border-radius: 50%;
  background: currentColor;
}

.code-card__body {
  position: relative;
  padding: 1.2em 1.4em 1.4em;
  overflow: hidden;
}

.code {
  margin: 0;
  font: inherit;
  white-space: pre;
}

.code--live {
  position: absolute;
  inset: 1.2em 1.4em 1.4em;
}

.code--ghost.is-hidden {
  visibility: hidden;
}

.tok-kw {
  color: hsl(var(--muted-foreground));
}

.tok-ty,
.tok-fn {
  color: hsl(var(--foreground));
  font-weight: 600;
}

.tok-prop {
  color: hsl(var(--foreground) / 0.8);
}

.tok-str {
  color: hsl(var(--success));
}

.tok-p {
  color: hsl(var(--muted-foreground));
}

.tok-id {
  color: hsl(var(--foreground));
}

.caret {
  display: inline-block;
  width: 0.55em;
  height: 1.15em;
  margin-left: 1px;
  vertical-align: -0.2em;
  background: currentColor;
  animation: blink 1s steps(1) infinite;
}

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

/* ---------- Page body (slides over the pinned hero) ---------- */
.page-body {
  position: relative;
  z-index: 2;
  border-radius: clamp(1.5rem, 4vw, 2.75rem) clamp(1.5rem, 4vw, 2.75rem) 0 0;
  background: hsl(var(--background));
  box-shadow: 0 -1px 0 hsl(var(--border)), 0 -2rem 4rem -2.5rem rgb(0 0 0 / 0.18);
}

.dark .page-body {
  box-shadow: 0 -1px 0 hsl(var(--border)), 0 -2.5rem 5rem -2rem rgb(0 0 0 / 0.5);
}

/* ---------- Marquee ---------- */
.marquee {
  display: grid;
  gap: clamp(0.25rem, 1vw, 0.75rem);
  padding-top: clamp(2.75rem, 7vw, 5rem);
  overflow: hidden;
}

.marquee__row {
  transform: skewX(var(--skew, 0deg));
}

.marquee__track {
  display: flex;
  width: max-content;
}

.marquee__row--outline .marquee__track {
  transform: translate3d(-12%, 0, 0);
}

.marquee__group {
  display: flex;
  flex: none;
  align-items: center;
  gap: clamp(1.25rem, 3vw, 2.75rem);
  padding-right: clamp(1.25rem, 3vw, 2.75rem);
  font-size: clamp(2.75rem, 9.5vw, 8.5rem);
  font-weight: 800;
  font-stretch: 125%;
  line-height: 1.08;
  letter-spacing: -0.045em;
  white-space: nowrap;
}

.marquee__group i {
  flex: none;
  width: 0.36em;
  height: 0.36em;
  background: currentColor;
  clip-path: polygon(50% 0, 61% 39%, 100% 50%, 61% 61%, 50% 100%, 39% 61%, 0 50%, 39% 39%);
}

.marquee__row--outline .marquee__group {
  color: transparent;
  -webkit-text-stroke: 1.5px hsl(var(--foreground) / 0.42);
}

.marquee__row--outline .marquee__group i {
  background: hsl(var(--foreground) / 0.42);
}

/* ---------- Services (stacking cards) ---------- */
.stack__card + .stack__card {
  margin-top: 1.25rem;
}

.service {
  position: relative;
  display: grid;
  gap: 1.5rem;
  align-items: center;
  min-height: 15rem;
  padding: clamp(1.5rem, 4vw, 3rem);
  overflow: hidden;
  border: 1px solid hsl(var(--border));
  border-radius: var(--radius-xl);
  background: hsl(var(--surface));
  transform-origin: 50% 0;
  transition: border-color 0.35s ease;
}

/* Dims a card as the next ones stack on top of it (--dim is set from JS). */
.service::after {
  content: "";
  position: absolute;
  inset: 0;
  background: hsl(var(--background));
  opacity: calc(var(--dim, 0) * 0.55);
  pointer-events: none;
}

.service__text {
  display: grid;
  gap: 1rem;
  justify-items: start;
}

.service__icon {
  display: grid;
  place-items: center;
  width: 3.25rem;
  height: 3.25rem;
  border: 1px solid hsl(var(--border));
  border-radius: var(--radius-md);
  background: hsl(var(--background));
  transition: background-color 0.35s ease, color 0.35s ease, border-color 0.35s ease;
}

.service__icon svg {
  width: 1.5rem;
  height: 1.5rem;
}

.service__title {
  font-size: clamp(1.9rem, 4.6vw, 3.4rem);
  font-weight: 800;
  font-stretch: 118%;
  line-height: 1;
  letter-spacing: -0.04em;
}

.service__desc {
  max-width: 42ch;
  color: hsl(var(--muted-foreground));
}

.service__art {
  justify-self: center;
  width: min(100%, 17rem);
  color: hsl(var(--muted-foreground));
  transition: color 0.4s ease, transform 0.6s var(--ease-out);
}

.service__art svg {
  width: 100%;
  height: auto;
  overflow: visible;
}

@media (hover: hover) {
  .service:hover {
    border-color: hsl(var(--foreground) / 0.35);
  }

  .service:hover .service__icon {
    border-color: hsl(var(--foreground));
    background: hsl(var(--foreground));
    color: hsl(var(--background));
  }

  .service:hover .service__art {
    color: hsl(var(--foreground));
    transform: scale(1.04) rotate(-1.5deg);
  }
}

@media (min-height: 620px) {
  .stack__card {
    position: sticky;
    top: calc(var(--header-h) + 1rem + var(--n, 0) * 0.9rem);
  }
}

/* ---------- Technologies ---------- */
.tech-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 1px;
  overflow: hidden;
  border: 1px solid hsl(var(--border));
  border-radius: var(--radius-lg);
  background: hsl(var(--border));
}

.tech {
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
  min-height: 9.5rem;
  padding: clamp(1.15rem, 3vw, 1.85rem);
  background: hsl(var(--background));
  transition: background-color 0.3s ease;
}

.tech__logo {
  display: grid;
  place-items: center;
  width: 2.9rem;
  height: 2.9rem;
  margin-bottom: auto;
  border: 1px solid hsl(var(--border));
  border-radius: 0.8rem;
  background: hsl(var(--surface));
  transition: transform 0.45s var(--ease-out);
}

.tech__logo img {
  width: 1.6rem;
  height: 1.6rem;
  object-fit: contain;
}

.tech__name {
  margin-top: 1.25rem;
  font-size: 1.0625rem;
  font-weight: 700;
  line-height: 1.25;
}

.tech__type {
  color: hsl(var(--muted-foreground));
  font-size: 0.875rem;
}

@media (hover: hover) {
  .tech:hover {
    background: hsl(var(--surface));
  }

  .tech:hover .tech__logo {
    transform: translateY(-4px) rotate(-6deg);
  }
}

/* ---------- Call to action ---------- */
.cta__inner {
  display: grid;
  gap: 3rem;
  align-items: center;
}

.cta__title {
  max-width: 13ch;
  font-size: clamp(2.6rem, 8.5vw, 7rem);
  font-weight: 800;
  font-stretch: 125%;
  line-height: 0.95;
  letter-spacing: -0.045em;
}

.cta__text {
  max-width: 30ch;
  margin-block: clamp(1.75rem, 4vw, 2.75rem) clamp(2rem, 4vw, 3rem);
  font-size: clamp(1.3rem, 2.8vw, 2.1rem);
  font-weight: 500;
  line-height: 1.3;
  letter-spacing: -0.015em;
}

.sw {
  transition: opacity 0.4s ease;
}

.is-scrubbing .sw {
  opacity: 0.18;
}

.is-scrubbing .sw.is-lit {
  opacity: 1;
}

/* Rotating round badge (decorative duplicate of the button next to it) */
.badge {
  position: relative;
  display: none;
  place-items: center;
  width: clamp(10rem, 16vw, 14rem);
  aspect-ratio: 1;
  border-radius: 50%;
  color: hsl(var(--foreground));
  text-decoration: none;
  transition: translate 0.6s var(--ease-out);
}

.badge__ring {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
}

.badge__ring text {
  fill: currentColor;
  font-size: 15px;
  font-weight: 600;
  letter-spacing: 0.01em;
}

.badge__core {
  display: grid;
  place-items: center;
  width: 44%;
  aspect-ratio: 1;
  border-radius: 50%;
  background: hsl(var(--foreground));
  color: hsl(var(--background));
  transition: transform 0.6s var(--ease-out);
}

.badge__core svg {
  width: 36%;
  transition: transform 0.6s var(--ease-out);
}

.badge:hover .badge__core {
  transform: scale(1.14);
}

.badge:hover .badge__core svg {
  transform: rotate(45deg);
}

@media (prefers-reduced-motion: no-preference) {
  .badge__ring {
    animation: spin 20s linear infinite;
  }
}

/* ---------- Footer ---------- */
.footer {
  padding-block: clamp(3.5rem, 7vw, 5rem) calc(2rem + env(safe-area-inset-bottom));
  border-top: 1px solid hsl(var(--border));
  background: hsl(var(--surface));
}

.footer__top {
  display: grid;
  gap: 2.5rem;
  padding-bottom: 2.5rem;
}

.footer__name {
  margin-bottom: 0.75rem;
  font-size: 1.5rem;
  font-weight: 800;
  font-stretch: 115%;
  letter-spacing: -0.025em;
}

.footer__desc {
  max-width: 34ch;
  color: hsl(var(--muted-foreground));
  font-size: 0.9375rem;
}

.footer__heading {
  margin-bottom: 1rem;
  font-size: 0.9375rem;
  font-weight: 700;
}

.footer__links {
  display: grid;
  gap: 0.25rem;
}

.footer__link {
  display: inline-block;
  padding: 0.25rem 0;
  color: hsl(var(--muted-foreground));
  font-size: 0.9375rem;
  text-decoration: none;
  transition: color 0.2s ease;
}

.footer__link:hover {
  color: hsl(var(--foreground));
}

.socials {
  display: flex;
  flex-wrap: wrap;
  gap: 0.6rem;
}

.social {
  display: grid;
  place-items: center;
  width: 2.75rem;
  height: 2.75rem;
  border: 1px solid hsl(var(--border));
  border-radius: 50%;
  color: hsl(var(--muted-foreground));
  transition: color 0.2s ease, border-color 0.2s ease, transform 0.35s var(--ease-out),
    translate 0.6s var(--ease-out);
}

.social svg {
  width: 1.15rem;
  height: 1.15rem;
}

.social:hover {
  color: hsl(var(--foreground));
  border-color: hsl(var(--foreground) / 0.5);
  transform: translateY(-2px);
}

.footer__bottom {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding-top: 1.75rem;
  border-top: 1px solid hsl(var(--border));
  color: hsl(var(--muted-foreground));
  font-size: 0.875rem;
}

.footer__totop {
  padding: 0.35rem 0;
  color: hsl(var(--muted-foreground));
  text-decoration: none;
  transition: color 0.2s ease;
}

.footer__totop:hover {
  color: hsl(var(--foreground));
}

/* ==========================================================================
   Inner pages
   ========================================================================== */

.page-hero {
  position: relative;
  isolation: isolate;
  padding-top: calc(var(--header-h) + clamp(2.5rem, 8vw, 5.5rem));
  padding-bottom: var(--section-y);
}

.page-hero--compact {
  padding-bottom: clamp(3rem, 7vw, 5rem);
}

.page-hero__head {
  margin-bottom: clamp(2.5rem, 6vw, 4rem);
}

.page-title {
  font-size: clamp(3rem, 11vw, 8.5rem);
  font-weight: 800;
  font-stretch: 125%;
  line-height: 0.92;
  letter-spacing: -0.045em;
}

.page-rule {
  display: block;
  width: 6rem;
  height: 4px;
  margin-top: 1.5rem;
  border-radius: 999px;
  background: hsl(var(--foreground));
  transform-origin: 0 50%;
}

.page-lead {
  max-width: 44ch;
  margin-top: -1rem;
  color: hsl(var(--muted-foreground));
  font-size: clamp(1.15rem, 1.8vw, 1.35rem);
}

/* ---------- About ---------- */
.about {
  display: grid;
  gap: clamp(3rem, 6vw, 5rem);
  align-items: start;
}

.about__copy {
  display: grid;
  gap: 1.1rem;
  justify-items: start;
}

.about__copy > p {
  max-width: 62ch;
  color: hsl(var(--muted-foreground));
}

.about__name {
  font-size: clamp(1.6rem, 3vw, 2.25rem);
  font-weight: 750;
  font-stretch: 110%;
  letter-spacing: -0.025em;
}

.about__copy > .about__lead {
  color: hsl(var(--foreground));
  font-size: clamp(1.2rem, 2vw, 1.45rem);
  line-height: 1.45;
}

.about__copy > div {
  margin-top: 0.75rem;
}

.stats {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 1px;
  overflow: hidden;
  border: 1px solid hsl(var(--border));
  border-radius: var(--radius-lg);
  background: hsl(var(--border));
}

.stat {
  display: flex;
  flex-direction: column;
  min-height: 11rem;
  padding: clamp(1.15rem, 2.5vw, 1.6rem);
  background: hsl(var(--background));
}

.stat__icon {
  width: 1.5rem;
  height: 1.5rem;
  margin-bottom: auto;
  color: hsl(var(--muted-foreground));
}

.stat__value {
  order: 1;
  margin-top: 1.25rem;
  font-size: clamp(2.25rem, 5vw, 3.25rem);
  font-weight: 800;
  font-stretch: 115%;
  line-height: 1;
  letter-spacing: -0.04em;
  font-variant-numeric: tabular-nums;
}

.stat__label {
  order: 2;
  margin-top: 0.5rem;
  color: hsl(var(--muted-foreground));
  font-size: 0.875rem;
  line-height: 1.35;
}

/* ---------- Skills ---------- */
.skill-groups {
  display: grid;
  gap: 1.25rem;
}

.skill-group {
  display: flex;
  flex-direction: column;
  padding: clamp(1.5rem, 3vw, 2rem);
  border: 1px solid hsl(var(--border));
  border-radius: var(--radius-lg);
  background: hsl(var(--background));
  transition: border-color 0.3s ease;
}

.skill-group:hover {
  border-color: hsl(var(--foreground) / 0.3);
}

.skill-group__label {
  align-self: flex-start;
  margin-bottom: 1.25rem;
  padding: 0.2rem 0.65rem;
  border: 1px solid hsl(var(--border));
  border-radius: 999px;
  color: hsl(var(--muted-foreground));
  font-size: 0.8125rem;
  font-weight: 600;
}

.skill-group__title {
  margin-bottom: 0.5rem;
  font-size: 1.375rem;
  font-weight: 700;
  font-stretch: 108%;
  letter-spacing: -0.02em;
}

.skill-group__desc {
  min-height: 3.2em; /* two lines: keeps the lists aligned across cards */
  margin-bottom: 1.5rem;
  color: hsl(var(--muted-foreground));
  font-size: 0.9375rem;
}

.skill-list {
  display: grid;
  gap: 0.125rem;
  padding-top: 1rem;
  border-top: 1px solid hsl(var(--border));
}

.skill-item {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.55rem 0.5rem;
  border-radius: var(--radius-sm);
  font-size: 0.9375rem;
  font-weight: 500;
  transition: background-color 0.2s ease;
}

.skill-item:hover {
  background: hsl(var(--surface));
}

.skill-item img {
  width: 1.25rem;
  height: 1.25rem;
  object-fit: contain;
}

/* ---------- Projects ---------- */
.projects {
  display: grid;
  gap: clamp(1.5rem, 3vw, 2.25rem);
}

.project {
  --tone: hsl(var(--foreground));
  display: grid;
  overflow: hidden;
  overflow: clip; /* clip keeps the rounded corners without breaking the sticky visual */
  border: 1px solid hsl(var(--border));
  border-radius: var(--radius-xl);
  background: hsl(var(--background));
  transition: border-color 0.35s ease, box-shadow 0.35s ease;
}

.project:hover {
  border-color: color-mix(in srgb, var(--tone) 45%, transparent);
  box-shadow: 0 1.5rem 3rem -2rem color-mix(in srgb, var(--tone) 60%, transparent);
}

.project--green {
  --tone: #3f8f6b;
}

.project--blue {
  --tone: #2f6fd0;
}

.project__visual {
  position: relative;
  padding: clamp(1.5rem, 3vw, 2.25rem);
  overflow: hidden;
  overflow: clip;
  color: #fff;
  background: linear-gradient(135deg, #2b2b2b, #737373);
}

.project__visual-inner {
  position: relative;
  z-index: 1;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 2.5rem;
  min-height: 9.5rem;
}

.project__visual::after {
  content: "";
  position: absolute;
  inset: 0;
  background-image:
    linear-gradient(rgb(255 255 255 / 0.08) 1px, transparent 1px),
    linear-gradient(90deg, rgb(255 255 255 / 0.08) 1px, transparent 1px);
  background-size: 2rem 2rem;
  -webkit-mask-image: linear-gradient(to top left, #000, transparent 70%);
  mask-image: linear-gradient(to top left, #000, transparent 70%);
  pointer-events: none;
}

.project--mono .project__visual {
  background: linear-gradient(135deg, hsl(var(--foreground)), hsl(var(--muted-foreground)));
  color: hsl(var(--background));
}

.project--mono .project__visual::after {
  background-image:
    linear-gradient(hsl(var(--background) / 0.1) 1px, transparent 1px),
    linear-gradient(90deg, hsl(var(--background) / 0.1) 1px, transparent 1px);
}

.project--green .project__visual {
  background: linear-gradient(135deg, #2f7355, #3f8f6b 55%, #66b393);
}

.project--blue .project__visual {
  background: linear-gradient(135deg, #1f4f9e, #2f6fd0 55%, #6ea0ee);
}

.project__glyph {
  position: relative;
  z-index: 1;
  display: block;
  line-height: 1;
}

.project__glyph svg {
  width: clamp(3.25rem, 6vw, 4.5rem);
  height: clamp(3.25rem, 6vw, 4.5rem);
}

.project__glyph--text {
  font-size: clamp(3.25rem, 7vw, 5rem);
  font-weight: 800;
  font-stretch: 125%;
  letter-spacing: -0.06em;
}

.project__caption {
  position: relative;
  z-index: 1;
  max-width: 11rem;
  min-height: 2.6em;
  font-size: 1.05rem;
  font-weight: 600;
  line-height: 1.3;
}

.project__content {
  display: grid;
  gap: 1.25rem;
  justify-items: start;
  padding: clamp(1.5rem, 4vw, 2.75rem);
}

.project__kicker {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 0.25rem 0.75rem;
  font-size: 0.9375rem;
  font-weight: 700;
}

.project__domain {
  color: hsl(var(--muted-foreground));
  font-weight: 500;
}

.project__title {
  max-width: 24ch;
  margin-top: -0.5rem;
  font-size: clamp(1.6rem, 3.2vw, 2.35rem);
  font-weight: 750;
  font-stretch: 108%;
  letter-spacing: -0.03em;
}

.project__desc {
  max-width: 62ch;
  color: hsl(var(--muted-foreground));
}

.features {
  display: grid;
  gap: 0.55rem;
}

.features li {
  position: relative;
  padding-left: 1.6rem;
  font-size: 0.9375rem;
}

.features li::before {
  content: "";
  position: absolute;
  left: 0.15rem;
  top: 0.45em;
  width: 0.6rem;
  height: 0.6rem;
  border-radius: 50%;
  border: 2px solid var(--tone);
}

.project__sections {
  display: grid;
  gap: 0.6rem;
  width: 100%;
}

.project__sections li {
  display: grid;
  gap: 0.1rem;
  padding: 0.75rem 1rem;
  border: 1px solid hsl(var(--border));
  border-left: 3px solid var(--tone);
  border-radius: var(--radius-sm);
  font-size: 0.9rem;
}

.project__sections span {
  color: hsl(var(--muted-foreground));
}

.project__meta {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem 1.75rem;
  width: 100%;
  padding-top: 1.1rem;
  border-top: 1px dashed hsl(var(--border));
  font-size: 0.875rem;
}

.project__meta div {
  display: flex;
  gap: 0.4rem;
}

.project__meta dt {
  color: hsl(var(--muted-foreground));
}

.project__meta dt::after {
  content: ":";
}

.project__meta dd {
  font-weight: 600;
}

/* ---------- Timeline ---------- */
.timeline {
  position: relative;
  max-width: 52rem;
  padding-left: 2.25rem;
}

.timeline__track {
  position: absolute;
  top: 0.5rem;
  bottom: 0.5rem;
  left: 0.4rem;
  width: 2px;
  border-radius: 2px;
  background: hsl(var(--border));
  overflow: hidden;
}

.timeline__progress {
  display: block;
  width: 100%;
  height: 100%;
  background: hsl(var(--foreground));
  transform: scaleY(1);
  transform-origin: 50% 0;
}

.timeline__list {
  display: grid;
  gap: clamp(2.5rem, 5vw, 3.5rem);
}

.timeline__item {
  position: relative;
}

.timeline__dot {
  position: absolute;
  top: 0.4rem;
  left: -2.25rem;
  width: 1rem;
  height: 1rem;
  margin-left: calc(-0.1rem + 1px);
  border: 2px solid hsl(var(--foreground));
  border-radius: 50%;
  background: hsl(var(--foreground));
  box-shadow: 0 0 0 5px hsl(var(--surface));
  transition: background-color 0.4s ease, transform 0.5s var(--ease-out);
}

.timeline__head {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  justify-content: space-between;
  gap: 0.4rem 1.5rem;
  margin-bottom: 0.35rem;
}

.timeline__title {
  font-size: clamp(1.3rem, 2.4vw, 1.65rem);
  font-weight: 700;
  font-stretch: 106%;
  letter-spacing: -0.02em;
}

.timeline__period {
  padding: 0.2rem 0.7rem;
  border: 1px solid hsl(var(--border));
  border-radius: 999px;
  color: hsl(var(--muted-foreground));
  font-size: 0.8125rem;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.timeline__org {
  margin-bottom: 0.75rem;
  font-weight: 600;
}

.timeline__desc {
  max-width: 62ch;
  margin-bottom: 1rem;
  color: hsl(var(--muted-foreground));
}

/* ---------- Education ---------- */
.education {
  display: grid;
  gap: 1px;
  overflow: hidden;
  border: 1px solid hsl(var(--border));
  border-radius: var(--radius-lg);
  background: hsl(var(--border));
}

.edu {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
  padding: clamp(1.5rem, 3vw, 2rem);
  background: hsl(var(--background));
}

.edu__icon {
  width: 1.75rem;
  height: 1.75rem;
  margin-bottom: 1.5rem;
  color: hsl(var(--muted-foreground));
}

.edu__title {
  font-size: 1.25rem;
  font-weight: 700;
  letter-spacing: -0.015em;
}

.edu__subtitle,
.edu__date {
  color: hsl(var(--muted-foreground));
  font-size: 0.9375rem;
}

/* ---------- Contact ---------- */
.contact__grid {
  display: grid;
  gap: clamp(3rem, 6vw, 4.5rem);
  align-items: start;
}

.methods {
  display: grid;
  gap: 0.75rem;
}

.method {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.5rem;
  border: 1px solid hsl(var(--border));
  border-radius: var(--radius-lg);
  background: hsl(var(--background));
  transition: border-color 0.25s ease;
}

.method:hover {
  border-color: hsl(var(--foreground) / 0.3);
}

.method__main {
  display: flex;
  flex: 1;
  align-items: center;
  gap: 1rem;
  min-width: 0;
  padding: 0.5rem;
  border-radius: var(--radius-md);
  text-decoration: none;
}

.method__icon {
  display: grid;
  flex: none;
  place-items: center;
  width: 3rem;
  height: 3rem;
  border-radius: var(--radius-md);
  background: hsl(var(--surface));
  border: 1px solid hsl(var(--border));
}

.method__icon svg {
  width: 1.35rem;
  height: 1.35rem;
}

.method__text {
  display: grid;
  min-width: 0;
}

.method__label {
  color: hsl(var(--muted-foreground));
  font-size: 0.8125rem;
}

.method__value {
  font-weight: 600;
  overflow-wrap: break-word;
}

.method__copy {
  position: relative;
  display: grid;
  flex: none;
  place-items: center;
  width: 2.75rem;
  height: 2.75rem;
  border: 1px solid transparent;
  border-radius: var(--radius-md);
  background: transparent;
  color: hsl(var(--muted-foreground));
  cursor: pointer;
  transition: color 0.2s ease, background-color 0.2s ease;
}

.method__copy:hover {
  color: hsl(var(--foreground));
  background: hsl(var(--surface));
}

.method__copy svg {
  position: absolute;
  width: 1.1rem;
  height: 1.1rem;
  transition: transform 0.35s var(--ease-out), opacity 0.2s ease;
}

.method__done-icon {
  opacity: 0;
  transform: scale(0.4);
  color: hsl(var(--success));
}

.method__copy.is-copied .method__copy-icon {
  opacity: 0;
  transform: scale(0.4);
}

.method__copy.is-copied .method__done-icon {
  opacity: 1;
  transform: none;
}

.social-block {
  margin-top: 2.5rem;
}

.social-block__title {
  margin-bottom: 1rem;
  font-size: 1rem;
  font-weight: 700;
}

.pills {
  display: flex;
  flex-wrap: wrap;
  gap: 0.6rem;
}

.pill {
  display: inline-flex;
  align-items: center;
  min-height: 2.75rem;
  padding: 0.5rem 1.15rem;
  border: 1px solid hsl(var(--border));
  border-radius: 999px;
  background: hsl(var(--background));
  font-size: 0.9375rem;
  font-weight: 600;
  text-decoration: none;
  transition: background-color 0.25s ease, color 0.25s ease, border-color 0.25s ease;
}

.pill:hover {
  border-color: hsl(var(--foreground));
  background: hsl(var(--foreground));
  color: hsl(var(--background));
}

.contact__side {
  display: grid;
  gap: 1.25rem;
}

.form-card {
  padding: clamp(1.5rem, 4vw, 2.5rem);
  border: 1px solid hsl(var(--border));
  border-radius: var(--radius-xl);
  background: hsl(var(--background));
}

.form {
  display: grid;
  gap: 1.15rem;
}

.field {
  display: grid;
  gap: 0.45rem;
}

.field__label {
  font-size: 0.9rem;
  font-weight: 600;
}

.field__hint {
  color: hsl(var(--muted-foreground));
  font-weight: 400;
}

.field__input {
  width: 100%;
  min-height: 3rem;
  padding: 0.8rem 1rem;
  border: 1px solid hsl(var(--input));
  border-radius: var(--radius-md);
  background: hsl(var(--surface));
  font-size: 1rem; /* ≥16px stops iOS zoom on focus */
  line-height: 1.4;
  transition: border-color 0.2s ease, box-shadow 0.2s ease, background-color 0.2s ease;
}

.field__input::placeholder {
  color: hsl(var(--muted-foreground) / 0.8);
}

.field__input:hover {
  border-color: hsl(var(--foreground) / 0.25);
}

.field__input:focus {
  outline: none;
  border-color: hsl(var(--foreground));
  background: hsl(var(--background));
  box-shadow: 0 0 0 4px hsl(var(--foreground) / 0.08);
}

.field__input--area {
  min-height: 8.5rem;
  resize: vertical;
}

.field__error {
  min-height: 0;
  color: hsl(var(--destructive));
  font-size: 0.8125rem;
  font-weight: 500;
}

.field__error:empty {
  display: none;
}

.field.has-error .field__input {
  border-color: hsl(var(--destructive));
}

.field.has-error .field__input:focus {
  box-shadow: 0 0 0 4px hsl(var(--destructive) / 0.15);
}

/* Telegram profile card keeps Telegram's own colours on purpose */
.telegram-card {
  overflow: hidden;
  border-radius: var(--radius-xl);
  background: #fff;
  box-shadow: 0 0.75rem 1.75rem rgb(34 158 217 / 0.12);
}

.dark .telegram-card {
  background: #17212b;
  box-shadow: 0 0.75rem 1.75rem rgb(0 0 0 / 0.3);
}

.telegram-card__header {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  padding: 0.85rem 1.15rem;
  background: linear-gradient(135deg, #229ed9, #168acd);
  color: #fff;
  font-size: 0.9rem;
  font-weight: 700;
}

.telegram-card__brand {
  display: grid;
  place-items: center;
  width: 1.6rem;
  height: 1.6rem;
  border-radius: 50%;
  background: rgb(255 255 255 / 0.2);
}

.telegram-card__brand svg {
  width: 0.9rem;
  height: 0.9rem;
}

.telegram-card__body {
  display: flex;
  align-items: center;
  gap: 0.9rem;
  padding: 1.15rem;
}

.telegram-card__avatar {
  flex: none;
  color: transparent; /* hide alt text if the avatar service is unreachable */
  font-size: 0;
  width: 3.5rem;
  height: 3.5rem;
  border-radius: 50%;
  object-fit: cover;
  background: linear-gradient(135deg, #229ed9, #55b9e8);
}

.telegram-card__info {
  min-width: 0;
}

.telegram-card__info h3 {
  margin-bottom: 0.1rem;
  color: #17212b;
  font-size: 1rem;
}

.telegram-card__info p {
  color: #229ed9;
  font-size: 0.875rem;
}

.telegram-card__info span {
  display: block;
  overflow: hidden;
  color: #73808c;
  font-size: 0.8125rem;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.dark .telegram-card__info h3 {
  color: #f1f5f8;
}

.dark .telegram-card__info span {
  color: #9fb0bd;
}

.telegram-card__button {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  min-height: 3rem;
  margin: 0 1.15rem 1.15rem;
  padding: 0.75rem 1rem;
  border-radius: var(--radius-md);
  background: #229ed9;
  color: #fff;
  font-size: 0.9rem;
  font-weight: 700;
  text-decoration: none;
  transition: background-color 0.2s ease, transform 0.3s var(--ease-out);
}

.telegram-card__button svg {
  width: 1rem;
  height: 1rem;
  transition: transform 0.3s var(--ease-out);
}

.telegram-card__button:hover {
  background: #168acd;
}

.telegram-card__button:hover svg {
  transform: translateX(3px);
}

/* ---------- Toasts ---------- */
.toast-region {
  position: fixed;
  left: 50%;
  bottom: max(1rem, env(safe-area-inset-bottom));
  z-index: 100;
  display: grid;
  gap: 0.6rem;
  width: min(calc(100% - 2rem), 24rem);
  transform: translateX(-50%);
  pointer-events: none;
}

.toast {
  display: flex;
  align-items: flex-start;
  gap: 0.75rem;
  padding: 0.9rem 0.9rem 0.9rem 1rem;
  border: 1px solid hsl(var(--border));
  border-radius: var(--radius-lg);
  background: hsl(var(--background));
  box-shadow: 0 1.25rem 2.5rem -1rem hsl(0 0% 0% / 0.35);
  pointer-events: auto;
  opacity: 0;
  transform: translateY(1rem) scale(0.97);
  transition: opacity 0.35s ease, transform 0.45s var(--ease-out);
}

.toast.is-visible {
  opacity: 1;
  transform: none;
}

.toast.is-leaving {
  opacity: 0;
  transform: translateY(0.5rem) scale(0.98);
}

.toast__icon {
  display: grid;
  flex: none;
  place-items: center;
  width: 1.75rem;
  height: 1.75rem;
  border-radius: 50%;
  background: hsl(var(--foreground));
  color: hsl(var(--background));
}

.toast__icon svg {
  width: 0.95rem;
  height: 0.95rem;
}

.toast--success .toast__icon {
  background: hsl(var(--success));
  color: #fff;
}

.toast--error {
  border-color: hsl(var(--destructive) / 0.6);
}

.toast--error .toast__icon {
  background: hsl(var(--destructive));
  color: #fff;
}

.toast__body {
  flex: 1;
  min-width: 0;
}

.toast__title {
  font-size: 0.9375rem;
  font-weight: 700;
}

.toast__desc {
  color: hsl(var(--muted-foreground));
  font-size: 0.875rem;
  line-height: 1.45;
}

.toast__close {
  display: grid;
  flex: none;
  place-items: center;
  width: 2rem;
  height: 2rem;
  margin: -0.25rem -0.25rem 0 0;
  border: 0;
  border-radius: 50%;
  background: transparent;
  color: hsl(var(--muted-foreground));
  cursor: pointer;
}

.toast__close:hover {
  background: hsl(var(--accent));
  color: hsl(var(--foreground));
}

.toast__close svg {
  width: 0.9rem;
  height: 0.9rem;
}

/* ==========================================================================
   Overlays and shared effects
   ========================================================================== */

/* ---------- Intro (first page of a visit) ---------- */
.intro {
  display: none;
}

html.intro-on {
  overflow: hidden;
}

/* The state class on <html> is intro-on (not .intro, which is the overlay itself).
   Timed in CSS so it always leaves, even if the script is late. */
html.intro-on .intro {
  position: fixed;
  inset: 0;
  z-index: 300;
  display: grid;
  grid-template-rows: 1fr auto;
  padding: var(--gutter);
  padding-bottom: max(var(--gutter), env(safe-area-inset-bottom));
  background: hsl(var(--background));
  animation: intro-leave 0.95s var(--ease-in-out) 1.55s forwards;
}

.intro__center {
  display: grid;
  place-content: center;
  justify-items: center;
  gap: 1.1rem;
}

.intro__logo {
  width: 4.5rem;
  height: 4.5rem;
  border-radius: 1.2rem;
  box-shadow: 0 0 0 1px hsl(var(--border));
  animation: intro-logo 1s var(--ease-out) both;
}

.intro__name {
  color: hsl(var(--muted-foreground));
  font-weight: 600;
  animation: intro-fade 0.8s ease 0.3s both;
}

.intro__foot {
  display: flex;
  align-items: flex-end;
  gap: 1.5rem;
}

.intro__bar {
  flex: 1;
  height: 2px;
  margin-bottom: 0.9rem;
  overflow: hidden;
  background: hsl(var(--border));
}

.intro__bar span {
  display: block;
  height: 100%;
  background: hsl(var(--foreground));
  transform-origin: 0 50%;
  animation: intro-bar 1.5s cubic-bezier(0.3, 0.1, 0.2, 1) both;
}

.intro__count {
  min-width: 2.1ch;
  font-size: clamp(4.5rem, 17vw, 10rem);
  font-weight: 800;
  font-stretch: 125%;
  line-height: 0.8;
  letter-spacing: -0.05em;
  font-variant-numeric: tabular-nums;
  text-align: right;
}

@keyframes intro-leave {
  to {
    transform: translate3d(0, -100%, 0);
    visibility: hidden;
  }
}

@keyframes intro-logo {
  from {
    opacity: 0;
    transform: scale(0.6) rotate(-12deg);
  }
}

@keyframes intro-fade {
  from {
    opacity: 0;
    transform: translate3d(0, 0.6rem, 0);
  }
}

@keyframes intro-bar {
  from {
    transform: scaleX(0);
  }
}

/* ---------- Page transition curtain ---------- */
.curtain {
  position: fixed;
  inset: 0;
  z-index: 250;
  display: grid;
  place-items: center;
  background: hsl(var(--background));
  box-shadow: 0 0 0 2px hsl(var(--foreground));
  transform: translate3d(0, 102%, 0);
  visibility: hidden;
  pointer-events: none;
}

.curtain__logo {
  width: 3.5rem;
  height: 3.5rem;
  border-radius: 0.95rem;
  box-shadow: 0 0 0 1px hsl(var(--border));
}

html.pt-out .curtain {
  visibility: visible;
  animation: curtain-in 0.5s var(--ease-in-out) forwards;
}

html.pt-in .curtain {
  visibility: visible;
  transform: none;
  animation: curtain-out 0.8s var(--ease-in-out) 0.12s forwards;
}

@keyframes curtain-in {
  to {
    transform: translate3d(0, 0, 0);
  }
}

@keyframes curtain-out {
  to {
    transform: translate3d(0, -102%, 0);
    visibility: hidden;
  }
}

/* ---------- Spotlight: soft light that follows the pointer inside a card ---------- */
[data-spot] {
  position: relative;
}

@media (hover: hover) and (pointer: fine) {
  [data-spot]::before {
    content: "";
    position: absolute;
    inset: 0;
    border-radius: inherit;
    background: radial-gradient(
      16rem circle at var(--mx, 50%) var(--my, 50%),
      hsl(var(--foreground) / var(--spot-alpha, 0.06)),
      transparent 65%
    );
    opacity: 0;
    transition: opacity 0.35s ease;
    pointer-events: none;
  }

  [data-spot]:hover::before {
    opacity: 1;
  }
}

.dark [data-spot] {
  --spot-alpha: 0.1;
}

/* ---------- Tilt ---------- */
.motion [data-tilt] {
  transform: perspective(900px) rotateX(var(--tilt-x, 0deg)) rotateY(var(--tilt-y, 0deg));
  transition: transform 0.7s var(--ease-out), border-color 0.3s ease;
}

.motion [data-tilt].is-tilting {
  transition-duration: 0.15s, 0.3s;
}

/* ---------- Rolling numbers ---------- */
/* The stats grid draws its dividers with its own background: keep it clear until the tiles arrive. */
.motion .stats[data-reveal]:not(.is-done) {
  transition: background-color 0.8s ease 0.5s, border-color 0.8s ease 0.5s;
}

.motion .stats:not(.is-in) {
  border-color: transparent;
  background-color: transparent;
}

.odo {
  display: inline-flex;
}

.odo__col {
  display: block;
  height: 1em;
  overflow: hidden;
  line-height: 1;
}

.odo__strip {
  display: flex;
  flex-direction: column;
  transition: transform 2s var(--ease-out) calc(0.35s + var(--i, 0) * 0.13s);
}

.odo__strip span {
  display: block;
  height: 1em;
}

.odo.is-rolled .odo__strip {
  transform: translate3d(0, calc((10 + var(--digit)) * -5%), 0);
}

/* ---------- Project illustrations ---------- */
.art {
  position: absolute;
  top: 50%;
  right: 1.5rem;
  z-index: 1;
  transform: translateY(-50%);
  pointer-events: none;
}

/* Imora AI: signal rings */
.art--rings {
  width: 7rem;
  height: 7rem;
}

.art--rings i {
  position: absolute;
  inset: 0;
  border: 1.5px solid currentColor;
  border-radius: 50%;
  opacity: 0.35;
}

.art--rings i:nth-child(2) {
  inset: 18%;
}

.art--rings i:nth-child(3) {
  inset: 36%;
  background: currentColor;
  opacity: 0.2;
}

/* Yosh Kitobxon: keys being pressed */
.art--keys {
  display: flex;
  gap: 0.35rem;
}

.art--keys i {
  display: grid;
  place-items: center;
  width: 2rem;
  height: 2.15rem;
  border: 1.5px solid rgb(255 255 255 / 0.55);
  border-bottom-width: 4px;
  border-radius: 0.5rem;
  font-family: var(--font-mono);
  font-size: 0.85rem;
  font-style: normal;
  font-weight: 600;
}

/* Hammasi birda: endless feed */
.art--feed {
  width: 9.5rem;
  height: 7.5rem;
  overflow: hidden;
  -webkit-mask-image: linear-gradient(transparent, #000 22%, #000 78%, transparent);
  mask-image: linear-gradient(transparent, #000 22%, #000 78%, transparent);
}

.art--feed ul {
  display: grid;
  gap: 0.5rem;
  padding-bottom: 0.5rem;
}

.art--feed li {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.5rem 0.7rem;
  border: 1px solid rgb(255 255 255 / 0.3);
  border-radius: 0.7rem;
  background: rgb(255 255 255 / 0.12);
  font-size: 0.78rem;
  font-weight: 600;
  white-space: nowrap;
}

.art--feed li::before {
  content: "";
  width: 0.45rem;
  height: 0.45rem;
  border-radius: 50%;
  background: currentColor;
}

@media (prefers-reduced-motion: no-preference) {
  .art--rings i {
    animation: ring 3.2s ease-out infinite;
  }

  .art--rings i:nth-child(2) {
    animation-delay: 0.5s;
  }

  .art--rings i:nth-child(3) {
    animation: ring-core 3.2s ease-in-out infinite;
  }

  .art--keys i {
    animation: key 2.5s ease-in-out infinite;
    animation-delay: calc(var(--k, 0) * 0.22s);
  }

  .art--keys i:nth-child(2) { --k: 1; }
  .art--keys i:nth-child(3) { --k: 2; }
  .art--keys i:nth-child(4) { --k: 3; }
  .art--keys i:nth-child(5) { --k: 4; }

  .art--feed ul {
    animation: feed 9s linear infinite;
  }
}

@keyframes ring {
  0% {
    opacity: 0.6;
    transform: scale(0.55);
  }

  100% {
    opacity: 0;
    transform: scale(1.45);
  }
}

@keyframes ring-core {
  50% {
    opacity: 0.45;
    transform: scale(1.18);
  }
}

@keyframes key {
  0%,
  16%,
  100% {
    background: transparent;
    transform: none;
  }

  8% {
    background: rgb(255 255 255 / 0.3);
    transform: translateY(3px);
  }
}

@keyframes feed {
  to {
    transform: translate3d(0, -50%, 0);
  }
}

/* ---------- Footer wordmark ---------- */
.footer__mark {
  margin-bottom: 1.5rem;
  overflow: hidden;
  color: transparent;
  font-size: clamp(2rem, 10.2vw, 11rem);
  font-weight: 800;
  font-stretch: 125%;
  line-height: 0.95;
  letter-spacing: -0.045em;
  white-space: nowrap;
  -webkit-text-stroke: 1px hsl(var(--foreground) / 0.5);
  user-select: none;
}

/* ---------- Contact form: sent state ---------- */
.btn.is-sent .btn__icon {
  animation: fly 0.9s var(--ease-in-out) forwards;
}

@keyframes fly {
  25% {
    transform: translate(-0.4rem, 0.4rem) rotate(-12deg);
  }

  100% {
    opacity: 0;
    transform: translate(9rem, -6rem) rotate(18deg) scale(0.6);
  }
}

/* ==========================================================================
   Motion
   Hidden start states exist only under html.motion, which is set before
   first paint when JS runs and the visitor has not asked for reduced motion.
   ========================================================================== */

/* Split text: each word is a mask, each glyph rises through it */
.w {
  display: inline-block;
  vertical-align: top;
  white-space: nowrap;
}

.c {
  display: inline-block;
}

.motion [data-split] .w {
  overflow: hidden;
  padding: 0.12em 0.04em 0.16em;
  margin: -0.12em -0.04em -0.16em;
}

.motion [data-split] .c {
  transition: transform 1s var(--ease-out) calc(var(--delay, 0s) + var(--i, 0) * var(--stagger, 55ms));
}

.motion [data-split]:not(.is-in) .c {
  transform: translate3d(0, 112%, 0);
}

.motion .hero__title,
.motion .page-title {
  --stagger: 32ms;
}

.motion .hero__title .c,
.motion .page-title .c {
  transform-origin: 0 100%;
  transition-duration: 1.1s;
}

.motion .hero__title:not(.is-in) .c,
.motion .page-title:not(.is-in) .c {
  transform: translate3d(0, 115%, 0) rotate(8deg);
}

/* Single elements */
.motion [data-reveal]:not(.is-done) {
  transition:
    opacity 0.9s var(--ease-out) var(--delay, 0s),
    transform 1s var(--ease-out) var(--delay, 0s),
    filter 0.9s var(--ease-out) var(--delay, 0s),
    clip-path 1.2s var(--ease-in-out) var(--delay, 0s);
}

.motion [data-reveal="fade"]:not(.is-in) {
  opacity: 0;
  transform: translate3d(0, 1.5rem, 0);
}

.motion [data-reveal="slide"]:not(.is-in) {
  opacity: 0;
  transform: translate3d(-1.75rem, 0, 0);
}

.motion [data-reveal="blur"]:not(.is-in) {
  opacity: 0;
  filter: blur(12px);
  transform: translate3d(0, 1rem, 0) scale(0.97);
}

.motion [data-reveal="draw"]:not(.is-in) {
  transform: scaleX(0);
}

/* Project visuals: colour panel wipes up, glyph settles after */
.motion [data-reveal="wipe"]:not(.is-in) {
  clip-path: inset(100% 0 0 0);
}

.motion [data-reveal="wipe"] > * {
  transition: transform 1.1s var(--ease-out) 0.45s, opacity 0.8s ease 0.45s;
}

.motion [data-reveal="wipe"]:not(.is-in) > * {
  opacity: 0;
  transform: translate3d(0, 1.5rem, 0) scale(0.85);
}

/* Staggered children */
.motion [data-reveal="stagger"]:not(.is-done) > * {
  transition:
    opacity 0.8s var(--ease-out) calc(var(--delay, 0s) + var(--i, 0) * 90ms),
    transform 0.9s var(--ease-out) calc(var(--delay, 0s) + var(--i, 0) * 90ms);
}

.motion [data-reveal="stagger"]:not(.is-in) > * {
  opacity: 0;
  transform: translate3d(0, 1.25rem, 0);
}

/* Lists: items slide in from the start edge */
.motion [data-reveal="list"]:not(.is-done) > * {
  transition:
    opacity 0.6s var(--ease-out) calc(0.15s + var(--i, 0) * 70ms),
    transform 0.7s var(--ease-out) calc(0.15s + var(--i, 0) * 70ms);
}

.motion [data-reveal="list"]:not(.is-in) > * {
  opacity: 0;
  transform: translate3d(-0.85rem, 0, 0);
}

/* Device: the phone swings in from the side */
.motion [data-reveal="device"]:not(.is-done) {
  transition:
    opacity 0.9s ease var(--delay, 0s),
    transform 1.7s var(--ease-out) var(--delay, 0s);
}

.motion [data-reveal="device"]:not(.is-in) {
  opacity: 0;
  transform: translate3d(0, 5rem, -12rem) rotateY(-58deg) rotateX(20deg) rotateZ(9deg) scale(0.85);
}

/* Card: rises and settles, then its line art draws itself */
.motion [data-reveal="card"]:not(.is-in) {
  opacity: 0;
  transform: translate3d(0, 4.5rem, 0) scale(0.95);
}

.motion .draw {
  stroke-dasharray: 1;
  stroke-dashoffset: 0;
  transition: stroke-dashoffset 1.5s var(--ease-in-out) calc(0.3s + var(--p, 0) * 75ms);
}

.motion [data-reveal="card"]:not(.is-in) .draw {
  stroke-dashoffset: 1;
}

/* Pop: spins and springs into place */
.motion [data-reveal="pop"]:not(.is-done) {
  transition: opacity 0.5s ease, transform 1.2s cubic-bezier(0.2, 1.35, 0.3, 1), translate 0.6s var(--ease-out);
}

.motion [data-reveal="pop"]:not(.is-in) {
  opacity: 0;
  transform: scale(0.3) rotate(-70deg);
}

/* Wave: tile contents resolve diagonally across the grid */
.motion [data-reveal="wave"]:not(.is-done) > * > * {
  transition:
    opacity 0.7s var(--ease-out) calc(var(--d, 0) * 80ms),
    transform 0.9s var(--ease-out) calc(var(--d, 0) * 80ms),
    filter 0.7s var(--ease-out) calc(var(--d, 0) * 80ms);
}

.motion [data-reveal="wave"]:not(.is-in) > * > * {
  opacity: 0;
  filter: blur(8px);
  transform: translate3d(0, 0.75rem, 0) scale(0.92);
}

/* Timeline dots light up as the line reaches them */
.motion [data-timeline] .timeline__dot {
  background: hsl(var(--surface));
  transform: scale(0.85);
}

.motion [data-timeline] .timeline__item.is-active .timeline__dot {
  background: hsl(var(--foreground));
  transform: scale(1);
}

.motion [data-timeline] .timeline__progress {
  transform: scaleY(0);
}

/* Mobile menu links rise when the sheet opens */
@media (prefers-reduced-motion: no-preference) {
  .mobile-menu__link,
  .mobile-menu__footer {
    transform: translate3d(0, 110%, 0);
    transition: transform 0.7s var(--ease-out);
  }

  .mobile-menu__footer {
    opacity: 0;
    transform: translate3d(0, 1rem, 0);
    transition: transform 0.7s var(--ease-out), opacity 0.5s ease;
  }

  .mobile-menu.is-open .mobile-menu__link,
  .mobile-menu.is-open .mobile-menu__footer {
    opacity: 1;
    transform: none;
  }

  .mobile-menu.is-open li:nth-child(1) .mobile-menu__link { transition-delay: 0.18s; }
  .mobile-menu.is-open li:nth-child(2) .mobile-menu__link { transition-delay: 0.24s; }
  .mobile-menu.is-open li:nth-child(3) .mobile-menu__link { transition-delay: 0.3s; }
  .mobile-menu.is-open .mobile-menu__footer { transition-delay: 0.38s; }
}

/* Theme switch: circular reveal from the toggle (View Transitions API) */
html[data-vt="theme"]::view-transition-old(root),
html[data-vt="theme"]::view-transition-new(root) {
  animation: none;
  mix-blend-mode: normal;
}

html[data-vt="theme"]::view-transition-old(root) {
  z-index: 1;
}

html[data-vt="theme"]::view-transition-new(root) {
  z-index: 2;
}

/* Ambient float of the hero scene */
@media (prefers-reduced-motion: no-preference) {
  .scene__item--phone {
    animation: floaty 7s ease-in-out infinite;
  }

  .scene__item--code {
    animation: floaty 7s ease-in-out -3.5s infinite;
  }
}

@keyframes floaty {
  50% {
    translate: 0 -0.6rem;
  }
}

@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;
    transition-delay: 0s !important;
  }
}

/* ==========================================================================
   Responsive
   ========================================================================== */

@media (max-width: 559.98px) {
  .hero__badge {
    font-size: 0.8125rem;
  }

  .tech:last-child {
    grid-column: 1 / -1;
  }

  .tech {
    min-height: 8.5rem;
  }

  .hero__actions .btn {
    flex: 1 1 auto;
  }
}

@media (min-width: 560px) {
  .tech-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .education {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}

@media (min-width: 640px) {
  .nav__phone {
    display: inline-flex;
  }

  .project__sections {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}

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

  .nav__links {
    display: flex;
  }

  .menu-toggle,
  .mobile-menu {
    display: none;
  }

  /* Scene: phone on the right, code card overlapping its lower-left corner */
  .scene__stage {
    --u: 1rem;
    --u: min(1rem, 2.777cqw, 1.86svh);
    display: block;
    width: calc(var(--u) * 36);
    height: calc(var(--u) * 36);
    margin-inline: auto;
  }

  .scene__item {
    position: absolute;
  }

  .scene__item--phone {
    top: 0;
    right: 0;
  }

  .scene__item--code {
    bottom: calc(var(--u) * 1.25);
    left: 0;
    width: calc(var(--u) * 19.75);
    max-width: none;
    margin: 0;
    transform: translateZ(4rem);
  }

  .scene .code-card {
    font-size: calc(var(--u) * 0.7);
    transform: rotateY(7deg) rotateX(2deg);
  }

  .service {
    grid-template-columns: minmax(0, 1.25fr) minmax(0, 1fr);
    gap: 2.5rem;
    min-height: 17.5rem;
  }

  .service__art {
    justify-self: end;
    width: min(100%, 21rem);
  }

  .skill-groups {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .project {
    grid-template-columns: minmax(0, 1.65fr) minmax(0, 1fr);
  }

  .project__visual {
    order: 2;
  }

  /* The visual travels with the reader down a tall project card */
  .project__visual-inner {
    position: sticky;
    top: calc(var(--header-h) + 1.5rem);
    height: min(21rem, 100%);
  }

  .art {
    top: 50%;
    right: auto;
    left: 50%;
    transform: translate(-50%, -50%) scale(1.35);
  }

  .footer__top {
    grid-template-columns: 1.6fr 1fr 1fr;
  }
}

@media (min-width: 900px) {
  .section-head {
    grid-template-columns: minmax(0, 1fr) auto;
    align-items: end;
  }

  .about {
    grid-template-columns: minmax(0, 1.25fr) minmax(0, 1fr);
  }

  .contact__grid {
    grid-template-columns: minmax(0, 1fr) minmax(0, 1.1fr);
  }

  .toast-region {
    left: auto;
    right: 1.5rem;
    bottom: 1.5rem;
    transform: none;
  }
}

@media (min-width: 900px) {
  .cta__inner {
    grid-template-columns: minmax(0, 1fr) auto;
  }

  .badge {
    display: grid;
  }
}

@media (min-width: 1000px) {
  .hero__inner {
    grid-template-columns: minmax(0, 1.04fr) minmax(0, 0.96fr);
    gap: clamp(2rem, 3.5vw, 3rem);
  }

  .hero__title {
    font-size: clamp(4rem, 6.3vw, 8rem);
  }

  .scene__stage {
    margin-inline: auto 0;
  }
}

@media (max-width: 380px) {
  .btn--lg {
    padding-inline: 1.25rem;
  }

  .method__value {
    font-size: 0.9375rem;
  }
}
