/* ==========================================================================
   Muhammad Usama — portfolio design system
   Light: warm paper. Dark: near-black. One accent: cobalt.
   ========================================================================== */

:root {
  --bg: #f7f6f3;
  --bg-elevated: #fffefb;
  --ink: #101114;
  --ink-soft: #2b2d33;
  --muted: #6b6d74;
  --line: rgba(16, 17, 20, 0.12);
  --line-strong: rgba(16, 17, 20, 0.22);
  --accent: #2f4bff;
  --accent-2: #7b8cff;
  --accent-ink: #ffffff;
  --accent-soft: rgba(47, 75, 255, 0.09);

  --live: #187a4a;
  --live-soft: rgba(24, 122, 74, 0.12);
  --staging: #9a6408;
  --staging-soft: rgba(154, 100, 8, 0.12);
  --local: #2f4bff;
  --local-soft: rgba(47, 75, 255, 0.1);
  --archive: #6b4bb5;
  --archive-soft: rgba(107, 75, 181, 0.12);
  --down: #8a4a45;
  --down-soft: rgba(138, 74, 69, 0.12);

  --font-sans: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  --font-serif: 'Instrument Serif', Georgia, serif;
  --font-mono: 'IBM Plex Mono', ui-monospace, SFMono-Regular, Menlo, monospace;

  --radius-sm: 8px;
  --radius: 14px;
  --radius-lg: 22px;
  --radius-pill: 999px;

  --max-width: 1280px;
  --gutter: clamp(20px, 4vw, 56px);
  --section-pad: clamp(72px, 9vw, 132px);

  --ease: cubic-bezier(0.22, 1, 0.36, 1);

  color-scheme: light;
}

:root[data-theme='dark'],
html.dark-mode {
  --bg: #0b0c0e;
  --bg-elevated: #141519;
  --ink: #f1f0ec;
  --ink-soft: #d7d7d4;
  --muted: #9a9ba1;
  --line: rgba(255, 255, 255, 0.13);
  --line-strong: rgba(255, 255, 255, 0.26);
  --accent: #7b8cff;
  --accent-2: #a9b4ff;
  --accent-ink: #0b0c0e;
  --accent-soft: rgba(123, 140, 255, 0.12);

  --live: #5fd39a;
  --live-soft: rgba(95, 211, 154, 0.14);
  --staging: #e0ab4a;
  --staging-soft: rgba(224, 171, 74, 0.14);
  --local: #8f9dff;
  --local-soft: rgba(143, 157, 255, 0.14);
  --archive: #b79bf0;
  --archive-soft: rgba(183, 155, 240, 0.14);
  --down: #d99a94;
  --down-soft: rgba(217, 154, 148, 0.14);

  color-scheme: dark;
}

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

html {
  -webkit-text-size-adjust: 100%;
  scrollbar-width: none;
  background: var(--bg);
  color-scheme: light;
}

html[data-theme='dark'] {
  color-scheme: dark;
}

html::-webkit-scrollbar {
  display: none;
}

body {
  min-height: 100vh;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font-sans);
  font-size: 16px;
  font-weight: 400;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  overflow: hidden;
  transition: background-color 0.4s var(--ease), color 0.4s var(--ease);
}

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

a {
  color: inherit;
  text-decoration: none;
}

button {
  font: inherit;
  color: inherit;
  background: none;
  border: 0;
  cursor: pointer;
}

ul,
ol {
  list-style: none;
}

::selection {
  background: var(--accent);
  color: var(--accent-ink);
}

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

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

/* ------------------------------------------------------------- scroller */

#smooth-wrapper {
  position: relative;
  z-index: 3;
  height: 100dvh;
  width: 100%;
  overflow-x: hidden;
  overflow-y: auto;
  overscroll-behavior-y: none;
  scrollbar-width: none;
}

#smooth-wrapper::-webkit-scrollbar {
  display: none;
}

#smooth-wrapper.modal-open {
  overflow: hidden;
}

#smooth-content {
  position: relative;
  width: 100%;
  overflow-x: clip;
}

main {
  position: relative;
}

/* --------------------------------------------------------------- layout */

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

.section {
  position: relative;
  padding-block: var(--section-pad);
}

.section-inner {
  width: 100%;
}

.section-head {
  display: grid;
  gap: 14px;
  margin-bottom: clamp(32px, 5vw, 64px);
}

.section-kicker {
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--muted);
}

.section-title {
  font-size: clamp(2.3rem, 4.6vw, 4rem);
  font-weight: 600;
  line-height: 1.02;
  letter-spacing: -0.035em;
  text-wrap: balance;
}

.section-title em {
  font-family: var(--font-serif);
  font-style: italic;
  font-weight: 400;
  letter-spacing: -0.01em;
  color: var(--accent);
}

.text-body {
  font-size: clamp(15px, 1.08vw, 17px);
  line-height: 1.75;
  color: var(--ink-soft);
}

.text-body-sm {
  font-size: 14px;
  line-height: 1.65;
  color: var(--muted);
}

.text-mono {
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--muted);
}

.text-h3 {
  font-size: 18px;
  font-weight: 600;
  letter-spacing: -0.015em;
}

/* --------------------------------------------------------------- header */

.site-header {
  position: fixed;
  z-index: 1200;
  inset: 0 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  padding: 18px var(--gutter);
  background: color-mix(in srgb, var(--bg) 82%, transparent);
  border-bottom: 1px solid transparent;
  backdrop-filter: blur(18px);
  -webkit-backdrop-filter: blur(18px);
  transition: border-color 0.3s var(--ease), background 0.3s var(--ease);
}

body.scrolled .site-header {
  border-bottom-color: var(--line);
}

.brand-mark {
  display: inline-flex;
  align-items: center;
  gap: 11px;
  flex-shrink: 0;
}

.brand-mark span {
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  border-radius: 50%;
  background: var(--ink);
  color: var(--bg);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.04em;
}

.brand-mark small {
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--muted);
}

.header-nav {
  display: flex;
  align-items: center;
  gap: 28px;
  font-size: 13px;
  font-weight: 500;
}

.header-nav a {
  position: relative;
  color: var(--muted);
  transition: color 0.2s ease;
}

.header-nav a::after {
  content: '';
  position: absolute;
  left: 0;
  right: 100%;
  bottom: -5px;
  height: 1px;
  background: var(--accent);
  transition: right 0.3s var(--ease);
}

.header-nav a:hover {
  color: var(--ink);
}

.header-nav a:hover::after {
  right: 0;
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 14px;
}

.section-counter {
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: 0.12em;
  color: var(--muted);
}

.icon-button {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  height: 34px;
  padding: 0 13px;
  border: 1px solid var(--line);
  border-radius: var(--radius-pill);
  font-size: 12px;
  font-weight: 500;
  transition: border-color 0.2s ease, background 0.2s ease;
}

.icon-button:hover {
  border-color: var(--line-strong);
  background: var(--accent-soft);
}

.theme-icon {
  font-size: 14px;
  line-height: 1;
}

.scroll-progress {
  position: fixed;
  z-index: 1300;
  inset: 0 0 auto;
  height: 2px;
  background: transparent;
  pointer-events: none;
}

#scroll-progress-bar {
  display: block;
  height: 100%;
  background: var(--accent);
  transform: scaleX(0);
  transform-origin: left center;
}

/* Vertical rail with hairlines between stops. Hidden until the viewport is
   wide enough to keep it clear of the container's left gutter. */
.section-dots {
  position: fixed;
  z-index: 1100;
  left: 22px;
  top: 50%;
  transform: translateY(-50%);
  display: none;
  grid-template-rows: repeat(7, auto);
  gap: 0;
  padding-right: 14px;
}

@media (min-width: 1360px) {
  .section-dots {
    display: grid;
  }
}

.section-dots a {
  position: relative;
  display: grid;
  place-items: center;
  width: 9px;
  height: 30px;
  background: none;
}

.section-dots a::before {
  content: '';
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: var(--line-strong);
  transition: background 0.25s ease, transform 0.25s ease, box-shadow 0.25s ease;
}

.section-dots a:not(:last-child)::after {
  content: '';
  position: absolute;
  top: 20px;
  left: 50%;
  width: 1px;
  height: 10px;
  background: var(--line);
  transform: translateX(-0.5px);
}

.section-dots a span {
  position: absolute;
  left: 18px;
  opacity: 0;
  pointer-events: none;
  font-family: var(--font-mono);
  font-size: 9px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  white-space: nowrap;
  color: var(--muted);
  transition: opacity 0.2s ease;
}

.section-dots a:hover span,
.section-dots a:focus-visible span {
  opacity: 1;
}

.section-dots a.active::before {
  background: var(--accent);
  transform: scale(1.35);
  box-shadow: 0 0 0 3px var(--accent-soft);
}

/* ----------------------------------------------------------------- hero */

.hero-section {
  position: relative;
  min-height: max(680px, 100dvh);
  display: flex;
  align-items: center;
  padding-block: 120px 80px;
  overflow: hidden;
}

.hero-canvas {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  z-index: 0;
  opacity: 0.95;
  pointer-events: none;
}

.hero-wash {
  position: absolute;
  inset: 0;
  z-index: 0;
  background:
    radial-gradient(circle at 76% 42%, var(--accent-soft), transparent 46%),
    linear-gradient(180deg, transparent 62%, var(--bg) 100%);
  pointer-events: none;
}

.hero-section.no-webgl .hero-wash,
.hero-section.no-canvas .hero-wash {
  background:
    radial-gradient(circle at 74% 40%, var(--accent-soft), transparent 52%),
    radial-gradient(circle at 88% 66%, color-mix(in srgb, var(--accent) 8%, transparent), transparent 40%),
    linear-gradient(180deg, transparent 62%, var(--bg) 100%);
}

@media (prefers-reduced-motion: reduce) {
  .hero-section .hero-wash {
    background:
      radial-gradient(circle at 74% 40%, var(--accent-soft), transparent 52%),
      radial-gradient(circle at 88% 66%, color-mix(in srgb, var(--accent) 8%, transparent), transparent 40%),
      linear-gradient(180deg, transparent 62%, var(--bg) 100%);
  }
}

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

.hero-eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  font-family: var(--font-mono);
  font-size: 10.5px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--muted);
}

.hero-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--live);
  box-shadow: 0 0 0 4px color-mix(in srgb, var(--live) 16%, transparent);
}

.hero-title {
  margin: 22px 0 0;
  font-size: clamp(3.6rem, 9.2vw, 8.4rem);
  font-weight: 600;
  line-height: 0.86;
  letter-spacing: -0.055em;
}

.hero-title em {
  display: inline-block;
  font-family: var(--font-serif);
  font-style: italic;
  font-weight: 400;
  letter-spacing: -0.02em;
  color: var(--accent);
  padding-right: 0.08em;
}

.hero-subtitle {
  margin-top: 30px;
  font-size: clamp(15px, 1.5vw, 19px);
  font-weight: 500;
  letter-spacing: -0.01em;
}

.hero-desc {
  margin-top: 14px;
  max-width: 52ch;
  font-size: clamp(14.5px, 1.15vw, 17px);
  line-height: 1.7;
  color: var(--muted);
}

.hero-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 34px;
}

.hero-stats {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 20px;
  max-width: 660px;
  margin-top: clamp(40px, 7vh, 80px);
  padding-top: 22px;
  border-top: 1px solid var(--line);
}

.hero-stat dt {
  font-size: clamp(1.5rem, 2.3vw, 2.1rem);
  font-weight: 600;
  letter-spacing: -0.04em;
  line-height: 1;
}

.hero-stat dd {
  margin-top: 7px;
  font-family: var(--font-mono);
  font-size: 9.5px;
  line-height: 1.4;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--muted);
}

.hero-scroll-cue {
  position: absolute;
  z-index: 1;
  left: 50%;
  bottom: 26px;
  transform: translateX(-50%);
  display: flex;
  align-items: center;
  gap: 10px;
  font-family: var(--font-mono);
  font-size: 9.5px;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--muted);
}

.hero-scroll-cue span {
  display: block;
  width: 1px;
  height: 34px;
  background: linear-gradient(180deg, var(--accent), transparent);
  animation: cueDrop 2.2s ease-in-out infinite;
}

@keyframes cueDrop {
  0%, 100% { transform: scaleY(0.4); opacity: 0.4; transform-origin: top; }
  50% { transform: scaleY(1); opacity: 1; transform-origin: top; }
}

/* ---------------------------------------------------------------- about */

.about-layout {
  display: grid;
  grid-template-columns: minmax(0, 1.5fr) minmax(280px, 0.8fr);
  gap: clamp(32px, 5vw, 72px);
  align-items: start;
}

.about-content {
  display: grid;
  gap: 17px;
  max-width: 68ch;
}

.about-content p {
  font-size: clamp(15px, 1.08vw, 17px);
  line-height: 1.78;
  color: var(--ink-soft);
}

.about-content strong {
  font-weight: 600;
  color: var(--ink);
}

.about-aside {
  display: grid;
  gap: 16px;
  position: sticky;
  top: 104px;
}

.about-card {
  display: grid;
  gap: 9px;
  padding: 22px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--bg-elevated);
}

.about-card-strong {
  font-size: 15px;
  font-weight: 600;
  letter-spacing: -0.01em;
}

.about-actions {
  display: grid;
  gap: 8px;
}

/* --------------------------------------------------------------- skills */

.bento-grid {
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  gap: 14px;
}

.bento-card {
  position: relative;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 26px;
  min-height: 190px;
  padding: 24px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--bg-elevated);
  transition: border-color 0.3s var(--ease), transform 0.4s var(--ease);
}

.bento-card:nth-child(1),
.bento-card:nth-child(2) {
  grid-column: span 3;
}

.bento-card:nth-child(3),
.bento-card:nth-child(4) {
  grid-column: span 3;
}

.bento-card:nth-child(5) {
  grid-column: span 6;
}

.bento-card:hover {
  border-color: var(--line-strong);
  transform: translateY(-3px);
}

.bento-number {
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: 0.14em;
  color: var(--muted);
}

.bento-title {
  font-size: clamp(1.05rem, 1.5vw, 1.35rem);
  font-weight: 600;
  letter-spacing: -0.025em;
}

.tags {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.tag {
  padding: 5px 10px;
  border: 1px solid var(--line);
  border-radius: var(--radius-pill);
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: 0.04em;
  color: var(--muted);
}

/* -------------------------------------------------------------- buttons */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  height: 46px;
  padding: 0 22px;
  border: 1px solid transparent;
  border-radius: var(--radius-pill);
  font-size: 13.5px;
  font-weight: 500;
  letter-spacing: -0.005em;
  white-space: nowrap;
  transition: transform 0.25s var(--ease), background 0.25s ease, border-color 0.25s ease, color 0.25s ease;
}

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

.btn-primary {
  background: var(--ink);
  color: var(--bg);
}

.btn-primary:hover {
  background: var(--accent);
  color: var(--accent-ink);
}

.btn-secondary {
  border-color: var(--line-strong);
  background: transparent;
  color: var(--ink);
}

.btn-secondary:hover {
  border-color: var(--accent);
  color: var(--accent);
}

.btn-ghost {
  color: var(--muted);
  padding-inline: 4px;
}

.btn-ghost:hover {
  color: var(--ink);
}

.text-link {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  font-size: 12.5px;
  font-weight: 500;
  color: var(--ink);
  transition: color 0.2s ease;
}

.text-link:hover {
  color: var(--accent);
}

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

/* ------------------------------------------------------------ featured */

.projects-section {
  border-top: 1px solid var(--line);
}

.projects-header {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: clamp(24px, 5vw, 80px);
  align-items: end;
  margin-bottom: clamp(36px, 5vw, 60px);
}

.projects-header .section-head {
  margin-bottom: 0;
}

.projects-lede {
  max-width: 48ch;
  font-size: 14.5px;
  line-height: 1.75;
  color: var(--muted);
}

.featured-grid {
  display: grid;
  grid-template-columns: repeat(12, minmax(0, 1fr));
  gap: clamp(18px, 2.4vw, 34px);
}

.featured-card {
  grid-column: span 6;
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.featured-media {
  position: relative;
  display: block;
  width: 100%;
  aspect-ratio: 16 / 10;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: color-mix(in srgb, var(--ink) 6%, var(--bg));
  text-align: left;
}

.featured-media img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.7s var(--ease), filter 0.4s ease;
}

.featured-media:hover img {
  transform: scale(1.035);
}

.featured-index {
  position: absolute;
  bottom: 14px;
  left: 14px;
  display: grid;
  place-items: center;
  min-width: 28px;
  height: 24px;
  padding: 0 7px;
  border-radius: var(--radius-pill);
  background: rgba(9, 10, 12, 0.62);
  color: #fff;
  font-family: var(--font-mono);
  font-size: 9.5px;
  letter-spacing: 0.12em;
  backdrop-filter: blur(8px);
}

.featured-body {
  display: grid;
  gap: 9px;
  padding-top: 16px;
}

.card-kicker {
  font-family: var(--font-mono);
  font-size: 9.5px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--accent);
}

.featured-body h3 {
  font-size: clamp(1.15rem, 1.9vw, 1.55rem);
  font-weight: 600;
  line-height: 1.15;
  letter-spacing: -0.03em;
}

.featured-subtitle {
  font-size: 13px;
  font-weight: 500;
  color: var(--ink-soft);
}

.featured-summary {
  display: -webkit-box;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 3;
  overflow: hidden;
  max-width: 54ch;
  min-height: calc(3 * 1.65em);
  font-size: 13.5px;
  line-height: 1.65;
  color: var(--muted);
}

.card-tech {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 2px;
}

.card-tech li {
  padding: 3px 8px;
  border: 1px solid var(--line);
  border-radius: 5px;
  font-family: var(--font-mono);
  font-size: 9.5px;
  letter-spacing: 0.03em;
  color: var(--muted);
}

.featured-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 18px;
  margin-top: 6px;
}

/* ------------------------------------------------------------- statuses */

.status-pill {
  position: absolute;
  right: 14px;
  bottom: 14px;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 5px 10px 5px 8px;
  border-radius: var(--radius-pill);
  background: rgba(9, 10, 12, 0.66);
  color: #fff;
  font-family: var(--font-mono);
  font-size: 9.5px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
}

.status-pill i {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: currentColor;
}

.status-pill[data-tone='live'] { color: #7df0b4; }
.status-pill[data-tone='staging'] { color: #f5c66b; }
.status-pill[data-tone='local'] { color: #a3b0ff; }
.status-pill[data-tone='archive'] { color: #c9b1ff; }
.status-pill[data-tone='github'] { color: #c9b1ff; }
.status-pill[data-tone='down'] { color: #e3a49e; }

.status-pill-sm {
  right: 9px;
  bottom: 9px;
  padding: 3px 8px 3px 7px;
  font-size: 8.5px;
}

/* -------------------------------------------------------------- archive */

.archive-header {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 24px;
  margin-top: clamp(56px, 8vw, 104px);
  padding-top: clamp(32px, 4vw, 48px);
  border-top: 1px solid var(--line);
}

.archive-title {
  font-size: clamp(1.4rem, 2.4vw, 1.9rem);
  font-weight: 600;
  letter-spacing: -0.03em;
}

.archive-note {
  margin-top: 8px;
  max-width: 56ch;
  font-size: 13.5px;
  line-height: 1.65;
  color: var(--muted);
}

.archive-search {
  display: flex;
  align-items: center;
  gap: 9px;
  width: min(320px, 100%);
  height: 42px;
  padding: 0 14px;
  border: 1px solid var(--line);
  border-radius: var(--radius-pill);
  background: var(--bg-elevated);
  color: var(--muted);
  transition: border-color 0.2s ease;
}

.archive-search:focus-within {
  border-color: var(--accent);
}

.archive-search input {
  flex: 1;
  min-width: 0;
  height: 100%;
  border: 0;
  background: none;
  color: var(--ink);
  font: inherit;
  font-size: 13px;
  outline: none;
}

.archive-search input::placeholder {
  color: var(--muted);
}

.archive-filters {
  display: grid;
  gap: 10px;
  margin-top: 26px;
}

.filter-row {
  display: flex;
  align-items: center;
  gap: 14px;
  flex-wrap: wrap;
}

.filter-label {
  flex: 0 0 62px;
  font-family: var(--font-mono);
  font-size: 9.5px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--muted);
}

.category-filter-pills,
.status-filter-pills {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.filter-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 32px;
  padding: 0 13px;
  border: 1px solid var(--line);
  border-radius: var(--radius-pill);
  font-size: 12px;
  font-weight: 450;
  color: var(--muted);
  transition: border-color 0.2s ease, color 0.2s ease, background 0.2s ease;
}

.filter-pill:hover {
  border-color: var(--line-strong);
  color: var(--ink);
}

.filter-pill.active {
  border-color: var(--ink);
  background: var(--ink);
  color: var(--bg);
}

.pill-count {
  font-family: var(--font-mono);
  font-size: 9px;
  opacity: 0.65;
}

.archive-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin: 24px 0 18px;
}

.archive-count {
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--muted);
}

.archive-reset {
  font-size: 12px;
  font-weight: 500;
  color: var(--accent);
  text-decoration: underline;
  text-underline-offset: 3px;
}

.archive-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 18px;
}

.archive-card {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.archive-media {
  position: relative;
  display: block;
  width: 100%;
  aspect-ratio: 4 / 3;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: color-mix(in srgb, var(--ink) 5%, var(--bg));
}

.archive-media img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.6s var(--ease), opacity 0.3s ease;
}

.archive-media:hover img {
  transform: scale(1.04);
}

.archive-card[data-tone='down'] .archive-media img {
  opacity: 0.55;
  filter: grayscale(0.65);
}

.archive-body h4 {
  font-size: 13.5px;
  font-weight: 600;
  line-height: 1.35;
  letter-spacing: -0.015em;
}

.archive-body p {
  margin-top: 3px;
  font-size: 11.5px;
  line-height: 1.5;
  color: var(--muted);
}

.archive-empty {
  padding: 48px 0;
  text-align: center;
  color: var(--muted);
}

/* ---------------------------------------------------------------- modal */

.project-preview-modal {
  position: fixed;
  z-index: 3000;
  inset: 0;
  display: grid;
  place-items: center;
  padding: 20px;
  visibility: hidden;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s ease, visibility 0.3s;
}

.project-preview-modal.open {
  visibility: visible;
  opacity: 1;
  pointer-events: auto;
}

.project-preview-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(6, 7, 9, 0.72);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
}

.project-preview-dialog {
  position: relative;
  z-index: 1;
  display: grid;
  grid-template-columns: minmax(0, 1.15fr) minmax(0, 0.85fr);
  width: min(1120px, calc(100vw - 40px));
  max-height: min(780px, calc(100dvh - 40px));
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  background: var(--bg-elevated);
  box-shadow: 0 40px 120px rgba(0, 0, 0, 0.4);
  transform: translateY(16px) scale(0.985);
  transition: transform 0.4s var(--ease);
}

.project-preview-modal.open .project-preview-dialog {
  transform: none;
}

.preview-image-wrap {
  position: relative;
  display: grid;
  place-items: center;
  min-height: 0;
  /* Same surface as the dialog, so a screenshot that does not fill the pane
     sits on the page instead of inside a black letterbox. */
  background: var(--bg-elevated);
  overflow: hidden;
}

.preview-image-wrap img {
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.preview-copy {
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 34px 32px;
  overflow-y: auto;
  overscroll-behavior: contain;
}

.preview-copy #preview-category {
  display: flex;
  align-items: center;
  gap: 10px;
  color: var(--accent);
}

.preview-copy #preview-category .status-pill {
  position: static;
  background: var(--accent-soft);
  color: var(--accent);
  backdrop-filter: none;
}

.preview-sep {
  color: var(--line-strong);
}

#preview-title {
  font-size: clamp(1.5rem, 2.6vw, 2.1rem);
  font-weight: 600;
  line-height: 1.1;
  letter-spacing: -0.035em;
}

#preview-description {
  font-size: 14px;
  line-height: 1.7;
  color: var(--muted);
}

.preview-verified {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  font-family: var(--font-mono);
  font-size: 9.5px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
}

.preview-verified::before {
  content: '';
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: currentColor;
}

.preview-verified[data-tone='live'] { color: var(--live); }
.preview-verified[data-tone='staging'] { color: var(--staging); }
.preview-verified[data-tone='local'] { color: var(--local); }
.preview-verified[data-tone='archive'] { color: var(--archive); }
.preview-verified[data-tone='down'] { color: var(--down); }

.preview-highlights {
  display: grid;
  gap: 7px;
  margin-top: 4px;
}

.preview-highlights li {
  position: relative;
  padding-left: 16px;
  font-size: 13px;
  line-height: 1.6;
  color: var(--ink-soft);
}

.preview-highlights li::before {
  content: '';
  position: absolute;
  left: 0;
  top: 8px;
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: var(--accent);
}

.preview-tech {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 6px;
}

.preview-tech span {
  padding: 4px 9px;
  border: 1px solid var(--line);
  border-radius: 5px;
  font-family: var(--font-mono);
  font-size: 9.5px;
  color: var(--muted);
}

.preview-gallery {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
  margin-top: 10px;
}

.preview-gallery figure {
  overflow: hidden;
  border-radius: var(--radius-sm);
  border: 1px solid var(--line);
}

.preview-gallery img {
  width: 100%;
  aspect-ratio: 4 / 3;
  object-fit: cover;
}

.preview-gallery figcaption {
  padding: 5px 7px;
  font-size: 9.5px;
  color: var(--muted);
}

.preview-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 9px;
  margin-top: 14px;
  padding-top: 16px;
  border-top: 1px solid var(--line);
}

.preview-close {
  position: absolute;
  z-index: 3;
  top: 14px;
  right: 14px;
  display: grid;
  place-items: center;
  width: 38px;
  height: 38px;
  border-radius: 50%;
  background: rgba(9, 10, 12, 0.72);
  color: #fff;
  font-size: 22px;
  line-height: 1;
  backdrop-filter: blur(8px);
  transition: background 0.2s ease;
}

.preview-close:hover {
  background: var(--accent);
}

/* ------------------------------------------------------------- timeline */

.timeline-container {
  position: relative;
}

.timeline-list {
  position: relative;
  display: grid;
  gap: 0;
  margin-top: clamp(32px, 4vw, 52px);
}

.timeline-line {
  position: absolute;
  left: 210px;
  top: 20px;
  bottom: 26px;
  width: 1px;
  background: var(--line);
}

.timeline-progress {
  width: 100%;
  height: 0;
  background: var(--accent);
  transform-origin: top center;
}

.timeline-item {
  position: relative;
  display: grid;
  grid-template-columns: minmax(0, 190px) minmax(0, 1fr);
  column-gap: 40px;
  padding: 32px 0;
  border-bottom: 1px solid rgba(255, 255, 255, 0.05);
  align-items: start;
  transition: transform 0.25s ease;
}

.timeline-item:hover {
  transform: translateX(4px);
}

.timeline-item:last-child {
  border-bottom: 0;
}

.timeline-badge {
  position: absolute;
  left: 210px;
  top: 36px;
  display: grid;
  place-items: center;
  width: 13px;
  height: 13px;
  transform: translateX(-50%);
  border-radius: 50%;
  border: 1px solid rgba(255, 255, 255, 0.2);
  background: var(--bg);
  transition: all 0.2s ease;
  z-index: 2;
}

.timeline-badge span {
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: var(--accent);
  transition: transform 0.2s ease;
}

.timeline-item.is-current .timeline-badge {
  border-color: #38bdf8;
  box-shadow: 0 0 12px rgba(56, 189, 248, 0.5);
}

.timeline-item.is-current .timeline-badge span {
  background: #38bdf8;
  transform: scale(1.3);
}

.timeline-item:hover .timeline-badge {
  border-color: #38bdf8;
  transform: translateX(-50%) scale(1.2);
}

.timeline-meta {
  text-align: right;
  padding-top: 4px;
}

.timeline-period {
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 500;
  line-height: 1.6;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
}

.timeline-current-tag {
  display: inline-block;
  margin-top: 6px;
  font-size: 10px;
  font-family: var(--font-mono);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: #38bdf8;
  background: rgba(56, 189, 248, 0.12);
  padding: 2px 8px;
  border-radius: 12px;
  border: 1px solid rgba(56, 189, 248, 0.3);
}

.timeline-content {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.timeline-header {
  display: flex;
  align-items: baseline;
  flex-wrap: wrap;
  gap: 12px;
}

.timeline-role {
  font-size: clamp(18px, 1.4vw, 22px);
  font-weight: 700;
  letter-spacing: -0.01em;
  color: #f8fafc;
  margin: 0;
}

.timeline-company {
  font-size: 14px;
  font-weight: 600;
  color: #818cf8;
}

.timeline-desc {
  font-size: 14.5px;
  line-height: 1.65;
  color: var(--muted);
  max-width: 65ch;
  margin: 0;
}

.timeline-skills {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 8px;
}

.timeline-skill-pill {
  font-size: 11px;
  font-family: var(--font-mono);
  color: #cbd5e1;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.08);
  padding: 3px 9px;
  border-radius: 6px;
  transition: all 0.2s ease;
}

.timeline-skill-pill:hover {
  background: rgba(255, 255, 255, 0.08);
  border-color: rgba(255, 255, 255, 0.18);
  color: #fff;
}

/* -------------------------------------------------------------- contact */

#contact {
  border-top: 1px solid var(--line);
}

.contact-desc {
  max-width: 52ch;
  margin-bottom: 36px;
  color: var(--muted);
}

.contact-layout {
  display: grid;
  grid-template-columns: minmax(0, 1.1fr) minmax(0, 0.9fr);
  gap: clamp(28px, 5vw, 72px);
  align-items: start;
}

.contact-form {
  display: grid;
  gap: 12px;
}

.input-group {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

.form-input {
  width: 100%;
  padding: 14px 16px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--bg-elevated);
  color: var(--ink);
  font: inherit;
  font-size: 14px;
  transition: border-color 0.2s ease;
}

.form-input::placeholder {
  color: var(--muted);
}

.form-input:focus {
  outline: none;
  border-color: var(--accent);
}

textarea.form-input {
  resize: vertical;
  min-height: 120px;
}

.contact-form .btn {
  justify-self: start;
}

.contact-card {
  display: grid;
  border-top: 1px solid var(--line);
}

.contact-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  padding: 15px 0;
  border-bottom: 1px solid var(--line);
  transition: padding 0.25s var(--ease), color 0.2s ease;
}

.contact-row:hover {
  padding-left: 8px;
  color: var(--accent);
}

.contact-key {
  font-family: var(--font-mono);
  font-size: 9.5px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--muted);
}

.contact-value {
  font-size: 13.5px;
  font-weight: 500;
  text-align: right;
}

.contact-row-accent .contact-value {
  color: var(--accent);
}

.site-footer {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-top: clamp(56px, 8vw, 96px);
  padding-top: 22px;
  border-top: 1px solid var(--line);
  font-family: var(--font-mono);
  font-size: 9.5px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--muted);
}

/* ------------------------------------------------------------ responsive */

@media (max-width: 1100px) {
  .featured-card {
    grid-column: span 6;
  }

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

@media (max-width: 900px) {
  /* Keep a usable nav on tablets and phones instead of removing it. */
  .header-nav {
    display: flex;
    gap: 16px;
    font-size: 12px;
  }

  .header-nav a[href='#experience'] {
    display: none;
  }

  .about-layout,
  .contact-layout {
    grid-template-columns: 1fr;
  }

  .about-aside {
    position: static;
    grid-template-columns: 1fr 1fr;
    align-items: start;
  }

  .projects-header {
    grid-template-columns: 1fr;
    align-items: start;
  }

  .featured-grid {
    grid-template-columns: 1fr;
  }

  .featured-card {
    grid-column: span 1;
  }

  .bento-card:nth-child(n) {
    grid-column: span 3;
  }

  .bento-card:nth-child(5) {
    grid-column: span 6;
  }

  .timeline-line,
  .timeline-badge {
    display: none;
  }

  .timeline-item {
    grid-template-columns: 1fr;
    gap: 6px;
    padding: 22px 0;
  }

  .timeline-period,
  .timeline-item .text-h3,
  .timeline-item .text-body-sm {
    grid-column: 1;
    grid-row: auto;
    text-align: left;
  }

  .timeline-item .text-body-sm {
    margin-top: 0;
    padding-top: 0;
  }

  .timeline-item .text-h3 {
    order: -1;
  }

  .archive-header {
    flex-direction: column;
    align-items: flex-start;
  }

  .archive-search {
    width: 100%;
  }

  .project-preview-dialog {
    grid-template-columns: 1fr;
    grid-template-rows: minmax(200px, 38vh) minmax(0, 1fr);
    max-height: calc(100dvh - 24px);
    width: calc(100vw - 24px);
  }

  .preview-image-wrap {
    min-height: 0;
  }

  .preview-copy {
    padding: 24px 20px;
  }
}

@media (max-width: 640px) {
  .section-dots {
    display: none;
  }

  .brand-mark small,
  .section-counter {
    display: none;
  }

  .theme-label {
    display: none;
  }

  .icon-button {
    width: 34px;
    padding: 0;
    justify-content: center;
  }

  .hero-section {
    min-height: max(620px, 100svh);
    padding-top: 108px;
  }

  .hero-stats {
    grid-template-columns: 1fr 1fr;
    gap: 16px 20px;
  }

  .hero-scroll-cue {
    display: none;
  }

  .bento-grid {
    grid-template-columns: 1fr;
  }

  .bento-card:nth-child(n) {
    grid-column: span 1;
    min-height: 0;
  }

  .featured-grid {
    grid-template-columns: 1fr;
  }

  .featured-card,
  .featured-card:nth-child(n) {
    grid-column: span 1;
  }

  .archive-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 14px;
  }

  .archive-body h4 {
    font-size: 12px;
  }

  .input-group {
    grid-template-columns: 1fr;
  }

  .about-aside {
    grid-template-columns: 1fr;
  }

  .filter-label {
    flex-basis: 100%;
  }

  .preview-gallery {
    grid-template-columns: 1fr 1fr;
  }

  .contact-row {
    align-items: flex-start;
    flex-direction: column;
    gap: 4px;
  }

  .contact-value {
    text-align: left;
  }
}

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

  .hero-canvas {
    display: none;
  }
}
