/* ==========================================================================
   Black Light Logic
   Two tokens drive the brand: --paper (the page) and --ink (the lamp and its
   light). Dark mode swaps them, which turns the logo into the dark artwork.
   ========================================================================== */

/* ---------- Tokens ---------- */

:root {
  --paper: #ffffff;
  --ink: #000000;
  --text: #0b0b0c;
  --muted: #55555c;
  --faint: #8c8c93;
  --line: rgb(0 0 0 / 0.1);
  --line-strong: rgb(0 0 0 / 0.22);
  --surface: #f6f6f5;
  --halo: rgb(0 0 0 / 0.07);
  --beam: rgb(0 0 0 / 0.09);
  --glow: 0.22;

  --font-display: "Unbounded", ui-sans-serif, system-ui, sans-serif;
  --font-body: "Inter", ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --font-mono: "JetBrains Mono", ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;

  --max: 1200px;
  --gutter: clamp(1rem, 4vw, 2.5rem);
  --header-h: 72px;
  --radius: 22px;
  --pad: clamp(1.5rem, 3vw, 2.5rem);
  --ease: cubic-bezier(0.2, 0.7, 0.2, 1);

  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --paper: #000000;
    --ink: #ffffff;
    --text: #f2f2f2;
    --muted: #a2a2a9;
    --faint: #6e6e75;
    --line: rgb(255 255 255 / 0.11);
    --line-strong: rgb(255 255 255 / 0.24);
    --surface: #0a0a0b;
    --halo: rgb(255 255 255 / 0.08);
    --beam: rgb(255 255 255 / 0.1);
    --glow: 0.4;
    color-scheme: dark;
  }
}

:root[data-theme="dark"] {
  --paper: #000000;
  --ink: #ffffff;
  --text: #f2f2f2;
  --muted: #a2a2a9;
  --faint: #6e6e75;
  --line: rgb(255 255 255 / 0.11);
  --line-strong: rgb(255 255 255 / 0.24);
  --surface: #0a0a0b;
  --halo: rgb(255 255 255 / 0.08);
  --beam: rgb(255 255 255 / 0.1);
  --glow: 0.4;
  color-scheme: dark;
}

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

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

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

body {
  margin: 0;
  min-height: 100vh;
  background: var(--paper);
  color: var(--text);
  font: 400 1rem/1.65 var(--font-body);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  overflow-x: clip;
}

h1,
h2,
h3,
p {
  margin: 0;
}

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

a {
  color: inherit;
}

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

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

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

.sprite {
  position: absolute;
  width: 0;
  height: 0;
  overflow: hidden;
}

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

.skip-link {
  position: absolute;
  top: -100px;
  left: 1rem;
  z-index: 100;
  padding: 0.75rem 1rem;
  border-radius: 10px;
  background: var(--ink);
  color: var(--paper);
  font-weight: 500;
  text-decoration: none;
}

.skip-link:focus {
  top: 1rem;
}

/* ---------- Logo artwork (inline SVG) ---------- */

.beam-stop {
  stop-color: var(--ink);
}

.beam-stop-end {
  stop-opacity: 0;
}

.lamp-circuit,
.lamp-mouth {
  fill: var(--paper);
}

.lamp-shade {
  fill: var(--ink);
  stroke: var(--ink);
}

.lamp-stem {
  fill: var(--ink);
  stroke: var(--paper);
  stroke-width: 5;
}

.mark .lamp-stem {
  stroke-width: 22;
}

.mark {
  overflow: visible;
}

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

.site-header {
  position: sticky;
  top: 0;
  z-index: 50;
  height: var(--header-h);
  background: var(--paper);
  background: color-mix(in srgb, var(--paper) 82%, transparent);
  -webkit-backdrop-filter: saturate(160%) blur(16px);
  backdrop-filter: saturate(160%) blur(16px);
  border-bottom: 1px solid transparent;
  transition: border-color 0.3s;
}

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

.header-inner {
  display: flex;
  align-items: center;
  gap: clamp(1rem, 3vw, 2.5rem);
  height: 100%;
}

.brand {
  display: flex;
  align-items: center;
  gap: 0.8rem;
  margin-right: auto;
  color: var(--ink);
  text-decoration: none;
}

.brand-mark {
  width: 30px;
  height: 30px;
}

.brand-word {
  width: 172px;
  height: auto;
}

.brand-word use {
  stroke: currentColor;
  stroke-width: 2;
}

.nav {
  display: flex;
  gap: clamp(1.25rem, 3vw, 2.25rem);
}

.nav a {
  position: relative;
  color: var(--muted);
  font: 500 0.75rem/1 var(--font-mono);
  letter-spacing: 0.14em;
  text-transform: uppercase;
  text-decoration: none;
  transition: color 0.2s;
}

.nav a::after {
  content: "";
  position: absolute;
  right: 0;
  bottom: -6px;
  left: 0;
  height: 1px;
  background: currentColor;
  transform: scaleX(0);
  transform-origin: right;
  transition: transform 0.35s var(--ease);
}

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

.nav a:hover::after {
  transform: scaleX(1);
  transform-origin: left;
}

/* The theme switch is a lamp pull-cord hanging from the top of the page. */
.cord {
  position: relative;
  align-self: flex-start;
  width: 44px;
  height: 64px;
  margin-right: -6px;
  padding: 0;
  border: 0;
  background: none;
  color: var(--ink);
  cursor: pointer;
  transform-origin: 50% 0;
  -webkit-tap-highlight-color: transparent;
}

.cord-string {
  position: absolute;
  top: 0;
  left: calc(50% - 0.5px);
  width: 1px;
  height: 42px;
  background: currentColor;
  transform-origin: top;
}

.cord-bead {
  position: absolute;
  top: 40px;
  left: calc(50% - 5px);
  width: 10px;
  height: 15px;
  border-radius: 5px;
  background: currentColor;
}

.cord:focus-visible {
  outline-offset: -2px;
}

.cord.is-pulled .cord-string {
  animation: cord-stretch 0.5s var(--ease);
}

.cord.is-pulled .cord-bead {
  animation: cord-pull 0.5s var(--ease);
}

@media (hover: hover) {
  .cord:hover {
    animation: cord-sway 1.6s var(--ease);
  }
}

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

.hero {
  display: grid;
  grid-template-columns: minmax(0, 1.08fr) minmax(0, 1fr);
  align-items: center;
  gap: clamp(2rem, 5vw, 5rem);
  min-height: calc(100svh - var(--header-h));
  padding-block: clamp(2rem, 6vh, 4rem) clamp(3rem, 8vh, 5rem);
}

.hero-copy {
  display: grid;
  justify-items: start;
  gap: 1.5rem;
}

.hero-copy > * {
  animation: rise 1s var(--ease) both;
}

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

.hero-copy > :nth-child(3) {
  animation-delay: 0.16s;
}

.hero-copy > :nth-child(4) {
  animation-delay: 0.24s;
}

.eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 0.7rem;
  color: var(--muted);
  font: 500 0.75rem/1 var(--font-mono);
  letter-spacing: 0.16em;
  text-transform: uppercase;
}

.pulse {
  position: relative;
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--ink);
}

.pulse::after {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: inherit;
  background: inherit;
  animation: ping 2.4s var(--ease) infinite;
}

.display {
  font: 200 clamp(2.6rem, 5.6vw, 5rem) / 1.02 var(--font-display);
  letter-spacing: -0.035em;
}

@supports (background-clip: text) and (color: color-mix(in srgb, red, blue)) {
  .glow-text {
    background: linear-gradient(180deg, var(--ink) 30%, color-mix(in srgb, var(--ink) 28%, transparent));
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
  }
}

.lede {
  max-width: 34rem;
  color: var(--muted);
  font-size: clamp(1.0625rem, 1.4vw, 1.1875rem);
}

.lede a,
.contact-note a,
.prose a {
  color: var(--text);
  text-decoration-color: var(--line-strong);
  text-decoration-thickness: 1px;
  text-underline-offset: 3px;
  transition: text-decoration-color 0.2s;
}

.lede a:hover,
.contact-note a:hover,
.prose a:hover {
  text-decoration-color: currentColor;
}

.actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  margin-top: 0.5rem;
}

.btn {
  display: inline-flex;
  align-items: center;
  gap: 0.6rem;
  height: 50px;
  padding: 0 1.5rem;
  border: 1px solid transparent;
  border-radius: 999px;
  font: 500 0.9375rem/1 var(--font-body);
  text-decoration: none;
  transition: transform 0.25s var(--ease), border-color 0.25s;
}

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

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

.btn-solid {
  background: var(--ink);
  color: var(--paper);
}

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

.btn-line {
  border-color: var(--line-strong);
  color: var(--text);
}

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

.hero-art {
  position: relative;
  justify-self: center;
  width: min(100%, 600px);
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}

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

.lamp-glow {
  opacity: var(--glow);
  transition: opacity 0.6s var(--ease);
}

.hero-art:hover .lamp-glow {
  opacity: calc(var(--glow) * 1.6);
}

/* The lamp flickers on when the page loads. */
.lamp-light {
  animation: lamp-on 2.2s 0.35s both;
}

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

.section {
  padding-block: clamp(5rem, 11vw, 8.5rem);
}

.section-head {
  display: grid;
  gap: 1.1rem;
  max-width: 46rem;
  margin-bottom: clamp(2.5rem, 5vw, 4rem);
}

.kicker {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  color: var(--muted);
  font: 500 0.75rem/1 var(--font-mono);
  letter-spacing: 0.16em;
  text-transform: uppercase;
}

.kicker span {
  color: var(--text);
}

.kicker::after {
  content: "";
  width: 3rem;
  height: 1px;
  background: var(--line-strong);
}

.section-title {
  font: 200 clamp(2rem, 4.2vw, 3.25rem) / 1.08 var(--font-display);
  letter-spacing: -0.03em;
}

.section-intro {
  max-width: 38rem;
  color: var(--muted);
  font-size: 1.0625rem;
}

/* ---------- Work ---------- */

.work-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: clamp(0.75rem, 1.5vw, 1.25rem);
}

.work-grid > :nth-child(2) {
  transition-delay: 0.08s;
}

.work-grid > :nth-child(3) {
  transition-delay: 0.16s;
}

.card {
  position: relative;
  isolation: isolate;
  display: flex;
  flex-direction: column;
  gap: 1rem;
  padding: var(--pad);
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  transition: border-color 0.3s var(--ease), opacity 0.9s var(--ease), transform 0.9s var(--ease);
}

/* A soft spotlight follows the pointer across each card. */
.card::before {
  content: "";
  position: absolute;
  inset: 0;
  z-index: -1;
  background: radial-gradient(520px circle at var(--mx, 50%) var(--my, 0%), var(--halo), transparent 65%);
  opacity: 0;
  transition: opacity 0.4s var(--ease);
}

.card:hover {
  border-color: var(--line-strong);
}

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

.card-feature {
  grid-column: 1 / -1;
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  align-items: center;
  gap: clamp(1.5rem, 4vw, 4rem);
}

.card-body {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 1rem;
}

.card-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
}

.card-index {
  color: var(--faint);
  font: 400 0.75rem/1 var(--font-mono);
  letter-spacing: 0.1em;
}

.status {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.45rem 0.7rem;
  border: 1px solid var(--line-strong);
  border-radius: 999px;
  font: 500 0.6875rem/1 var(--font-mono);
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

.status::before {
  content: "";
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: currentColor;
}

.status-live::before {
  animation: blink 2.4s steps(1) infinite;
}

.status-soon::before {
  background: transparent;
  border: 1px solid currentColor;
}

.card-title {
  margin-top: 0.25rem;
  font: 300 clamp(1.75rem, 3vw, 2.5rem) / 1.1 var(--font-display);
  letter-spacing: -0.02em;
}

.card-tagline {
  font-size: 1.125rem;
  font-weight: 500;
  line-height: 1.4;
}

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

.tags {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  margin: 0.25rem 0 0;
  padding: 0;
  list-style: none;
}

.tags li {
  padding: 0.45rem 0.6rem;
  border: 1px solid var(--line);
  border-radius: 6px;
  color: var(--muted);
  font: 400 0.75rem/1 var(--font-mono);
}

.card-link {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  margin-top: 0.5rem;
  font-weight: 500;
  text-decoration: underline;
  text-decoration-color: var(--line-strong);
  text-underline-offset: 4px;
}

/* Make the whole card clickable. */
.card-link::after {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: inherit;
}

.card-link .icon {
  transition: transform 0.3s var(--ease);
}

.card:hover .card-link .icon {
  transform: translate(2px, -2px);
}

/* DocuMemory: a tiny session log */
.term {
  overflow: hidden;
  border: 1px solid var(--line-strong);
  border-radius: 14px;
  background: var(--paper);
  box-shadow: 0 40px 80px -40px var(--halo);
  font: 400 0.8125rem/1.5 var(--font-mono);
}

.term-bar {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.75rem 1rem;
  border-bottom: 1px solid var(--line);
}

.term-bar span {
  width: 9px;
  height: 9px;
  border: 1px solid var(--line-strong);
  border-radius: 50%;
}

.term-bar em {
  margin-left: auto;
  color: var(--faint);
  font-size: 0.6875rem;
  font-style: normal;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.term-lines {
  display: grid;
  gap: 0.7rem;
  margin: 0;
  padding: 1.1rem 1rem 1.25rem;
  list-style: none;
}

.term-lines li {
  display: grid;
  grid-template-columns: 6.25rem 3.75rem minmax(0, 1fr);
  gap: 0.5rem;
  white-space: nowrap;
}

.term-lines b {
  color: var(--text);
  font-weight: 500;
}

.term-lines i {
  color: var(--faint);
  font-style: normal;
}

.term-lines span {
  overflow: hidden;
  color: var(--muted);
  text-overflow: ellipsis;
}

.term-lines .term-out {
  padding-top: 0.7rem;
  border-top: 1px dashed var(--line);
}

.term-lines .term-out span {
  color: var(--text);
}

.js .term-lines li {
  opacity: 0;
  transform: translateY(6px);
  transition: opacity 0.5s var(--ease), transform 0.5s var(--ease);
}

.is-in .term-lines li {
  opacity: 1;
  transform: none;
}

.is-in .term-lines li:nth-child(2) {
  transition-delay: 0.45s;
}

.is-in .term-lines li:nth-child(3) {
  transition-delay: 0.9s;
}

.is-in .term-lines li:nth-child(4) {
  transition-delay: 1.35s;
}

/* Android: a phone peeking up from the bottom of the card */
.phone {
  align-self: flex-end;
  width: 150px;
  height: 200px;
  margin: auto 0 calc(-1 * var(--pad) - 1px);
  padding: 9px 9px 0;
  border: 1px solid var(--line-strong);
  border-bottom: 0;
  border-radius: 28px 28px 0 0;
  background: var(--paper);
  transition: transform 0.5s var(--ease);
}

.phone-screen {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.55rem;
  height: 100%;
  border: 1px solid var(--line);
  border-bottom: 0;
  border-radius: 20px 20px 0 0;
  background: var(--surface);
}

.phone-mark {
  width: 64px;
  height: 64px;
  margin-bottom: 0.4rem;
}

.phone-line {
  width: 64px;
  height: 5px;
  border-radius: 3px;
  background: var(--line-strong);
}

.phone-line.short {
  width: 38px;
  background: var(--line);
}

.card:hover .phone {
  transform: translateY(-8px);
}

/* The lab: a breadboard with a signal running along its wires */
.breadboard {
  width: calc(100% + 2 * var(--pad));
  height: 150px;
  margin: auto calc(-1 * var(--pad)) calc(-1 * var(--pad));
  -webkit-mask-image: linear-gradient(to bottom, transparent, #000 45%);
  mask-image: linear-gradient(to bottom, transparent, #000 45%);
}

.bb-hole {
  fill: var(--line-strong);
}

.bb-wire,
.bb-pulse {
  fill: none;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 1.5;
}

.bb-wire {
  stroke: var(--line-strong);
}

.bb-pulse {
  stroke: var(--ink);
  stroke-dasharray: 10 90;
  animation: signal 3.2s linear infinite;
}

.bb-pulse + .bb-pulse {
  animation-delay: -1.6s;
}

.bb-node {
  fill: var(--ink);
}

/* ---------- Approach ---------- */

.logic {
  display: grid;
  grid-template-columns: minmax(0, 1.35fr) minmax(0, 1fr);
  align-items: center;
}

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

.logic-row {
  position: relative;
  display: grid;
  grid-template-columns: 2.75rem minmax(0, 24rem) minmax(2rem, 1fr);
  align-items: center;
  column-gap: 1.25rem;
  padding-block: 1.4rem;
}

/* Vertical bus collecting the four input wires */
.logic-row::after {
  content: "";
  position: absolute;
  top: 0;
  right: 0;
  bottom: 0;
  width: 1px;
  background: var(--line-strong);
}

.logic-row:first-child::after {
  top: 50%;
}

.logic-row:last-child::after {
  bottom: 50%;
}

.pin {
  position: relative;
  z-index: 1;
  display: grid;
  place-items: center;
  width: 2.75rem;
  height: 2.75rem;
  border: 1px solid var(--line-strong);
  border-radius: 50%;
  background: var(--paper);
  font: 500 0.875rem/1 var(--font-mono);
  transition: background-color 0.5s var(--ease), color 0.5s var(--ease), border-color 0.5s var(--ease);
}

.logic-copy h3 {
  margin-bottom: 0.35rem;
  font: 300 1.375rem/1.2 var(--font-display);
  letter-spacing: -0.01em;
}

.logic-copy p {
  color: var(--muted);
}

.wire {
  position: relative;
  height: 1px;
  background: var(--line-strong);
  transform-origin: left;
}

.wire::after {
  content: "";
  position: absolute;
  top: -3px;
  right: -3.5px;
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--ink);
}

.js .logic-row .wire {
  transform: scaleX(0);
  transition: transform 1s var(--ease) 0.25s;
}

.logic-row.is-in .wire {
  transform: none;
}

.logic-output {
  display: flex;
  align-items: center;
}

.gate {
  flex: none;
  width: clamp(110px, 12vw, 160px);
  overflow: visible;
  fill: none;
  stroke: var(--ink);
  stroke-width: 1.5;
}

.gate path {
  vector-effect: non-scaling-stroke;
}

.output-copy {
  display: grid;
  justify-items: start;
  gap: 1rem;
  padding-left: 1.25rem;
}

.output-title {
  font: 200 clamp(1.5rem, 2.4vw, 2rem) / 1.2 var(--font-display);
  letter-spacing: -0.02em;
}

.expr {
  color: var(--muted);
  font: 400 0.8125rem/1 var(--font-mono);
  letter-spacing: 0.04em;
}

/* Output goes high once the inputs have drawn in. */
.logic-output.is-in .pin-out {
  border-color: var(--ink);
  background: var(--ink);
  color: var(--paper);
  transition-delay: 0.9s;
}

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

.contact {
  position: relative;
  isolation: isolate;
  overflow: hidden;
  padding-top: 0;
  text-align: center;
}

.contact {
  --cord-h: clamp(3rem, 8vw, 5rem);
}

.contact-light {
  display: grid;
  justify-items: center;
}

.contact-cord {
  width: 1px;
  height: var(--cord-h);
  background: var(--line-strong);
}

.contact-shade {
  position: relative;
  z-index: 1;
  width: 104px;
  height: auto;
}

/* Starts at the shade's mouth (75px down a 104px-wide shade), fades out at the section's end. */
.contact-beam {
  position: absolute;
  top: calc(var(--cord-h) + 75px);
  bottom: 0;
  left: 50%;
  z-index: -1;
  width: min(1100px, 100vw);
  background: linear-gradient(to bottom, var(--beam), transparent);
  clip-path: polygon(calc(50% - 45px) 0, calc(50% + 45px) 0, 100% 100%, 0 100%);
  transform: translateX(-50%);
}

.js .contact-beam {
  opacity: 0;
}

.contact-light.is-in + .contact-beam {
  animation: lamp-on 2s 0.3s both;
}

.contact-inner {
  display: grid;
  justify-items: center;
  padding-top: clamp(3rem, 7vw, 5rem);
}

.contact-inner .kicker::before,
.notfound .kicker::before {
  content: "";
  width: 3rem;
  height: 1px;
  background: var(--line-strong);
}

.contact-title {
  max-width: 15ch;
  margin: 1.5rem 0 2.5rem;
  font: 200 clamp(2.25rem, 5.6vw, 4.5rem) / 1.05 var(--font-display);
  letter-spacing: -0.035em;
}

.contact-mail {
  display: inline-flex;
  align-items: center;
  gap: 0.75rem;
  max-width: 100%;
  padding-bottom: 0.5rem;
  background: linear-gradient(var(--ink), var(--ink)) 0 100% / 100% 1px no-repeat;
  font: 300 clamp(1rem, 4.2vw, 2.25rem) / 1.2 var(--font-display);
  letter-spacing: -0.02em;
  overflow-wrap: anywhere;
  text-decoration: none;
  transition: background-size 0.5s var(--ease);
}

.contact-mail:hover {
  background-position: 100% 100%;
  background-size: 0% 1px;
}

.contact-mail .icon {
  transition: transform 0.3s var(--ease);
}

.contact-mail:hover .icon {
  transform: translate(3px, -3px);
}

.contact-note {
  max-width: 34rem;
  margin-top: 1.75rem;
  color: var(--muted);
}

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

.site-footer {
  overflow: hidden;
  padding-top: 2rem;
  border-top: 1px solid var(--line);
}

.footer-row {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 1rem 2rem;
  color: var(--muted);
  font: 400 0.75rem/1.4 var(--font-mono);
  letter-spacing: 0.06em;
}

.footer-row p {
  margin: 0;
}

.footer-links {
  display: flex;
  gap: 1.5rem;
}

.footer-links a {
  text-decoration: none;
  transition: color 0.2s;
}

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

.footer-word {
  width: 100%;
  height: auto;
  margin-top: clamp(2.5rem, 7vw, 5rem);
  color: var(--ink);
  -webkit-mask-image: linear-gradient(to bottom, #000 20%, transparent 95%);
  mask-image: linear-gradient(to bottom, #000 20%, transparent 95%);
  transform: translateY(14%);
}

/* ---------- Legal pages ---------- */

.legal {
  display: grid;
  grid-template-columns: 14rem minmax(0, 1fr);
  column-gap: clamp(2rem, 6vw, 6rem);
  padding-block: clamp(3rem, 8vw, 6rem) clamp(5rem, 10vw, 8rem);
}

.legal-head {
  grid-column: 1 / -1;
  display: grid;
  justify-items: start;
  gap: 1.25rem;
  margin-bottom: clamp(3rem, 6vw, 4.5rem);
}

.legal-head .display {
  font-size: clamp(2.4rem, 5vw, 4.25rem);
}

.legal-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem 1.5rem;
  color: var(--muted);
  font: 400 0.75rem/1.6 var(--font-mono);
  letter-spacing: 0.06em;
}

.crumbs {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  color: var(--muted);
  font: 500 0.75rem/1 var(--font-mono);
  letter-spacing: 0.16em;
  text-transform: uppercase;
}

.crumbs a {
  color: var(--text);
  text-decoration: none;
}

.crumbs a:hover {
  text-decoration: underline;
  text-underline-offset: 3px;
}

.crumbs [aria-hidden] {
  color: var(--faint);
}

/* Product icons keep their own colors; everything around them stays monochrome. */
.app-icon {
  flex: none;
  width: 52px;
  height: 52px;
  border-radius: 22%;
  box-shadow: 0 0 0 1px var(--line);
}

.app-icon-lg {
  width: 72px;
  height: 72px;
  margin-top: 0.5rem;
  box-shadow: 0 0 0 1px var(--line), 0 16px 40px -14px rgb(255 159 184 / 0.7);
}

.summary {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 0.75rem;
  width: 100%;
  margin: 1.5rem 0 0;
  padding: 0;
  list-style: none;
}

.summary li {
  padding: 1.25rem 1.25rem 1.4rem;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: var(--surface);
  color: var(--muted);
  font-size: 0.9375rem;
}

.summary strong {
  display: block;
  margin-bottom: 0.4rem;
  color: var(--text);
  font: 300 1.125rem/1.3 var(--font-display);
  letter-spacing: -0.01em;
}

/* Petal Lasso's page borrows a hint of the game's pastel palette. */
.summary-petal li::before {
  content: "";
  display: block;
  width: 10px;
  height: 10px;
  margin-bottom: 0.9rem;
  border-radius: 50%;
  background: #ff9fb8;
}

.summary-petal li:nth-child(2)::before {
  background: #8fd3c1;
}

.summary-petal li:nth-child(3)::before {
  background: #ffd36e;
}

.toc {
  position: sticky;
  top: calc(var(--header-h) + 2rem);
  align-self: start;
}

.toc .kicker {
  margin-bottom: 1.25rem;
}

.toc ol {
  display: grid;
  margin: 0;
  padding: 0;
  border-left: 1px solid var(--line);
  list-style: none;
  counter-reset: toc;
}

.toc a {
  display: flex;
  gap: 0.75rem;
  margin-left: -1px;
  padding: 0.45rem 0 0.45rem 1rem;
  border-left: 1px solid transparent;
  color: var(--muted);
  font-size: 0.875rem;
  line-height: 1.4;
  text-decoration: none;
  transition: color 0.2s, border-color 0.2s;
}

.toc a::before {
  content: counter(toc, decimal-leading-zero);
  counter-increment: toc;
  color: var(--faint);
  font: 400 0.75rem/1.65 var(--font-mono);
}

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

.toc a[aria-current="true"] {
  border-left-color: var(--ink);
  color: var(--text);
}

.prose {
  max-width: 44rem;
  counter-reset: section;
}

.prose > section + section {
  margin-top: clamp(2.75rem, 5vw, 3.5rem);
  padding-top: clamp(2.75rem, 5vw, 3.5rem);
  border-top: 1px solid var(--line);
}

.prose h2 {
  display: flex;
  align-items: baseline;
  gap: 1rem;
  margin-bottom: 1.25rem;
  font: 300 clamp(1.4rem, 2.4vw, 1.75rem) / 1.2 var(--font-display);
  letter-spacing: -0.02em;
  counter-increment: section;
}

.prose h2::before {
  content: counter(section, decimal-leading-zero);
  color: var(--faint);
  font: 500 0.75rem/1 var(--font-mono);
  letter-spacing: 0.1em;
}

.prose h3 {
  margin: 1.75rem 0 0.5rem;
  font-size: 1rem;
  font-weight: 600;
}

.prose p,
.prose li,
.prose dd {
  color: var(--muted);
}

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

.prose p + p,
.prose p + ul,
.prose p + ol,
.prose ul + p,
.prose ol + p {
  margin-top: 1rem;
}

.prose ul,
.prose ol {
  margin-bottom: 0;
  padding-left: 1.25rem;
}

.prose li + li {
  margin-top: 0.5rem;
}

.prose li::marker {
  color: var(--faint);
}

.app-card {
  margin-top: 1.5rem;
  padding: var(--pad);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
}

.app-card-head {
  display: flex;
  align-items: center;
  gap: 1rem;
}

.app-card h3 {
  margin: 0 0 0.2rem;
  font: 300 1.375rem/1.2 var(--font-display);
  letter-spacing: -0.01em;
}

.app-card .app-id {
  font: 400 0.75rem/1.6 var(--font-mono);
}

.pkg {
  color: var(--faint);
  font: 400 0.8125rem/1.8 var(--font-mono);
  overflow-wrap: anywhere;
}

.facts {
  display: grid;
  grid-template-columns: 10.5rem minmax(0, 1fr);
  margin: 1.25rem 0 0;
}

.facts dt,
.facts dd {
  padding: 0.85rem 0;
  border-top: 1px solid var(--line);
}

.facts dt {
  padding-right: 1rem;
  color: var(--text);
  font-size: 0.9375rem;
  font-weight: 500;
}

.facts dd {
  margin: 0;
}

.table-wrap {
  overflow-x: auto;
  margin-top: 1.25rem;
}

.data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.9375rem;
}

.data-table th {
  padding: 0 1rem 0.6rem 0;
  border-bottom: 1px solid var(--line-strong);
  color: var(--faint);
  font: 500 0.6875rem/1 var(--font-mono);
  letter-spacing: 0.1em;
  text-align: left;
  text-transform: uppercase;
}

.data-table td {
  padding: 0.8rem 1rem 0.8rem 0;
  border-bottom: 1px solid var(--line);
  color: var(--muted);
  vertical-align: top;
}

.data-table td:first-child {
  color: var(--text);
}

.legal-address {
  margin-top: 1rem;
  padding-left: 1rem;
  border-left: 1px solid var(--line-strong);
  font-style: normal;
  line-height: 1.8;
}

.footer-links a[aria-current="page"] {
  color: var(--text);
}

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

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

  .toc {
    position: static;
    margin-bottom: 3rem;
  }
}

@media (max-width: 640px) {
  .facts {
    grid-template-columns: minmax(0, 1fr);
  }

  .facts dd {
    padding-top: 0;
    border-top: 0;
  }
}

/* ---------- 404 ---------- */

.notfound {
  display: grid;
  align-content: center;
  justify-items: center;
  gap: 1.5rem;
  min-height: 100svh;
  padding-block: 3rem;
  text-align: center;
}

.notfound-lamp {
  width: 120px;
  height: auto;
  margin-bottom: 1rem;
}

.notfound .lede {
  max-width: 28rem;
}

/* ---------- Reveal on scroll ---------- */

.js [data-reveal] {
  opacity: 0;
  transform: translateY(24px);
  transition: opacity 0.9s var(--ease), transform 0.9s var(--ease);
}

.js [data-reveal].is-in {
  opacity: 1;
  transform: none;
}

/* ---------- Theme switch transition ---------- */

::view-transition-old(root),
::view-transition-new(root) {
  animation: none;
  mix-blend-mode: normal;
}

/* ---------- Keyframes ---------- */

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

@keyframes ping {
  0% {
    opacity: 0.6;
    transform: scale(1);
  }
  80%,
  100% {
    opacity: 0;
    transform: scale(3.2);
  }
}

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

@keyframes lamp-on {
  0% { opacity: 0; }
  9% { opacity: 0.7; }
  12% { opacity: 0.05; }
  21% { opacity: 0.85; }
  24% { opacity: 0.15; }
  31% { opacity: 0.95; }
  35% { opacity: 0.5; }
  48%,
  100% { opacity: 1; }
}

@keyframes signal {
  from {
    stroke-dashoffset: 100;
  }
  to {
    stroke-dashoffset: 0;
  }
}

@keyframes cord-sway {
  20% { transform: rotate(7deg); }
  45% { transform: rotate(-5deg); }
  70% { transform: rotate(2deg); }
}

@keyframes cord-stretch {
  40% { transform: scaleY(1.3); }
}

@keyframes cord-pull {
  40% { transform: translateY(12.6px); }
}

/* ---------- Responsive ---------- */

@media (max-width: 900px) {
  .hero {
    grid-template-columns: minmax(0, 1fr);
    gap: 1.5rem;
    min-height: 0;
    padding-top: 1rem;
  }

  .hero-art {
    order: -1;
    width: min(80vw, 420px);
  }

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

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

  .logic-row {
    grid-template-columns: 2.75rem minmax(0, 1fr);
  }

  /* On narrow screens the bus runs vertically through the pins down to Q. */
  .logic-row::after {
    right: auto;
    left: calc(1.375rem - 0.5px);
  }

  .logic-row:last-child::after {
    bottom: 0;
  }

  .wire,
  .gate {
    display: none;
  }

  .logic-output {
    position: relative;
    padding-top: 1.4rem;
  }

  .logic-output::before {
    content: "";
    position: absolute;
    top: 0;
    left: calc(1.375rem - 0.5px);
    height: calc(1.4rem + 1.375rem);
    width: 1px;
    background: var(--line-strong);
  }

  .output-copy {
    grid-template-columns: 2.75rem minmax(0, 1fr);
    align-items: center;
    column-gap: 1.25rem;
    padding-left: 0;
  }

  .expr {
    grid-column: 2;
  }
}

@media (max-width: 720px) {
  .nav {
    display: none;
  }

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

  .term-lines li {
    grid-template-columns: 5.25rem 3.25rem minmax(0, 1fr);
    font-size: 0.75rem;
  }
}

@media (max-width: 420px) {
  .brand-word {
    width: 148px;
  }

  .brand-mark {
    width: 26px;
    height: 26px;
  }
}

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

  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-delay: 0s !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    transition-delay: 0s !important;
  }
}
