/*
 * DIM8 Labs design system — Design Pass 1.
 *
 * Loaded first on every SiteLayout page (see src/layouts/SiteLayout.astro), so
 * it owns the pieces that must look identical everywhere: tokens, the page
 * container, link language, header, footer, buttons, and the contact dialog.
 * Page-specific stylesheets (home.css, intro.css, aac-architecture.css) load after it.
 *
 * Palette rule: near-black ground, off-white text, one accent — the pale
 * teal/cyan of the VFD "8" mark. The accent is reserved for primary actions,
 * active navigation, status indicators, and the motto's third line.
 */

:root {
  color-scheme: dark;

  /* Ground and surfaces. --bg matches the logo PNG's black so the mark blends. */
  --bg: #010100;
  --surface: #0a0c0d;
  --surface-raised: #111517;

  /* Text. --text-faint keeps the legacy link tone (#758985) for continuity. */
  --text: #eceeec;
  --text-body: #c9cfcd;
  --text-muted: #96a3a0;
  --text-faint: #758985;

  /* Accent: VFD phosphor. --accent is the existing interior chrome color. */
  --accent: #b8ddd7;
  --accent-bright: #d6f4ef;
  --accent-dim: #5d837e;
  --accent-wash: rgb(184 221 215 / 6%);
  --accent-glow: rgb(140 220 206 / 38%);

  --border: #1c2426;
  --border-strong: #2e3c3b;

  /*
   * Display field (Home): the lighter phosphor gray-green "glass" that opens
   * below the black hero bezel. Panels are the near-black surface that cards
   * sit on inside the field, so they read as mounted displays.
   */
  --field: #161c1b;
  --field-rule: #2a3533;
  --field-radius: 16px;
  --panel: #0b0e0e;

  --font-sans: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  --font-wordmark: "Avenir Next", "Segoe UI", Helvetica, Arial, sans-serif;
  --font-mono: ui-monospace, "SF Mono", SFMono-Regular, Menlo, Consolas, "Liberation Mono", monospace;

  /* 8px spacing scale. */
  --space-1: 0.5rem;
  --space-2: 1rem;
  --space-3: 1.5rem;
  --space-4: 2rem;
  --space-5: 3rem;
  --space-6: 4rem;
  --space-7: 6rem;
  --space-8: 8rem;

  /* Page grid: ~1200px content, fluid gutter (16px at phone width). */
  --page-max: 75rem;
  --gutter: clamp(1rem, 4vw, 2.5rem);
  --measure: 68ch;
  --section-pad: clamp(4rem, 3rem + 5vw, 7.5rem);

  --radius: 2px;
  --transition-speed: 160ms;
  --ease-out: cubic-bezier(0.2, 0.7, 0.2, 1);
}

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

html {
  background: var(--bg);
}

img {
  max-width: 100%;
}

/* Shared content container. Interior pages align their main column to it. */
.container {
  width: min(100% - 2 * var(--gutter), var(--page-max));
  margin-inline: auto;
}

/* ---------------------------------------------------------------------------
 * Link language: lowercase sans text with a trailing →, muted until hovered.
 * ------------------------------------------------------------------------ */

.github-link,
.dim8-link,
.dim8-link:link,
.dim8-link:visited {
  display: inline-block;
  color: var(--text-faint);
  font-size: 0.875rem;
  font-weight: 400;
  letter-spacing: 0.1em;
  text-decoration: none;
  transition: color var(--transition-speed) ease;
}

.github-link:hover,
.dim8-link:hover {
  color: var(--accent);
}

.github-link:focus-visible,
.dim8-link:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 4px;
}

/* Contact opens a dialog, but its trigger uses the same textual link treatment. */
button.dim8-link {
  appearance: none;
  -webkit-appearance: none;
  margin: 0;
  padding: 0;
  border: 0;
  border-radius: 0;
  background: transparent;
  box-shadow: none;
  text-shadow: none;
  text-align: inherit;
  font-family: inherit;
  line-height: inherit;
  cursor: pointer;
}

/* ---------------------------------------------------------------------------
 * Eyebrow / technical label. Monospace, uppercase, numbered where useful.
 * ------------------------------------------------------------------------ */

.eyebrow {
  display: flex;
  align-items: baseline;
  flex-wrap: wrap;
  gap: 0 0.75em;
  margin: 0;
  color: var(--text-muted);
  font-family: var(--font-mono);
  font-size: 0.75rem;
  font-weight: 400;
  letter-spacing: 0.14em;
  line-height: 1.6;
  text-transform: uppercase;
}

.eyebrow__index {
  color: var(--accent);
}

.eyebrow__index::after {
  content: " /";
  color: var(--accent-dim);
}

/* Tags: small mono chips with square corners (no pills). */
.tag-list {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-1);
  margin: 0;
  padding: 0;
  list-style: none;
}

.tag {
  padding: 0.25rem 0.5rem;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius);
  color: var(--text-muted);
  font-family: var(--font-mono);
  font-size: 0.6875rem;
  letter-spacing: 0.06em;
  line-height: 1.4;
}

/* Status: a lit "decimal point" dot plus a mono label. */
.status {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  color: var(--accent);
  font-family: var(--font-mono);
  font-size: 0.6875rem;
  letter-spacing: 0.12em;
  line-height: 1.4;
  text-transform: uppercase;
}

.status__dot {
  flex: 0 0 auto;
  width: 0.4375rem;
  height: 0.4375rem;
  border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 0 8px var(--accent-glow);
}

.status--development .status__dot {
  background: transparent;
  border: 1px solid var(--accent);
  box-shadow: none;
}

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

.status--planned .status__dot {
  background: var(--text-faint);
  box-shadow: none;
}

/* ---------------------------------------------------------------------------
 * Buttons. Primary = outlined accent with a faint phosphor wash. Square-ish.
 * ------------------------------------------------------------------------ */

.btn {
  appearance: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5em;
  min-height: 2.75rem;
  margin: 0;
  padding: 0.6875rem 1.25rem;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius);
  background: transparent;
  color: var(--text);
  font-family: var(--font-sans);
  font-size: 0.9375rem;
  font-weight: 500;
  letter-spacing: 0.02em;
  line-height: 1.2;
  text-decoration: none;
  white-space: nowrap;
  cursor: pointer;
  transition:
    color var(--transition-speed) ease,
    border-color var(--transition-speed) ease,
    background-color var(--transition-speed) ease,
    box-shadow var(--transition-speed) ease;
}

.btn:hover {
  border-color: var(--text-muted);
}

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

.btn--primary {
  border-color: var(--accent);
  background: var(--accent-wash);
  color: var(--accent-bright);
}

.btn--primary:hover {
  border-color: var(--accent-bright);
  background: rgb(184 221 215 / 12%);
  box-shadow: 0 0 28px -8px var(--accent-glow);
}

.btn--compact {
  min-height: 2.375rem;
  padding: 0.5rem 0.9375rem;
  font-size: 0.875rem;
}

/* ---------------------------------------------------------------------------
 * Skip link
 * ------------------------------------------------------------------------ */

.skip-link {
  position: absolute;
  top: var(--space-1);
  left: var(--space-3);
  z-index: 20;
  padding: var(--space-1);
  background: var(--bg);
  transform: translateY(-200%);
}

.skip-link:focus {
  transform: none;
}

/* Skip-link targets are focused programmatically; no ring on the whole main. */
main[tabindex="-1"]:focus {
  outline: none;
}

/* ---------------------------------------------------------------------------
 * Header. Logo left → "/". Nav right with one highlighted action.
 * Sticky only where it fits on one row (>= 56rem); narrower screens stack
 * brand over nav and let the header scroll away to save height. Below 30rem
 * the header's project button is hidden; the hero shows it immediately.
 * ------------------------------------------------------------------------ */

.site-header {
  position: relative;
  z-index: 5;
  border-bottom: 1px solid var(--border);
  background: var(--bg);
}

.site-header__inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: var(--space-2) var(--space-5);
  min-height: 4.5rem;
  padding-block: 0.75rem;
}

.site-brand {
  display: inline-flex;
  align-items: center;
  gap: 0.875rem;
  color: var(--accent);
  text-decoration: none;
  transition: color var(--transition-speed) ease;
}

.site-brand:hover {
  color: var(--accent-bright);
}

.site-brand:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 4px;
}

/*
 * Crop the existing logo PNG to its seven-segment mark (no new artwork).
 * Geometry is the legacy 52px crop scaled to 34px: image 95.2px square,
 * offset -28.9px / -17px.
 */
.site-brand__mark {
  position: relative;
  display: block;
  flex: 0 0 34px;
  width: 34px;
  height: 47.6px;
  overflow: hidden;
}

.site-brand__mark img {
  position: absolute;
  width: 95.2px;
  height: 95.2px;
  max-width: none;
  left: -28.9px;
  top: -17px;
}

.site-brand__text {
  font-family: var(--font-wordmark);
  font-size: 1.0625rem;
  font-weight: 300;
  letter-spacing: 0.21em;
  line-height: 1;
  white-space: nowrap;
}

.site-nav {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: var(--space-1) var(--space-4);
}

.site-nav__links {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-1) var(--space-4);
  margin: 0;
  padding: 0;
  list-style: none;
}

.site-nav__link {
  position: relative;
  display: inline-block;
  padding-block: 0.5rem;
  color: var(--text-muted);
  font-size: 0.9375rem;
  letter-spacing: 0.04em;
  text-decoration: none;
  transition: color var(--transition-speed) ease;
}

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

.site-nav__link:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 4px;
}

/* Active page: a lit "bottom segment" under the label. */
.site-nav__link[aria-current="page"] {
  color: var(--accent);
}

.site-nav__link[aria-current="page"]::after {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0.125rem;
  height: 2px;
  border-radius: 1px;
  background: var(--accent);
  box-shadow: 0 0 6px var(--accent-glow);
}

@media (min-width: 56rem) {
  .site-header {
    position: sticky;
    top: 0;
  }

  html {
    scroll-padding-top: 5.5rem;
  }
}

@media (max-width: 55.99rem) {
  .site-header__inner {
    gap: var(--space-1);
    padding-block: 0.75rem 0.5rem;
  }

  .site-nav {
    flex-basis: 100%;
    justify-content: space-between;
  }

  .site-nav__links {
    gap: var(--space-1) var(--space-3);
  }
}

@media (max-width: 29.99rem) {
  .site-nav .btn {
    display: none;
  }
}

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

.site-footer {
  flex: 0 0 auto;
  border-top: 1px solid var(--border);
  background: var(--bg);
  color: var(--text-muted);
}

.site-footer__grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: var(--space-5);
  padding-block: var(--space-6) var(--space-5);
}

.site-footer__brand {
  display: grid;
  gap: var(--space-3);
  align-content: start;
}

.site-footer__motto {
  margin: 0;
  color: var(--text-muted);
  font-size: 0.9375rem;
  line-height: 1.7;
}

.site-footer__motto span {
  display: block;
}

.site-footer__motto span:last-child {
  color: var(--accent);
}

.site-footer__column {
  display: grid;
  gap: var(--space-2);
  align-content: start;
}

.site-footer__list {
  display: grid;
  gap: 0.375rem;
  margin: 0;
  padding: 0;
  list-style: none;
}

.site-footer__legal {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-1) var(--space-4);
  padding-block: var(--space-3) var(--space-4);
  border-top: 1px solid var(--border);
  color: var(--text-faint);
  font-family: var(--font-mono);
  font-size: 0.6875rem;
  letter-spacing: 0.06em;
  line-height: 1.7;
}

.site-footer__legal-items {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-1) var(--space-4);
}

.site-footer__legal .dim8-link {
  font-family: var(--font-sans);
  font-size: 0.8125rem;
}

@media (min-width: 48rem) {
  .site-footer__grid {
    grid-template-columns: minmax(0, 2fr) minmax(0, 1fr) minmax(0, 1fr);
  }
}

/* ---------------------------------------------------------------------------
 * Contact dialog (ContactDialog.astro + public/js/interior.js)
 * ------------------------------------------------------------------------ */

.modal-control {
  display: inline-flex;
  align-items: center;
  gap: var(--space-1);
  padding: 0.5rem 0;
  border: 0;
  border-radius: 0;
  background: transparent;
  color: var(--text-faint);
  font: inherit;
  font-size: 0.875rem;
  font-weight: 400;
  letter-spacing: 0.1em;
  text-decoration: none;
  cursor: pointer;
  transition: color var(--transition-speed) ease;
}

.modal-control:hover {
  color: var(--accent);
}

.contact-dialog {
  width: min(32rem, calc(100% - 2rem));
  max-height: calc(100svh - 2rem);
  overflow-y: auto;
  padding: var(--space-3);
  border: 1px solid var(--text-faint);
  background: var(--bg);
  color: var(--accent);
  font-family: var(--font-sans);
  line-height: 1.5;
}

.contact-dialog::backdrop {
  background: rgb(1 1 0 / 85%);
}

.contact-dialog :focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 4px;
}

.contact-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-2);
  margin-bottom: var(--space-2);
}

.contact-dialog h2 {
  margin: 0;
  color: #97b5b0;
  font-family: var(--font-wordmark);
  font-size: 1.125rem;
  font-weight: 300;
  letter-spacing: 0.21em;
}

.contact-form {
  display: grid;
  gap: var(--space-1);
}

.contact-form label {
  margin-top: var(--space-1);
  color: #97b5b0;
  font-size: 0.875rem;
  letter-spacing: 0.04em;
}

.contact-form input,
.contact-form textarea {
  width: 100%;
  min-width: 0;
  padding: 0.625rem;
  border: 1px solid var(--text-faint);
  border-radius: 0;
  background: var(--bg);
  color: var(--accent);
  font: inherit;
  font-size: 1rem;
}

.contact-form textarea {
  resize: vertical;
}

.contact-form .interior-note {
  margin-block: var(--space-1);
  color: var(--text-muted);
  font-size: 0.875rem;
  line-height: 1.65;
}

.contact-form [data-contact-turnstile] {
  min-height: 65px;
  margin-block: var(--space-1);
}

.form-submit {
  justify-self: start;
  padding: 0.625rem var(--space-2);
  border: 1px solid var(--text-faint);
  border-radius: 0;
  background: transparent;
  color: var(--accent);
  font: inherit;
  font-size: 0.875rem;
  letter-spacing: 0.1em;
  cursor: pointer;
}

.form-submit:hover {
  border-color: var(--accent);
}

/* ===========================================================================
 * Reusable components (Design Pass 1). Home uses them now; Work, Products and
 * Services adopt them in later phases.
 * ======================================================================== */

/* Section heading (SectionHeading.astro) */
.section-head {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: var(--space-2) var(--space-5);
  margin-bottom: var(--space-5);
}

.section-head__text {
  display: grid;
  flex: 1 1 32rem;
  gap: var(--space-2);
  max-width: 46rem;
}

.section-head__title {
  margin: 0;
  color: var(--text);
  font-size: clamp(1.75rem, 1.25rem + 1.6vw, 2.5rem);
  font-weight: 500;
  letter-spacing: -0.015em;
  line-height: 1.15;
  text-wrap: balance;
}

.section-head__lede {
  margin: 0;
  max-width: var(--measure);
  color: var(--text-muted);
  font-size: 1.0625rem;
  line-height: 1.65;
}

.section-head__action {
  white-space: nowrap;
}

/* Work card (WorkCard.astro) */
.work-card {
  position: relative;
  display: grid;
  grid-template-rows: auto 1fr;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  overflow: hidden;
  transition: border-color var(--transition-speed) ease;
}

.work-card:hover,
.work-card:focus-within {
  border-color: var(--accent-dim);
}

.work-card__media {
  aspect-ratio: 16 / 10;
  overflow: hidden;
  background: var(--bg);
}

.work-card__media img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 600ms var(--ease-out);
}

.work-card:hover .work-card__media img {
  transform: scale(1.03);
}

.work-card__body {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: var(--space-2);
  padding: var(--space-3);
}

.work-card__type {
  margin: 0;
  color: var(--accent);
  font-family: var(--font-mono);
  font-size: 0.6875rem;
  letter-spacing: 0.14em;
  line-height: 1.4;
  text-transform: uppercase;
}

.work-card__title {
  margin: 0;
  color: var(--text);
  font-size: 1.375rem;
  font-weight: 500;
  letter-spacing: -0.01em;
  line-height: 1.25;
}

.work-card__title a {
  color: inherit;
  text-decoration: none;
}

/* Stretch the title link over the whole card. */
.work-card__title a::after {
  content: "";
  position: absolute;
  inset: 0;
  z-index: 1;
}

.work-card__title a:focus-visible {
  outline: none;
}

.work-card:has(.work-card__title a:focus-visible) {
  outline: 2px solid var(--accent);
  outline-offset: 3px;
}

.work-card__summary {
  margin: 0;
  color: var(--text-body);
  font-size: 0.9375rem;
  line-height: 1.65;
}

.work-card__more {
  margin-top: auto;
  padding-top: var(--space-1);
  color: var(--text-faint);
  font-size: 0.875rem;
  letter-spacing: 0.1em;
  transition: color var(--transition-speed) ease;
}

.work-card:hover .work-card__more,
.work-card:focus-within .work-card__more,
.work-card:hover .work-card__title {
  color: var(--accent);
}

@media (min-width: 56rem) {
  .work-card--lead {
    grid-template-rows: none;
    grid-template-columns: minmax(0, 7fr) minmax(0, 5fr);
  }

  .work-card--lead .work-card__media {
    aspect-ratio: auto;
    min-height: 100%;
  }

  .work-card--lead .work-card__body {
    justify-content: center;
    padding: var(--space-5) var(--space-4);
  }

  .work-card--lead .work-card__title {
    font-size: clamp(1.625rem, 1rem + 1.2vw, 2rem);
  }
}

/* Product card (ProductCard.astro) */
.product-card {
  display: grid;
  grid-template-rows: auto 1fr;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  overflow: hidden;
  transition: border-color var(--transition-speed) ease;
}

.product-card:hover,
.product-card:focus-within {
  border-color: var(--accent-dim);
}

/* Phone screenshots are portrait; show the top of the screen (title/branding). */
.product-card__media {
  display: block;
  aspect-ratio: 4 / 3;
  overflow: hidden;
  border-bottom: 1px solid var(--border);
  background: var(--bg);
}

.product-card__media img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center top;
  transition: transform 600ms var(--ease-out);
}

.product-card:hover .product-card__media img {
  transform: scale(1.03);
}

.product-card__body {
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
  padding: var(--space-3);
}

.product-card__meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-1) var(--space-2);
}

.product-card__platform {
  color: var(--text-faint);
  font-family: var(--font-mono);
  font-size: 0.6875rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

.product-card__title {
  margin: 0;
  color: var(--text);
  font-size: 1.25rem;
  font-weight: 500;
  letter-spacing: -0.01em;
  line-height: 1.25;
}

.product-card__summary {
  margin: 0;
  color: var(--text-body);
  font-size: 0.9375rem;
  line-height: 1.65;
}

.product-card__actions {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-1) var(--space-3);
  margin-top: auto;
  padding-top: var(--space-1);
}

/* Steps row (StepsRow.astro) */
.steps {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 0;
  margin: 0;
  padding: 0;
  list-style: none;
  counter-reset: none;
}

.steps__item {
  position: relative;
  display: grid;
  grid-template-columns: 3rem minmax(0, 1fr);
  column-gap: var(--space-2);
  row-gap: var(--space-1);
  padding-block: var(--space-3);
  border-top: 1px solid var(--border-strong);
}

.steps__index {
  grid-row: span 2;
  color: var(--accent);
  font-family: var(--font-mono);
  font-size: 0.8125rem;
  letter-spacing: 0.1em;
  line-height: 1.9;
}

.steps__title {
  margin: 0;
  color: var(--text);
  font-size: 1.25rem;
  font-weight: 500;
  line-height: 1.3;
}

.steps__text {
  margin: 0;
  color: var(--text-body);
  font-size: 0.9375rem;
  line-height: 1.65;
}

@media (min-width: 56rem) {
  .steps {
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: var(--space-4);
  }

  .steps__item {
    grid-template-columns: minmax(0, 1fr);
    align-content: start;
    padding-block: var(--space-3) 0;
  }

  .steps__index {
    grid-row: auto;
  }

  /* Lit segment on the leading edge of each stage; arrow between stages. */
  .steps__item::before {
    content: "";
    position: absolute;
    top: -1px;
    left: 0;
    width: 2.5rem;
    height: 2px;
    background: var(--accent);
    box-shadow: 0 0 8px var(--accent-glow);
  }

  .steps__item:not(:last-child)::after {
    content: "→";
    position: absolute;
    top: calc(var(--space-3) - 0.1rem);
    right: calc(-1 * var(--space-4) / 2 - 0.45em);
    color: var(--accent-dim);
    font-size: 1rem;
    line-height: 1.5;
  }
}

/* CTA band (CtaBand.astro) */
.cta-band {
  border-block: 1px solid var(--border);
  background: var(--surface);
}

.cta-band__inner {
  position: relative;
  display: grid;
  gap: var(--space-4);
  align-items: end;
  padding-block: var(--section-pad);
}

/* Lit segment on the band's top rule, aligned to the content grid. */
.cta-band__inner::before {
  content: "";
  position: absolute;
  top: -1px;
  left: 0;
  width: 4rem;
  height: 2px;
  background: var(--accent);
  box-shadow: 0 0 8px var(--accent-glow);
}

.cta-band__title {
  margin: 0;
  color: var(--text);
  font-size: clamp(2rem, 1.2rem + 3vw, 3.5rem);
  font-weight: 500;
  letter-spacing: -0.025em;
  line-height: 1.08;
}

.cta-band__title span {
  display: block;
}

.cta-band__accent {
  color: var(--accent);
  text-shadow: 0 0 22px var(--accent-glow);
}

.cta-band__action {
  display: grid;
  justify-items: start;
  gap: var(--space-2);
}

.cta-band__text {
  margin: 0;
  max-width: 28rem;
  color: var(--text-muted);
  font-size: 1rem;
  line-height: 1.65;
}

@media (min-width: 56rem) {
  .cta-band__inner {
    grid-template-columns: minmax(0, 7fr) minmax(0, 4fr);
    column-gap: var(--space-6);
  }
}

/* ===========================================================================
 * Page shell — "bezel and display field" (Design Pass 2)
 *
 * Shared by Home, Work (/work/) and Products (/products/); later Services,
 * About and Contact. Pages opt in with <body class="shell-page">:
 *
 *   header (black) → hero or .page-header (black bezel)
 *   → .field (lighter phosphor gray-green display, rounded inset edge)
 *   → CtaBand + footer (black shell again)
 *
 * Case studies and product detail pages joined the shell in Design Pass 4
 * (see "Detail pages" near the end of this file). Website Examples and the
 * 404 page joined in the pre-deployment polish pass; every page now uses
 * this shell, and the legacy main.css / interior.css stylesheets are gone.
 * ======================================================================== */

body.shell-page {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  min-height: 100svh;
  margin: 0;
  background: var(--bg);
  color: var(--text-body);
  font-family: var(--font-sans);
  font-size: 1rem;
  line-height: 1.6;
}

.shell-page main {
  flex: 1 0 auto;
}

.shell-page main :focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 4px;
}

/* Interior page header (PageHeader.astro): compact, ~260–320px with content. */
.page-header {
  padding-block: 3.25rem 2.5rem;
}

.page-header__inner {
  display: grid;
  gap: 0.875rem;
}

.page-header__title {
  max-width: 52rem;
  margin: 0;
  color: var(--text);
  font-size: clamp(2rem, 1.3rem + 2.2vw, 3rem);
  font-weight: 500;
  letter-spacing: -0.03em;
  line-height: 1.08;
  text-wrap: balance;
}

.page-header__lede {
  max-width: 46rem;
  margin: 0;
  color: var(--text-muted);
  font-size: clamp(1rem, 0.95rem + 0.2vw, 1.0625rem);
  line-height: 1.6;
}

.page-header__meta {
  display: flex;
  flex-wrap: wrap;
  gap: 0.25rem 0;
  margin: 0.25rem 0 0;
  padding: 0;
  list-style: none;
  color: var(--text-faint);
  font-family: var(--font-mono);
  font-size: 0.6875rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}

.page-header__meta li + li::before {
  content: "·";
  padding-inline: 0.75rem;
  color: var(--accent-dim);
}

@media (max-width: 30rem) {
  .page-header {
    padding-block: 2.5rem 2rem;
  }
}

/*
 * Display field — the lighter "glass" inside the black bezel.
 * Inset slightly from the viewport edge with rounded corners at top and
 * bottom, so it reads as an enclosed display. Containers inside compensate
 * for the inset so content still aligns with the header and footer grid.
 */
.field {
  --field-inset: clamp(0.5rem, 1.25vw, 1.5rem);
  /* Raise faint text inside the lighter field to keep small links >= 4.5:1. */
  --text-faint: #8a9c98;

  position: relative;
  margin-inline: var(--field-inset);
  border: 1px solid var(--field-rule);
  border-radius: var(--field-radius);
  background: var(--field);
}

/* 100% here is the field's content box: viewport − 2 × inset − 2px border. */
.field .container {
  width: min(100% - 2 * var(--gutter) + 2 * var(--field-inset) + 2px, var(--page-max));
}

/* Short luminous bars on the top and bottom edges, aligned to the content column. */
.field::before,
.field::after {
  content: "";
  position: absolute;
  left: max(calc(var(--gutter) - var(--field-inset)), calc((100% - var(--page-max)) / 2));
  width: 4rem;
  height: 2px;
  background: var(--accent);
  box-shadow: 0 0 8px var(--accent-glow);
}

.field::before {
  top: -1px;
}

.field::after {
  bottom: -1px;
  background: var(--accent-dim);
  box-shadow: none;
}

@media (max-width: 30rem) {
  .field {
    --field-radius: 12px;
  }
}

/* Cards and panels inside the field sit on the near-black panel surface. */
.field .work-card,
.field .product-card,
.field .product-panel {
  border-color: var(--field-rule);
  background: var(--panel);
}

.field .work-card:hover,
.field .work-card:focus-within,
.field .product-card:hover,
.field .product-card:focus-within {
  border-color: var(--accent-dim);
}

/* Field sections — one surface, thin rules, ~64–80px between sections. */
.field-section__inner {
  padding-block: clamp(2rem, 1.5rem + 1vw, 2.5rem);
}

.field-section + .field-section .field-section__inner {
  border-top: 1px solid var(--field-rule);
}

.field-section:first-child .field-section__inner {
  padding-top: clamp(2.5rem, 2rem + 1.5vw, 3.5rem);
}

.field-section:last-child .field-section__inner {
  padding-bottom: clamp(2.5rem, 2rem + 1.5vw, 3.5rem);
}

.field .section-head {
  margin-bottom: var(--space-4);
}

/*
 * Rail: section identity in a narrow left column, content beside it.
 * Stacks below 64rem. The heading stays in view while its content scrolls.
 */
.rail {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
}

@media (min-width: 64rem) {
  .rail {
    grid-template-columns: minmax(0, 3fr) minmax(0, 9fr);
    column-gap: var(--space-5);
    align-items: start;
  }

  .rail > .section-head {
    position: sticky;
    top: 6.5rem;
    flex-direction: column;
    align-items: flex-start;
    margin-bottom: 0;
  }

  .rail > .section-head .section-head__text {
    flex: none;
  }

  .rail > .section-head .section-head__title {
    font-size: clamp(1.5rem, 1.1rem + 0.7vw, 1.875rem);
  }
}

/* Work grid — lead card full width, then two up (Home, Work). */
.work-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: var(--space-3);
}

@media (min-width: 48rem) {
  .work-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .work-grid .work-card--lead {
    grid-column: 1 / -1;
  }
}

/* Compact work card (concept builds). */
.work-card--compact .work-card__body {
  gap: 0.75rem;
  padding: var(--space-3) var(--space-3) var(--space-3);
}

.work-card--compact .work-card__title {
  font-size: 1.125rem;
}

.work-card--compact .work-card__summary {
  font-size: 0.875rem;
}

/* Closing CTA band sits on the black shell below the field; the field's
 * bottom edge already provides the transition, so the band drops its surface. */
.shell-page .cta-band {
  border: 0;
  background: var(--bg);
}

.shell-page .cta-band__inner {
  padding-block: clamp(3.5rem, 2.5rem + 3vw, 5.5rem);
}

.shell-page .cta-band__inner::before {
  display: none;
}

/* ---------------------------------------------------------------------------
 * Product panel (ProductPanel.astro) — one per product, screenshots left.
 * ------------------------------------------------------------------------ */

.product-panels {
  display: grid;
  gap: var(--space-3);
}

.product-panel {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  overflow: hidden;
}

/*
 * Screenshot pair shown whole at phone proportions, side by side. When the
 * panel is stacked, the pair is width-capped and centered so the shots stay
 * phone-sized instead of growing to full panel width.
 */
.product-panel__shots {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 11rem));
  justify-content: center;
  gap: var(--space-2);
  align-items: start;
  padding: var(--space-3);
  border-bottom: 1px solid var(--field-rule);
  background: var(--bg);
}

.product-panel__shot {
  display: grid;
  gap: 0.5rem;
  margin: 0;
}

.product-panel__shot img {
  display: block;
  width: 100%;
  height: auto;
  border: 1px solid var(--border-strong);
  border-radius: 6px;
}

.product-panel__shot figcaption {
  color: var(--text-faint);
  font-family: var(--font-mono);
  font-size: 0.6875rem;
  letter-spacing: 0.12em;
  text-align: center;
  text-transform: uppercase;
}

.product-panel__body {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: var(--space-2);
  padding: var(--space-4) var(--space-3);
}

.product-panel__title {
  margin: 0;
  color: var(--text);
  font-size: clamp(1.5rem, 1.2rem + 1vw, 2rem);
  font-weight: 500;
  letter-spacing: -0.02em;
  line-height: 1.15;
}

.product-panel__description {
  max-width: 40rem;
  margin: 0;
  color: var(--text-body);
  font-size: 1.0625rem;
  line-height: 1.6;
}

.product-panel__features {
  display: grid;
  gap: 0.375rem;
  max-width: 40rem;
  margin: 0;
  padding: 0;
  list-style: none;
  color: var(--text-body);
  font-size: 0.9375rem;
  line-height: 1.5;
}

.product-panel__features li {
  position: relative;
  padding-left: 1.125rem;
}

.product-panel__features li::before {
  content: "";
  position: absolute;
  left: 0;
  top: 0.62em;
  width: 0.5rem;
  height: 1px;
  background: var(--accent-dim);
}

.product-panel__actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--space-2) var(--space-3);
  margin-top: var(--space-1);
}

@media (min-width: 60rem) {
  .product-panel {
    grid-template-columns: minmax(16rem, 5fr) minmax(0, 7fr);
  }

  .product-panel__shots {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    padding: var(--space-4);
    border-right: 1px solid var(--field-rule);
    border-bottom: 0;
  }

  .product-panel__body {
    justify-content: center;
    padding: var(--space-5) var(--space-5) var(--space-5) var(--space-4);
  }
}

/* Platform line: one compact mono row instead of a per-product table. */
.platform-line {
  display: flex;
  flex-wrap: wrap;
  gap: 0.375rem 1.25rem;
  margin: 0;
  padding: 0.75rem 0;
  border-block: 1px solid var(--field-rule);
  list-style: none;
  font-family: var(--font-mono);
  font-size: 0.6875rem;
  letter-spacing: 0.1em;
  line-height: 1.5;
  text-transform: uppercase;
}

.platform-line__item {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  white-space: nowrap;
}

.platform-line__name {
  color: var(--text-body);
}

.platform-line__dot {
  width: 0.4375rem;
  height: 0.4375rem;
  border-radius: 50%;
}

.platform-line__item--available .platform-line__dot {
  background: var(--accent);
  box-shadow: 0 0 8px var(--accent-glow);
}

.platform-line__item--available .platform-line__state {
  color: var(--accent);
}

.platform-line__item--planned .platform-line__dot {
  border: 1px solid var(--text-faint);
}

.platform-line__item--planned .platform-line__state {
  color: var(--text-faint);
}

/* ---------------------------------------------------------------------------
 * Scroll reveal — CSS scroll-driven fade-up where supported (no JS);
 * elsewhere content is simply visible. Off with reduced motion.
 * ------------------------------------------------------------------------ */

@keyframes section-rise {
  from {
    opacity: 0;
    transform: translateY(1.5rem);
  }
  to {
    opacity: 1;
    transform: none;
  }
}

@media (prefers-reduced-motion: no-preference) {
  @supports (animation-timeline: view()) {
    .reveal {
      animation: section-rise linear both;
      animation-timeline: view();
      animation-range: entry 0% entry 35%;
    }
  }
}

/* ===========================================================================
 * Services, About, Contact (Design Pass 3)
 * ======================================================================== */

/* A page whose field is the last block (Contact) still needs air above the footer. */
.shell-page main > .field:last-child {
  margin-bottom: clamp(3rem, 2rem + 3vw, 5rem);
}

/* ---------------------------------------------------------------------------
 * Services — one panel per service: intro left, deliverables/examples right.
 * ------------------------------------------------------------------------ */

.service-list {
  display: grid;
  gap: var(--space-3);
}

.service {
  position: relative;
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: var(--space-4);
  padding: var(--space-4) var(--space-3);
  border: 1px solid var(--field-rule);
  border-radius: var(--radius);
  background: var(--panel);
}

/* Lit segment on each panel's top edge, like the field's own edge. */
.service::before {
  content: "";
  position: absolute;
  top: -1px;
  left: var(--space-3);
  width: 2.5rem;
  height: 2px;
  background: var(--accent-dim);
}

.service__intro {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: var(--space-2);
}

.service__index {
  margin: 0;
  color: var(--accent);
  font-family: var(--font-mono);
  font-size: 0.75rem;
  letter-spacing: 0.1em;
}

.service__title {
  margin: 0;
  color: var(--text);
  font-size: clamp(1.375rem, 1.1rem + 0.9vw, 1.75rem);
  font-weight: 500;
  letter-spacing: -0.015em;
  line-height: 1.2;
}

.service__description {
  max-width: 34rem;
  margin: 0 0 var(--space-1);
  color: var(--text-body);
  font-size: 1rem;
  line-height: 1.65;
}

.service__detail {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: var(--space-3);
}

.service__group {
  display: grid;
  align-content: start;
  gap: var(--space-2);
  padding-top: var(--space-2);
  border-top: 1px solid var(--field-rule);
}

.service__list,
.service__examples {
  display: grid;
  gap: 0.375rem;
  margin: 0;
  padding: 0;
  list-style: none;
  font-size: 0.9375rem;
  line-height: 1.5;
}

.service__list li {
  position: relative;
  padding-left: 1.125rem;
  color: var(--text-body);
}

.service__list li::before {
  content: "";
  position: absolute;
  left: 0;
  top: 0.62em;
  width: 0.5rem;
  height: 1px;
  background: var(--accent-dim);
}

.service__note {
  margin: 0;
  color: var(--text-faint);
  font-size: 0.8125rem;
  line-height: 1.5;
}

@media (min-width: 40rem) {
  .service__detail {
    grid-template-columns: minmax(0, 1.25fr) minmax(0, 1fr);
  }

  /* A service without public examples yet: deliverables use the full column. */
  .service__detail > .service__group:only-child {
    grid-column: 1 / -1;
  }
}

@media (min-width: 60rem) {
  .service {
    grid-template-columns: minmax(0, 5fr) minmax(0, 7fr);
    column-gap: var(--space-5);
    padding: var(--space-5) var(--space-4);
  }

  .service::before {
    left: var(--space-4);
  }
}

/* FAQ (Services): question/answer pairs in the rail's content column. */
.faq {
  display: grid;
  gap: 0;
  margin: 0;
}

.faq__item {
  display: grid;
  gap: var(--space-1);
  padding-block: var(--space-3);
  border-top: 1px solid var(--field-rule);
}

.faq__item:first-child {
  padding-top: 0;
  border-top: 0;
}

.faq__item dt {
  color: var(--text);
  font-size: 1.0625rem;
  font-weight: 500;
}

.faq__item dd {
  max-width: var(--measure);
  margin: 0;
  color: var(--text-body);
  line-height: 1.65;
}

@media (min-width: 64rem) {
  .faq__item {
    grid-template-columns: minmax(0, 2fr) minmax(0, 3fr);
    column-gap: var(--space-4);
  }
}

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

.prose-block {
  display: grid;
  gap: var(--space-2);
  max-width: 44rem;
}

.prose-block > p {
  margin: 0;
  color: var(--text-body);
  font-size: 1.0625rem;
  line-height: 1.7;
}

/* The motto at reading scale: present, but not a second hero. */
.motto-block {
  display: grid;
  gap: 0.15rem;
  margin-bottom: var(--space-2);
  padding-left: var(--space-3);
  border-left: 2px solid var(--accent);
}

.motto-block p {
  margin: 0;
  color: var(--text);
  font-size: clamp(1.25rem, 1rem + 1vw, 1.625rem);
  font-weight: 500;
  letter-spacing: -0.015em;
  line-height: 1.25;
}

.motto-block p:last-child {
  color: var(--accent);
  text-shadow: 0 0 22px var(--accent-glow);
}

.prose-block > .person {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 0.25rem 1rem;
}

.person__name {
  color: var(--text);
  font-size: 1.375rem;
  font-weight: 500;
  letter-spacing: -0.01em;
}

.person__role {
  color: var(--text-faint);
  font-family: var(--font-mono);
  font-size: 0.6875rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}

.prose-block > .tag-list {
  margin-top: var(--space-1);
}

.prose-block > .person__resume {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  margin-top: var(--space-1);
}

.person__resume-note {
  color: var(--text-faint);
  font-family: var(--font-mono);
  font-size: 0.6875rem;
  letter-spacing: 0.14em;
}

.principles {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(15rem, 1fr));
  gap: var(--space-3) var(--space-4);
  margin: 0;
  padding: 0;
  list-style: none;
}

.principles__item {
  position: relative;
  display: grid;
  align-content: start;
  gap: var(--space-1);
  padding-top: var(--space-2);
  border-top: 1px solid var(--border-strong);
}

.principles__item::before {
  content: "";
  position: absolute;
  top: -1px;
  left: 0;
  width: 2rem;
  height: 2px;
  background: var(--accent-dim);
}

.principles__item h3 {
  margin: 0;
  color: var(--text);
  font-size: 1.0625rem;
  font-weight: 500;
  line-height: 1.35;
}

.principles__item p {
  margin: 0;
  color: var(--text-body);
  font-size: 0.9375rem;
  line-height: 1.6;
}

/* ---------------------------------------------------------------------------
 * Contact — info left, form panel right; stacked on narrow screens.
 * ------------------------------------------------------------------------ */

.contact-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: var(--space-5);
  align-items: start;
}

.contact-info {
  display: grid;
  gap: var(--space-4);
}

.contact-info__group {
  display: grid;
  gap: var(--space-1);
}

.contact-info__group > p {
  margin: 0;
  color: var(--text-body);
}

.contact-info__list,
.contact-info__links {
  display: grid;
  gap: 0.375rem;
  margin: 0;
  padding: 0;
  list-style: none;
  color: var(--text-body);
  font-size: 0.9375rem;
  line-height: 1.5;
}

.contact-info__list li {
  position: relative;
  padding-left: 1.125rem;
}

.contact-info__list li::before {
  content: "";
  position: absolute;
  left: 0;
  top: 0.62em;
  width: 0.5rem;
  height: 1px;
  background: var(--accent-dim);
}

.contact-panel {
  display: grid;
  gap: var(--space-2);
  padding: var(--space-4) var(--space-3);
  border: 1px solid var(--field-rule);
  border-radius: var(--radius);
  background: var(--panel);
}

.contact-panel__title {
  margin: 0;
  color: var(--text);
  font-size: 1.375rem;
  font-weight: 500;
  letter-spacing: -0.01em;
}

/* Page form fields read a little larger than the modal's. */
.contact-panel .contact-form input,
.contact-panel .contact-form textarea {
  border-color: var(--border-strong);
  color: var(--text);
}

.contact-panel .contact-form input:focus-visible,
.contact-panel .contact-form textarea:focus-visible {
  border-color: var(--accent);
}

.contact-panel .form-submit {
  margin-top: var(--space-1);
  padding: 0.75rem 1.25rem;
  border-color: var(--accent);
  background: var(--accent-wash);
  color: var(--accent-bright);
}

.contact-panel .form-submit:disabled {
  opacity: 0.55;
  cursor: not-allowed;
}

@media (min-width: 60rem) {
  .contact-layout {
    grid-template-columns: minmax(0, 5fr) minmax(0, 7fr);
    column-gap: var(--space-6);
  }

  .contact-panel {
    padding: var(--space-5);
  }
}

/* ===========================================================================
 * Detail pages — case studies and product details (Design Pass 4)
 *
 * <body class="shell-page detail-page">. Layouts: src/layouts/
 * CaseStudyLayout.astro and ProductDetailLayout.astro; components in
 * src/components/detail/. Same bezel → field → black footer rhythm as the
 * listing pages, with rail sections for long technical text.
 * ======================================================================== */

/* Header: return link, then the usual compact page header. */
.detail-header__back {
  justify-self: start;
  margin-bottom: 0.25rem;
}

.detail-header__meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--space-1) var(--space-3);
  margin-top: 0.25rem;
}

.detail-header__meta .platform-line {
  padding: 0;
  border: 0;
}

.detail-header__tags {
  margin-top: 0.25rem;
}

.detail-header__actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--space-2);
  margin-top: var(--space-1);
}

/* Overview: media (or lead prose) beside the spec panel. */
.detail-overview {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: var(--space-4);
  align-items: start;
}

@media (min-width: 64rem) {
  .detail-overview {
    grid-template-columns: minmax(0, 7fr) minmax(0, 5fr);
    column-gap: var(--space-5);
  }
}

/* Figures: images on a black mount, mono caption. */
.detail-figure {
  display: grid;
  gap: 0.625rem;
  margin: 0;
}

.detail-figure img {
  display: block;
  width: 100%;
  height: auto;
  border: 1px solid var(--field-rule);
  border-radius: var(--radius);
  background: var(--bg);
}

.detail-figure figcaption,
.detail-diagram figcaption {
  color: var(--text-faint);
  font-size: 0.8125rem;
  line-height: 1.55;
}

/* Spec panel (SpecPanel.astro). */
.spec-panel {
  position: relative;
  display: grid;
  gap: var(--space-2);
  padding: var(--space-3);
  border: 1px solid var(--field-rule);
  border-radius: var(--radius);
  background: var(--panel);
}

.spec-panel::before {
  content: "";
  position: absolute;
  top: -1px;
  left: var(--space-3);
  width: 2.5rem;
  height: 2px;
  background: var(--accent);
  box-shadow: 0 0 8px var(--accent-glow);
}

.spec-panel__list {
  display: grid;
  margin: 0;
}

.spec-panel__row {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 0.125rem;
  padding-block: 0.625rem;
  border-top: 1px solid var(--field-rule);
}

.spec-panel__row:last-child {
  padding-bottom: 0;
}

.spec-panel__row dt {
  color: var(--text-faint);
  font-family: var(--font-mono);
  font-size: 0.6875rem;
  letter-spacing: 0.12em;
  line-height: 1.7;
  text-transform: uppercase;
}

.spec-panel__row dd {
  min-width: 0;
  margin: 0;
  color: var(--text);
  font-size: 0.9375rem;
  line-height: 1.5;
  overflow-wrap: anywhere;
}

.spec-panel__link {
  color: var(--accent);
  text-decoration: none;
}

.spec-panel__link:hover {
  color: var(--accent-bright);
  text-decoration: underline;
  text-underline-offset: 3px;
}

@media (min-width: 30rem) {
  .spec-panel__row {
    grid-template-columns: 8.5rem minmax(0, 1fr);
    column-gap: var(--space-2);
  }
}

/* Section body typography for long technical text. */
.detail-body {
  display: grid;
  gap: var(--space-2);
  min-width: 0;
  max-width: 46rem;
}

.detail-wide .detail-body {
  max-width: none;
}

.detail-body > p,
.detail-body li,
.detail-columns > p {
  margin: 0;
  color: var(--text-body);
  font-size: 1rem;
  line-height: 1.75;
}

.detail-body > .detail-body__lead {
  color: var(--text);
  font-size: 1.125rem;
  line-height: 1.65;
}

.detail-body > .detail-body__note {
  padding-left: var(--space-2);
  border-left: 2px solid var(--field-rule);
  color: var(--text-muted);
  font-size: 0.9375rem;
}

.detail-body h3 {
  margin: var(--space-2) 0 0;
  color: var(--text);
  font-size: 1.1875rem;
  font-weight: 500;
  line-height: 1.35;
}

.detail-body > ul {
  display: grid;
  gap: var(--space-1);
  margin: 0;
  padding: 0;
  list-style: none;
}

.detail-body > ul li {
  position: relative;
  padding-left: 1.125rem;
}

.detail-body > ul li::before {
  content: "";
  position: absolute;
  left: 0;
  top: 0.85em;
  width: 0.5rem;
  height: 1px;
  background: var(--accent-dim);
}

.detail-body p a,
.detail-body li a {
  color: var(--accent);
  text-underline-offset: 3px;
}

.detail-body p a:hover,
.detail-body li a:hover {
  color: var(--accent-bright);
}

.detail-page code {
  padding: 0.05em 0.3em;
  border: 1px solid var(--field-rule);
  border-radius: var(--radius);
  background: var(--panel);
  color: var(--accent-bright);
  font-family: var(--font-mono);
  font-size: 0.85em;
  overflow-wrap: anywhere;
}

/* Wide sections: heading above, content across the full container. */
.detail-wide > .section-head {
  margin-bottom: var(--space-4);
}

/* Introductory text above a wide diagram, in two readable columns. */
.detail-columns {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: var(--space-2) var(--space-5);
}

@media (min-width: 64rem) {
  .detail-columns {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

/* First-person engineering notes, set apart from company copy. */
.bench-note {
  display: grid;
  gap: var(--space-2);
  padding-left: var(--space-3);
  border-left: 2px solid var(--accent-dim);
}

.bench-note p {
  margin: 0;
  color: var(--text-body);
  font-size: 1.0625rem;
  line-height: 1.75;
}

.bench-note > .bench-note__label {
  color: var(--accent);
  font-family: var(--font-mono);
  font-size: 0.75rem;
  letter-spacing: 0.14em;
  line-height: 1.6;
  text-transform: uppercase;
}

/*
 * Architecture diagrams: shown whole at desktop widths. Below 48rem the
 * SVG keeps a legible minimum width and scrolls inside its own frame, so
 * the page itself never scrolls sideways.
 */
.detail-diagram {
  display: grid;
  gap: 0.75rem;
  margin: 0;
}

.detail-diagram__scroll {
  overflow-x: auto;
  border: 1px solid var(--field-rule);
  border-radius: var(--radius);
  background: #090c10;
  overscroll-behavior-x: contain;
}

.detail-diagram__scroll svg {
  display: block;
  width: 100%;
  height: auto;
}

.detail-diagram figcaption {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  justify-content: space-between;
  gap: var(--space-1) var(--space-3);
}

.detail-diagram figcaption span {
  max-width: 52rem;
}

@media (max-width: 47.99rem) {
  .detail-diagram__scroll svg {
    width: 52rem;
    max-width: none;
  }
}

/* Text beside a tall screenshot (WebUI captures). */
.detail-split {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: var(--space-4);
  align-items: start;
}

.detail-split__text {
  display: grid;
  gap: var(--space-2);
}

.detail-split__text p {
  margin: 0;
  color: var(--text-body);
  line-height: 1.75;
}

.detail-split__figure {
  max-width: 28rem;
}

.detail-split__figure--narrow {
  max-width: 18rem;
}

@media (min-width: 56rem) {
  .rail .detail-body:has(.detail-split) {
    max-width: none;
  }

  .detail-split {
    grid-template-columns: minmax(0, 3fr) minmax(0, 2fr);
    column-gap: var(--space-4);
  }

  .detail-split__figure {
    justify-self: end;
  }
}

/* Gallery: three scenes across at tablet widths and up. */
.detail-gallery {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: var(--space-3);
}

@media (min-width: 48rem) {
  .detail-gallery {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}

/* State table (Bathroom Clock behavior). */
.state-table {
  display: grid;
  margin: 0;
  border: 1px solid var(--field-rule);
  border-radius: var(--radius);
  background: var(--panel);
}

.state-table > div {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 0.25rem var(--space-3);
  padding: var(--space-2) var(--space-3);
}

.state-table > div + div {
  border-top: 1px solid var(--field-rule);
}

.state-table dt {
  color: var(--accent);
  font-family: var(--font-mono);
  font-size: 0.75rem;
  letter-spacing: 0.12em;
  line-height: 1.9;
  text-transform: uppercase;
}

.state-table dd {
  margin: 0;
  color: var(--text-body);
  font-size: 0.9375rem;
  line-height: 1.65;
}

@media (min-width: 40rem) {
  .state-table > div {
    grid-template-columns: 8.5rem minmax(0, 1fr);
  }
}

/* Metric grid (MetricGrid.astro): recorded measurements. */
.metric-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 12.5rem), 1fr));
  gap: 1px;
  margin: 0;
  border: 1px solid var(--field-rule);
  border-radius: var(--radius);
  background: var(--field-rule);
  overflow: hidden;
}

.metric-grid__item {
  display: grid;
  align-content: start;
  gap: 0.375rem;
  padding: var(--space-2) var(--space-3);
  background: var(--panel);
}

.metric-grid dt {
  color: var(--text-faint);
  font-family: var(--font-mono);
  font-size: 0.6875rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.metric-grid dd {
  display: grid;
  gap: 0.25rem;
  margin: 0;
}

.metric-grid dd strong {
  color: var(--text);
  font-family: var(--font-mono);
  font-size: 1.125rem;
  font-weight: 500;
  letter-spacing: 0.01em;
}

.metric-grid dd span {
  color: var(--text-muted);
  font-size: 0.8125rem;
  line-height: 1.45;
}

/* Evidence ledger (EvidenceLedger.astro): hardware / host / open. */
.ledger {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 15rem), 1fr));
  gap: var(--space-2);
  margin-top: var(--space-1);
}

.ledger__group {
  display: grid;
  align-content: start;
  gap: var(--space-2);
  padding: var(--space-3);
  border: 1px solid var(--field-rule);
  border-radius: var(--radius);
  background: var(--panel);
}

.ledger__label {
  display: flex;
  align-items: baseline;
  gap: 0.625rem;
  margin: 0;
  color: var(--text);
  font-family: var(--font-mono);
  font-size: 0.75rem;
  font-weight: 400;
  letter-spacing: 0.12em;
  line-height: 1.5;
  text-transform: uppercase;
}

.ledger__dot {
  flex: 0 0 auto;
  width: 0.4375rem;
  height: 0.4375rem;
  border-radius: 50%;
  transform: translateY(-0.05em);
}

.ledger__group--hardware .ledger__dot {
  background: var(--accent);
  box-shadow: 0 0 8px var(--accent-glow);
}

.ledger__group--host .ledger__dot {
  border: 1px solid var(--accent);
}

.ledger__group--open .ledger__dot {
  border: 1px solid var(--text-faint);
}

.ledger__items {
  display: grid;
  gap: var(--space-1);
  margin: 0;
  padding: 0;
  list-style: none;
}

.ledger__items li {
  position: relative;
  padding-left: 1.125rem;
  color: var(--text-body);
  font-size: 0.9375rem;
  line-height: 1.55;
}

.ledger__items li::before {
  content: "";
  position: absolute;
  left: 0;
  top: 0.75em;
  width: 0.5rem;
  height: 1px;
  background: var(--accent-dim);
}

.ledger__note {
  margin: 0;
  padding-top: var(--space-1);
  border-top: 1px solid var(--field-rule);
  color: var(--text-muted);
  font-size: 0.8125rem;
  line-height: 1.5;
}

/* Rail sections that hold a ledger use the full content column. */
.rail .detail-body:has(.ledger) {
  max-width: none;
}

/* Audio samples. */
.detail-audio {
  display: grid;
  gap: var(--space-1);
  padding: var(--space-2) var(--space-3);
  border: 1px solid var(--field-rule);
  border-radius: var(--radius);
  background: var(--panel);
}

.detail-audio p {
  margin: 0;
}

.detail-audio__label {
  color: var(--text);
  font-family: var(--font-mono);
  font-size: 0.75rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.detail-audio audio {
  display: block;
  width: min(100%, 26rem);
}

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

/* Product screenshots: a purposeful pair, shown whole at phone proportions. */
.detail-shots {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: var(--space-2);
  align-items: start;
  justify-self: center;
  width: min(100%, 36rem);
  padding: var(--space-3);
  border: 1px solid var(--field-rule);
  border-radius: var(--radius);
  background: var(--bg);
}

.detail-shots__item {
  display: grid;
  gap: 0.625rem;
  margin: 0;
}

.detail-shots__item img {
  display: block;
  width: 100%;
  height: auto;
  border: 1px solid var(--border-strong);
  border-radius: 8px;
}

.detail-shots__item figcaption {
  display: grid;
  gap: 0.25rem;
  text-align: center;
}

.detail-shots__label {
  color: var(--text-muted);
  font-family: var(--font-mono);
  font-size: 0.6875rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.detail-shots__detail {
  color: var(--text-faint);
  font-size: 0.8125rem;
  line-height: 1.45;
}

@media (min-width: 64rem) {
  .detail-overview--product {
    grid-template-columns: minmax(0, 6fr) minmax(0, 5fr);
  }

  .detail-shots {
    justify-self: start;
    padding: var(--space-4);
  }
}

@media (max-width: 30rem) {
  .detail-shots {
    padding: var(--space-2);
    gap: 0.75rem;
  }
}

/* PWA install steps (InstallTabs.astro + public/js/apps.js). */
.install {
  display: grid;
  gap: var(--space-2);
}

.install__tabset {
  border: 1px solid var(--field-rule);
  border-radius: var(--radius);
  background: var(--panel);
}

.install__tabs {
  display: flex;
  flex-wrap: wrap;
  border-bottom: 1px solid var(--field-rule);
}

.install__tab {
  flex: 1 1 12rem;
  min-height: 2.75rem;
  margin: 0;
  padding: 0.75rem var(--space-2);
  border: 0;
  border-bottom: 2px solid transparent;
  background: transparent;
  color: var(--text-muted);
  font: inherit;
  font-size: 0.875rem;
  letter-spacing: 0.04em;
  cursor: pointer;
  transition: color var(--transition-speed) ease, border-color var(--transition-speed) ease;
}

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

.install__tab[aria-selected="true"] {
  border-bottom-color: var(--accent);
  color: var(--accent);
}

.install__tab:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: -2px;
}

.install__panel {
  display: grid;
  gap: var(--space-2);
  padding: var(--space-3);
}

.install__panel[hidden] {
  display: none;
}

.install__panel + .install__panel {
  border-top: 1px solid var(--field-rule);
}

.install__panel h3 {
  margin: 0;
  color: var(--text-faint);
  font-family: var(--font-mono);
  font-size: 0.6875rem;
  font-weight: 400;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}

.install__panel ol {
  display: grid;
  gap: 0.5rem;
  margin: 0;
  padding-left: 1.25rem;
  color: var(--text-body);
  line-height: 1.6;
}

.install__panel ol li::marker {
  color: var(--accent-dim);
  font-family: var(--font-mono);
}

.install__panel p,
.install__note {
  margin: 0;
  color: var(--text-muted);
  font-size: 0.9375rem;
  line-height: 1.6;
}

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

.install__panel strong {
  color: var(--text);
  font-weight: 500;
}

/* Previous / next navigation (DetailNav.astro). */
.detail-nav {
  display: grid;
  gap: var(--space-3);
}

.detail-nav__pair {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: var(--space-2);
}

.detail-nav__link {
  display: grid;
  gap: 0.375rem;
  padding: var(--space-2) var(--space-3);
  border: 1px solid var(--field-rule);
  border-radius: var(--radius);
  background: var(--panel);
  text-decoration: none;
  transition: border-color var(--transition-speed) ease;
}

.detail-nav__link:hover {
  border-color: var(--accent-dim);
}

.detail-nav__link--next {
  text-align: right;
}

.detail-nav__kicker {
  color: var(--text-faint);
  font-family: var(--font-mono);
  font-size: 0.6875rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.detail-nav__title {
  color: var(--text);
  font-size: 1.0625rem;
  font-weight: 500;
  line-height: 1.3;
  transition: color var(--transition-speed) ease;
}

.detail-nav__link:hover .detail-nav__title {
  color: var(--accent);
}

.detail-nav__spacer {
  display: none;
}

.detail-nav__footer {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-2);
}

@media (min-width: 40rem) {
  .detail-nav__pair {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .detail-nav__spacer {
    display: block;
  }
}

/* Detail pages end on navigation, so the field needs air above the footer. */
.detail-page main > .field:last-child {
  margin-bottom: clamp(3rem, 2rem + 3vw, 5rem);
}

/* ---------------------------------------------------------------------------
 * 404 (pre-deployment polish pass): a short row of ways back into the site.
 * ------------------------------------------------------------------------ */

.not-found {
  display: grid;
  gap: var(--space-2);
}

.not-found__actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--space-2);
}
