/* ------------------------------------------------------------------
   Khaos Systems
   Dark, grid-ruled layout: dashed rails, "+" marks where rules meet,
   halftone dots for texture. Brand orange from the original site.
------------------------------------------------------------------- */

@font-face {
  font-family: "Hanken Grotesk";
  src: url("/assets/fonts/hanken-grotesk.woff2") format("woff2");
  font-weight: 100 900;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: "JetBrains Mono";
  src: url("/assets/fonts/jetbrains-mono.woff2") format("woff2");
  font-weight: 100 800;
  font-style: normal;
  font-display: swap;
}

:root {
  color-scheme: dark;

  --bg: #121111;
  --bg-raised: #181716;
  --fg: #f0e3de;
  --fg-strong: #fffbf5;
  --muted: #9a9390;
  --faint: #5f5a57;
  --line: rgba(240, 227, 222, 0.17);
  --line-strong: rgba(240, 227, 222, 0.38);
  --accent: #ff4000;
  --accent-text: #ff6a33;
  --ink: #160a05;

  --sans: "Hanken Grotesk", ui-sans-serif, system-ui, -apple-system, "Segoe UI", sans-serif;
  --mono: "JetBrains Mono", ui-monospace, "SFMono-Regular", Menlo, Consolas, monospace;

  --frame: 1240px;
  --edge: clamp(8px, 3vw, 32px);
  --pad: clamp(16px, 3.5vw, 40px);
  --header-h: 64px;
  --ease: cubic-bezier(0.2, 0.7, 0.2, 1);
}

/* Pointer position for the halftone spotlights; registered so it can ease. */
@property --mx {
  syntax: "<length-percentage>";
  inherits: true;
  initial-value: 50%;
}

@property --my {
  syntax: "<length-percentage>";
  inherits: true;
  initial-value: 100%;
}

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

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

/* Column layout so <main> stretches and the footer sits at the bottom of short pages */
body {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  min-height: 100dvh;
  margin: 0;
  background: var(--bg);
  color: var(--fg);
  font-family: var(--sans);
  font-size: 16px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
}

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

a {
  color: inherit;
}

h1,
h2,
h3,
p,
ul,
ol,
dl,
dd {
  margin: 0;
}

ul,
ol {
  padding: 0;
  list-style: none;
}

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

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

[hidden] {
  display: none !important;
}

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

.skip {
  position: absolute;
  left: 12px;
  top: -48px;
  z-index: 100;
  padding: 8px 12px;
  background: var(--accent);
  color: var(--ink);
  font: 500 13px/1 var(--mono);
  text-decoration: none;
}

.skip:focus {
  top: 12px;
}

/* ---------- Frame: the two dashed rails that run the full page ---------- */

.frame {
  width: min(var(--frame), calc(100% - 2 * var(--edge)));
  margin-inline: auto;
  border-inline: 1px dashed var(--line);
}

main.frame {
  flex: 1 0 auto;
}

/* Horizontal rule with "+" marks where it crosses the rails */
.section {
  position: relative;
  border-top: 1px dashed var(--line);
}

.section::before,
.section::after {
  content: "";
  position: absolute;
  top: -6px;
  width: 11px;
  height: 11px;
  background:
    linear-gradient(var(--line-strong), var(--line-strong)) center / 1px 100% no-repeat,
    linear-gradient(var(--line-strong), var(--line-strong)) center / 100% 1px no-repeat;
  pointer-events: none;
  z-index: 2;
}

.section::before {
  left: -6.5px;
}

.section::after {
  right: -6.5px;
}

.section--flush {
  border-top: 0;
}

/* ---------- Type primitives ---------- */

.tag {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  font: 500 12px/1 var(--mono);
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
}

.tag::before {
  content: "";
  width: 6px;
  height: 6px;
  background: var(--accent);
}

.section-head {
  display: grid;
  gap: 14px;
  padding: clamp(40px, 6vw, 72px) var(--pad) clamp(28px, 4vw, 44px);
}

.section-head h2,
.page-title {
  font-weight: 500;
  font-size: clamp(30px, 4.2vw, 48px);
  line-height: 1.05;
  letter-spacing: -0.03em;
  color: var(--fg-strong);
}

.section-note {
  max-width: 56ch;
  color: var(--muted);
}

.arrow {
  flex: none;
  width: 16px;
  height: 16px;
  transition: transform 0.25s ease;
}

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

.site-header {
  position: sticky;
  top: 0;
  z-index: 50;
  background: rgba(18, 17, 17, 0.82);
  backdrop-filter: blur(12px) saturate(1.2);
  -webkit-backdrop-filter: blur(12px) saturate(1.2);
  border-bottom: 1px dashed var(--line);
}

.site-header .frame {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  height: var(--header-h);
  padding-inline: var(--pad);
}

.brand {
  display: block;
  flex: none;
}

.brand img {
  height: 30px;
  width: auto;
}

.nav {
  display: flex;
  align-items: center;
  gap: clamp(12px, 2.4vw, 32px);
  font: 500 12px/1 var(--mono);
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.nav a {
  color: var(--muted);
  text-decoration: none;
  transition: color 0.2s ease;
}

.nav a:hover,
.nav a[aria-current="page"] {
  color: var(--fg-strong);
}

.nav .nav-cta {
  padding: 9px 14px;
  border: 1px solid var(--line-strong);
  border-radius: 999px;
  color: var(--fg-strong);
  transition: border-color 0.2s ease, background-color 0.2s ease, color 0.2s ease;
}

.nav .nav-cta:hover {
  background: var(--accent);
  border-color: var(--accent);
  color: var(--ink);
}

@media (max-width: 520px) {
  .brand img {
    height: 26px;
  }

  .nav {
    gap: 14px;
    font-size: 11px;
    letter-spacing: 0.04em;
  }

  .nav .nav-hide-sm {
    display: none;
  }

  .nav .nav-cta {
    padding: 8px 11px;
  }
}

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

.hero {
  position: relative;
  min-height: clamp(420px, 68vh, 640px);
  display: flex;
  align-items: flex-end;
  overflow: hidden;
  border-top: 0;
}

.hero-field {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  -webkit-mask-image: radial-gradient(90% 110% at 78% 18%, #000 25%, transparent 78%);
  mask-image: radial-gradient(90% 110% at 78% 18%, #000 25%, transparent 78%);
}

.hero-copy {
  position: relative;
  display: grid;
  gap: 22px;
  padding: 0 var(--pad) clamp(40px, 6vw, 72px);
}

.hero h1 {
  max-width: 11em;
  font-weight: 500;
  font-size: clamp(42px, 8.2vw, 108px);
  line-height: 0.94;
  letter-spacing: -0.045em;
  color: var(--fg-strong);
}

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

@media (max-width: 600px) {
  .hero {
    min-height: 440px;
  }
}

/* ---------- Intro: description + spec sheet ---------- */

.intro {
  display: grid;
  grid-template-columns: minmax(0, 7fr) minmax(0, 5fr);
}

.intro-copy {
  display: grid;
  align-content: start;
  gap: 18px;
  padding: clamp(32px, 5vw, 56px) var(--pad);
}

.lede {
  font-size: clamp(19px, 2vw, 24px);
  line-height: 1.45;
  letter-spacing: -0.01em;
  color: var(--fg);
  max-width: 34em;
}

.lede strong {
  font-weight: 500;
  color: var(--fg-strong);
}

.intro-copy p:not(.lede) {
  color: var(--muted);
  max-width: 52ch;
}

.spec {
  border-left: 1px dashed var(--line);
  padding: clamp(24px, 4vw, 44px) var(--pad);
  align-self: stretch;
}

.spec > div {
  display: grid;
  grid-template-columns: 96px minmax(0, 1fr);
  gap: 16px;
  padding: 13px 0;
  border-bottom: 1px dashed var(--line);
}

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

.spec dt {
  font: 500 11.5px/1.9 var(--mono);
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--faint);
}

.spec dd {
  font-size: 15px;
  color: var(--fg);
}

.spec a {
  text-decoration-color: var(--line-strong);
  text-underline-offset: 3px;
}

.spec a:hover {
  color: var(--accent-text);
  text-decoration-color: currentColor;
}

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

  .spec {
    border-left: 0;
    border-top: 1px dashed var(--line);
  }
}

/* ---------- Ruled grids (projects, clients) ----------
   Every cell draws its right + bottom rule; the wrapper clips the
   outermost ones so they don't double up with the rails. */

.grid-clip {
  overflow: hidden;
  border-top: 1px dashed var(--line);
}

.grid {
  display: grid;
  grid-template-columns: repeat(var(--cols, 4), minmax(0, 1fr));
  margin: 0 -1px -1px 0;
}

.grid > * {
  border-right: 1px dashed var(--line);
  border-bottom: 1px dashed var(--line);
}

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

.projects {
  --cols: 3;
}

@media (max-width: 1040px) {
  .projects {
    --cols: 2;
  }
}

@media (max-width: 600px) {
  .projects {
    --cols: 1;
  }
}

.project {
  position: relative;
  display: flex;
  flex-direction: column;
  min-height: 340px;
  padding: 22px var(--pad) 22px;
  text-decoration: none;
  isolation: isolate;
  transition: background-color 0.3s ease, --mx 0.25s ease-out, --my 0.25s ease-out;
}

@media (min-width: 601px) {
  .project {
    padding-inline: clamp(20px, 2.2vw, 28px);
  }
}

/* Halftone wash on hover */
.project::before {
  content: "";
  position: absolute;
  inset: 0;
  z-index: -1;
  background-image: radial-gradient(rgba(255, 64, 0, 0.55) 1px, transparent 1.6px);
  background-size: 9px 9px;
  -webkit-mask-image: radial-gradient(220px circle at var(--mx) var(--my), #000, transparent 75%);
  mask-image: radial-gradient(220px circle at var(--mx) var(--my), #000, transparent 75%);
  opacity: 0;
  transition: opacity 0.35s ease;
}

/* Corner ticks on hover */
.project::after {
  --t: var(--accent);
  content: "";
  position: absolute;
  inset: 8px;
  background:
    linear-gradient(var(--t), var(--t)) top left / 12px 1px no-repeat,
    linear-gradient(var(--t), var(--t)) top left / 1px 12px no-repeat,
    linear-gradient(var(--t), var(--t)) top right / 12px 1px no-repeat,
    linear-gradient(var(--t), var(--t)) top right / 1px 12px no-repeat,
    linear-gradient(var(--t), var(--t)) bottom left / 12px 1px no-repeat,
    linear-gradient(var(--t), var(--t)) bottom left / 1px 12px no-repeat,
    linear-gradient(var(--t), var(--t)) bottom right / 12px 1px no-repeat,
    linear-gradient(var(--t), var(--t)) bottom right / 1px 12px no-repeat;
  opacity: 0;
  transform: scale(1.02);
  transition: opacity 0.25s ease, transform 0.25s ease;
  pointer-events: none;
}

.project:hover,
.project:focus-visible {
  background-color: var(--bg-raised);
}

.project:hover::before,
.project:focus-visible::before {
  opacity: 1;
}

.project:hover::after,
.project:focus-visible::after {
  opacity: 1;
  transform: none;
}

.project:focus-visible {
  outline-offset: -2px;
  border-radius: 0;
}

.project-top {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font: 500 11.5px/1 var(--mono);
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--faint);
}

.project-top .arrow {
  color: var(--muted);
}

.project:hover .project-top .arrow {
  color: var(--accent);
  transform: translate(2px, -2px);
}

.glyph {
  height: 72px;
  margin: 34px 0 30px;
}

.glyph svg {
  width: auto;
  height: 100%;
}

.glyph circle {
  fill: var(--faint);
  opacity: 0.45;
  transition: fill 0.2s ease, opacity 0.2s ease;
}

.glyph circle.on {
  fill: var(--fg-strong);
  opacity: 1;
  transition-delay: var(--d, 0ms);
}

.project:hover .glyph circle.on,
.project:focus-visible .glyph circle.on {
  fill: var(--accent);
}

.project-name {
  font-weight: 500;
  font-size: 24px;
  line-height: 1.15;
  letter-spacing: -0.02em;
  color: var(--fg-strong);
}

.project-desc {
  margin-top: 10px;
  color: var(--muted);
  font-size: 15px;
}

.project-foot {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  margin-top: auto;
  padding-top: 24px;
  font: 500 11.5px/1.4 var(--mono);
  letter-spacing: 0.04em;
  color: var(--faint);
}

.project-foot .domain {
  color: var(--muted);
}

.project:hover .project-foot .domain {
  color: var(--fg-strong);
}

/* ---------- Clients ---------- */

.clients {
  --cols: 6;
}

@media (max-width: 1040px) {
  .clients {
    --cols: 5;
  }
}

@media (max-width: 760px) {
  .clients {
    --cols: 3;
  }
}

@media (max-width: 480px) {
  .clients {
    --cols: 2;
  }
}

.client {
  display: grid;
  place-items: center;
  height: clamp(104px, 11vw, 136px);
  padding: 20px;
}

.client img {
  max-width: min(84%, 150px);
  max-height: 46px;
  width: auto;
  height: auto;
  object-fit: contain;
  /* Flatten every logo to a single tone */
  filter: brightness(0) invert(1);
  opacity: 0.55;
  transition: opacity 0.25s ease;
}

.client img.tall {
  max-height: 64px;
}

.client img.wide {
  max-width: min(90%, 190px);
}

.client:hover img {
  opacity: 1;
}

/* Halftone spotlight behind the logos, following the pointer */
.clients {
  position: relative;
  isolation: isolate;
  transition: --mx 0.25s ease-out, --my 0.25s ease-out;
}

.clients::before {
  content: "";
  position: absolute;
  inset: 0;
  z-index: -1;
  background-image: radial-gradient(rgba(255, 64, 0, 0.4) 1px, transparent 1.6px);
  background-size: 9px 9px;
  -webkit-mask-image: radial-gradient(170px circle at var(--mx) var(--my), #000, transparent 75%);
  mask-image: radial-gradient(170px circle at var(--mx) var(--my), #000, transparent 75%);
  opacity: 0;
  transition: opacity 0.4s ease;
  pointer-events: none;
}

.clients:hover::before {
  opacity: 1;
}

/* The "+N" cell that unfolds the rest of the list */
.client--toggle {
  padding: 0;
  place-items: stretch;
}

.client--toggle button {
  display: grid;
  place-content: center;
  gap: 8px;
  width: 100%;
  height: 100%;
  padding: 0;
  border: 0;
  background: none;
  color: inherit;
  font: inherit;
  cursor: pointer;
  transition: background-color 0.25s ease;
}

.client--toggle button:hover {
  background: var(--bg-raised);
}

.client--toggle button:focus-visible {
  outline-offset: -2px;
  border-radius: 0;
}

.more-count {
  font-weight: 500;
  font-size: 30px;
  line-height: 1;
  letter-spacing: -0.02em;
  color: var(--fg-strong);
  transition: color 0.2s ease;
}

.client--toggle.is-open .more-count {
  font-size: 20px;
}

.client--toggle button:hover .more-count {
  color: var(--accent-text);
}

.more-note {
  font: 500 10.5px/1.4 var(--mono);
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--faint);
}

.client--fill {
  background-image: radial-gradient(var(--line-strong) 1px, transparent 1.4px);
  background-size: 9px 9px;
  opacity: 0.6;
}

/* ---------- Post list ---------- */

.posts {
  border-top: 1px dashed var(--line);
}

.post-row {
  display: grid;
  grid-template-columns: 132px 96px minmax(0, 1fr) auto;
  align-items: baseline;
  gap: 20px;
  padding: 26px var(--pad);
  border-bottom: 1px dashed var(--line);
  text-decoration: none;
  transition: background-color 0.25s ease;
}

.posts li:last-child .post-row {
  border-bottom: 0;
}

.post-row:hover {
  background: var(--bg-raised);
}

.post-row time,
.post-cat {
  font: 500 12px/1.6 var(--mono);
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--faint);
}

.post-cat {
  color: var(--accent-text);
}

.post-title {
  display: block;
  font-weight: 500;
  font-size: 20px;
  line-height: 1.3;
  letter-spacing: -0.01em;
  color: var(--fg-strong);
}

.post-excerpt {
  display: block;
  margin-top: 4px;
  color: var(--muted);
  font-size: 15px;
}

.post-row .arrow {
  align-self: center;
  color: var(--muted);
}

.post-row:hover .arrow {
  color: var(--accent);
  transform: translateX(3px);
}

.post-row:focus-visible {
  outline-offset: -2px;
  border-radius: 0;
}

@media (max-width: 700px) {
  .post-row {
    grid-template-columns: auto 1fr auto;
    row-gap: 8px;
    column-gap: 14px;
  }

  .post-row > span:has(.post-title) {
    grid-column: 1 / -1;
    grid-row: 2;
  }

  .post-row .arrow {
    grid-column: 3;
    grid-row: 1;
    justify-self: end;
  }
}

.more-link {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  font: 500 12px/1 var(--mono);
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--fg);
  text-decoration: none;
}

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

.more-link:hover .arrow {
  transform: translateX(3px);
}

.section-foot {
  padding: 22px var(--pad);
  border-top: 1px dashed var(--line);
}

.more-line {
  font: 500 12px/1.5 var(--mono);
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
}

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

.contact {
  padding: clamp(16px, 3vw, 32px) var(--pad) clamp(40px, 6vw, 72px);
}

@media (max-width: 600px) {
  .contact {
    padding-inline: 8px;
  }
}

.contact-panel {
  position: relative;
  overflow: hidden;
  display: grid;
  gap: 20px;
  padding: clamp(28px, 5vw, 64px) clamp(18px, 5vw, 64px);
  border-radius: 10px;
  background: var(--accent);
  color: var(--ink);
  isolation: isolate;
  --mx: 100%;
  --my: 0%;
  transition: --mx 0.9s var(--ease), --my 0.9s var(--ease);
}

/* Halftone texture, fading from the top-right corner */
.contact-panel::before {
  content: "";
  position: absolute;
  inset: 0;
  z-index: -1;
  background-image: radial-gradient(rgba(22, 10, 5, 0.3) 1.1px, transparent 1.7px);
  background-size: 8px 8px;
  -webkit-mask-image: radial-gradient(240px circle at var(--mx) var(--my), #000 10%, transparent 75%);
  mask-image: radial-gradient(240px circle at var(--mx) var(--my), #000 10%, transparent 75%);
}

.contact-panel .tag {
  color: var(--ink);
  opacity: 0.8;
}

.contact-panel .tag::before {
  background: var(--ink);
}

.contact-panel h2 {
  font-weight: 500;
  font-size: clamp(30px, 4.2vw, 48px);
  line-height: 1.05;
  letter-spacing: -0.03em;
}

.email-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 14px 20px;
  margin-top: 8px;
}

.email {
  font-weight: 500;
  font-size: clamp(22px, 6.2vw, 76px);
  line-height: 1;
  letter-spacing: -0.035em;
  text-decoration: underline;
  text-decoration-thickness: 2px;
  text-underline-offset: 0.14em;
  text-decoration-color: rgba(22, 10, 5, 0.3);
  transition: text-decoration-color 0.2s ease;
}

.email:hover {
  text-decoration-color: currentColor;
}

.copy {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 10px 14px;
  border: 1px solid rgba(22, 10, 5, 0.45);
  border-radius: 999px;
  background: transparent;
  color: var(--ink);
  font: 500 12px/1 var(--mono);
  letter-spacing: 0.08em;
  text-transform: uppercase;
  cursor: pointer;
  transition: background-color 0.2s ease, color 0.2s ease;
}

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

.copy:focus-visible {
  outline-color: var(--ink);
}

.copy svg {
  width: 14px;
  height: 14px;
}

.contact-alt {
  max-width: 52ch;
  font-size: 16px;
}

.contact-alt a {
  font-weight: 500;
  text-underline-offset: 3px;
}

.contact-panel :focus-visible {
  outline-color: var(--ink);
}

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

.site-footer {
  border-top: 1px dashed var(--line);
}

.footer-inner {
  display: grid;
  gap: 32px;
  padding: 44px var(--pad) 0;
}

.footer-top {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: flex-start;
  gap: 28px 48px;
}

.footer-brand img {
  height: 34px;
  width: auto;
}

.footer-brand p {
  margin-top: 14px;
  color: var(--muted);
  font-size: 14px;
}

.footer-links {
  display: flex;
  flex-wrap: wrap;
  gap: 28px 56px;
}

.footer-links h3 {
  margin-bottom: 14px;
  font: 500 11.5px/1 var(--mono);
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--faint);
}

.footer-links li + li {
  margin-top: 8px;
}

.footer-links a {
  color: var(--muted);
  text-decoration: none;
  font-size: 14px;
}

.footer-links a:hover {
  color: var(--fg-strong);
}

.wordmark {
  width: 100%;
  height: auto;
  margin-top: 8px;
}

.wordmark circle {
  fill: rgba(240, 227, 222, 0.07);
}

.wordmark circle.on {
  fill: var(--faint);
}

/* Dots under the pointer light up at once and fade back slowly */
.wordmark circle {
  transition: fill 0.9s ease;
}

.wordmark circle.hot {
  fill: rgba(240, 227, 222, 0.22);
  transition-duration: 0.1s;
}

.wordmark circle.on.hot {
  fill: var(--accent);
}

.footer-base {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 8px 24px;
  padding: 18px 0 28px;
  border-top: 1px dashed var(--line);
  font: 500 11.5px/1.6 var(--mono);
  letter-spacing: 0.04em;
  color: var(--faint);
}

/* ---------- Blog pages ---------- */

.page-head {
  display: grid;
  gap: 16px;
  padding: clamp(48px, 8vw, 96px) var(--pad) clamp(32px, 5vw, 56px);
  border-top: 0;
}

.page-head .section-note {
  font-size: 17px;
}

.article {
  padding: clamp(40px, 6vw, 72px) var(--pad) clamp(56px, 8vw, 96px);
  border-top: 0;
}

.article-inner {
  max-width: 700px;
  margin-inline: auto;
}

.back-link {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  font: 500 12px/1 var(--mono);
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
  text-decoration: none;
}

.back-link .arrow {
  transform: rotate(180deg);
}

.back-link:hover {
  color: var(--fg-strong);
}

.back-link:hover .arrow {
  transform: rotate(180deg) translateX(3px);
}

.article-meta {
  display: flex;
  gap: 16px;
  margin-top: 40px;
  font: 500 12px/1 var(--mono);
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--faint);
}

.article-meta .post-cat {
  line-height: 1;
}

.article h1 {
  margin-top: 18px;
  font-weight: 500;
  font-size: clamp(34px, 5.2vw, 56px);
  line-height: 1.04;
  letter-spacing: -0.035em;
  color: var(--fg-strong);
}

.article-figure {
  margin: 36px 0 8px;
  border: 1px dashed var(--line);
  padding: 8px;
  border-radius: 6px;
}

.article-figure img {
  width: 100%;
  height: auto;
  border-radius: 3px;
}

.prose {
  margin-top: 28px;
  font-size: 18px;
  line-height: 1.7;
  color: var(--fg);
}

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

.prose strong {
  font-weight: 600;
  color: var(--fg-strong);
}

.prose a {
  color: var(--accent-text);
  text-underline-offset: 3px;
}

.prose a:hover {
  color: var(--fg-strong);
}

.button {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 13px 20px;
  border-radius: 999px;
  background: var(--accent);
  color: var(--ink);
  font: 500 13px/1 var(--mono);
  letter-spacing: 0.06em;
  text-transform: uppercase;
  text-decoration: none;
  transition: background-color 0.2s ease;
}

.prose a.button {
  color: var(--ink);
}

.button:hover {
  background: var(--fg-strong);
}

.button:hover .arrow {
  transform: translateX(3px);
}

/* ---------- Entrance motion ----------
   Only under html.motion-ok, which the inline script in <head> sets when the
   visitor hasn't asked for reduced motion. main.js adds .is-in / .is-drawn as
   things scroll into view. Keep the selector list in sync with REVEAL there. */

.motion-ok :is(.section-head, .intro-copy, .spec > div, .project, .client:not(.client--fill), .posts li,
  .section-foot, .contact-panel, .page-head > *, .article-inner, .footer-inner > *) {
  transition: opacity 0.8s var(--ease), transform 0.8s var(--ease);
  transition-delay: var(--delay, 0ms);
}

.motion-ok :is(.section-head, .intro-copy, .spec > div, .project, .client:not(.client--fill), .posts li,
  .section-foot, .contact-panel, .page-head > *, .article-inner, .footer-inner > *):not(.is-in) {
  opacity: 0;
  transform: translateY(16px);
}

/* Cards keep their hover transitions alongside the entrance */
.motion-ok .projects .project {
  transition:
    opacity 0.8s var(--ease) var(--delay, 0ms),
    transform 0.8s var(--ease) var(--delay, 0ms),
    background-color 0.3s ease,
    --mx 0.25s ease-out,
    --my 0.25s ease-out;
}

.motion-ok .contact .contact-panel {
  transition:
    opacity 0.8s var(--ease) var(--delay, 0ms),
    transform 0.8s var(--ease) var(--delay, 0ms),
    --mx 0.9s var(--ease),
    --my 0.9s var(--ease);
}

/* Glyphs light up dot by dot once their card is in */
.motion-ok .project:not(.is-in) .glyph circle.on {
  fill: var(--faint);
  opacity: 0.45;
}

.motion-ok .project:not(.booted) .glyph circle.on {
  transition-delay: calc(var(--d, 0ms) + var(--delay, 0ms) + 300ms);
}

/* Hero: copy rises in, dot field fades up */
.motion-ok .hero-copy > * {
  animation: rise 1s var(--ease) both;
}

.motion-ok .hero-copy > :nth-child(2) {
  animation-delay: 0.12s;
}

.motion-ok .hero-field {
  animation: fade-in 1.8s ease both;
}

@keyframes rise {
  from {
    opacity: 0;
    transform: translateY(20px);
  }
}

@keyframes fade-in {
  from {
    opacity: 0;
  }
}

/* Section rules draw in from the left; the "+" marks turn into place */
.motion-ok .section:not(.hero, .page-head, .article, .section--flush) {
  border-top-color: transparent;
  background-image: repeating-linear-gradient(90deg, var(--line) 0 3px, transparent 3px 6px);
  background-origin: border-box;
  background-position: 0 0;
  background-repeat: no-repeat;
  background-size: 0% 1px;
  transition: background-size 1.4s var(--ease);
}

.motion-ok .section.is-drawn {
  background-size: 100% 1px;
}

.motion-ok .section::before,
.motion-ok .section::after {
  transition: opacity 0.6s ease 0.3s, transform 0.9s var(--ease) 0.3s;
}

.motion-ok .section:not(.is-drawn)::before,
.motion-ok .section:not(.is-drawn)::after {
  opacity: 0;
  transform: rotate(-90deg) scale(0.4);
}

/* ---------- Motion preferences ----------
   Reduced motion switches transitions off, unless the page was opened
   with ?motion (which sets .motion-ok) to preview them. */

@media (prefers-reduced-motion: reduce) {
  html:not(.motion-ok) {
    scroll-behavior: auto;
  }

  html:not(.motion-ok) *,
  html:not(.motion-ok) *::before,
  html:not(.motion-ok) *::after {
    transition-duration: 0.01ms !important;
    transition-delay: 0ms !important;
  }
}
