@font-face {
  font-family: "Inter";
  src: url("/fonts/Inter-Regular.woff2") format("woff2");
  font-style: normal;
  font-weight: 400;
  font-display: swap;
}

@font-face {
  font-family: "Inter";
  src: url("/fonts/Inter-Medium.woff2") format("woff2");
  font-style: normal;
  font-weight: 500;
  font-display: swap;
}

@font-face {
  font-family: "Inter";
  src: url("/fonts/Inter-SemiBold.woff2") format("woff2");
  font-style: normal;
  font-weight: 600;
  font-display: swap;
}

@font-face {
  font-family: "JetBrains Mono";
  src: url("/fonts/JetBrainsMono-Regular.woff2") format("woff2");
  font-style: normal;
  font-weight: 400;
  font-display: swap;
}

@font-face {
  font-family: "JetBrains Mono";
  src: url("/fonts/JetBrainsMono-SemiBold.woff2") format("woff2");
  font-style: normal;
  font-weight: 600;
  font-display: swap;
}

@font-face {
  font-family: "JetBrains Mono";
  src: url("/fonts/JetBrainsMono-Bold.woff2") format("woff2");
  font-style: normal;
  font-weight: 700;
  font-display: swap;
}

:root {
  color-scheme: dark;
  --ink: #0a0a0a;
  --panel: #131313;
  --panel-raised: #1b1b1b;
  --rule: #282828;
  --carbon: #e8e8e8;
  --carbon-strong: #ffffff;
  --text: #f2f2f2;
  --muted: #a3a3a3;
  --dim: #6b6b6b;
  --body: "Inter", system-ui, sans-serif;
  --mono: "JetBrains Mono", ui-monospace, SFMono-Regular, Menlo, monospace;
  background: var(--ink);
  color: var(--text);
  font-family: var(--body);
  font-synthesis: none;
  line-height: 1.6;
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  background: var(--ink);
}

body > header,
body > main,
body > footer {
  width: min(100% - 2.5rem, 76rem);
  margin-inline: auto;
}

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

a:hover {
  color: var(--carbon-strong);
}

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

.skip-link {
  position: fixed;
  z-index: 20;
  top: 0.75rem;
  left: 0.75rem;
  padding: 0.55rem 0.75rem;
  color: var(--ink);
  background: var(--carbon);
  transform: translateY(-200%);
}

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

.site-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 4.75rem;
  gap: 2rem;
  border-bottom: 1px solid var(--rule);
}

.site-header nav,
.footer-links,
.actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.75rem 1.25rem;
}

.site-header nav a {
  color: var(--muted);
  text-decoration: none;
}

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

.sr-only {
  position: absolute;
  overflow: hidden;
  width: 1px;
  height: 1px;
  margin: -1px;
  padding: 0;
  white-space: nowrap;
  clip-path: inset(50%);
  border: 0;
}

.repo {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.2rem 0.3rem;
  border-radius: 3px;
  font-family: var(--mono);
}

.site-header nav a.repo:hover {
  background: var(--panel);
}

.repo > svg {
  flex: 0 0 auto;
}

.repo-meta {
  display: flex;
  flex-direction: column;
  gap: 0.1rem;
  line-height: 1.2;
}

.repo-name {
  font-size: 0.72rem;
}

.facts {
  display: flex;
  gap: 0.5rem;
  font-size: 0.64rem;
}

.facts[hidden],
.fact[hidden] {
  display: none;
}

.fact {
  display: inline-flex;
  align-items: center;
  gap: 0.22rem;
}

.wordmark,
.eyebrow,
.section-index,
.ledger strong,
.proof-tag,
.choice-label,
code,
kbd {
  font-family: var(--mono);
}

.wordmark {
  display: inline-flex;
  align-items: baseline;
  gap: 0.55rem;
  color: var(--text);
  font-family: var(--mono);
  font-size: 1.05rem;
  font-weight: 700;
  letter-spacing: -0.03em;
  text-decoration: none;
}

.wordmark .kana {
  color: var(--dim);
  font-size: 0.85em;
  font-weight: 400;
}

main {
  display: block;
}

/* ---------------------------------------------------------------- hero */

.hero {
  position: relative;
  padding: clamp(5rem, 12vw, 8rem) 0 clamp(4rem, 9vw, 6rem);
  border-bottom: 1px solid var(--rule);
  overflow: hidden;
}

.hero::after {
  content: "カタ";
  position: absolute;
  right: -0.05em;
  bottom: -0.28em;
  z-index: 0;
  color: rgb(232 232 232 / 4%);
  font-family: var(--mono);
  font-size: clamp(12rem, 30vw, 24rem);
  font-weight: 700;
  line-height: 1;
  letter-spacing: -0.06em;
  pointer-events: none;
  user-select: none;
}

.hero > * {
  position: relative;
  z-index: 1;
}

.hero.compact {
  padding-bottom: clamp(3rem, 7vw, 5rem);
}

.hero.compact::after {
  content: none;
}

.hero-brand {
  display: flex;
  align-items: baseline;
  gap: clamp(0.6rem, 1.4vw, 1rem);
  margin: 0 0 2rem;
  font-family: var(--mono);
  font-size: clamp(2.6rem, 6vw, 4.5rem);
  font-weight: 700;
  letter-spacing: -0.05em;
  line-height: 1;
}

.hero-brand .kana {
  color: var(--dim);
  font-size: 0.55em;
  font-weight: 400;
  letter-spacing: 0;
}

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

h1,
h2,
h3 {
  font-family: var(--mono);
  line-height: 1.12;
  text-wrap: balance;
}

h1 {
  max-width: 24ch;
  margin-bottom: 1.5rem;
  font-size: clamp(1.9rem, 4.6vw, 3.4rem);
  font-weight: 600;
  letter-spacing: -0.045em;
}

h2 {
  max-width: 26ch;
  margin-bottom: 1rem;
  font-size: clamp(1.45rem, 3.1vw, 2.3rem);
  font-weight: 600;
  letter-spacing: -0.035em;
}

h3 {
  margin-bottom: 0.65rem;
  font-size: 1.02rem;
  font-weight: 600;
  letter-spacing: -0.02em;
}

.lede {
  max-width: 52rem;
  margin-bottom: 2rem;
  color: var(--muted);
  font-size: clamp(1.05rem, 1.9vw, 1.3rem);
}

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

.eyebrow,
.section-index,
.proof-tag,
.choice-label {
  margin: 0 0 1rem;
  color: var(--muted);
  font-size: 0.76rem;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.caption,
.fine-print,
.install-hint {
  color: var(--muted);
  font-size: 0.88rem;
}

/* ------------------------------------------------------ terminal panel */

.term {
  margin: 2.5rem 0 0;
  max-width: 46rem;
  border: 1px solid var(--rule);
  background: var(--panel);
  font-family: var(--mono);
  font-size: 0.86rem;
  line-height: 1.75;
}

.term-title {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  margin: 0;
  padding: 0.5rem 1rem;
  border-bottom: 1px solid var(--rule);
  color: var(--dim);
  font-size: 0.7rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.term pre {
  overflow-x: auto;
  margin: 0;
  padding: 1rem 1.25rem 1.25rem;
}

.term .ps1 {
  color: var(--dim);
}

.term .cmd {
  color: var(--carbon-strong);
  font-weight: 600;
}

.term .out {
  color: var(--muted);
}

.term .ok {
  color: var(--carbon);
  font-weight: 600;
}

.term .ms {
  color: var(--dim);
  font-style: normal;
}

/* --------------------------------------------------------- install row */

.install-matrix {
  width: fit-content;
  max-width: 100%;
  margin-top: 2.5rem;
  border: 1px solid var(--rule);
  background: var(--panel);
}

.install-row {
  display: grid;
  grid-template-columns: 8.5rem minmax(0, 1fr) max-content;
  align-items: center;
  gap: 1.25rem;
  padding: 0.45rem 0.45rem 0.45rem 1.1rem;
}

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

.install-label {
  color: var(--muted);
  font-family: var(--mono);
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.install-row code {
  color: var(--carbon);
  font-size: 0.92rem;
  overflow-wrap: anywhere;
}

.install-row code::before {
  color: var(--dim);
  content: "$ ";
}

.install-row code.ps::before {
  content: "> ";
}

.install-hint {
  margin-top: 0.75rem;
}

.install-hint [data-install-status]:not(:empty)::before {
  content: " · ";
}

.actions {
  margin-top: 2rem;
}

.button,
button.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 2.8rem;
  padding: 0.65rem 1rem;
  border: 1px solid var(--rule);
  border-radius: 3px;
  color: var(--text);
  background: var(--panel);
  cursor: pointer;
  font: inherit;
  font-family: var(--mono);
  font-size: 0.9rem;
  text-decoration: none;
}

.button:hover,
button.button:hover {
  border-color: var(--carbon);
  color: var(--text);
  background: var(--panel-raised);
}

.button.primary {
  border-color: var(--carbon);
  color: var(--ink);
  background: var(--carbon);
  font-weight: 600;
}

.button.primary:hover {
  color: var(--ink);
  background: var(--carbon-strong);
}

/* ------------------------------------------------------------ sections */

.site-section {
  padding: clamp(4rem, 9vw, 7rem) 0;
  border-bottom: 1px solid var(--rule);
}

.section-heading {
  display: grid;
  grid-template-columns: minmax(0, 0.65fr) minmax(0, 1.35fr);
  gap: 2rem;
  margin-bottom: clamp(2rem, 5vw, 4rem);
}

.section-heading p:last-child {
  max-width: 44rem;
  color: var(--muted);
}

.section-heading p code,
.proof p code,
.choice p code,
.boundary p code,
.guide-copy p code,
.ledger span code {
  font-size: 0.85em;
  color: var(--carbon);
}

.ledger {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 1px;
  margin: 0;
  padding: 1px;
  background: var(--rule);
  list-style: none;
}

.ledger.four {
  grid-template-columns: repeat(4, minmax(0, 1fr));
}

.ledger li {
  min-height: 10rem;
  padding: 1.25rem;
  background: var(--panel);
}

.ledger strong,
.ledger span {
  display: block;
}

.ledger strong {
  margin-bottom: 2rem;
  color: var(--carbon);
  font-size: 0.76rem;
  text-transform: uppercase;
}

.ledger span {
  color: var(--muted);
}

.stat {
  font-family: var(--mono);
  font-weight: 700;
  font-size: clamp(1.6rem, 3vw, 2.4rem);
  letter-spacing: -0.04em;
  color: var(--carbon-strong);
}

.stat small {
  color: var(--dim);
  font-size: 0.55em;
  font-weight: 400;
}

.proof-grid,
.choice-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 1px;
  padding: 1px;
  background: var(--rule);
}

.boundary-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 1px;
  padding: 1px;
  background: var(--rule);
}

.pipeline {
  margin: 0 0 clamp(2rem, 5vw, 3rem);
  border: 1px solid var(--rule);
  background: var(--panel);
}

.proof,
.choice,
.boundary {
  padding: clamp(1.5rem, 4vw, 2.5rem);
  background: var(--panel);
}

.proof p:last-child,
.choice p:last-child,
.boundary p:last-child {
  margin-bottom: 0;
  color: var(--muted);
}

.capture {
  margin: 0;
}

.capture > a {
  display: block;
  border: 1px solid var(--rule);
  background: var(--panel);
}

.capture > a:hover {
  border-color: var(--carbon);
}

.capture img,
.diagram img,
dialog img {
  display: block;
  width: 100%;
  height: auto;
}

.caption {
  margin: 0.8rem 0 0;
}

.pipeline .caption {
  margin: 0;
  padding: 0.8rem 1.25rem 1rem;
  border-top: 1px solid var(--rule);
}

.capture-pair {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: clamp(1.5rem, 3vw, 2.5rem);
}

.interface-layout {
  display: grid;
  grid-template-columns: minmax(0, 1.2fr) minmax(18rem, 0.8fr);
  gap: clamp(2rem, 6vw, 5rem);
  align-items: center;
}

.interface-list {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 1rem 2rem;
  margin: 2rem 0 0;
  padding: 0;
  list-style: none;
}

.interface-list strong,
.interface-list span {
  display: block;
}

.interface-list strong {
  font-family: var(--mono);
  font-size: 0.86rem;
}

.interface-list span {
  color: var(--muted);
}

/* ---------------------------------------------------------------- guide */

.guide-nav {
  display: grid;
  grid-template-columns: repeat(9, minmax(0, 1fr));
  gap: 1px;
  margin: 2.5rem 0 0;
  padding: 1px;
  background: var(--rule);
  list-style: none;
}

.guide-nav a {
  display: block;
  height: 100%;
  padding: 0.8rem;
  color: var(--muted);
  background: var(--panel);
  font-family: var(--mono);
  font-size: 0.75rem;
  text-decoration: none;
}

.guide-nav a:hover {
  color: var(--text);
  background: var(--panel-raised);
}

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

.guide-stop {
  display: grid;
  grid-template-columns: minmax(0, 0.7fr) minmax(0, 1.3fr);
  gap: clamp(2rem, 7vw, 6rem);
  padding: clamp(4rem, 9vw, 7rem) 0;
  border-bottom: 1px solid var(--rule);
  scroll-margin-top: 2rem;
  counter-increment: guide;
}

.guide-copy h2::before {
  display: block;
  margin-bottom: 1rem;
  color: var(--dim);
  font-family: var(--mono);
  font-size: 0.76rem;
  font-weight: 400;
  letter-spacing: 0.08em;
  content: "0" counter(guide) " / 09";
}

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

.guide-copy a {
  font-weight: 600;
}

.guide-media {
  align-self: center;
  min-width: 0;
}

.guide-media .capture,
.guide-media .diagram,
.guide-media .term {
  margin: 0;
}

.guide-media .term {
  max-width: none;
}

.guide-media .diagram {
  border: 1px solid var(--rule);
  background: var(--panel);
}

/* --------------------------------------------------------------- footer */

.site-footer {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 2rem;
  padding: 2rem 0 3rem;
  color: var(--muted);
  font-size: 0.88rem;
}

.site-footer p {
  margin: 0;
}

dialog {
  width: min(96vw, 90rem);
  max-height: 94vh;
  padding: 0;
  border: 1px solid var(--carbon);
  border-radius: 4px;
  color: var(--text);
  background: var(--ink);
}

dialog::backdrop {
  background: rgb(5 5 5 / 88%);
}

.dialog-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
  padding: 0.8rem 1rem;
  border-bottom: 1px solid var(--rule);
}

.dialog-header p {
  margin: 0;
  font-family: var(--mono);
  font-size: 0.8rem;
}

.dialog-close {
  min-width: 2.5rem;
  min-height: 2.5rem;
  border: 1px solid var(--rule);
  border-radius: 3px;
  color: var(--text);
  background: var(--panel);
  font: inherit;
  cursor: pointer;
}

dialog img {
  max-height: calc(94vh - 4.25rem);
  object-fit: contain;
}

@media (max-width: 900px) {
  .section-heading,
  .interface-layout,
  .guide-stop,
  .capture-pair {
    grid-template-columns: 1fr;
  }

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

  .ledger li:last-child {
    grid-column: 1 / -1;
  }

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

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

  .guide-media {
    order: -1;
  }
}

@media (max-width: 620px) {
  body > header,
  body > main,
  body > footer {
    width: min(100% - 1.5rem, 76rem);
  }

  .site-header {
    align-items: flex-start;
    flex-direction: column;
    gap: 0.7rem;
    padding: 1rem 0;
  }

  .site-header nav {
    width: 100%;
    justify-content: space-between;
  }

  .repo-meta {
    display: none;
  }

  .install-row {
    grid-template-columns: minmax(0, 1fr) max-content;
    gap: 0.4rem 1rem;
  }

  .install-label {
    grid-column: 1 / -1;
  }

  h1 {
    font-size: clamp(1.6rem, 8vw, 2.4rem);
  }

  .ledger,
  .ledger.four,
  .proof-grid,
  .choice-grid,
  .boundary-grid,
  .interface-list,
  .guide-nav {
    grid-template-columns: 1fr;
  }

  .ledger li:last-child {
    grid-column: auto;
  }

  .site-footer {
    flex-direction: column;
  }
}

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

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