/* ==========================================================================
   Ali Pahlevani, portfolio
   Palette: Amethyst Night — deep violet ground, lilac text, amethyst accent,
   gold spark for data. Type: Newsreader (display), Hanken Grotesk (text).
   ========================================================================== */

:root {
  --base: #17102e;
  --surface: #1e1438;
  --surface-2: #221641;
  --text: #f2ecff;
  --muted: #b9aedd;
  --accent: #a277ff;
  --accent-bright: #b795ff;
  --spark: #ffc24b;

  --rule: color-mix(in srgb, var(--text) 12%, transparent);
  --rule-strong: color-mix(in srgb, var(--text) 22%, transparent);
  --veil: color-mix(in srgb, var(--base) 92%, transparent);
  --accent-soft: color-mix(in srgb, var(--accent) 16%, transparent);
  --shadow: 0 18px 40px -24px rgb(0 0 0 / 0.9);

  --serif: "Newsreader", Georgia, "Times New Roman", serif;
  --sans: "Hanken Grotesk", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;

  --focus: var(--accent);
  --header-h: 72px;
  --gutter: clamp(20px, 5vw, 48px);
  --ease-out: cubic-bezier(0.2, 0.7, 0.2, 1);
}

/* ---------- Base ---------- */

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

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

body {
  margin: 0;
  background: transparent;
  color: var(--text);
  font-family: var(--sans);
  font-size: 1.0625rem;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

body.menu-open { overflow: hidden; }

[hidden] { display: none !important; }

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

a { color: inherit; }

h1, h2, h3 { text-wrap: balance; }
p, li { text-wrap: pretty; }

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

.icon {
  width: 1.1em;
  height: 1.1em;
  flex: none;
}

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

.skip-link {
  position: absolute;
  left: 16px;
  top: -80px;
  z-index: 200;
  padding: 10px 16px;
  background: var(--accent);
  color: var(--base);
  font-weight: 600;
  border-radius: 4px;
  text-decoration: none;
}
.skip-link:focus { top: 16px; }

.container {
  width: 100%;
  max-width: 1200px;
  margin-inline: auto;
  padding-inline: var(--gutter);
}

/* Ambient lidar-scan layer, painted behind everything by script.js */
.scan-layer {
  position: fixed;
  inset: 0;
  z-index: -1;
  pointer-events: none;
}

/* ---------- Buttons and links ---------- */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  min-height: 48px;
  padding: 0 22px;
  border: 1px solid transparent;
  border-radius: 4px;
  font: 500 1rem/1 var(--sans);
  text-decoration: none;
  cursor: pointer;
  transition: background-color 180ms ease, border-color 180ms ease, color 180ms ease, box-shadow 180ms ease;
}

.btn--accent {
  background: var(--accent);
  color: var(--base);
}
.btn--accent:hover {
  background: var(--accent-bright);
  box-shadow: 0 0 0 6px var(--accent-soft);
}

.btn--ghost {
  color: var(--text);
  border-color: var(--rule-strong);
}
.btn--ghost:hover {
  border-color: var(--accent);
  background: var(--accent-soft);
}

.btn--outline {
  color: inherit;
  border-color: color-mix(in srgb, currentColor 40%, transparent);
}
.btn--outline:hover { border-color: currentColor; }

.btn--small {
  min-height: 44px;
  padding: 0 16px;
  font-size: 0.9375rem;
}

.text-link {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 44px;
  font-weight: 500;
  text-decoration: underline;
  text-decoration-color: var(--accent);
  text-decoration-thickness: 1px;
  text-underline-offset: 5px;
}
.text-link:hover { text-decoration-thickness: 2px; }

/* ---------- Header ---------- */

.site-header {
  position: fixed;
  inset: 0 0 auto;
  z-index: 50;
  color: var(--text);
  transition: background-color 250ms ease, box-shadow 250ms ease;
}

.site-header.is-solid {
  background: color-mix(in srgb, var(--base) 88%, transparent);
  box-shadow: 0 1px 0 var(--rule);
  -webkit-backdrop-filter: blur(10px);
  backdrop-filter: blur(10px);
}

.site-header__inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  height: var(--header-h);
  max-width: 1200px;
  margin-inline: auto;
  padding-inline: var(--gutter);
}

.site-header__progress {
  height: 2px;
  background: linear-gradient(90deg, var(--accent), var(--spark));
  transform: scaleX(var(--progress, 0));
  transform-origin: left;
  opacity: 0;
  transition: opacity 250ms ease;
}
.site-header.is-solid .site-header__progress { opacity: 1; }

.wordmark {
  position: relative;
  z-index: 2;
  font-family: var(--serif);
  font-size: 1.375rem;
  font-weight: 500;
  letter-spacing: -0.01em;
  text-decoration: none;
  white-space: nowrap;
}

.site-nav {
  display: flex;
  align-items: center;
  gap: 20px;
}

.site-nav__list {
  display: flex;
  gap: 4px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.site-nav__list a {
  position: relative;
  display: inline-flex;
  align-items: center;
  min-height: 44px;
  padding: 0 12px;
  font-size: 0.9375rem;
  font-weight: 500;
  text-decoration: none;
}

.site-nav__list a::after {
  content: "";
  position: absolute;
  left: 12px;
  right: 12px;
  bottom: 8px;
  height: 2px;
  background: var(--accent);
  transform: scaleX(0);
  transform-origin: left;
  transition: transform 220ms var(--ease-out);
}

.site-nav__list a:hover::after,
.site-nav__list a[aria-current="true"]::after { transform: scaleX(1); }

.menu-toggle {
  position: relative;
  z-index: 2;
  display: none;
  align-items: center;
  justify-content: center;
  width: 44px;
  height: 44px;
  padding: 0;
  border: 0;
  border-radius: 4px;
  background: transparent;
  color: inherit;
  cursor: pointer;
}
.menu-toggle .icon { width: 24px; height: 24px; }

@media (max-width: 880px) {
  .menu-toggle { display: inline-flex; }

  .site-nav {
    position: fixed;
    inset: 0;
    display: none;
    flex-direction: column;
    align-items: flex-start;
    justify-content: center;
    gap: 40px;
    padding: 96px var(--gutter) 48px;
    background: var(--base);
  }

  .site-nav.is-open { display: flex; }
  .site-nav__list { flex-direction: column; gap: 4px; }

  .site-nav__list a {
    padding: 4px 0;
    font-family: var(--serif);
    font-size: 2.25rem;
    font-weight: 400;
  }
  .site-nav__list a::after { left: 0; right: 0; bottom: 6px; }

  /* backdrop-filter would trap the fixed menu inside the header */
  .site-header.menu-is-open {
    background: transparent;
    box-shadow: none;
    -webkit-backdrop-filter: none;
    backdrop-filter: none;
  }
}

/* ---------- Journey trail ---------- */

.journey {
  position: fixed;
  left: 0;
  top: 0;
  width: 72px;
  height: 100vh;
  z-index: 20;
  pointer-events: none;
}
.journey svg { width: 100%; height: 100%; overflow: visible; }
.journey__line { fill: none; stroke: var(--rule); stroke-width: 1.5; }
.journey__progress { fill: none; stroke: var(--accent); stroke-width: 1.5; }
.journey__stop {
  fill: var(--base);
  stroke: var(--rule-strong);
  stroke-width: 1.5;
  pointer-events: auto;
  cursor: pointer;
  transition: fill 250ms ease, stroke 250ms ease;
}
.journey__stop:hover { stroke: var(--accent); }
.journey__stop.is-passed { fill: var(--accent); stroke: var(--accent); }
.journey__robot { fill: var(--accent); }

.journey__label {
  fill: var(--muted);
  font: 500 10px var(--sans);
  opacity: 0;
  transition: opacity 200ms ease;
}
.journey__stop:hover + .journey__label,
.journey__label.is-current { opacity: 1; }

@media (max-width: 1099px) { .journey { display: none; } }

/* ---------- Hero ---------- */

.hero {
  position: relative;
  display: flex;
  align-items: center;
  min-height: 100vh;
  min-height: 100svh;
  padding-block: calc(var(--header-h) + 32px) 180px;
  overflow: hidden;
  background: var(--base);
  isolation: isolate;
}

.hero__map {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  z-index: -2;
  cursor: crosshair;
  touch-action: pan-y;
}

.hero__veil {
  position: absolute;
  inset: 0;
  z-index: -1;
  pointer-events: none;
  background: linear-gradient(90deg, var(--base) 0%, var(--veil) 30%, transparent 56%);
}

.hero__content { pointer-events: none; }
.hero__content > * { pointer-events: auto; }

.hero__kicker {
  margin: 0;
  max-width: max-content;
  color: var(--muted);
  font-size: 1rem;
}

.hero__title {
  max-width: max-content;
  margin: 0.15em 0 0.28em;
  font-family: var(--serif);
  font-size: clamp(3.5rem, 9vw, 7.5rem);
  font-weight: 350;
  font-variation-settings: "opsz" 72;
  line-height: 0.95;
  letter-spacing: -0.025em;
}

.hero__lead {
  max-width: 33rem;
  margin: 0;
  color: var(--muted);
  font-size: clamp(1.125rem, 1.6vw, 1.3125rem);
  line-height: 1.55;
}

.hero__actions {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  max-width: max-content;
  margin-top: 2.25rem;
}

.hero__hud {
  position: absolute;
  right: var(--gutter);
  bottom: 28px;
  z-index: 1;
  width: min(340px, calc(100% - 2 * var(--gutter)));
  padding: 14px 16px 12px;
  border: 1px solid var(--rule);
  border-radius: 6px;
  background: color-mix(in srgb, var(--base) 74%, transparent);
  color: var(--muted);
  font-size: 0.8125rem;
  line-height: 1.4;
  -webkit-backdrop-filter: blur(6px);
  backdrop-filter: blur(6px);
}

.hud__hint { margin: 0 0 12px; color: var(--text); font-size: 0.875rem; }

.hud__readout {
  display: grid;
  grid-template-columns: repeat(3, auto);
  justify-content: space-between;
  gap: 4px 16px;
  margin: 0;
  padding: 10px 0;
  border-block: 1px solid var(--rule);
}

.hud__readout dt { font-size: 0.75rem; }

.hud__readout dd {
  margin: 0;
  color: var(--text);
  font-size: 0.9375rem;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.hud__mode { margin: 10px 0 0; color: var(--spark); }

.hud__toggle {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 44px;
  margin-top: 6px;
  margin-left: -10px;
  padding: 0 12px 0 10px;
  border: 0;
  border-radius: 4px;
  background: transparent;
  color: var(--text);
  font: 500 0.875rem var(--sans);
  cursor: pointer;
}
.hud__toggle:hover { background: var(--accent-soft); }
.hud__toggle .icon { width: 14px; height: 14px; }

@media (max-width: 880px) {
  .hero { align-items: flex-start; padding-bottom: 400px; }
  .hero__veil { background: linear-gradient(180deg, var(--base) 0%, var(--veil) 42%, transparent 64%); }
  .hero__hud { left: var(--gutter); right: var(--gutter); bottom: 16px; width: auto; }
  .hud__readout { display: none; }
  .hud__hint { margin-bottom: 4px; }
}

@media (prefers-reduced-motion: no-preference) {
  .hero__kicker,
  .hero__title,
  .hero__lead,
  .hero__actions { animation: rise 800ms var(--ease-out) both; }

  .hero__title { animation-delay: 90ms; }
  .hero__lead { animation-delay: 200ms; }
  .hero__actions { animation-delay: 320ms; }
  .hero__hud { animation: fade 700ms ease 700ms both; }
}

@keyframes rise {
  from { opacity: 0; transform: translateY(18px); }
  to { opacity: 1; transform: none; }
}

@keyframes fade {
  from { opacity: 0; }
  to { opacity: 1; }
}

/* ---------- Sections ---------- */

.section {
  position: relative;
  padding-block: clamp(56px, 6.5vw, 96px);
}

.section--alt { background: color-mix(in srgb, var(--surface) 86%, transparent); }

.section-title {
  position: relative;
  margin: 0 0 clamp(32px, 4vw, 56px);
  font-family: var(--serif);
  font-size: clamp(2.5rem, 5vw, 3.75rem);
  font-weight: 400;
  font-variation-settings: "opsz" 60;
  line-height: 1.05;
  letter-spacing: -0.02em;
}

/* ---------- Reveals ---------- */

.js [data-reveal] {
  opacity: 0;
  transform: translateY(12px);
  transition: opacity 600ms var(--ease-out), transform 600ms var(--ease-out);
  transition-delay: calc(var(--reveal-i, 0) * 70ms);
}
.js [data-reveal].is-in { opacity: 1; transform: none; }

/* Headings wipe in behind a lidar-style sweep line */
.js [data-reveal="sweep"] {
  opacity: 1;
  transform: none;
  clip-path: inset(0 100% 0 0);
  transition: clip-path 800ms var(--ease-out);
}
.js [data-reveal="sweep"].is-in { clip-path: inset(0 0 0 0); }

.js [data-reveal="sweep"]::after {
  content: "";
  position: absolute;
  top: 0.1em;
  bottom: 0.15em;
  width: 2px;
  background: var(--accent);
  opacity: 0;
}
.js [data-reveal="sweep"].is-in::after { animation: sweep-line 800ms var(--ease-out); }

@keyframes sweep-line {
  from { left: 0; opacity: 1; }
  to { left: 100%; opacity: 0; }
}

/* ---------- About ---------- */

.about {
  display: grid;
  grid-template-columns: minmax(0, 4fr) minmax(0, 7fr);
  gap: clamp(32px, 6vw, 96px);
  align-items: start;
}

.about__portrait {
  position: relative;
  margin: 0;
  max-width: 360px;
  border-radius: 8px;
  overflow: hidden;
  border: 1px solid var(--rule);
  box-shadow: var(--shadow);
}

.about__portrait img { width: 100%; }

/* settles the light photo into the violet page */
.about__portrait::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(190deg, transparent 45%, color-mix(in srgb, var(--base) 55%, transparent));
  mix-blend-mode: multiply;
  pointer-events: none;
}

.prose { max-width: 38rem; }
.prose p { margin: 0 0 1.1em; color: var(--muted); }

.prose .prose__lead {
  color: var(--text);
  font-family: var(--serif);
  font-size: clamp(1.375rem, 2.2vw, 1.625rem);
  line-height: 1.38;
}

.facts {
  max-width: 38rem;
  margin: 40px 0 0;
  border-top: 1px solid var(--rule);
}

.facts__row {
  display: grid;
  grid-template-columns: 9rem 1fr;
  gap: 16px;
  padding: 14px 0;
  border-bottom: 1px solid var(--rule);
}

.facts__row dt { color: var(--muted); font-size: 0.9375rem; }
.facts__row dd { margin: 0; }
.facts__row .icon { margin-right: 8px; vertical-align: -0.15em; color: var(--accent); }
[data-count] { font-variant-numeric: tabular-nums; font-weight: 600; color: var(--spark); }

@media (max-width: 760px) {
  .about { grid-template-columns: 1fr; }
  .about__portrait { max-width: 200px; }
  .facts__row { grid-template-columns: 1fr; gap: 2px; }
}

/* ---------- Experience ---------- */

.experience {
  display: grid;
  grid-template-columns: minmax(0, 8fr) minmax(0, 4fr);
  gap: clamp(40px, 6vw, 96px);
}

.timeline {
  position: relative;
  margin: 0;
  padding: 0;
  list-style: none;
}

/* rail that draws itself as you scroll */
.timeline::before {
  content: "";
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  width: 1px;
  background: var(--accent);
  transform: scaleY(var(--draw, 0));
  transform-origin: top;
  opacity: 0.5;
}

.role {
  position: relative;
  display: grid;
  grid-template-columns: 10rem 1fr;
  gap: 32px;
  padding: 32px 0 32px 28px;
  border-top: 1px solid var(--rule);
}
.role:first-child { padding-top: 0; border-top: 0; }

.role::before {
  content: "";
  position: absolute;
  left: -4px;
  top: 40px;
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: var(--base);
  border: 1.5px solid var(--accent);
}
.role:first-child::before { top: 8px; }
.role.is-in::before { animation: ping 900ms var(--ease-out); }

@keyframes ping {
  0% { box-shadow: 0 0 0 0 var(--accent-soft); }
  70% { box-shadow: 0 0 0 12px transparent; }
  100% { box-shadow: 0 0 0 0 transparent; }
}

.role__dates {
  margin: 0;
  padding-top: 0.35em;
  color: var(--muted);
  font-size: 0.9375rem;
  font-variant-numeric: tabular-nums;
}
.role:first-child .role__dates { color: var(--spark); font-weight: 500; }

.role__title {
  margin: 0;
  font-family: var(--serif);
  font-size: 1.5rem;
  font-weight: 500;
  line-height: 1.25;
}

.role__org { margin: 0.2rem 0 1rem; font-weight: 500; }

.role__type {
  display: inline-block;
  margin-left: 0.5em;
  padding-left: 0.6em;
  border-left: 1px solid var(--rule-strong);
  color: var(--muted);
  font-weight: 400;
}

.role__points {
  margin: 0;
  padding-left: 1.1em;
  color: var(--muted);
  max-width: 60ch;
}
.role__points li { margin: 0.4em 0; padding-left: 0.2em; }
.role__points li::marker { color: var(--accent); }

.experience__aside {
  align-self: start;
  position: sticky;
  top: calc(var(--header-h) + 32px);
  padding-top: calc(clamp(2.5rem, 5vw, 3.75rem) * 1.05 + clamp(32px, 4vw, 56px));
}

.aside-block + .aside-block { margin-top: 40px; }

.aside-block__title {
  margin: 0 0 14px;
  padding-bottom: 10px;
  border-bottom: 1px solid var(--rule);
  font-size: 0.9375rem;
  font-weight: 600;
}

.aside-list { margin: 0; padding: 0; list-style: none; }
.aside-list li + li { margin-top: 16px; }
.aside-list strong { display: block; font-weight: 600; line-height: 1.4; }
.aside-list span { display: block; color: var(--muted); font-size: 0.9375rem; line-height: 1.5; }

.aside-list a {
  text-decoration: underline;
  text-decoration-color: var(--accent);
  text-decoration-thickness: 1px;
  text-underline-offset: 4px;
}
.aside-list a:hover { text-decoration-thickness: 2px; }

@media (max-width: 980px) {
  .experience { grid-template-columns: 1fr; }
  .experience__aside { position: static; padding-top: 0; }
}

@media (max-width: 640px) {
  .role { grid-template-columns: 1fr; gap: 8px; }
  .role__dates { padding-top: 0; }
  .role__type { display: block; margin-left: 0; padding-left: 0; border-left: 0; }
}

/* ---------- Projects ---------- */

.projects__intro { max-width: 40rem; margin: -16px 0 0; color: var(--muted); }

.filters {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 28px;
}

.filter {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 44px;
  padding: 0 16px;
  border: 1px solid var(--rule-strong);
  border-radius: 999px;
  background: transparent;
  color: var(--text);
  font: 500 0.9375rem var(--sans);
  cursor: pointer;
  transition: background-color 180ms ease, color 180ms ease, border-color 180ms ease;
}
.filter:hover { border-color: var(--accent); }

.filter[aria-pressed="true"] {
  background: var(--accent);
  border-color: var(--accent);
  color: var(--base);
}

.filter__count { color: var(--muted); font-variant-numeric: tabular-nums; }
.filter[aria-pressed="true"] .filter__count { color: color-mix(in srgb, var(--base) 70%, transparent); }

.projects {
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  gap: 56px clamp(24px, 3vw, 40px);
  margin-top: 56px;
}

.project { grid-column: span 2; }
.project.is-leaving,
.project.is-entering { opacity: 0; transform: translateY(10px); }

.project--feature {
  grid-column: 1 / -1;
  display: grid;
  grid-template-columns: minmax(0, 7fr) minmax(0, 5fr);
  gap: clamp(24px, 4vw, 64px);
  align-items: center;
}
.project--flip .project__media { order: 2; }

.project__media {
  position: relative;
  transform: perspective(900px) rotateX(var(--rx, 0deg)) rotateY(var(--ry, 0deg));
  transform-style: preserve-3d;
  transition: transform 220ms ease;
}
.project__media.is-empty { display: none; }

.project__body { padding-top: 20px; }
.project--feature .project__body { padding-top: 0; }
.project__media.is-empty + .project__body { padding-top: 0; }

.project__title {
  margin: 0 0 0.5rem;
  font-family: var(--serif);
  font-size: 1.5rem;
  font-weight: 500;
  line-height: 1.25;
}
.project--feature .project__title {
  font-size: clamp(1.75rem, 3vw, 2.375rem);
  font-weight: 400;
  letter-spacing: -0.01em;
}

.project__title a {
  text-decoration: underline;
  text-decoration-color: transparent;
  text-decoration-thickness: 1px;
  text-underline-offset: 5px;
  transition: text-decoration-color 180ms ease, color 180ms ease;
}
.project__title a:hover,
.project:hover .project__title a { text-decoration-color: var(--accent); }

.badge {
  display: inline-block;
  margin-left: 0.4em;
  padding: 2px 9px;
  border: 1px solid var(--rule-strong);
  border-radius: 999px;
  color: var(--muted);
  font: 500 0.75rem/1.6 var(--sans);
  vertical-align: 0.25em;
  white-space: nowrap;
}
.badge--org { border-color: var(--accent-soft); color: var(--accent); }

.project__desc { margin: 0; color: var(--muted); font-size: 1rem; }

.project__more { margin-top: 14px; }

.project__more summary {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 36px;
  color: var(--text);
  font-size: 0.9375rem;
  font-weight: 500;
  cursor: pointer;
  list-style: none;
}
.project__more summary::-webkit-details-marker { display: none; }

.project__more summary::before {
  content: "";
  width: 7px;
  height: 7px;
  border-right: 1.5px solid var(--accent);
  border-bottom: 1.5px solid var(--accent);
  transform: rotate(-45deg);
  transition: transform 200ms var(--ease-out);
}
.project__more[open] summary::before { transform: rotate(45deg); }
.project__more summary:hover { color: var(--accent); }

.project__more ul {
  margin: 10px 0 0;
  padding-left: 1.1em;
  color: var(--muted);
  font-size: 0.9375rem;
}
.project__more li { margin: 0.45em 0; }
.project__more li::marker { color: var(--accent); }
.project__more p { margin: 0.8em 0 0; color: var(--muted); font-size: 0.9375rem; }

.tags {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin: 18px 0 0;
  padding: 0;
  list-style: none;
}
.tags li {
  padding: 3px 10px;
  border: 1px solid var(--rule);
  border-radius: 999px;
  color: var(--muted);
  font-size: 0.8125rem;
}

.project__meta {
  display: flex;
  align-items: center;
  gap: 14px;
  margin: 14px 0 0;
  color: var(--muted);
  font-size: 0.9375rem;
}

.stars {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  color: var(--text);
  font-variant-numeric: tabular-nums;
  font-weight: 500;
}
.stars .icon { width: 15px; height: 15px; color: var(--spark); }

/* ---------- Project gallery ---------- */

.gallery { position: relative; }

.gallery__frame {
  position: relative;
  aspect-ratio: 16 / 10;
  overflow: hidden;
  border: 1px solid var(--rule);
  border-radius: 6px;
  background: var(--surface-2);
}

.gallery__track {
  display: flex;
  height: 100%;
  margin: 0;
  padding: 0;
  list-style: none;
  transform: translateX(calc(var(--slide, 0) * -100%));
  transition: transform 450ms var(--ease-out);
}

.gallery__slide {
  flex: 0 0 100%;
  height: 100%;
}

.gallery__slide img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  transform: translateY(var(--py, 0px));
}

.gallery__nav {
  position: absolute;
  top: 50%;
  translate: 0 -50%;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  padding: 0;
  border: 1px solid var(--rule-strong);
  border-radius: 50%;
  background: color-mix(in srgb, var(--base) 80%, transparent);
  color: var(--text);
  cursor: pointer;
  opacity: 0;
  transition: opacity 200ms ease, background-color 200ms ease, border-color 200ms ease;
  -webkit-backdrop-filter: blur(4px);
  backdrop-filter: blur(4px);
}
.gallery__nav--prev { left: 10px; }
.gallery__nav--next { right: 10px; }
.gallery__nav:hover { background: var(--accent); border-color: var(--accent); color: var(--base); }
.gallery:hover .gallery__nav,
.gallery__nav:focus-visible { opacity: 1; }
.gallery__nav[disabled] { opacity: 0 !important; pointer-events: none; }

.gallery__bar {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-top: 10px;
}

.gallery__dots {
  display: flex;
  gap: 6px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.gallery__dot {
  position: relative;
  width: 22px;
  height: 4px;
  padding: 0;
  border: 0;
  border-radius: 2px;
  background: var(--rule-strong);
  cursor: pointer;
  transition: background-color 200ms ease;
}

/* the dot stays a hairline, but the target it accepts is finger-sized */
.gallery__dot::after {
  content: "";
  position: absolute;
  inset: -20px -5px;
}
.gallery__dot[aria-current="true"] { background: var(--accent); }

.gallery__counter {
  margin: 0 0 0 auto;
  color: var(--muted);
  font-size: 0.8125rem;
  font-variant-numeric: tabular-nums;
}

/* touch: controls always visible, since there is no hover */
@media (hover: none) {
  .gallery__nav { opacity: 1; }
}

/* ---------- More on GitHub ---------- */

.more {
  display: grid;
  grid-template-columns: minmax(0, 4fr) minmax(0, 8fr);
  gap: 16px clamp(32px, 6vw, 96px);
  margin-top: clamp(72px, 9vw, 112px);
  padding-top: 32px;
  border-top: 1px solid var(--rule);
}

.more__title {
  margin: 0;
  font-family: var(--serif);
  font-size: 1.625rem;
  font-weight: 400;
}

.more__list { margin: 0; padding: 0; list-style: none; }

.more__list li {
  display: grid;
  grid-template-columns: 13rem 1fr;
  gap: 16px;
  padding: 12px 0;
  border-bottom: 1px solid var(--rule);
}

.more__list a {
  font-weight: 500;
  text-decoration: underline;
  text-decoration-color: var(--accent);
  text-decoration-thickness: 1px;
  text-underline-offset: 4px;
}
.more__list a:hover { text-decoration-thickness: 2px; }
.more__list span { color: var(--muted); }
.more .text-link { grid-column: 2; justify-self: start; }

@media (max-width: 980px) { .project { grid-column: span 3; } }

@media (max-width: 880px) {
  .project--feature { grid-template-columns: 1fr; gap: 20px; }
  .project--flip .project__media { order: 0; }
  .more { grid-template-columns: 1fr; }
  .more .text-link { grid-column: 1; }
}

@media (max-width: 640px) {
  .project { grid-column: 1 / -1; }
  .more__list li { grid-template-columns: 1fr; gap: 2px; }
}

/* ---------- Skills ---------- */

.skills {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 40px clamp(24px, 3vw, 40px);
}

.skill-group { border-top: 1px solid var(--accent); }

.skill-group__title {
  margin: 16px 0 10px;
  font-family: var(--serif);
  font-size: 1.375rem;
  font-weight: 500;
}

.skill-group__list { margin: 0; padding: 0; list-style: none; }

.skill-group__list li {
  padding: 9px 0;
  border-bottom: 1px solid var(--rule);
  color: var(--muted);
}

@media (max-width: 980px) { .skills { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 560px) { .skills { grid-template-columns: 1fr; } }

/* ---------- Contact ---------- */

.contact {
  position: relative;
  overflow: hidden;
  background: color-mix(in srgb, var(--surface-2) 80%, transparent);
  isolation: isolate;
}

.contact::before {
  content: "";
  position: absolute;
  inset: 0;
  z-index: -1;
  background-image: radial-gradient(color-mix(in srgb, var(--text) 13%, transparent) 1px, transparent 1.4px);
  background-size: 16px 16px;
  -webkit-mask-image: linear-gradient(100deg, transparent 45%, #000 100%);
  mask-image: linear-gradient(100deg, transparent 45%, #000 100%);
}

.contact__arrival {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
}

.contact__title {
  position: relative;
  max-width: 17ch;
  margin: 0;
  font-family: var(--serif);
  font-size: clamp(2.25rem, 5.2vw, 4.25rem);
  font-weight: 400;
  font-variation-settings: "opsz" 72;
  line-height: 1.08;
  letter-spacing: -0.02em;
}

.contact__lead {
  max-width: 34rem;
  margin: 24px 0 40px;
  color: var(--muted);
  font-size: 1.125rem;
}

.contact__email {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 12px 20px;
}

.contact__address {
  color: var(--accent);
  font-family: var(--serif);
  font-size: clamp(1.375rem, 3.4vw, 2.5rem);
  line-height: 1.2;
  overflow-wrap: anywhere;
  text-decoration: underline;
  text-decoration-thickness: 1px;
  text-underline-offset: 7px;
}
.contact__address:hover { color: var(--accent-bright); }

.copy-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 44px;
  padding: 0 16px;
  border: 1px solid var(--rule-strong);
  border-radius: 4px;
  background: transparent;
  color: var(--text);
  font: 500 0.9375rem var(--sans);
  cursor: pointer;
  transition: border-color 180ms ease, color 180ms ease;
}
.copy-btn:hover { border-color: var(--accent); }
.copy-btn.is-copied { border-color: var(--spark); color: var(--spark); }

.contact__links {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 32px;
  margin: 56px 0 0;
  padding: 32px 0 0;
  border-top: 1px solid var(--rule);
  list-style: none;
}

.contact__links a {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  min-height: 44px;
  font-weight: 500;
  text-decoration: none;
  transition: color 180ms ease;
}
.contact__links a:hover { color: var(--accent); }
.contact__links .icon { width: 1.2em; height: 1.2em; }

/* ---------- Footer ---------- */

.site-footer {
  background: var(--base);
  color: var(--muted);
  font-size: 0.9375rem;
}

.site-footer__inner {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding-block: 20px;
  border-top: 1px solid var(--rule);
}
.site-footer p { margin: 0; }

/* ---------- Custom pointer ----------
   A sphere with a trailing ring, in place of the arrow. Only ever active when
   script.js has confirmed a mouse and full motion, so the native cursor is
   never removed without a replacement. */

.has-cursor,
.has-cursor * { cursor: none !important; }

.cursor {
  position: fixed;
  inset: 0;
  z-index: 9999;
  pointer-events: none;
  opacity: 0;
  transition: opacity 220ms ease;
}
.cursor.is-on { opacity: 1; }

.cursor__ball,
.cursor__ring {
  position: absolute;
  top: 0;
  left: 0;
  border-radius: 50%;
  translate: -50% -50%;
  will-change: transform;
}

.cursor__ball {
  width: 13px;
  height: 13px;
  background: radial-gradient(circle at 34% 30%, #fff, var(--accent-bright) 45%, #6f43cc 100%);
  box-shadow: 0 0 0 1px rgb(23 16 46 / 0.6), 0 0 16px rgb(162 119 255 / 0.75);
}

.cursor__ring {
  width: 26px;
  height: 26px;
  border: 1px solid color-mix(in srgb, var(--accent) 75%, transparent);
  box-shadow: 0 0 0 1px rgb(23 16 46 / 0.35);
  transition: width 200ms var(--ease-out), height 200ms var(--ease-out),
    border-color 200ms ease, background-color 200ms ease;
}

/* over links, buttons and slider controls */
.cursor.is-hot .cursor__ring {
  width: 42px;
  height: 42px;
  background: var(--accent-soft);
  border-color: var(--accent-bright);
}

/* over the hero map, where a click sets a goal */
.cursor.is-map .cursor__ring { border-color: var(--spark); width: 34px; height: 34px; }
.cursor.is-map .cursor__ball {
  background: radial-gradient(circle at 34% 30%, #fff, var(--spark) 45%, #b07a13 100%);
  box-shadow: 0 0 0 1px rgb(23 16 46 / 0.6), 0 0 16px rgb(255 194 75 / 0.7);
}

.cursor.is-press .cursor__ring { width: 18px; height: 18px; }

/* ---------- Reduced motion ---------- */

@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;
  }
  .js [data-reveal] { opacity: 1; transform: none; }
  .js [data-reveal="sweep"] { clip-path: none; }
  .project__media { transform: none; }
  .gallery__slide img { transform: none; }
}
