/* ==========================================================================
   uhren.dev
   1. Fonts   2. Tokens & themes   3. Base   4. Layout   5. Components
   6. Header & footer   7. Home   8. Work & case studies   9. Forms
   10. Utilities   11. Motion & print
   ========================================================================== */

/* 1. Fonts (self-hosted, SIL Open Font License) --------------------------- */

@font-face {
  font-family: "Inter";
  src: url("../fonts/inter-var.woff2") format("woff2");
  font-weight: 100 900;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: "Bricolage Grotesque";
  src: url("../fonts/bricolage-grotesque-var.woff2") format("woff2");
  font-weight: 200 800;
  font-style: normal;
  font-display: swap;
}

/* 2. Tokens & themes ------------------------------------------------------- */

:root {
  /* Signature violet; text variants below keep the same hue with AA contrast. */
  --brand: #5d3ef9;
  --font-display: "Bricolage Grotesque", ui-sans-serif, system-ui, sans-serif;
  --font-body: "Inter", ui-sans-serif, system-ui, -apple-system, "Segoe UI", sans-serif;
  --font-mono: ui-monospace, "SF Mono", "Cascadia Code", "JetBrains Mono", Menlo, Consolas, monospace;

  --step--1: clamp(0.8125rem, 0.79rem + 0.1vw, 0.875rem);
  --step-0: clamp(1rem, 0.97rem + 0.15vw, 1.0625rem);
  --step-1: clamp(1.125rem, 1.07rem + 0.3vw, 1.3125rem);
  --step-2: clamp(1.375rem, 1.25rem + 0.6vw, 1.75rem);
  --step-3: clamp(1.75rem, 1.5rem + 1.25vw, 2.625rem);
  --step-4: clamp(2.25rem, 1.75rem + 2.5vw, 3.75rem);
  --step-5: clamp(2.875rem, 1.9rem + 5vw, 6rem);

  --space-2xs: 0.25rem;
  --space-xs: 0.5rem;
  --space-s: 0.75rem;
  --space-m: 1rem;
  --space-l: 1.5rem;
  --space-xl: 2rem;
  --space-2xl: 3rem;
  --space-3xl: 4.5rem;
  --section-y: clamp(4.5rem, 3rem + 6vw, 8rem);

  --container: 72rem;
  --gutter: clamp(1rem, 0.5rem + 2.5vw, 2rem);
  --radius-s: 6px;
  --radius-m: 10px;
  --radius-l: 16px;
  --header-h: 4rem;

  --ease: cubic-bezier(0.2, 0.7, 0.2, 1);
  --dur: 180ms;
}

/* Dark is the default theme (also used before JavaScript runs). */
:root,
[data-theme="dark"] {
  color-scheme: dark;
  --bg: #0d0c12;
  --bg-alt: #111018;
  --surface: #16141e;
  --surface-2: #1c1a26;
  --border: #272432;
  --border-strong: #3a3648;
  --text: #ece9f4;
  --text-muted: #a7a2b5;
  --text-faint: #8a8599;
  --accent: var(--brand);
  --accent-text: #8e75ff;
  --accent-text-strong: #9b83ff;
  --accent-strong: #6b4bff;
  --accent-ink: #ffffff;
  --accent-soft: rgb(93 62 249 / 0.12);
  --accent-line: rgb(93 62 249 / 0.38);
  --glow: rgb(93 62 249 / 0.22);
  --shadow: 0 1px 2px rgb(0 0 0 / 0.4), 0 12px 32px -12px rgb(0 0 0 / 0.6);
  --shadow-hover: 0 1px 2px rgb(0 0 0 / 0.4), 0 22px 48px -18px rgb(50 24 170 / 0.55);
  --dot: rgb(93 62 249 / 0.13);
  --ok: #4ade80;
  --warn: #fbbf24;
  --danger: #fb7185;
  --success-bg: rgb(74 222 128 / 0.1);
  --danger-bg: rgb(251 113 133 / 0.1);
}

[data-theme="light"] {
  color-scheme: light;
  --bg: #faf8f4;
  --bg-alt: #f3f0ea;
  --surface: #ffffff;
  --surface-2: #f7f4ee;
  --border: #e5dfd4;
  --border-strong: #d2cabb;
  --text: #1b1822;
  --text-muted: #57525f;
  --text-faint: #6b6573;
  --accent: var(--brand);
  --accent-text: var(--brand);
  --accent-text-strong: #4b2bdd;
  --accent-strong: #4b2bdd;
  --accent-ink: #ffffff;
  --accent-soft: rgb(93 62 249 / 0.08);
  --accent-line: rgb(93 62 249 / 0.3);
  --glow: rgb(93 62 249 / 0.28);
  --shadow: 0 1px 2px rgb(60 40 20 / 0.06), 0 12px 32px -14px rgb(60 40 20 / 0.18);
  --shadow-hover: 0 1px 2px rgb(60 40 20 / 0.06), 0 22px 44px -18px rgb(50 24 170 / 0.28);
  --dot: rgb(93 62 249 / 0.12);
  --ok: #15803d;
  --warn: #b45309;
  --danger: #be123c;
  --success-bg: rgb(21 128 61 / 0.08);
  --danger-bg: rgb(190 18 60 / 0.07);
}

/* 3. Base ------------------------------------------------------------------ */

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

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

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-body);
  font-size: var(--step-0);
  line-height: 1.65;
  font-feature-settings: "cv11", "ss01";
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
}

.js body {
  transition: background-color 250ms ease, color 250ms ease;
}

h1,
h2,
h3,
h4 {
  font-family: var(--font-display);
  font-weight: 650;
  line-height: 1.1;
  letter-spacing: -0.02em;
  margin: 0;
  text-wrap: balance;
}

p {
  margin: 0;
  text-wrap: pretty;
}

ul,
ol {
  margin: 0;
  padding: 0;
}

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

img {
  height: auto;
}

a {
  color: var(--accent-text);
  text-decoration-thickness: 1px;
  text-underline-offset: 0.2em;
}

a:hover {
  color: var(--accent-text-strong);
}

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

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

main:focus {
  outline: none;
}

dl,
dd {
  margin: 0;
}

em {
  font-style: normal;
}

/* 4. Layout ---------------------------------------------------------------- */

.container {
  width: min(100% - 2 * var(--gutter), var(--container));
  margin-inline: auto;
}

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

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

.page-top {
  padding-top: calc(var(--section-y) * 0.7);
}

.section-head {
  max-width: 44rem;
  margin-bottom: clamp(2rem, 1.5rem + 2vw, 3.5rem);
}

.section-head h1,
.section-head h2 {
  font-size: var(--step-4);
}

.section-head--row {
  display: flex;
  flex-wrap: wrap;
  align-items: end;
  justify-content: space-between;
  gap: var(--space-m) var(--space-xl);
  max-width: none;
}

.section-intro {
  margin-top: var(--space-m);
  color: var(--text-muted);
  font-size: var(--step-1);
  line-height: 1.55;
}

.eyebrow {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  margin-bottom: var(--space-m);
  color: var(--text-muted);
  font-family: var(--font-mono);
  font-size: var(--step--1);
  letter-spacing: 0.04em;
  text-transform: lowercase;
}

.eyebrow-num {
  color: var(--accent-text);
}

.eyebrow-num::after {
  content: " /";
  color: var(--text-faint);
}

.eyebrow--small {
  margin-bottom: var(--space-s);
}

.subhead {
  margin: var(--space-3xl) 0 var(--space-l);
  font-size: var(--step-2);
}

.prose p + p {
  margin-top: 1.1em;
}

/* 5. Components ------------------------------------------------------------ */

.icon {
  width: 1.1em;
  height: 1.1em;
  flex: none;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.sprite {
  display: none;
}

/* Buttons */
.btn {
  --btn-bg: transparent;
  --btn-fg: var(--text);
  --btn-border: var(--border-strong);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.55rem;
  min-height: 2.875rem;
  padding: 0.65rem 1.2rem;
  border: 1px solid var(--btn-border);
  border-radius: 999px;
  background: var(--btn-bg);
  color: var(--btn-fg);
  font: 550 0.9375rem/1.2 var(--font-body);
  text-decoration: none;
  white-space: nowrap;
  cursor: pointer;
  transition: background-color var(--dur) ease, border-color var(--dur) ease, color var(--dur) ease,
    transform var(--dur) var(--ease), box-shadow var(--dur) ease;
}

.btn:hover {
  color: var(--btn-fg);
  transform: translateY(-1px);
}

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

.btn .icon {
  transition: transform var(--dur) var(--ease);
}

.btn:hover .icon {
  transform: translateX(2px);
}

.btn--primary {
  --btn-bg: var(--accent);
  --btn-fg: var(--accent-ink);
  --btn-border: var(--accent);
}

.btn--primary:hover {
  --btn-bg: var(--accent-strong);
  --btn-border: var(--accent-strong);
  box-shadow: 0 8px 24px -10px var(--glow);
}

.btn--ghost:hover {
  --btn-border: var(--accent-line);
  --btn-bg: var(--accent-soft);
}

.btn--small {
  min-height: 2.5rem;
  padding: 0.5rem 0.95rem;
  font-size: 0.875rem;
}

.btn[disabled] {
  opacity: 0.6;
  cursor: progress;
  transform: none;
}

.icon-button {
  display: inline-grid;
  place-items: center;
  width: 2.5rem;
  height: 2.5rem;
  padding: 0;
  border: 1px solid transparent;
  border-radius: 999px;
  background: transparent;
  color: var(--text-muted);
  cursor: pointer;
  transition: color var(--dur) ease, background-color var(--dur) ease, border-color var(--dur) ease;
}

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

.icon-button .icon {
  grid-area: 1 / 1;
  width: 1.2rem;
  height: 1.2rem;
}

.text-link {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  font-weight: 550;
  text-decoration: none;
}

.text-link:hover .icon {
  transform: translateX(2px);
}

.text-link .icon {
  transition: transform var(--dur) var(--ease);
}

.link-meta,
.nav-meta {
  color: var(--text-faint);
  font-family: var(--font-mono);
  font-size: 0.75em;
}

/* Tags and status */
.tags {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  list-style: none;
}

.tags li {
  padding: 0.2rem 0.6rem;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--surface-2);
  color: var(--text-muted);
  font-family: var(--font-mono);
  font-size: 0.75rem;
  line-height: 1.5;
}

.status {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  color: var(--text);
  font-family: var(--font-mono);
  font-size: 0.75rem;
  letter-spacing: 0.02em;
}

.status-dot {
  width: 0.5rem;
  height: 0.5rem;
  border-radius: 50%;
  background: var(--text-faint);
}

.status--live .status-dot {
  background: var(--ok);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--ok) 20%, transparent);
}

.status--experimental .status-dot {
  background: var(--warn);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--warn) 20%, transparent);
}

.status--progress .status-dot {
  background: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
}

/* Media frames: screenshots sit in a quiet, consistent frame. */
.frame,
.project-media {
  position: relative;
  margin: 0;
  overflow: hidden;
  border: 1px solid var(--border);
  border-radius: var(--radius-m);
  background: var(--surface-2);
  box-shadow: var(--shadow);
}

.frame figcaption {
  padding: 0.7rem 1rem;
  border-top: 1px solid var(--border);
  color: var(--text-muted);
  font-size: var(--step--1);
}

.img-missing {
  aspect-ratio: 16 / 10;
  background: repeating-linear-gradient(45deg, var(--surface), var(--surface) 10px, var(--surface-2) 10px, var(--surface-2) 20px);
}

/* Pixel mascot */
.mascot,
.brand-mark,
.spec-mascot,
.footer-mark,
.nf-mascot {
  color: var(--accent);
  image-rendering: pixelated;
}

/* Notices */
.notice {
  display: flex;
  gap: 0.6rem;
  align-items: flex-start;
  padding: 0.85rem 1rem;
  border: 1px solid;
  border-radius: var(--radius-m);
  font-size: 0.9375rem;
}

.notice .icon {
  margin-top: 0.2em;
}

.notice--success {
  border-color: color-mix(in srgb, var(--ok) 45%, transparent);
  background: var(--success-bg);
}

.notice--success .icon {
  color: var(--ok);
}

.notice--error {
  border-color: color-mix(in srgb, var(--danger) 45%, transparent);
  background: var(--danger-bg);
}

.notice--error .icon {
  color: var(--danger);
}

/* 6. Header & footer ------------------------------------------------------- */

.skip-link {
  position: absolute;
  top: -10rem;
  left: var(--space-m);
  z-index: 100;
  padding: 0.6rem 1rem;
  border-radius: var(--radius-s);
  background: var(--accent);
  color: var(--accent-ink);
  font-weight: 600;
  text-decoration: none;
}

.skip-link:focus {
  top: var(--space-s);
}

.site-header {
  position: sticky;
  top: 0;
  z-index: 50;
  border-bottom: 1px solid transparent;
  background: color-mix(in srgb, var(--bg) 82%, transparent);
  -webkit-backdrop-filter: saturate(1.4) blur(14px);
  backdrop-filter: saturate(1.4) blur(14px);
  transition: border-color var(--dur) ease;
}

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

.header-inner {
  display: flex;
  align-items: center;
  gap: var(--space-l);
  height: var(--header-h);
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 0.65rem;
  margin-right: auto;
  color: var(--text);
  font-family: var(--font-display);
  font-size: 1.0625rem;
  font-weight: 650;
  letter-spacing: -0.01em;
  text-decoration: none;
}

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

.brand-mark {
  width: 1.6rem;
  transition: transform 300ms var(--ease);
}

.brand:hover .brand-mark {
  transform: translateY(-2px) rotate(-6deg);
}

.nav-list {
  display: flex;
  gap: 0.25rem;
  list-style: none;
}

.nav-list a {
  display: block;
  padding: 0.45rem 0.8rem;
  border-radius: 999px;
  color: var(--text-muted);
  font-size: 0.9375rem;
  font-weight: 500;
  text-decoration: none;
  transition: color var(--dur) ease, background-color var(--dur) ease;
}

.nav-list a:hover,
.nav-list a[aria-current] {
  color: var(--text);
  background: var(--accent-soft);
}

.nav-resume,
.nav-toggle {
  display: none;
}

.header-actions {
  display: flex;
  align-items: center;
  gap: var(--space-xs);
}

/* Theme toggle: show the icon for the theme you would switch to. */
.theme-toggle .icon {
  transition: transform 400ms var(--ease), opacity 250ms ease;
}

[data-theme="dark"] .theme-toggle .icon-moon,
[data-theme="light"] .theme-toggle .icon-sun {
  opacity: 0;
  transform: rotate(-90deg) scale(0.6);
}

.theme-toggle {
  visibility: hidden;
}

.js .theme-toggle {
  visibility: visible;
}

@media (max-width: 47.99rem) {
  .js .nav-toggle {
    display: inline-grid;
  }

  .header-resume {
    display: none;
  }

  .nav-toggle .icon-close,
  .nav-toggle[aria-expanded="true"] .icon-open {
    opacity: 0;
  }

  .nav-toggle[aria-expanded="true"] .icon-close {
    opacity: 1;
  }

  .js .site-nav {
    order: 3;
  }

  .js .nav-list {
    position: absolute;
    inset: var(--header-h) 0 auto;
    display: none;
    flex-direction: column;
    gap: 0;
    padding: var(--space-s) var(--gutter) var(--space-l);
    border-bottom: 1px solid var(--border);
    background: var(--bg);
    box-shadow: 0 24px 40px -24px rgb(0 0 0 / 0.5);
  }

  .js .nav-list.is-open {
    display: flex;
  }

  .js .nav-list a {
    padding: 0.85rem 0.5rem;
    border-radius: var(--radius-s);
    font-size: var(--step-1);
  }

  .nav-resume {
    display: block;
    margin-top: var(--space-xs);
    padding-top: var(--space-xs);
    border-top: 1px solid var(--border);
  }

  /* Without JavaScript the links simply wrap under the brand. */
  html:not(.js) .header-inner {
    flex-wrap: wrap;
    height: auto;
    padding-block: var(--space-s);
  }

  html:not(.js) .nav-list {
    flex-wrap: wrap;
  }
}

.site-footer {
  padding-block: var(--space-2xl);
  border-top: 1px solid var(--border);
  color: var(--text-muted);
  font-size: var(--step--1);
}

.footer-inner {
  display: grid;
  gap: var(--space-l);
  grid-template-columns: 1fr auto;
  align-items: center;
}

.footer-brand {
  display: flex;
  align-items: center;
  gap: var(--space-s);
}

.footer-mark {
  width: 1.4rem;
  flex: none;
}

.footer-links {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-l);
  list-style: none;
}

.footer-links a,
.hero-links a,
.contact-links a {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  color: var(--text-muted);
  text-decoration: none;
  transition: color var(--dur) ease;
}

.footer-links a:hover,
.hero-links a:hover,
.contact-links a:hover {
  color: var(--accent-text);
}

.colophon {
  grid-column: 1 / -1;
  color: var(--text-faint);
  font-family: var(--font-mono);
  font-size: 0.75rem;
}

@media (max-width: 40rem) {
  .footer-inner {
    grid-template-columns: 1fr;
  }
}

/* 7. Home ------------------------------------------------------------------ */

.hero {
  position: relative;
  overflow: hidden;
  padding-block: clamp(3.5rem, 2rem + 7vw, 8rem) clamp(4rem, 2rem + 6vw, 7rem);
  isolation: isolate;
}

/* A soft ultraviolet glow over a fading dot grid. */
.hero::before,
.hero::after {
  content: "";
  position: absolute;
  z-index: -1;
  pointer-events: none;
}

.hero::before {
  inset: 0;
  background-image: radial-gradient(var(--dot) 1px, transparent 1.2px);
  background-size: 22px 22px;
  -webkit-mask-image: radial-gradient(ellipse 70% 80% at 70% 30%, #000 10%, transparent 70%);
  mask-image: radial-gradient(ellipse 70% 80% at 70% 30%, #000 10%, transparent 70%);
}

.hero::after {
  top: -30%;
  right: -10%;
  width: min(60rem, 90vw);
  aspect-ratio: 1;
  background: radial-gradient(closest-side, var(--glow), transparent 70%);
}

.hero + .section {
  padding-top: calc(var(--section-y) * 0.45);
}

.hero-inner {
  display: grid;
  grid-template-columns: minmax(0, 1.35fr) minmax(0, 1fr);
  gap: clamp(2.5rem, 2rem + 4vw, 5rem);
  align-items: center;
}

.hero-title {
  font-size: var(--step-5);
  font-weight: 700;
  line-height: 0.98;
  letter-spacing: -0.035em;
}

.hero-role {
  margin-top: var(--space-m);
  color: var(--text-muted);
  font-family: var(--font-display);
  font-size: var(--step-2);
  font-weight: 500;
  letter-spacing: -0.01em;
}

.hero-role em {
  color: var(--text);
  background: linear-gradient(transparent 62%, var(--accent-soft) 62%, var(--accent-soft) 92%, transparent 92%);
}

.hero-role .amp {
  color: var(--accent-text);
}

.hero-lede {
  max-width: 34rem;
  margin-top: var(--space-l);
  color: var(--text-muted);
  font-size: var(--step-1);
  line-height: 1.6;
}

.hero-actions {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-s);
  margin-top: var(--space-xl);
}

.hero-links {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-s) var(--space-l);
  margin-top: var(--space-xl);
  list-style: none;
  font-size: 0.9375rem;
}

/* The "spec sheet" card */
.spec {
  position: relative;
  border: 1px solid var(--border);
  border-radius: var(--radius-l);
  background: color-mix(in srgb, var(--surface) 88%, transparent);
  box-shadow: var(--shadow);
  font-family: var(--font-mono);
  font-size: 0.875rem;
}

.spec-bar {
  display: flex;
  align-items: center;
  gap: var(--space-s);
  padding: 0.7rem 1rem;
  border-bottom: 1px solid var(--border);
  color: var(--text-faint);
  font-size: 0.75rem;
}

.spec-dots {
  display: inline-flex;
  gap: 0.35rem;
}

.spec-dots i {
  width: 0.6rem;
  height: 0.6rem;
  border-radius: 50%;
  background: var(--border-strong);
}

.spec-mascot {
  width: 1.25rem;
  margin-left: auto;
  animation: bob 3.2s ease-in-out infinite;
}

@keyframes bob {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-3px); }
}

.spec-list {
  display: grid;
  gap: 0.15rem;
  padding: 1rem 1.15rem 1.2rem;
}

.spec-list div {
  display: grid;
  grid-template-columns: 6.5rem 1fr;
  gap: var(--space-s);
  padding: 0.45rem 0;
  border-bottom: 1px dashed var(--border);
}

.spec-list div:last-child {
  border-bottom: 0;
}

.spec-list dt {
  color: var(--accent-text);
}

.spec-list dt::after {
  content: ":";
  color: var(--text-faint);
}

.spec-list dd {
  color: var(--text);
}

@media (max-width: 56rem) {
  .hero-inner {
    grid-template-columns: 1fr;
  }

  .spec {
    max-width: 30rem;
  }
}

@media (max-width: 26rem) {
  .spec-list div {
    grid-template-columns: 1fr;
    gap: 0;
  }
}

/* Project cards */
.project {
  position: relative;
  display: grid;
  gap: var(--space-l);
  align-content: start;
}

.project-media {
  transition: transform 350ms var(--ease), box-shadow 350ms ease, border-color var(--dur) ease;
}

.project-media img {
  width: 100%;
  aspect-ratio: 16 / 10;
  object-fit: cover;
  object-position: top;
  transition: transform 600ms var(--ease);
}

.project:hover .project-media {
  border-color: var(--accent-line);
  box-shadow: var(--shadow-hover);
  transform: translateY(-3px);
}

.project:hover .project-media img {
  transform: scale(1.015);
}

.project-meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.4rem 1rem;
  margin-bottom: var(--space-s);
}

.project-cats {
  color: var(--text-faint);
  font-family: var(--font-mono);
  font-size: 0.75rem;
}

.project-title {
  font-size: var(--step-2);
}

.project-title a {
  color: var(--text);
  text-decoration: none;
  background-image: linear-gradient(var(--accent), var(--accent));
  background-size: 0 1px;
  background-position: 0 100%;
  background-repeat: no-repeat;
  transition: background-size 300ms var(--ease), color var(--dur) ease;
}

.project-title a:hover,
.project:hover .project-title a {
  color: var(--text);
  background-size: 100% 1px;
}

.project-summary {
  margin-top: var(--space-s);
  color: var(--text-muted);
}

.project .tags {
  margin-top: var(--space-m);
}

.project-actions {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-xs);
  margin-top: var(--space-l);
}

/* Featured (large, horizontal) */
.features {
  display: grid;
  gap: clamp(3rem, 2rem + 4vw, 5.5rem);
  margin-bottom: clamp(3rem, 2rem + 4vw, 5.5rem);
}

.project--feature {
  grid-template-columns: minmax(0, 1.25fr) minmax(0, 1fr);
  gap: clamp(1.5rem, 1rem + 3vw, 4rem);
  align-items: center;
}

.project--feature .project-title {
  font-size: var(--step-3);
}

.project--feature .project-summary {
  font-size: var(--step-1);
  line-height: 1.55;
}

.features > .project--feature:nth-child(even) .project-media {
  order: 2;
}

.card-grid {
  display: grid;
  gap: clamp(2.5rem, 2rem + 2vw, 3.5rem) clamp(1.5rem, 1rem + 2vw, 3rem);
}

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

/* Wide in-progress card */
.in-progress {
  margin-top: clamp(3.5rem, 2.5rem + 4vw, 6rem);
  padding-top: var(--space-2xl);
  border-top: 1px solid var(--border);
}

.project--wide {
  grid-template-columns: minmax(0, 0.8fr) minmax(0, 1.2fr);
  gap: clamp(1.5rem, 1rem + 3vw, 3.5rem);
  align-items: center;
}

@media (max-width: 56rem) {
  .project--feature,
  .project--wide,
  .card-grid--2 {
    grid-template-columns: 1fr;
  }

  .features > .project--feature:nth-child(even) .project-media {
    order: 0;
  }
}

/* UV Bot pipeline diagram */
.pipeline {
  margin: 0;
  padding: clamp(1.25rem, 1rem + 1.5vw, 2rem);
  border: 1px solid var(--border);
  border-radius: var(--radius-m);
  background:
    radial-gradient(circle at 85% 15%, var(--accent-soft), transparent 55%),
    var(--surface);
}

.project-media > a {
  display: block;
  color: inherit;
  text-decoration: none;
}

.project-media .pipeline {
  display: grid;
  align-content: center;
  aspect-ratio: 16 / 10;
  border: 0;
  border-radius: 0;
}

.pipeline ol {
  display: grid;
  gap: 0.55rem;
  list-style: none;
  counter-reset: step;
}

.pipeline li {
  position: relative;
  display: grid;
  grid-template-columns: 2.25rem 1fr;
  align-items: baseline;
  column-gap: var(--space-s);
  padding: 0.6rem 0.85rem;
  border: 1px solid var(--border);
  border-radius: var(--radius-s);
  background: var(--bg);
}

.pipeline li + li::before {
  content: "";
  position: absolute;
  top: calc(-0.55rem - 1px);
  left: calc(0.85rem + 0.85rem);
  width: 1px;
  height: 0.55rem;
  background: var(--accent-line);
}

.pipeline li:last-child {
  border-color: var(--accent-line);
}

.pipeline-step {
  color: var(--accent-text);
  font-family: var(--font-mono);
  font-size: 0.75rem;
}

.pipeline-title {
  font-weight: 600;
  font-size: 0.9375rem;
}

.pipeline-detail {
  grid-column: 2;
  color: var(--text-muted);
  font-size: 0.875rem;
}

.pipeline figcaption {
  margin-top: var(--space-m);
  color: var(--text-faint);
  font-family: var(--font-mono);
  font-size: 0.75rem;
}

.pipeline--compact figcaption {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  margin: 0 0 var(--space-m);
}

.pipeline-mascot {
  width: 1.1rem;
  color: var(--accent);
}

.pipeline--compact ol {
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.5rem 0.6rem;
}

.pipeline--compact li {
  padding: 0.5rem 0.7rem;
  grid-template-columns: 1.75rem 1fr;
}

.pipeline--compact li + li::before {
  display: none;
}

.pipeline--compact .pipeline-title {
  font-size: 0.8125rem;
}

/* How I build */
.steps {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: var(--space-m);
  list-style: none;
}

.step {
  position: relative;
  padding: var(--space-l);
  border: 1px solid var(--border);
  border-radius: var(--radius-m);
  background: var(--surface);
  transition: border-color var(--dur) ease, transform 300ms var(--ease);
}

.step:hover {
  border-color: var(--accent-line);
  transform: translateY(-2px);
}

.step-num {
  display: block;
  margin-bottom: var(--space-l);
  color: var(--accent-text);
  font-family: var(--font-mono);
  font-size: 0.8125rem;
}

.step h3 {
  font-size: var(--step-1);
  line-height: 1.25;
}

.step p {
  margin-top: var(--space-s);
  color: var(--text-muted);
  font-size: 0.9375rem;
  line-height: 1.55;
}

/* A step the content marks as highlighted. */
.step--highlight {
  border-color: var(--accent-line);
  background: linear-gradient(180deg, var(--accent-soft), transparent 70%), var(--surface);
}

@media (max-width: 68rem) {
  .steps {
    grid-template-columns: repeat(auto-fit, minmax(13rem, 1fr));
  }
}

@media (max-width: 30rem) {
  .step-num {
    margin-bottom: var(--space-xs);
  }
}

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

.about-copy {
  font-size: var(--step-1);
  line-height: 1.65;
  color: var(--text-muted);
}

.about-copy p:first-child {
  color: var(--text);
}

.about-side {
  display: grid;
  gap: var(--space-xl);
  justify-items: start;
}

.timeline {
  display: grid;
  width: 100%;
  list-style: none;
  border-left: 1px solid var(--border-strong);
}

.timeline li {
  position: relative;
  display: grid;
  gap: 0.15rem;
  padding: 0 0 var(--space-l) var(--space-l);
}

.timeline li:last-child {
  padding-bottom: 0;
}

.timeline li::before {
  content: "";
  position: absolute;
  top: 0.45rem;
  left: -0.3rem;
  width: 0.6rem;
  height: 0.6rem;
  border: 2px solid var(--bg);
  border-radius: 50%;
  background: var(--border-strong);
}

.timeline li:first-child::before {
  background: var(--accent);
}

.timeline-label {
  color: var(--accent-text);
  font-family: var(--font-mono);
  font-size: 0.75rem;
  text-transform: lowercase;
}

.timeline-title {
  font-weight: 600;
  line-height: 1.4;
}

.timeline-detail {
  color: var(--text-muted);
  font-size: 0.9375rem;
}

.capabilities {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(12.5rem, 1fr));
  gap: var(--space-m);
}

.capability {
  padding: var(--space-l);
  border: 1px solid var(--border);
  border-radius: var(--radius-m);
  background: var(--surface);
}

.capability h4 {
  margin-bottom: var(--space-s);
  font-size: var(--step-0);
  font-weight: 650;
}

.capability ul {
  display: grid;
  gap: 0.3rem;
  list-style: none;
  color: var(--text-muted);
  font-size: 0.9375rem;
}

.capability li {
  position: relative;
  padding-left: 1rem;
  line-height: 1.45;
}

.capability li::before {
  content: "›";
  position: absolute;
  left: 0;
  color: var(--accent-text);
  font-family: var(--font-mono);
}

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

/* Earlier work */
.earlier-list {
  list-style: none;
  border-top: 1px solid var(--border);
}

.earlier-list li {
  border-bottom: 1px solid var(--border);
}

.earlier-item {
  display: grid;
  grid-template-columns: 9rem minmax(12rem, 1fr) minmax(0, 2fr) auto;
  gap: var(--space-l);
  align-items: baseline;
  padding: var(--space-l) var(--space-s);
  color: var(--text);
  text-decoration: none;
  transition: background-color var(--dur) ease;
}

.earlier-item:hover {
  color: var(--text);
  background: var(--accent-soft);
}

.earlier-cats {
  color: var(--text-faint);
  font-family: var(--font-mono);
  font-size: 0.75rem;
}

.earlier-title {
  font-family: var(--font-display);
  font-size: var(--step-1);
  font-weight: 600;
  line-height: 1.3;
}

.earlier-summary {
  color: var(--text-muted);
  font-size: 0.9375rem;
}

.earlier-arrow {
  align-self: center;
  color: var(--accent-text);
  transition: transform var(--dur) var(--ease);
}

.earlier-item:hover .earlier-arrow {
  transform: translateX(3px);
}

@media (max-width: 56rem) {
  .earlier-item {
    grid-template-columns: 1fr auto;
    gap: 0.3rem var(--space-m);
  }

  .earlier-cats,
  .earlier-title,
  .earlier-summary {
    grid-column: 1;
  }

  .earlier-arrow {
    grid-column: 2;
    grid-row: 1 / span 3;
  }
}

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

.contact-intro h1,
.contact-intro h2 {
  font-size: var(--step-4);
}

.contact-intro > p:not(.eyebrow) {
  margin-top: var(--space-m);
  color: var(--text-muted);
  font-size: var(--step-1);
}

.contact-links {
  display: grid;
  gap: var(--space-s);
  margin-top: var(--space-xl);
  list-style: none;
}

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

/* 8. Work & case studies --------------------------------------------------- */

.filters {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-xs);
  margin-bottom: var(--space-l);
}

.filter {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.45rem 0.95rem;
  border: 1px solid var(--border);
  border-radius: 999px;
  color: var(--text-muted);
  font-size: 0.9375rem;
  font-weight: 500;
  text-decoration: none;
  transition: color var(--dur) ease, background-color var(--dur) ease, border-color var(--dur) ease;
}

.filter:hover {
  color: var(--text);
  border-color: var(--border-strong);
}

.filter[aria-current] {
  border-color: var(--accent-text);
  background: var(--accent);
  color: var(--accent-ink);
}

.filter-count {
  color: var(--text-faint);
  font-family: var(--font-mono);
  font-size: 0.75rem;
}

.filter[aria-current] .filter-count {
  color: inherit;
}

.work-group[hidden] {
  display: none;
}

.work-group .subhead {
  margin-top: var(--space-2xl);
}

.archive-list {
  display: grid;
  gap: var(--space-l);
}

.archive-item {
  display: grid;
  grid-template-columns: minmax(0, 22rem) minmax(0, 1fr);
  gap: var(--space-xl);
  padding: var(--space-xl);
  border: 1px solid var(--border);
  border-radius: var(--radius-l);
  background: var(--surface);
  scroll-margin-top: calc(var(--header-h) + 1.5rem);
}

.archive-item:not(:has(.archive-media)) .archive-body {
  grid-column: 1 / -1;
  max-width: 48rem;
}

.archive-item:target {
  border-color: var(--accent-text);
  box-shadow: 0 0 0 4px var(--accent-soft);
}

.archive-media {
  overflow: hidden;
  align-self: start;
  border: 1px solid var(--border);
  border-radius: var(--radius-s);
}

.archive-detail {
  margin-top: var(--space-s);
  color: var(--text-muted);
  font-size: 0.9375rem;
}

.archive-item .tags {
  margin-top: var(--space-m);
}

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

@media (max-width: 48rem) {
  .archive-item {
    grid-template-columns: 1fr;
    padding: var(--space-l);
  }
}

/* Case study */
.case-hero {
  position: relative;
  overflow: hidden;
  padding-block: calc(var(--section-y) * 0.55) var(--space-2xl);
  isolation: isolate;
}

.case-hero::after {
  content: "";
  position: absolute;
  z-index: -1;
  top: -40%;
  left: 40%;
  width: min(50rem, 90vw);
  aspect-ratio: 1;
  background: radial-gradient(closest-side, var(--glow), transparent 70%);
  pointer-events: none;
}

.back-link {
  margin-bottom: var(--space-xl);
  font-size: 0.9375rem;
}

.case-title {
  max-width: 18ch;
  font-size: var(--step-5);
  font-weight: 700;
  line-height: 1;
  letter-spacing: -0.035em;
}

.case-tagline {
  max-width: 40rem;
  margin-top: var(--space-l);
  color: var(--text-muted);
  font-size: var(--step-2);
  font-family: var(--font-display);
  font-weight: 450;
  line-height: 1.35;
}

.case-visual {
  margin-bottom: clamp(3rem, 2rem + 4vw, 5rem);
}

.case-visual .pipeline figcaption {
  max-width: 44rem;
}

@media (min-width: 56rem) {
  .case-visual .pipeline ol {
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: var(--space-m);
  }

  .case-visual .pipeline li {
    grid-template-columns: 1fr;
    align-content: start;
    row-gap: 0.35rem;
    padding: var(--space-m) var(--space-l) var(--space-l);
  }

  .case-visual .pipeline li + li::before {
    display: none;
  }

  .case-visual .pipeline-detail {
    grid-column: 1;
  }
}

.case-layout {
  display: grid;
  grid-template-columns: minmax(0, 17rem) minmax(0, 1fr);
  gap: clamp(2rem, 1rem + 5vw, 6rem);
  align-items: start;
}

.case-facts {
  position: sticky;
  top: calc(var(--header-h) + 1.5rem);
}

.case-facts dl {
  display: grid;
  gap: var(--space-l);
}

.case-facts dt {
  margin-bottom: 0.3rem;
  color: var(--text-faint);
  font-family: var(--font-mono);
  font-size: 0.75rem;
  text-transform: lowercase;
}

.case-facts dd {
  font-size: 0.9375rem;
  line-height: 1.5;
}

.case-body {
  max-width: 44rem;
  font-size: var(--step-1);
  line-height: 1.7;
  color: var(--text-muted);
}

.case-body section + section {
  margin-top: clamp(2.5rem, 2rem + 2vw, 3.5rem);
}

.case-body h2 {
  display: flex;
  align-items: baseline;
  gap: var(--space-s);
  margin-bottom: var(--space-m);
  color: var(--text);
  font-size: var(--step-3);
}

.case-num {
  color: var(--accent-text);
  font-family: var(--font-mono);
  font-size: 0.9rem;
  font-weight: 400;
  letter-spacing: 0;
}

.decisions {
  display: grid;
  gap: var(--space-m);
  list-style: none;
}

.decisions li {
  padding: var(--space-m) var(--space-l);
  border-left: 2px solid var(--accent-line);
  background: var(--surface);
  border-radius: 0 var(--radius-s) var(--radius-s) 0;
  font-size: var(--step-0);
  line-height: 1.6;
}

.decisions strong {
  display: block;
  margin-bottom: 0.2rem;
  color: var(--text);
  font-weight: 600;
}

.related {
  padding: var(--space-l) var(--space-xl);
  border: 1px solid var(--accent-line);
  border-radius: var(--radius-m);
  background: var(--accent-soft);
}

.related h2 {
  font-size: var(--step-2);
}

.gallery {
  margin-top: clamp(3rem, 2rem + 4vw, 5rem);
}

.gallery-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 22rem), 1fr));
  gap: var(--space-l);
  align-items: start;
}

.frame--phone {
  justify-self: center;
  width: min(100%, 17.5rem);
  border-radius: 1.6rem;
}

@media (min-width: 56rem) {
  .gallery-grid--phone {
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr) minmax(0, 0.6fr);
    align-items: center;
  }

  .gallery-grid--phone .frame--phone {
    width: 100%;
  }
}

.case-next {
  margin-top: clamp(4rem, 3rem + 4vw, 6rem);
  margin-bottom: var(--section-y);
  border-top: 1px solid var(--border);
}

.case-next a {
  display: grid;
  gap: 0.4rem;
  padding-top: var(--space-xl);
  color: var(--text);
  text-decoration: none;
}

.case-next-label {
  color: var(--text-faint);
  font-family: var(--font-mono);
  font-size: 0.8125rem;
}

.case-next-title {
  display: inline-flex;
  align-items: center;
  gap: var(--space-s);
  font-family: var(--font-display);
  font-size: var(--step-3);
  font-weight: 650;
  letter-spacing: -0.02em;
}

.case-next-title .icon {
  color: var(--accent-text);
  transition: transform 300ms var(--ease);
}

.case-next a:hover .case-next-title .icon {
  transform: translateX(6px);
}

@media (max-width: 56rem) {
  .case-layout {
    grid-template-columns: 1fr;
  }

  .case-facts {
    position: static;
    padding: var(--space-l);
    border: 1px solid var(--border);
    border-radius: var(--radius-m);
    background: var(--surface);
  }
}

/* 404 */
.not-found .container {
  max-width: 40rem;
}

.not-found h1 {
  font-size: var(--step-4);
}

.not-found p:not(.eyebrow) {
  margin-top: var(--space-m);
  color: var(--text-muted);
  font-size: var(--step-1);
}

.nf-mascot {
  width: 4rem;
  margin-bottom: var(--space-xl);
  animation: bob 3.2s ease-in-out infinite;
}

/* 9. Forms ----------------------------------------------------------------- */

.contact-form {
  display: grid;
  gap: var(--space-l);
  padding: clamp(1.25rem, 1rem + 2vw, 2.25rem);
  border: 1px solid var(--border);
  border-radius: var(--radius-l);
  background: var(--surface);
  box-shadow: var(--shadow);
}

.form-notice:not(:has(*)) {
  display: none;
}

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

.field label {
  font-size: 0.9375rem;
  font-weight: 600;
}

.field input,
.field textarea {
  width: 100%;
  padding: 0.75rem 0.9rem;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-s);
  background: var(--bg);
  color: var(--text);
  font: inherit;
  font-size: 1rem;
  transition: border-color var(--dur) ease, box-shadow var(--dur) ease;
}

.field textarea {
  min-height: 9rem;
  resize: vertical;
}

.field input:hover,
.field textarea:hover {
  border-color: var(--text-faint);
}

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

.field [aria-invalid="true"] {
  border-color: var(--danger);
}

.field-error {
  color: var(--danger);
  font-size: 0.875rem;
}

.form-footer {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--space-m) var(--space-l);
}

.form-hint {
  color: var(--text-faint);
  font-size: 0.8125rem;
}

.hp {
  position: absolute;
  left: -10000px;
  width: 1px;
  height: 1px;
  overflow: hidden;
}

/* 10. Utilities ------------------------------------------------------------ */

.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;
}

[hidden] {
  display: none !important;
}

/* 11. Motion & print ------------------------------------------------------- */

@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;
  }

  .project:hover .project-media,
  .project:hover .project-media img,
  .step:hover,
  .btn:hover {
    transform: none;
  }
}

@media print {
  .site-header,
  .site-footer,
  .hero::before,
  .hero::after,
  .contact-form,
  .project-actions,
  .filters {
    display: none;
  }

  body {
    background: #fff;
    color: #000;
  }
}

/* Dashboard draft preview banner (only rendered inside /admin/preview/) */
.preview-bar {
  position: sticky;
  top: 0;
  z-index: 60;
  padding: 0.6rem var(--gutter);
  background: #fbbf24;
  color: #1b1405;
  font-size: 0.875rem;
  text-align: center;
}

.preview-bar a {
  color: inherit;
  font-weight: 600;
}

.preview-bar + .site-header {
  top: 2.4rem;
}

.preview-hidden {
  margin-bottom: 1.5rem;
}
