:root {
  --paper: #f7f3ec;
  --card: #fffdf9;
  --ink: #1d2528;
  --muted: #586367;
  --line: #ddd5c8;
  --accent: #a8432a;
  --accent-strong: #8a3520;
  --on-accent: #fffaf5;
  --ok: #256b4a;
  --urgent: #a02a1c;
  --focus: #1a5fb4;
  --serif: "Iowan Old Style", "Palatino Linotype", Palatino, "Book Antiqua", Georgia, serif;
  --sans: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --mono: ui-monospace, "Cascadia Mono", "Segoe UI Mono", Menlo, Consolas, monospace;
  --measure: 40rem;
}

@media (prefers-color-scheme: dark) {
  :root {
    --paper: #14181a;
    --card: #1b2124;
    --ink: #ece7de;
    --muted: #a6afb2;
    --line: #2e3639;
    --accent: #e58a6f;
    --accent-strong: #f0a18a;
    --on-accent: #1a0f0b;
    --ok: #7fc8a3;
    --urgent: #ff9d8a;
    --focus: #8ab4f8;
  }
}

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

html {
  scroll-behavior: smooth;
  -webkit-text-size-adjust: 100%;
}

@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }
  * {
    animation: none !important;
    transition: none !important;
  }
}

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font: 1.0625rem/1.6 var(--sans);
}

a {
  color: var(--accent-strong);
  text-underline-offset: 0.18em;
}

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

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

h1,
h2,
h3 {
  font-family: var(--serif);
  font-weight: 600;
  line-height: 1.15;
  text-wrap: balance;
  margin: 0;
}

h1 {
  font-size: clamp(2.1rem, 6.2vw, 3.6rem);
  letter-spacing: -0.01em;
}

h2 {
  font-size: clamp(1.5rem, 3.6vw, 2rem);
  margin-bottom: 1rem;
}

h3 {
  font-size: 1.2rem;
  margin-bottom: 0.35rem;
}

p {
  margin: 0 0 1rem;
  max-width: var(--measure);
}

.skip {
  position: absolute;
  left: -100rem;
}

.skip:focus {
  left: 1rem;
  top: 1rem;
  background: var(--card);
  padding: 0.5rem 0.75rem;
  z-index: 10;
}

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
}

/* Header */
.site-header {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem 1.5rem;
  padding: 1rem clamp(1rem, 5vw, 3rem);
  border-bottom: 1px solid var(--line);
}

.wordmark {
  display: inline-flex;
  align-items: center;
  gap: 0.55rem;
  color: var(--ink);
  text-decoration: none;
  font: 600 1.35rem/1 var(--serif);
}

.knock {
  width: 2.3rem;
  height: 1.7rem;
  fill: none;
  stroke: var(--accent);
  stroke-width: 2.4;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.knock circle {
  fill: var(--accent);
}

.site-header nav {
  display: flex;
  flex-wrap: wrap;
  gap: 0.25rem 1.25rem;
  font-size: 0.98rem;
}

.site-header nav a {
  color: var(--ink);
  text-decoration: none;
  padding: 0.35rem 0;
  border-bottom: 2px solid transparent;
}

.site-header nav a:hover {
  border-bottom-color: var(--accent);
}

/* Sections */
main > section {
  padding: clamp(2.25rem, 7vw, 4.5rem) clamp(1rem, 5vw, 3rem);
}

main > section > * {
  margin-left: auto;
  margin-right: auto;
  max-width: 52rem;
}

.hero {
  padding-top: clamp(2.5rem, 9vw, 6rem);
}

.eyebrow {
  color: var(--accent-strong);
  font-size: 0.95rem;
  letter-spacing: 0.02em;
  margin-bottom: 0.9rem;
  max-width: 52rem;
}

.hero h1 {
  margin-bottom: 1.5rem;
}

.lede {
  font-size: clamp(1.1rem, 2.3vw, 1.28rem);
  max-width: 52rem;
}

.hero .lede {
  max-width: 43rem;
  margin-left: max(0px, calc((100% - 52rem) / 2));
}

.actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.9rem 1.5rem;
  margin-top: 1.75rem;
  max-width: 52rem;
}

.button {
  display: inline-block;
  background: var(--accent);
  color: var(--on-accent);
  border: 0;
  border-radius: 0.6rem;
  padding: 0.8rem 1.25rem;
  font: 600 1.02rem/1.2 var(--sans);
  text-decoration: none;
  cursor: pointer;
  min-height: 2.9rem;
}

.button:hover {
  background: var(--accent-strong);
}

.button:disabled {
  opacity: 0.55;
  cursor: default;
}

.quiet-link {
  color: var(--ink);
}

.band {
  background: var(--card);
  border-block: 1px solid var(--line);
}

.steps {
  list-style: none;
  counter-reset: step;
  display: grid;
  gap: 1.5rem;
  grid-template-columns: repeat(auto-fit, minmax(14rem, 1fr));
  padding: 0;
  margin-top: 0;
  margin-bottom: 1.75rem;
}

.steps li {
  counter-increment: step;
  border-top: 3px solid var(--accent);
  padding-top: 0.9rem;
}

.steps li::before {
  content: counter(step);
  display: block;
  font: 600 0.95rem/1 var(--mono);
  color: var(--accent-strong);
  margin-bottom: 0.5rem;
}

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

.principle {
  border-left: 3px solid var(--accent);
  padding: 0.25rem 0 0.25rem 1rem;
  max-width: 52rem;
}

/* Demo */
.demo-step {
  margin-top: 1.5rem;
}

.demo-step label,
.step-label {
  display: block;
  font-weight: 600;
  margin-bottom: 0.45rem;
  max-width: 52rem;
}

.row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.6rem;
}

.demo input[type="tel"],
.demo input[type="text"] {
  flex: 1 1 14rem;
  min-width: 0;
  max-width: 22rem;
  min-height: 2.9rem;
  padding: 0.6rem 0.8rem;
  font: 1.1rem/1.2 var(--mono);
  color: var(--ink);
  background: var(--card);
  border: 1.5px solid var(--muted);
  border-radius: 0.6rem;
}

.channel {
  border: 0;
  padding: 0;
  margin: 0.7rem auto 0;
  display: flex;
  flex-wrap: wrap;
  gap: 0.3rem 1.25rem;
}

.channel label {
  font-weight: 400;
  margin: 0;
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  min-height: 2rem;
}

.fine-print {
  color: var(--muted);
  font-size: 0.93rem;
  margin-top: 0.8rem;
}

.demo-message {
  min-height: 1.6rem;
  margin-top: 1.25rem;
  font-weight: 600;
  max-width: 52rem;
}

.demo-message[data-kind="error"] {
  color: var(--urgent);
}

.demo-sample audio {
  width: min(100%, 26rem);
}

.timeline {
  list-style: none;
  padding: 0;
  margin-top: 1rem;
  border-left: 2px solid var(--line);
}

.timeline:empty {
  display: none;
}

.timeline li {
  position: relative;
  padding: 0.5rem 0 0.5rem 1.25rem;
  display: grid;
  grid-template-columns: 4.6rem 1fr;
  gap: 0.75rem;
  align-items: baseline;
  animation: arrive 0.35s ease-out;
}

.timeline li::before {
  content: "";
  position: absolute;
  left: -0.42rem;
  top: 1.05rem;
  width: 0.7rem;
  height: 0.7rem;
  border-radius: 50%;
  background: var(--accent);
  border: 2px solid var(--paper);
}

.timeline time {
  font: 0.86rem/1.4 var(--mono);
  color: var(--muted);
}

.timeline li[data-tone="ok"]::before {
  background: var(--ok);
}

.timeline li[data-tone="ok"] span {
  color: var(--ok);
  font-weight: 600;
}

.timeline li[data-tone="urgent"]::before {
  background: var(--urgent);
}

.timeline li[data-tone="urgent"] span {
  color: var(--urgent);
  font-weight: 600;
}

.timeline li[data-tone="quiet"] span {
  color: var(--muted);
}

@keyframes arrive {
  from {
    opacity: 0;
    transform: translateY(0.3rem);
  }
  to {
    opacity: 1;
    transform: none;
  }
}

.closing p {
  font-size: 1.1rem;
}

/* Footer */
.site-footer {
  padding: 2rem clamp(1rem, 5vw, 3rem) 3rem;
  color: var(--muted);
  font-size: 0.95rem;
}

.site-footer p {
  max-width: 52rem;
  margin-left: auto;
  margin-right: auto;
}

.site-footer strong {
  color: var(--ink);
}

[hidden] {
  display: none !important;
}

/* Architecture page */
.arch-hero h1 {
  font-size: clamp(1.9rem, 5vw, 3rem);
}

.diagram-scroll {
  overflow-x: auto;
  max-width: 62rem;
  border-radius: 0.9rem;
}

.diagram {
  display: block;
  width: 100%;
  min-width: 46rem;
  height: auto;
}

code {
  font: 0.92em/1.3 var(--mono);
  background: color-mix(in srgb, var(--accent) 9%, transparent);
  padding: 0.08em 0.32em;
  border-radius: 0.3rem;
  white-space: nowrap;
}

.flow {
  padding-left: 1.3rem;
  max-width: 46rem;
}

.flow li {
  margin-bottom: 0.9rem;
  padding-left: 0.3rem;
}

.flow li::marker {
  color: var(--accent-strong);
  font-weight: 700;
}

.parts {
  max-width: 46rem;
}

.parts dt {
  font-weight: 700;
  margin-top: 1.1rem;
}

.parts dt span {
  font-weight: 400;
  color: var(--muted);
  font-size: 0.93rem;
  margin-left: 0.4rem;
}

.parts dd {
  margin: 0.2rem 0 0;
}

.plain {
  max-width: 46rem;
  padding-left: 1.2rem;
}

.plain li {
  margin-bottom: 0.6rem;
}

.table-scroll {
  overflow-x: auto;
  max-width: 46rem;
}

table {
  border-collapse: collapse;
  width: 100%;
  margin-bottom: 0.8rem;
}

th,
td {
  text-align: left;
  padding: 0.6rem 0.9rem 0.6rem 0;
  border-bottom: 1px solid var(--line);
  vertical-align: top;
}

thead th {
  color: var(--muted);
  font-size: 0.9rem;
  font-weight: 600;
}

tbody th {
  font-weight: 400;
}

tbody td {
  font-weight: 600;
}

.counters {
  display: flex;
  flex-wrap: wrap;
  gap: 1.5rem 3rem;
  margin-top: 0.5rem;
  margin-bottom: 1.5rem;
}

.counters dt {
  color: var(--muted);
  font-size: 0.93rem;
}

.counters dd {
  margin: 0;
  font: 600 2.2rem/1.15 var(--serif);
}

/* Family page */
.family h1 {
  font-size: clamp(1.9rem, 5vw, 2.8rem);
}

.family-top {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  justify-content: space-between;
  gap: 0.5rem 1.5rem;
}

.lang-toggle {
  margin: 0;
}

.link-button {
  background: none;
  border: 0;
  padding: 0.35rem 0.2rem;
  color: var(--accent-strong);
  font: inherit;
  text-decoration: underline;
  text-underline-offset: 0.18em;
  cursor: pointer;
  min-height: 2rem;
}

.link-button[aria-pressed="true"] {
  color: var(--ink);
  font-weight: 700;
  text-decoration: none;
}

.card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 0.9rem;
  padding: 1.1rem 1.25rem;
  margin-bottom: 1.25rem;
}

.card h2,
.card h3 {
  font-size: 1.3rem;
  margin-bottom: 0.5rem;
}

.card h4 {
  font: 600 1rem/1.3 var(--sans);
  margin: 1.1rem 0 0.4rem;
}

.person header {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.4rem 0.8rem;
}

.person header h3 {
  margin: 0;
}

.chip {
  display: inline-block;
  border: 1px solid var(--muted);
  border-radius: 999px;
  padding: 0.05rem 0.6rem;
  font-size: 0.85rem;
  color: var(--muted);
}

.chip-active {
  border-color: var(--ok);
  color: var(--ok);
}

.chip-declined {
  border-color: var(--urgent);
  color: var(--urgent);
}

.urgent {
  color: var(--urgent);
  font-weight: 600;
}

.button.quiet {
  background: transparent;
  color: var(--ink);
  border: 1.5px solid var(--muted);
}

.button.quiet:hover {
  background: color-mix(in srgb, var(--accent) 8%, transparent);
}

.confirm {
  margin-top: 0.8rem;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.6rem 1rem;
}

.neighbors {
  padding-left: 1.2rem;
  margin: 0;
}

.episode {
  border-top: 1px solid var(--line);
  padding: 0.5rem 0;
}

.episode summary,
.add-person summary {
  cursor: pointer;
  font-weight: 600;
  min-height: 2rem;
}

.recording audio {
  vertical-align: middle;
  width: min(100%, 20rem);
}

.add-person form label,
.add-person fieldset {
  display: block;
  margin: 0.9rem 0;
  border: 0;
  padding: 0;
}

.add-person form label > span,
.add-person legend {
  display: block;
  font-weight: 600;
  margin-bottom: 0.3rem;
  padding: 0;
}

.add-person input[type="text"],
.add-person input[type="tel"],
#local-email {
  width: 100%;
  max-width: 26rem;
  min-height: 2.8rem;
  padding: 0.55rem 0.75rem;
  font: 1.05rem/1.2 var(--sans);
  color: var(--ink);
  background: var(--paper);
  border: 1.5px solid var(--muted);
  border-radius: 0.6rem;
}

.add-person label.inline {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  margin: 0 1.2rem 0 0;
  font-weight: 400;
  min-height: 2rem;
}

.neighbor-row {
  margin-bottom: 0.5rem;
}

.neighbor-row input {
  flex: 1 1 12rem;
}

.place-results {
  list-style: none;
  padding: 0;
  margin: 0.2rem 0 0;
}
