/* Shared portfolio system: static-first, editorial, and deliberately restrained. */
*, *::before, *::after {
  box-sizing: border-box;
}

:root {
  --canvas: #f7f4ee;
  --surface: #fffdf9;
  --surface-strong: #ffffff;
  --ink: #1b1916;
  --muted: #625b52;
  --quiet: #736a61;
  --line: #dcd5ca;
  --line-strong: #bdb3a5;
  --copper: #9b4e16;
  --copper-soft: #f0dfd0;
  --green: #276845;
  --green-soft: #e3eee7;
  --teal: #126d73;
  --teal-soft: #e2eef0;
  --touchline: #32654f;
  --touchline-soft: #e3ece7;
  --focus: #0b6f78;
  --shadow: 0 18px 50px rgba(39, 31, 23, 0.08);
  --font-sans: "Space Grotesk", Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  --font-mono: "JetBrains Mono", "SFMono-Regular", Consolas, monospace;
  --page: 1180px;
  --reading: 760px;
  --radius-sm: 8px;
  --radius-md: 14px;
  --radius-lg: 22px;
}

html {
  background: var(--canvas);
  color: var(--ink);
  scroll-behavior: smooth;
}

body {
  min-width: 320px;
  margin: 0;
  background: var(--canvas);
  color: var(--ink);
  font-family: var(--font-sans);
  font-size: 16px;
  line-height: 1.65;
  text-rendering: optimizeLegibility;
  -webkit-font-smoothing: antialiased;
}

body::before {
  position: fixed;
  inset: 0;
  z-index: -1;
  background-image: linear-gradient(rgba(27, 25, 22, 0.022) 1px, transparent 1px);
  background-size: 100% 32px;
  content: "";
  pointer-events: none;
}

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

button,
input,
textarea {
  font: inherit;
}

button,
a {
  -webkit-tap-highlight-color: transparent;
}

a {
  color: inherit;
  text-decoration-thickness: 1px;
  text-underline-offset: 0.18em;
}

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

.skip-link {
  position: fixed;
  top: 10px;
  left: 10px;
  z-index: 1000;
  padding: 10px 14px;
  border-radius: var(--radius-sm);
  background: var(--ink);
  color: #ffffff;
  font-family: var(--font-mono);
  font-size: 0.78rem;
  transform: translateY(-160%);
}

.skip-link:focus {
  transform: translateY(0);
}

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

.shell {
  width: min(calc(100% - 44px), var(--page));
  margin-inline: auto;
}

.reading-width {
  max-width: var(--reading);
}

.site-header {
  position: sticky;
  top: 0;
  z-index: 100;
  border-bottom: 1px solid var(--line);
  background: rgba(247, 244, 238, 0.96);
}

.nav-inner {
  display: flex;
  min-height: 68px;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
}

.brand {
  display: inline-flex;
  min-height: 44px;
  align-items: center;
  font-family: var(--font-mono);
  font-size: 0.8rem;
  font-weight: 600;
  letter-spacing: 0.02em;
  text-decoration: none;
  white-space: nowrap;
}

.brand-mark {
  color: var(--copper);
}

.site-nav {
  display: flex;
  align-items: center;
  gap: 4px;
}

.site-nav a {
  display: inline-flex;
  min-height: 44px;
  align-items: center;
  padding: 0 12px;
  color: var(--muted);
  font-family: var(--font-mono);
  font-size: 0.72rem;
  text-decoration: none;
}

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

.site-nav .nav-cta {
  min-height: 44px;
  margin-left: 6px;
  border: 1px solid var(--ink);
  border-radius: 999px;
  color: var(--ink);
}

.eyebrow,
.section-label,
.project-index,
.status,
.tag,
.metric-label,
.case-fact dt,
.mini-label {
  font-family: var(--font-mono);
}

.eyebrow,
.section-label,
.project-index,
.mini-label {
  color: var(--copper);
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.13em;
  text-transform: uppercase;
}

.hero {
  display: grid;
  min-height: min(650px, calc(100svh - 68px));
  grid-template-columns: minmax(0, 1.45fr) minmax(270px, 0.55fr);
  align-items: center;
  gap: clamp(48px, 8vw, 110px);
  padding-block: clamp(44px, 5vw, 68px);
  padding-block-start: clamp(28px, 3.5vw, 48px);
}

.hero h1 {
  max-width: 900px;
  margin: 18px 0 24px;
  font-size: clamp(3.2rem, 7.4vw, 6.8rem);
  font-weight: 650;
  letter-spacing: -0.058em;
  line-height: 0.96;
  text-wrap: balance;
}

.hero .lede {
  max-width: 790px;
  margin: 0;
  color: var(--muted);
  font-size: clamp(1.05rem, 1.75vw, 1.28rem);
  line-height: 1.58;
}

.hero-actions,
.case-actions,
.contact-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 30px;
}

.button {
  display: inline-flex;
  min-height: 46px;
  align-items: center;
  justify-content: center;
  gap: 9px;
  padding: 11px 18px;
  border: 1px solid var(--line-strong);
  border-radius: 999px;
  background: var(--surface);
  color: var(--ink);
  font-family: var(--font-mono);
  font-size: 0.75rem;
  font-weight: 600;
  text-decoration: none;
  transition: background 150ms ease, border-color 150ms ease, color 150ms ease, transform 150ms ease;
}

.button:hover {
  border-color: var(--ink);
  transform: translateY(-1px);
}

.button.primary {
  border-color: var(--ink);
  background: var(--ink);
  color: #ffffff;
}

.button.primary:hover {
  background: var(--copper);
  border-color: var(--copper);
}

.text-link {
  color: var(--copper);
  font-weight: 600;
}

.hero-note {
  border-top: 3px solid var(--copper);
  background: var(--surface);
  padding: 26px;
  box-shadow: var(--shadow);
}

.hero-note h2 {
  margin: 8px 0 16px;
  font-size: 1.15rem;
  line-height: 1.3;
}

.delivery-list {
  margin: 0;
  padding: 0;
  list-style: none;
  counter-reset: delivery;
}

.delivery-list li {
  display: grid;
  grid-template-columns: 28px 1fr;
  gap: 10px;
  align-items: baseline;
  padding: 9px 0;
  border-top: 1px solid var(--line);
  color: var(--muted);
  font-size: 0.92rem;
}

.delivery-list li::before {
  color: var(--copper);
  content: "0" counter(delivery);
  counter-increment: delivery;
  font-family: var(--font-mono);
  font-size: 0.68rem;
}

.availability {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  margin-top: 22px;
  color: var(--muted);
  font-family: var(--font-mono);
  font-size: 0.72rem;
  line-height: 1.55;
}

.availability::before {
  width: 9px;
  height: 9px;
  flex: 0 0 auto;
  margin-top: 0.18rem;
  border-radius: 50%;
  background: var(--green);
  box-shadow: 0 0 0 4px var(--green-soft);
  content: "";
}

.section {
  padding-block: clamp(68px, 9vw, 116px);
  border-top: 1px solid var(--line);
}

.section-heading {
  display: grid;
  grid-template-columns: minmax(0, 0.42fr) minmax(0, 1fr);
  gap: 32px;
  align-items: start;
  margin-bottom: clamp(34px, 5vw, 62px);
}

.section-heading h2 {
  max-width: 760px;
  margin: 0;
  font-size: clamp(2rem, 4.4vw, 3.6rem);
  font-weight: 620;
  letter-spacing: -0.045em;
  line-height: 1.03;
  text-wrap: balance;
}

.section-heading p {
  max-width: 680px;
  margin: 16px 0 0;
  color: var(--muted);
  font-size: 1.02rem;
}

.featured-list {
  display: grid;
  gap: 22px;
}

.featured-project {
  --project-accent: var(--copper);
  --project-soft: var(--copper-soft);
  position: relative;
  display: grid;
  min-height: 390px;
  grid-template-columns: minmax(0, 0.93fr) minmax(0, 1.07fr);
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  background: var(--surface);
}

.featured-project.anonymiser {
  --project-accent: var(--green);
  --project-soft: var(--green-soft);
}

.featured-project.quoteguard {
  --project-accent: var(--teal);
  --project-soft: var(--teal-soft);
}

.featured-project.touchline {
  --project-accent: var(--touchline);
  --project-soft: var(--touchline-soft);
}

.featured-copy {
  display: flex;
  flex-direction: column;
  padding: clamp(28px, 4vw, 48px);
}

.project-topline {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.project-index {
  color: var(--project-accent);
}

.status {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  color: var(--green);
  font-size: 0.65rem;
  font-weight: 600;
  letter-spacing: 0.11em;
  text-transform: uppercase;
}

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

.status.prototype,
.status.in-progress {
  color: var(--copper);
}

.status.archived,
.status.planned {
  color: var(--quiet);
}

.featured-copy h3 {
  margin: 34px 0 12px;
  font-size: clamp(2rem, 4vw, 3.1rem);
  font-weight: 620;
  letter-spacing: -0.042em;
  line-height: 1.02;
}

.featured-copy > p {
  max-width: 540px;
  margin: 0;
  color: var(--muted);
  font-size: 1rem;
}

.metric-line {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
  margin: 28px 0;
}

.metric-small {
  padding-top: 13px;
  border-top: 2px solid var(--project-accent);
}

.metric-small strong {
  display: block;
  color: var(--project-accent);
  font-family: var(--font-mono);
  font-size: 1.15rem;
  line-height: 1.2;
}

.metric-small span {
  display: block;
  margin-top: 5px;
  color: var(--muted);
  font-size: 0.78rem;
  line-height: 1.45;
}

.project-links {
  display: flex;
  flex-wrap: wrap;
  gap: 4px 22px;
  margin-top: auto;
}

.project-choice-label {
  display: none;
  min-height: 44px;
  align-items: center;
  gap: 8px;
  margin-top: auto;
  color: var(--project-accent);
  font-family: var(--font-mono);
  font-size: 0.76rem;
  font-weight: 600;
}

.project-link {
  display: inline-flex;
  min-height: 44px;
  align-items: center;
  gap: 8px;
  color: var(--project-accent);
  font-family: var(--font-mono);
  font-size: 0.76rem;
  font-weight: 600;
  text-decoration: none;
}

.project-link:hover {
  text-decoration: underline;
}

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

.featured-media {
  position: relative;
  display: flex;
  min-height: 320px;
  align-items: center;
  justify-content: center;
  padding: clamp(22px, 3vw, 38px);
  border-left: 1px solid var(--line);
  background: var(--project-soft);
}

.showcase-preview {
  color: var(--ink);
}

.featured-media img {
  width: 100%;
  height: auto;
  max-height: 340px;
  object-fit: contain;
  border: 1px solid rgba(27, 25, 22, 0.1);
  border-radius: var(--radius-md);
  background: var(--surface-strong);
  box-shadow: 0 14px 38px rgba(39, 31, 23, 0.12);
}

.preview-label {
  position: absolute;
  right: clamp(28px, 3.5vw, 44px);
  bottom: clamp(28px, 3.5vw, 44px);
  display: inline-flex;
  min-height: 40px;
  align-items: center;
  gap: 8px;
  padding: 8px 13px;
  border: 1px solid var(--line-strong);
  border-radius: 999px;
  background: rgba(255, 253, 249, 0.96);
  box-shadow: 0 8px 22px rgba(39, 31, 23, 0.12);
  color: var(--project-accent);
  font-family: var(--font-mono);
  font-size: 0.68rem;
  font-weight: 600;
}

.project-choice-trigger,
.project-choice-popover {
  display: none;
}

@supports selector(:popover-open) {
  .project-choice-fallback {
    display: none;
  }

  .project-choice-label {
    display: inline-flex;
  }

  .project-choice-trigger {
    position: absolute;
    inset: 0;
    z-index: 3;
    display: block;
    width: 100%;
    padding: 0;
    border: 0;
    border-radius: inherit;
    background: transparent;
    color: transparent;
    cursor: pointer;
  }

  .project-choice-trigger::after {
    position: absolute;
    inset: 3px;
    border: 1px solid transparent;
    border-radius: calc(var(--radius-lg) - 3px);
    content: "";
    pointer-events: none;
    transition: border-color 150ms ease, box-shadow 150ms ease;
  }

  .project-choice-trigger:hover::after {
    border-color: var(--project-accent);
  }

  .project-choice-trigger:focus-visible {
    outline: 0;
  }

  .project-choice-trigger:focus-visible::after {
    border-color: var(--focus);
    box-shadow: inset 0 0 0 2px var(--focus);
  }

  .project-choice-popover:popover-open {
    --project-accent: var(--copper);
    display: block;
    width: min(calc(100vw - 44px), 650px);
    max-height: min(calc(100vh - 44px), 720px);
    padding: clamp(24px, 4vw, 36px);
    overflow: auto;
    border: 1px solid var(--line-strong);
    border-top: 4px solid var(--project-accent);
    border-radius: var(--radius-lg);
    background: var(--surface);
    box-shadow: 0 28px 80px rgba(27, 25, 22, 0.24);
    color: var(--ink);
  }

  .project-choice-popover.anonymiser:popover-open {
    --project-accent: var(--green);
  }

  .project-choice-popover.quoteguard:popover-open {
    --project-accent: var(--teal);
  }

  .project-choice-popover::backdrop {
    background: rgba(27, 25, 22, 0.42);
  }

  .project-choice-head {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 24px;
  }

  .project-choice-head .mini-label {
    color: var(--project-accent);
  }

  .project-choice-head h3 {
    margin: 8px 0 0;
    font-size: clamp(1.8rem, 5vw, 2.65rem);
    letter-spacing: -0.04em;
    line-height: 1.05;
  }

  .project-choice-close {
    display: inline-flex;
    width: 44px;
    height: 44px;
    flex: 0 0 44px;
    align-items: center;
    justify-content: center;
    padding: 0;
    border: 1px solid var(--line-strong);
    border-radius: 50%;
    background: transparent;
    color: var(--muted);
    cursor: pointer;
    font-size: 1.6rem;
    line-height: 1;
  }

  .project-choice-close:hover {
    border-color: var(--ink);
    color: var(--ink);
  }

  .project-choice-popover > p {
    max-width: 520px;
    margin: 18px 0 24px;
    color: var(--muted);
  }

  .project-choice-options {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 12px;
  }

  .project-choice-option {
    display: flex;
    min-height: 128px;
    flex-direction: column;
    justify-content: space-between;
    gap: 22px;
    padding: 20px;
    border: 1px solid var(--line-strong);
    border-radius: var(--radius-md);
    background: var(--surface-strong);
    color: var(--ink);
    text-decoration: none;
  }

  .project-choice-option.primary {
    border-color: var(--project-accent);
    background: var(--project-accent);
    color: #ffffff;
  }

  .project-choice-option:hover {
    border-color: var(--project-accent);
  }

  .project-choice-option strong {
    font-size: 1.05rem;
  }

  .project-choice-option span {
    color: var(--muted);
    font-size: 0.8rem;
    line-height: 1.45;
  }

  .project-choice-option.primary span {
    color: rgba(255, 255, 255, 0.82);
  }
}

.process-grid,
.capability-grid,
.brief-grid,
.metric-grid,
.about-grid,
.project-grid {
  display: grid;
  gap: 16px;
}

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

.process-step {
  min-height: 210px;
  padding: 22px;
  border-top: 3px solid var(--copper);
  background: var(--surface);
}

.process-step h3 {
  margin: 26px 0 8px;
  font-size: 1.08rem;
  line-height: 1.2;
}

.process-step p {
  margin: 0;
  color: var(--muted);
  font-size: 0.88rem;
}

.capability-grid {
  grid-template-columns: repeat(3, minmax(0, 1fr));
  margin-top: 18px;
}

.capability-card {
  padding: 28px;
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  background: var(--surface);
}

.capability-card h3 {
  margin: 12px 0 10px;
  font-size: 1.25rem;
}

.capability-card p {
  margin: 0;
  color: var(--muted);
  font-size: 0.92rem;
}

.evidence-links {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 14px;
  margin-top: 18px;
  color: var(--copper);
  font-family: var(--font-mono);
  font-size: 0.7rem;
}

.about-grid {
  grid-template-columns: minmax(0, 1.15fr) minmax(280px, 0.65fr);
  align-items: start;
  gap: clamp(32px, 7vw, 90px);
}

.about-copy h2,
.contact-panel h2 {
  margin: 12px 0 18px;
  font-size: clamp(2rem, 4.4vw, 3.6rem);
  font-weight: 620;
  letter-spacing: -0.045em;
  line-height: 1.05;
}

.about-copy p,
.contact-panel p {
  max-width: 680px;
  margin: 0 0 16px;
  color: var(--muted);
  font-size: 1rem;
}

.credential-card {
  padding: 25px;
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  background: var(--surface);
}

.credential-card strong {
  display: block;
  margin: 12px 0 8px;
  font-size: 1.05rem;
  line-height: 1.35;
}

.credential-card p {
  margin: 0;
  color: var(--muted);
  font-size: 0.88rem;
}

.contact-panel {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 36px;
  align-items: end;
  padding: clamp(30px, 6vw, 66px);
  border-radius: var(--radius-lg);
  background: var(--ink);
  color: #ffffff;
}

.contact-panel .section-label {
  color: #e4a36d;
}

.contact-panel p {
  color: #d3ccc2;
}

.contact-panel .button.primary {
  border-color: #ffffff;
  background: #ffffff;
  color: var(--ink);
}

.contact-panel .button:not(.primary) {
  border-color: #777169;
  background: transparent;
  color: #ffffff;
}

.site-footer {
  padding-block: 34px;
  border-top: 1px solid var(--line);
}

.footer-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  color: var(--muted);
  font-family: var(--font-mono);
  font-size: 0.68rem;
}

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

/* Archive */
.page-intro {
  padding-block: clamp(62px, 9vw, 108px) 46px;
}

.page-intro h1,
.case-hero h1 {
  margin: 14px 0 18px;
  font-size: clamp(3rem, 7vw, 6rem);
  font-weight: 650;
  letter-spacing: -0.055em;
  line-height: 0.98;
}

.page-intro p {
  max-width: 720px;
  margin: 0;
  color: var(--muted);
  font-size: 1.06rem;
}

.archive-controls {
  display: none;
  gap: 16px;
  align-items: end;
  justify-content: space-between;
  padding: 20px;
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  background: var(--surface);
}

.js .archive-controls {
  display: flex;
}

.search-field {
  display: grid;
  min-width: min(100%, 300px);
  gap: 7px;
}

.search-field label {
  color: var(--muted);
  font-family: var(--font-mono);
  font-size: 0.68rem;
  font-weight: 600;
  letter-spacing: 0.09em;
  text-transform: uppercase;
}

.search-field input {
  width: 100%;
  min-height: 46px;
  padding: 10px 13px;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-sm);
  background: #ffffff;
  color: var(--ink);
}

.filter-group {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
}

.filter-button {
  min-height: 44px;
  padding: 8px 13px;
  border: 1px solid var(--line-strong);
  border-radius: 999px;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  font-family: var(--font-mono);
  font-size: 0.68rem;
}

.filter-button[aria-pressed="true"] {
  border-color: var(--ink);
  background: var(--ink);
  color: #ffffff;
}

.archive-count {
  min-height: 1.5em;
  margin: 18px 0;
  color: var(--muted);
  font-family: var(--font-mono);
  font-size: 0.72rem;
}

.project-grid {
  grid-template-columns: repeat(2, minmax(0, 1fr));
  padding-bottom: clamp(70px, 10vw, 120px);
}

.project-card {
  display: flex;
  min-height: 250px;
  flex-direction: column;
  padding: 26px;
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  background: var(--surface);
  text-decoration: none;
  transition: border-color 150ms ease, box-shadow 150ms ease, transform 150ms ease;
}

a.project-card:hover {
  border-color: var(--line-strong);
  box-shadow: var(--shadow);
  transform: translateY(-2px);
}

.project-card[hidden] {
  display: none;
}

.project-card h2 {
  margin: 28px 0 8px;
  font-size: 1.55rem;
  letter-spacing: -0.025em;
  line-height: 1.15;
}

.project-card p {
  margin: 0;
  color: var(--muted);
  font-size: 0.9rem;
}

.tag-list {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: auto;
  padding-top: 24px;
}

.tag {
  padding: 4px 8px;
  border-radius: 4px;
  background: #efebe4;
  color: var(--muted);
  font-size: 0.62rem;
  letter-spacing: 0.035em;
}

/* Case studies */
.case-page {
  --case-accent: var(--copper);
  --case-soft: var(--copper-soft);
  /* Compatibility aliases for the self-contained legacy demo styles. */
  --text: var(--ink);
  --text-muted: var(--muted);
  --card: var(--surface);
  --border: var(--line);
  --accent: var(--case-accent);
  --font-display: var(--font-sans);
}

.case-page.anonymiser {
  --case-accent: var(--green);
  --case-soft: var(--green-soft);
}

.case-page.quoteguard {
  --case-accent: var(--teal);
  --case-soft: var(--teal-soft);
}

.case-page.touchline {
  --case-accent: var(--touchline);
  --case-soft: var(--touchline-soft);
}

.case-page .eyebrow,
.case-page .section-label,
.case-page .project-index,
.case-page .mini-label,
.case-page .text-link {
  color: var(--case-accent);
}

.case-hero {
  display: grid;
  grid-template-columns: minmax(0, 1.25fr) minmax(280px, 0.55fr);
  gap: clamp(38px, 7vw, 90px);
  align-items: end;
  padding-block: clamp(62px, 9vw, 112px);
}

.case-hero h1 {
  font-size: clamp(3.4rem, 8vw, 7.4rem);
}

.case-hero .case-subtitle {
  max-width: 760px;
  margin: 0;
  color: var(--muted);
  font-size: clamp(1.05rem, 1.8vw, 1.25rem);
}

.case-summary {
  padding: 26px;
  border-top: 3px solid var(--case-accent);
  background: var(--surface);
}

.case-summary strong {
  display: block;
  margin: 9px 0 12px;
  font-size: 1.22rem;
  line-height: 1.25;
}

.case-summary p {
  margin: 0;
  color: var(--muted);
  font-size: 0.9rem;
}

.case-nav-wrap {
  position: sticky;
  top: 68px;
  z-index: 80;
  border-block: 1px solid var(--line);
  background: rgba(247, 244, 238, 0.97);
}

.case-nav {
  display: flex;
  overflow-x: auto;
  gap: 2px;
  scrollbar-width: none;
}

.case-nav::-webkit-scrollbar {
  display: none;
}

.case-nav a {
  display: inline-flex;
  min-height: 50px;
  flex: 0 0 auto;
  align-items: center;
  padding: 0 14px;
  color: var(--muted);
  font-family: var(--font-mono);
  font-size: 0.68rem;
  text-decoration: none;
}

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

.case-tabs-wrap {
  position: sticky;
  top: 68px;
  z-index: 80;
  border-block: 1px solid var(--line);
  background: rgba(247, 244, 238, 0.98);
}

.case-tabs {
  display: flex;
  overflow-x: auto;
  gap: 2px;
  scrollbar-width: none;
}

.case-tabs::-webkit-scrollbar {
  display: none;
}

.case-tab {
  display: inline-flex;
  min-height: 54px;
  flex: 0 0 auto;
  align-items: center;
  padding: 0 18px;
  border-bottom: 3px solid transparent;
  color: var(--muted);
  font-family: var(--font-mono);
  font-size: 0.78rem;
  font-weight: 500;
  letter-spacing: 0.04em;
  text-decoration: none;
}

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

.case-tab-panel[hidden] {
  display: none;
}

.case-tab-panel {
  scroll-margin-top: 140px;
}

.case-tab-panel .case-section {
  padding-block: clamp(46px, 6vw, 76px);
}

.case-section {
  scroll-margin-top: 140px;
  padding-block: clamp(58px, 8vw, 96px);
  border-bottom: 1px solid var(--line);
}

.case-section:last-child {
  border-bottom: 0;
}

.case-section-head {
  display: grid;
  width: 100%;
  max-width: var(--reading);
  grid-template-columns: 1fr;
  gap: 12px;
  margin: 0 auto 36px;
}

.case-section-head .section-label {
  margin: 0;
}

.case-section-head h2 {
  max-width: 780px;
  margin: 0;
  font-size: clamp(1.85rem, 4vw, 3rem);
  font-weight: 620;
  letter-spacing: -0.04em;
  line-height: 1.08;
}

.case-prose {
  max-width: var(--reading);
  margin-inline: auto;
}

.case-prose > p,
.case-prose > ul,
.case-prose > ol {
  margin-top: 0;
  margin-bottom: 18px;
}

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

.case-prose strong {
  color: var(--ink);
}

.case-prose code,
.code-inline {
  padding: 0.12em 0.35em;
  border-radius: 4px;
  background: #eae5dc;
  font-family: var(--font-mono);
  font-size: 0.82em;
}

.brief-grid {
  grid-template-columns: repeat(3, minmax(0, 1fr));
  margin-top: 28px;
}

.brief-card,
.metric-card,
.tradeoff-card {
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  background: var(--surface);
}

.brief-card {
  padding: 24px;
}

.brief-card h3 {
  margin: 9px 0 8px;
  font-size: 1.12rem;
  line-height: 1.25;
}

.brief-card p {
  margin: 0;
  color: var(--muted);
  font-size: 0.88rem;
}

.metric-grid {
  grid-template-columns: repeat(3, minmax(0, 1fr));
  margin: 30px 0;
}

.metric-card {
  padding: 24px;
  border-top: 3px solid var(--case-accent);
}

.metric-value {
  color: var(--case-accent);
  font-family: var(--font-mono);
  font-size: clamp(1.55rem, 3vw, 2.3rem);
  font-weight: 600;
  line-height: 1.05;
}

.metric-label {
  margin-top: 9px;
  color: var(--muted);
  font-size: 0.72rem;
  line-height: 1.45;
}

.case-facts {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0 34px;
  margin: 28px 0 0;
}

.case-fact {
  padding: 16px 0;
  border-top: 1px solid var(--line);
}

.case-fact dt {
  margin-bottom: 5px;
  color: var(--case-accent);
  font-size: 0.67rem;
  font-weight: 600;
  letter-spacing: 0.09em;
  text-transform: uppercase;
}

.case-fact dd {
  margin: 0;
  color: var(--muted);
  font-size: 0.9rem;
}

.system-flow {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  margin: 30px 0;
  padding: 0;
  list-style: none;
  counter-reset: system-flow;
}

.system-flow li {
  position: relative;
  min-height: 170px;
  padding: 20px 18px;
  border: 1px solid var(--line);
  border-right: 0;
  background: var(--surface);
  color: var(--muted);
  font-size: 0.82rem;
}

.system-flow li:first-child {
  border-radius: var(--radius-md) 0 0 var(--radius-md);
}

.system-flow li:last-child {
  border-right: 1px solid var(--line);
  border-radius: 0 var(--radius-md) var(--radius-md) 0;
}

.system-flow li::before {
  display: block;
  margin-bottom: 28px;
  color: var(--case-accent);
  content: "0" counter(system-flow);
  counter-increment: system-flow;
  font-family: var(--font-mono);
  font-size: 0.67rem;
  font-weight: 600;
}

.system-flow strong {
  display: block;
  margin-bottom: 7px;
  color: var(--ink);
  font-size: 0.96rem;
  line-height: 1.25;
}

.figure {
  margin: 34px 0;
}

.figure img {
  width: 100%;
  height: auto;
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  background: var(--surface);
}

.figure figcaption {
  max-width: 760px;
  margin-top: 11px;
  color: var(--muted);
  font-size: 0.82rem;
}

.result-table-wrap {
  overflow-x: auto;
  margin: 28px 0;
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  background: var(--surface);
}

.result-table {
  width: 100%;
  min-width: 610px;
  border-collapse: collapse;
  font-size: 0.86rem;
}

.result-table th,
.result-table td {
  padding: 13px 15px;
  border-bottom: 1px solid var(--line);
  text-align: right;
}

.result-table th:first-child,
.result-table td:first-child {
  text-align: left;
}

.result-table th {
  color: var(--muted);
  font-family: var(--font-mono);
  font-size: 0.64rem;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.result-table tr:last-child td {
  border-bottom: 0;
}

.result-table .emphasis td {
  background: var(--case-soft);
  color: var(--ink);
  font-weight: 600;
}

.tradeoff-list {
  display: grid;
  gap: 12px;
  margin: 28px 0;
}

.tradeoff-card {
  display: grid;
  grid-template-columns: minmax(180px, 0.35fr) minmax(0, 1fr);
  gap: 22px;
  padding: 22px;
}

.tradeoff-card h3 {
  margin: 0;
  font-size: 1rem;
  line-height: 1.3;
}

.tradeoff-card p {
  margin: 0;
  color: var(--muted);
  font-size: 0.88rem;
}

.callout {
  margin: 28px 0;
  padding: 22px 24px;
  border-left: 3px solid var(--case-accent);
  background: var(--case-soft);
}

.callout strong {
  display: block;
  margin-bottom: 6px;
}

.callout p {
  margin: 0;
  color: var(--muted);
}

.demo-disclosure {
  margin-top: 28px;
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  background: var(--surface);
}

.demo-disclosure > summary {
  display: flex;
  min-height: 60px;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  padding: 14px 20px;
  color: var(--ink);
  cursor: pointer;
  font-weight: 600;
  list-style: none;
}

.demo-disclosure > summary::-webkit-details-marker {
  display: none;
}

.demo-disclosure > summary::after {
  color: var(--case-accent);
  content: "+";
  font-family: var(--font-mono);
  font-size: 1.4rem;
}

.demo-disclosure[open] > summary::after {
  content: "−";
}

.demo-content {
  padding: 0 20px 22px;
  border-top: 1px solid var(--line);
}

.demo-content > p {
  color: var(--muted);
}

.demo-content iframe {
  width: 100%;
  min-height: 720px;
  border: 0;
  border-radius: var(--radius-sm);
  background: var(--canvas);
}

.code-block {
  overflow-x: auto;
  margin: 24px 0;
  padding: 20px;
  border-left: 3px solid var(--case-accent);
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
  background: #24211d;
  color: #f6f1e9;
  font-family: var(--font-mono);
  font-size: 0.76rem;
  line-height: 1.65;
  white-space: pre;
}

.case-end {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  padding-block: 42px 80px;
  color: var(--muted);
  font-family: var(--font-mono);
  font-size: 0.72rem;
}

.case-end a {
  min-height: 44px;
  display: inline-flex;
  align-items: center;
}

@media (max-width: 980px) {
  .hero,
  .case-hero {
    grid-template-columns: 1fr;
    min-height: 0;
  }

  .hero-note,
  .case-summary {
    max-width: 560px;
  }

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

  .featured-media {
    min-height: 280px;
    border-top: 1px solid var(--line);
    border-left: 0;
  }

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

  .process-step:nth-child(4),
  .process-step:nth-child(5) {
    min-height: 180px;
  }

  .system-flow {
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 10px;
  }

  .system-flow li,
  .system-flow li:first-child,
  .system-flow li:last-child {
    border: 1px solid var(--line);
    border-radius: var(--radius-sm);
  }
}

@media (max-width: 760px) {
  .shell {
    width: min(calc(100% - 36px), var(--page));
  }

  .nav-inner {
    min-height: 62px;
  }

  .site-nav a {
    padding-inline: 9px;
  }

  .site-nav a:not(.nav-cta):nth-child(2) {
    display: none;
  }

  .site-nav .nav-cta {
    display: none;
  }

  .hero {
    gap: 34px;
    padding-block: 28px 56px;
  }

  .hero h1 {
    font-size: clamp(3.1rem, 14.2vw, 5.2rem);
  }

  .section-heading,
  .case-section-head {
    grid-template-columns: 1fr;
    gap: 12px;
  }

  .capability-grid,
  .brief-grid,
  .metric-grid,
  .about-grid,
  .project-grid {
    grid-template-columns: 1fr;
  }

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

  .process-step,
  .process-step:nth-child(4),
  .process-step:nth-child(5) {
    min-height: 185px;
  }

  .contact-panel {
    grid-template-columns: 1fr;
    align-items: start;
  }

  .archive-controls,
  .js .archive-controls {
    align-items: stretch;
    flex-direction: column;
  }

  .case-nav-wrap {
    top: 62px;
  }

  .case-tabs-wrap {
    top: 62px;
  }

  .case-tab {
    min-height: 52px;
    padding-inline: 14px;
  }

  .case-facts {
    grid-template-columns: 1fr;
  }

  .system-flow {
    grid-template-columns: 1fr;
  }

  .system-flow li {
    min-height: 0;
  }

  .system-flow li::before {
    margin-bottom: 14px;
  }

  .tradeoff-card {
    grid-template-columns: 1fr;
    gap: 8px;
  }

  .footer-inner,
  .case-end {
    align-items: flex-start;
    flex-direction: column;
  }
}

@media (max-width: 460px) {
  .shell {
    width: min(calc(100% - 28px), var(--page));
  }

  .brand {
    font-size: 0.73rem;
  }

  .site-nav a {
    padding-inline: 7px;
    font-size: 0.67rem;
  }

  .site-nav a:nth-child(3) {
    display: none;
  }

  .hero h1 {
    font-size: clamp(2.85rem, 14.2vw, 4rem);
  }

  .hero-actions .button,
  .case-actions .button,
  .contact-actions .button {
    width: 100%;
  }

  .featured-copy {
    padding: 25px 22px;
  }

  .featured-media {
    min-height: 220px;
    padding: 18px;
  }

  .preview-label {
    right: 26px;
    bottom: 26px;
  }

  .project-choice-popover:popover-open {
    width: min(calc(100vw - 28px), 420px);
    max-height: calc(100svh - 28px);
    padding: 22px;
  }

  .project-choice-options {
    grid-template-columns: 1fr;
  }

  .project-choice-option {
    min-height: 96px;
    gap: 12px;
  }

  .metric-line,
  .process-grid {
    grid-template-columns: 1fr;
  }

  .process-step {
    min-height: 0;
  }

  .page-intro h1,
  .case-hero h1 {
    font-size: clamp(2.8rem, 16vw, 4.4rem);
  }

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

  .demo-content iframe {
    min-height: 620px;
  }
}

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

  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    scroll-behavior: auto !important;
    transition-duration: 0.01ms !important;
  }
}
