:root {
  color-scheme: light dark;
  --bg: #f5f7f6;
  --ink: #161b1a;
  --muted: #52605d;
  --line: #d7ddda;
  --accent: #0b6357;
  --selection: #cfe8e2;
  --font-serif: ui-serif, "New York", "Iowan Old Style", "Palatino Linotype", Palatino, "Book Antiqua", Georgia, serif;
  --font-mono: "SFMono-Regular", "SF Mono", ui-monospace, Menlo, Consolas, "Liberation Mono", monospace;
  --measure: 66ch;
  --wrap: 1080px;
}

:root[data-theme="light"] {
  color-scheme: light;
}

:root[data-theme="dark"] {
  color-scheme: dark;
  --bg: #121615;
  --ink: #e7e9e5;
  --muted: #9fadaa;
  --line: #2a3230;
  --accent: #6cc7b6;
  --selection: #1f3f3a;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    color-scheme: dark;
    --bg: #121615;
    --ink: #e7e9e5;
    --muted: #9fadaa;
    --line: #2a3230;
    --accent: #6cc7b6;
    --selection: #1f3f3a;
  }
}

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

html {
  font-size: 100%;
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font-serif);
  font-size: 1.125rem;
  line-height: 1.65;
  font-kerning: normal;
  -webkit-font-smoothing: antialiased;
}

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

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

a:hover {
  text-decoration-thickness: 2px;
}

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

img {
  max-width: 100%;
}

h1,
h2,
h3 {
  margin-top: 0;
  font-weight: 600;
}

.wrap {
  width: min(100% - 40px, var(--wrap));
  margin-inline: auto;
}

.skip {
  position: absolute;
  left: 16px;
  top: -100px;
  z-index: 10;
  padding: 10px 14px;
  background: var(--ink);
  color: var(--bg);
  font-family: var(--font-mono);
  font-size: 0.75rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  text-decoration: none;
}

.skip:focus {
  top: 16px;
}

.site-header {
  padding-top: 32px;
}

.header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px 24px;
  flex-wrap: wrap;
}

.header-tools {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 20px;
}

.wordmark {
  color: var(--ink);
  font-size: 1.0625rem;
  font-weight: 600;
  letter-spacing: -0.01em;
  text-decoration: none;
}

.wordmark:hover {
  text-decoration: underline;
  text-underline-offset: 4px;
}

.site-nav {
  display: flex;
  flex-wrap: wrap;
  gap: 20px;
}

.site-nav a,
.footer-nav a {
  padding: 6px 0;
  color: var(--muted);
  font-family: var(--font-mono);
  font-size: 0.6875rem;
  letter-spacing: 0.09em;
  text-transform: uppercase;
  text-decoration: none;
}

.site-nav a:hover,
.footer-nav a:hover {
  color: var(--accent);
  text-decoration: underline;
  text-underline-offset: 4px;
}

.theme-toggle {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 44px;
  padding: 6px 0;
  border: 0;
  background: none;
  color: var(--muted);
  font-family: var(--font-mono);
  font-size: 0.6875rem;
  letter-spacing: 0.09em;
  text-transform: uppercase;
  cursor: pointer;
}

.theme-toggle:hover {
  color: var(--accent);
}

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

.theme-toggle-track {
  position: relative;
  width: 30px;
  height: 16px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--bg);
  transition: background-color 180ms ease, border-color 180ms ease;
}

.theme-toggle-knob {
  position: absolute;
  top: 2px;
  left: 2px;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--muted);
  transition: transform 180ms ease, background-color 180ms ease;
}

:root[data-theme="dark"] .theme-toggle-track {
  border-color: var(--accent);
  background: var(--accent);
}

:root[data-theme="dark"] .theme-toggle-knob {
  background: var(--bg);
  transform: translateX(14px);
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .theme-toggle-track {
    border-color: var(--accent);
    background: var(--accent);
  }

  :root:not([data-theme="light"]) .theme-toggle-knob {
    background: var(--bg);
    transform: translateX(14px);
  }
}

.hero {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 240px;
  align-items: start;
  gap: clamp(32px, 7vw, 88px);
  padding-top: clamp(32px, 5vw, 56px);
}

.hero-copy {
  max-width: 44rem;
}

.eyebrow {
  margin: 0 0 20px;
  color: var(--muted);
  font-family: var(--font-mono);
  font-size: 0.6875rem;
  letter-spacing: 0.12em;
  line-height: 1.6;
  text-transform: uppercase;
}

.hero h1 {
  margin-bottom: 24px;
  font-size: clamp(2.75rem, 7vw, 4rem);
  line-height: 1.02;
  letter-spacing: -0.025em;
  text-wrap: balance;
}

.hero h1.typing {
  text-wrap: normal;
}

.typing-caret {
  display: none;
  width: 0.08em;
  height: 0.8em;
  margin-left: 0.06em;
  background: var(--accent);
  vertical-align: -0.03em;
}

.typing.is-typing .typing-caret {
  display: inline-block;
  animation: caret-blink 900ms steps(1) infinite;
}

.typing.is-typed .typing-caret {
  animation: caret-blink 900ms steps(1) 2, caret-fade 400ms ease 1.8s forwards;
}

.availability {
  display: flex;
  align-items: baseline;
  gap: 10px;
  max-width: 36rem;
  margin: 0 0 24px;
  font-size: 1.0625rem;
  line-height: 1.5;
}

.dot {
  flex: none;
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--accent);
  transform: translateY(-1px);
}

.contact {
  display: flex;
  flex-wrap: wrap;
  gap: 18px;
  margin: 0 0 10px;
  padding: 0;
  list-style: none;
}

.contact a {
  padding-bottom: 3px;
  border-bottom: 1px solid var(--line);
  color: var(--ink);
  font-family: var(--font-mono);
  font-size: 0.6875rem;
  letter-spacing: 0.09em;
  text-transform: uppercase;
  text-decoration: none;
}

.contact a:hover {
  border-color: var(--accent);
  color: var(--accent);
}

.location {
  margin: 0;
  color: var(--muted);
  font-family: var(--font-mono);
  font-size: 0.6875rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.hero-photo {
  margin: 0;
}

/* The source photo has dark wedges at its edges; zoom slightly to crop them. */
.hero-photo-crop {
  display: block;
  overflow: hidden;
  border-radius: 4px;
  background: var(--line);
}

.hero-photo img {
  display: block;
  width: 100%;
  height: auto;
  transform: scale(1.08);
}

.intro {
  padding-top: clamp(32px, 5vw, 56px);
}

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

.measure p {
  margin: 0 0 1.1em;
}

.measure p:last-child {
  margin-bottom: 0;
}

.section {
  padding-top: clamp(64px, 9vw, 112px);
}

.section > h2,
.background-grid h2 {
  margin-bottom: 28px;
  font-size: 1.5rem;
  line-height: 1.2;
  letter-spacing: -0.01em;
}

.case-list {
  margin: 0;
  padding: 0;
  border-bottom: 1px solid var(--line);
  list-style: none;
}

.case-row {
  display: grid;
  grid-template-columns: 48px minmax(0, 1fr) 24px;
  gap: 24px;
  align-items: start;
  padding: 28px 0;
  border-top: 1px solid var(--line);
  color: inherit;
  text-decoration: none;
  scroll-margin-top: 96px;
}

.case-index {
  padding-top: 6px;
  color: var(--muted);
  font-family: var(--font-mono);
  font-size: 0.6875rem;
  letter-spacing: 0.08em;
}

.case-title {
  margin: 0 0 8px;
  color: var(--ink);
  font-size: 1.375rem;
  line-height: 1.3;
  letter-spacing: -0.01em;
}

.case-summary {
  display: block;
  max-width: 68ch;
  margin: 0 0 14px;
  color: var(--muted);
  font-size: 1rem;
  line-height: 1.6;
}

.tags {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.tag {
  padding: 3px 7px;
  border: 1px solid var(--line);
  border-radius: 2px;
  color: var(--muted);
  font-family: var(--font-mono);
  font-size: 0.6875rem;
  letter-spacing: 0.03em;
  line-height: 1.4;
  white-space: nowrap;
}

.case-arrow {
  padding-top: 4px;
  color: var(--muted);
  font-family: var(--font-mono);
  transition: transform 180ms ease, color 180ms ease;
}

.case-row:hover .case-title {
  text-decoration: underline;
  text-decoration-thickness: 1px;
  text-underline-offset: 4px;
}

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

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

.extras {
  margin: 0;
  padding: 0;
  border-bottom: 1px solid var(--line);
  list-style: none;
}

.extra-item {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 2fr);
  column-gap: 48px;
  padding: 28px 0;
  border-top: 1px solid var(--line);
}

.extra-item h3 {
  margin: 0;
  font-size: 1.125rem;
  line-height: 1.4;
}

.extra-body {
  max-width: 70ch;
}

.extra-body p {
  margin: 0 0 0.9em;
  font-size: 1rem;
  line-height: 1.6;
}

.extra-body p:last-child {
  margin-bottom: 0;
}

.extra-body ul {
  margin: 0.4em 0 0;
  padding-left: 1.1em;
}

.extra-body li,
.extra-body a {
  overflow-wrap: anywhere;
  font-size: 1rem;
  line-height: 1.6;
}

.background-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: clamp(32px, 6vw, 72px);
}

.background-grid h2 {
  margin-bottom: 16px;
  font-size: 1.25rem;
}

.background-grid ul {
  margin: 0;
  padding: 0;
  list-style: none;
}

.background-grid li {
  padding: 14px 0;
  border-top: 1px solid var(--line);
  font-size: 1rem;
  line-height: 1.6;
}

.background-grid li:last-child {
  border-bottom: 1px solid var(--line);
}

.site-footer {
  margin-top: clamp(80px, 12vw, 140px);
  padding: 28px 0 48px;
  border-top: 1px solid var(--line);
}

.footer-inner {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 16px 24px;
  flex-wrap: wrap;
}

.footer-name {
  margin: 0;
  font-size: 0.9375rem;
}

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

.article-wrap {
  width: min(100% - 40px, 680px);
  margin-inline: auto;
}

.back {
  display: inline-block;
  margin-top: clamp(16px, 3vw, 32px);
  color: var(--muted);
  font-family: var(--font-mono);
  font-size: 0.6875rem;
  letter-spacing: 0.09em;
  text-decoration: none;
  text-transform: uppercase;
}

.back:hover {
  color: var(--accent);
  text-decoration: underline;
  text-underline-offset: 4px;
}

/* Each case study has two back links: one above the title for single-column
   layouts, one in the facts rail for wide screens. Only one shows at a time. */
.facts-rail .back {
  display: none;
}

.article-head {
  margin-top: 20px;
}

.article-head .eyebrow {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
}

.article-head .status {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: var(--ink);
}

.article-head .sep {
  color: var(--muted);
}

.article-head h1 {
  margin-bottom: 20px;
  font-size: clamp(2rem, 4.6vw, 3.125rem);
  line-height: 1.08;
  letter-spacing: -0.02em;
  text-wrap: balance;
}

.lead {
  max-width: 60ch;
  margin: 0;
  color: var(--muted);
  font-size: 1.25rem;
  line-height: 1.55;
}

.facts {
  display: grid;
  grid-template-columns: 112px minmax(0, 1fr);
  margin: clamp(32px, 5vw, 48px) 0 clamp(40px, 6vw, 56px);
}

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

.facts dt {
  padding-right: 20px;
  color: var(--muted);
  font-family: var(--font-mono);
  font-size: 0.6875rem;
  letter-spacing: 0.09em;
  text-transform: uppercase;
}

.facts dd {
  font-size: 1rem;
  line-height: 1.6;
}

.facts dd .tags {
  margin-top: 2px;
}

.facts dt:last-of-type,
.facts dd:last-of-type {
  border-bottom: 1px solid var(--line);
}

.cs-section + .cs-section {
  margin-top: clamp(36px, 5vw, 48px);
  padding-top: clamp(32px, 4vw, 40px);
  border-top: 1px solid var(--line);
}

.cs-section h2 {
  margin-bottom: 20px;
  font-size: 1.5rem;
  line-height: 1.2;
  letter-spacing: -0.01em;
}

.prose p {
  margin: 0 0 1.1em;
}

.prose p:last-child,
.prose ul:last-child {
  margin-bottom: 0;
}

.prose ul {
  margin: 0 0 1.2em;
  padding-left: 1.2em;
}

.prose li {
  margin-bottom: 0.8em;
  padding-left: 0.2em;
}

.prose li:last-child {
  margin-bottom: 0;
}

.prose code {
  padding: 0.1em 0.35em;
  border-radius: 2px;
  background: color-mix(in srgb, var(--ink) 7%, transparent);
  font-family: var(--font-mono);
  font-size: 0.85em;
  overflow-wrap: anywhere;
}

.decisions ul {
  margin: 0;
  padding: 0;
  list-style: none;
}

.decisions li {
  margin: 0;
  padding: 18px 0;
  border-top: 1px solid var(--line);
}

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

.decisions li strong:first-child {
  display: block;
  margin-bottom: 6px;
  font-size: 1.0625rem;
  line-height: 1.45;
}

.pager {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 24px;
  margin-top: clamp(64px, 9vw, 96px);
  padding-top: 20px;
  border-top: 1px solid var(--line);
}

.pager a {
  display: block;
  color: var(--ink);
  text-decoration: none;
}

.pager-label {
  display: block;
  margin-bottom: 6px;
  color: var(--muted);
  font-family: var(--font-mono);
  font-size: 0.6875rem;
  letter-spacing: 0.09em;
  text-transform: uppercase;
}

.pager-title {
  display: block;
  font-size: 1.0625rem;
  line-height: 1.4;
}

.pager a:hover .pager-title {
  text-decoration: underline;
  text-decoration-thickness: 1px;
  text-underline-offset: 4px;
}

.pager-next {
  text-align: right;
}

@media (max-width: 560px) {
  .wrap,
  .article-wrap {
    width: min(100% - 32px, var(--wrap));
  }

  body {
    font-size: 1.0625rem;
  }

  .header-inner {
    flex-wrap: nowrap;
  }

  .header-tools {
    gap: 12px;
  }

  .site-nav {
    display: none;
  }

  .case-row {
    grid-template-columns: 28px minmax(0, 1fr) 18px;
    gap: 14px;
  }

  .case-title {
    font-size: 1.25rem;
  }

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

  .facts dt {
    padding-bottom: 4px;
  }

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

  .facts dt:last-of-type {
    border-bottom: 0;
  }

  .facts dd:last-of-type {
    border-bottom: 1px solid var(--line);
  }

  .pager {
    grid-template-columns: 1fr;
  }

  .pager-next {
    text-align: left;
  }

  .lead {
    font-size: 1.125rem;
  }
}

@keyframes caret-blink {
  0%,
  49% {
    opacity: 1;
  }
  50%,
  100% {
    opacity: 0;
  }
}

@keyframes caret-fade {
  to {
    opacity: 0;
  }
}

.key-points {
  margin: 0 0 40px;
  padding: 20px 24px;
  border-left: 2px solid var(--accent);
  background: color-mix(in srgb, var(--accent) 6%, transparent);
}

.key-points h2 {
  margin: 0 0 12px;
  font-family: var(--font-mono);
  font-size: 0.75rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
}

.key-points ul {
  margin: 0;
  padding-left: 1.1em;
}

.key-points li + li {
  margin-top: 6px;
}

.outside ul {
  margin: 0;
  padding: 0;
  border-bottom: 1px solid var(--line);
  list-style: none;
}

.outside li {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 2fr);
  column-gap: 48px;
  padding: 24px 0;
  border-top: 1px solid var(--line);
  font-size: 1rem;
  line-height: 1.6;
}

.outside li strong {
  font-size: 1.125rem;
  line-height: 1.4;
}

.not-found {
  padding-top: clamp(48px, 8vw, 96px);
}

.not-found h1 {
  margin-bottom: 20px;
  font-size: clamp(2rem, 4.6vw, 3.125rem);
  line-height: 1.08;
}

/* Wide screens: case studies share the home page's width and left edge.
   Facts sit in a left column; the text keeps its reading measure. */
@media (min-width: 1000px) {
  .article-wrap {
    display: grid;
    grid-template-columns: 240px minmax(0, 680px);
    grid-template-areas:
      "facts head"
      "facts keys"
      "facts prose"
      "pager pager";
    column-gap: 72px;
    width: min(100% - 40px, var(--wrap));
  }

  .article-wrap > .back { display: none; }
  .article-wrap > .article-head { grid-area: head; margin-bottom: 40px; }
  .article-wrap > .facts-rail { grid-area: facts; padding-top: 20px; }
  .article-wrap > .key-points { grid-area: keys; margin-top: 0; }
  .article-wrap > .prose { grid-area: prose; }
  .article-wrap > .pager { grid-area: pager; margin-top: 56px; }

  /* Back link and facts travel together, sticky inside the rail, so they
     stop where the text ends and never cover the text column. */
  .facts-rail-inner {
    position: sticky;
    top: 24px;
  }

  .facts-rail .facts {
    grid-template-columns: 1fr;
    margin: 0;
  }

  .facts-rail .back {
    display: inline-block;
    margin: 0 0 20px;
  }

  .facts-rail .facts dt {
    padding-bottom: 4px;
  }

  .facts-rail .facts dd {
    padding-top: 0;
    border-top: 0;
    font-size: 0.9375rem;
  }

  .facts-rail .facts dt:last-of-type {
    border-bottom: 0;
  }
}

/* One motion rule for the whole site: the hero types, everything below
   fades up once as it scrolls into view. */
@media (prefers-reduced-motion: no-preference) {
  .js .reveal {
    opacity: 0;
    transform: translateY(8px);
    transition:
      opacity 420ms cubic-bezier(0.22, 0.61, 0.36, 1),
      transform 420ms cubic-bezier(0.22, 0.61, 0.36, 1);
  }

  .js .reveal.is-visible {
    opacity: 1;
    transform: none;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    transition-duration: 0.01ms !important;
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
  }
}

/* Single-column case studies: key points before the facts. */
@media (max-width: 999px) {
  .article-wrap {
    display: flex;
    flex-direction: column;
  }

  .article-wrap > .back { order: 0; align-self: flex-start; }
  .article-wrap > .article-head { order: 1; }
  .article-wrap > .key-points { order: 2; margin-top: 32px; margin-bottom: 0; }
  .article-wrap > .facts-rail { order: 3; }
  .article-wrap > .prose { order: 4; }
  .article-wrap > .pager { order: 5; }
}

/* Narrow screens: single column, with the photo as a small avatar beside
   the role line. */
@media (max-width: 860px) {
  .background-grid {
    grid-template-columns: 1fr;
    gap: 48px;
  }

  .extra-item {
    grid-template-columns: 1fr;
  }

  .extra-item h3 {
    margin-bottom: 10px;
  }

  .outside li {
    grid-template-columns: 1fr;
    row-gap: 8px;
  }

  .hero {
    grid-template-columns: 64px minmax(0, 1fr);
    column-gap: 16px;
    row-gap: 0;
    align-items: center;
  }

  .hero-copy {
    display: contents;
  }

  .hero-photo {
    grid-column: 1;
    grid-row: 1;
    width: 64px;
  }

  .hero-copy > .eyebrow {
    grid-column: 2;
    grid-row: 1;
    margin: 0;
  }

  .hero-copy > :not(.eyebrow) {
    grid-column: 1 / -1;
  }

  .hero-copy > .typing {
    margin-top: 28px;
  }
}
