/* Nettlewick: an engineering-sheet look. A cream text column sits beside a
   charcoal drafting panel with mustard linework. Five colour tokens, all at hue 53. */

:root {
  --paper: #F4F3E6;
  --ink: #201E13;
  --ink-soft: #545245;
  --panel: #1F1F19;
  --signal: #FAE11E;
  color-scheme: light;
  --mono: ui-monospace, "SF Mono", SFMono-Regular, Menlo, Consolas, "Liberation Mono", monospace;
}

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

[hidden] {
  display: none !important;
}

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

body {
  margin: 0;
  min-width: 0;
  font-family: var(--mono);
  font-size: clamp(0.95rem, 0.9rem + 0.2vw, 1.05rem);
  line-height: 1.65;
  background-color: var(--paper);
  color: var(--ink);
  overflow-wrap: break-word;
}

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

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

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

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

.panel :focus-visible {
  outline-color: var(--signal);
}

.skip-link {
  position: absolute;
  left: 1rem;
  top: -4rem;
  z-index: 10;
  padding: 0.6rem 0.9rem;
  border: 2px solid var(--ink);
  background-color: var(--signal);
  color: var(--ink);
  font-weight: 700;
}

.skip-link:focus {
  top: 1rem;
}

/* Split sheet: on wide screens a fixed half-viewport panel sits beside a
   scrolling column. On narrow screens the two stack. */
.split {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

.column {
  min-width: 0;
  padding: 1.5rem clamp(1rem, 4vw, 3.5rem) 0;
  background-color: var(--paper);
}

.panel {
  order: 1;
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
  min-width: 0;
  padding: 1.25rem clamp(1rem, 4vw, 3rem) 2rem;
  background-color: var(--panel);
  color: var(--paper);
}

@media (min-width: 900px) {
  .split {
    display: block;
    min-height: 100vh;
  }

  .panel {
    position: fixed;
    top: 0;
    left: 0;
    width: 50%;
    height: 100vh;
    overflow-y: auto;
    padding: clamp(2rem, 4vw, 3.5rem) clamp(1.5rem, 3vw, 3rem);
  }

  .column {
    width: 50%;
    min-height: 100vh;
    margin-left: 50%;
    padding: clamp(2.5rem, 5vw, 4.5rem) clamp(1.5rem, 4vw, 4rem) 0;
  }
}

/* Header and navigation */
.site-header {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  justify-content: space-between;
  gap: 0.9rem 1.5rem;
  margin-bottom: clamp(2rem, 5vw, 3.5rem);
  padding-bottom: 1.1rem;
  border-bottom: 2px solid var(--ink);
}

.wordmark {
  display: inline-flex;
  flex-direction: column;
  font-size: 1.3rem;
  font-weight: 700;
  line-height: 1.1;
  letter-spacing: 0.01em;
  text-decoration: none;
}

.wordmark span {
  margin-top: 0.3rem;
  font-size: 0.72rem;
  font-weight: 400;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--ink-soft);
}

.nav-list {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem 1.1rem;
  margin: 0;
  padding: 0;
  list-style: none;
  font-size: 0.88rem;
}

.nav-list a {
  display: inline-block;
  padding: 0.15rem 0;
  text-decoration: none;
  border-bottom: 2px solid var(--paper);
}

.nav-list a:hover {
  border-bottom-color: var(--ink);
}

.nav-list a[aria-current="page"] {
  font-weight: 700;
  border-bottom-color: var(--ink);
}

/* Type */
h1 {
  margin: 0 0 1.25rem;
  font-size: clamp(1.8rem, 1.15rem + 2.6vw, 3.1rem);
  line-height: 1.08;
  letter-spacing: -0.02em;
}

h2 {
  margin: 2.75rem 0 0.9rem;
  padding-top: 0.9rem;
  border-top: 1px solid var(--ink-soft);
  font-size: clamp(1.1rem, 1rem + 0.5vw, 1.35rem);
  line-height: 1.3;
}

h3 {
  margin: 1.75rem 0 0.6rem;
  font-size: 1.02rem;
  line-height: 1.35;
}

p {
  max-width: 40rem;
  margin: 0 0 1rem;
}

.kicker {
  margin: 0 0 0.75rem;
  font-size: 0.75rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--ink-soft);
}

.lead {
  font-size: clamp(1.05rem, 0.98rem + 0.4vw, 1.25rem);
  line-height: 1.5;
}

.text-link {
  font-weight: 700;
}

/* Lists */
.plain-list {
  max-width: 40rem;
  margin: 0 0 1rem;
  padding-left: 1.25rem;
}

.plain-list li {
  margin-bottom: 0.5rem;
  padding-left: 0.2rem;
}

.index-list {
  counter-reset: idx;
  max-width: 40rem;
  margin: 0 0 1rem;
  padding: 0;
  list-style: none;
}

.index-list li {
  counter-increment: idx;
  display: grid;
  grid-template-columns: 2.6rem 1fr;
  gap: 0.5rem;
  padding: 0.9rem 0;
  border-bottom: 1px solid var(--ink-soft);
}

.index-list li::before {
  content: counter(idx, decimal-leading-zero);
  color: var(--ink-soft);
}

.index-list li > div {
  min-width: 0;
}

.check-list {
  max-width: 40rem;
  margin: 0 0 1rem;
  padding: 0;
  list-style: none;
}

.check-list li {
  position: relative;
  padding: 0.7rem 0 0.7rem 2rem;
  border-bottom: 1px solid var(--ink-soft);
}

.check-list li::before {
  content: "";
  position: absolute;
  left: 0;
  top: 1rem;
  width: 1rem;
  height: 1rem;
  border: 2px solid var(--ink);
  background-color: var(--paper);
}

.terms {
  max-width: 40rem;
  margin: 0 0 1rem;
}

.terms > div {
  display: grid;
  grid-template-columns: minmax(6.5rem, 10rem) 1fr;
  gap: 0.25rem 1rem;
  padding: 0.8rem 0;
  border-bottom: 1px solid var(--ink-soft);
}

.terms dt {
  font-weight: 700;
}

.terms dd {
  margin: 0;
}

.toc {
  max-width: 40rem;
  margin: 0 0 2rem;
  padding: 0.1rem 0 0.1rem 1rem;
  border-left: 3px solid var(--ink);
}

.toc-label {
  margin: 0 0 0.4rem;
  font-size: 0.75rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--ink-soft);
}

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

.toc-list li {
  margin-bottom: 0.3rem;
}

/* Notes and callouts */
.note {
  margin: 2.5rem 0 0;
  padding: 1rem 1.2rem;
  border: 2px solid var(--ink);
  border-left-width: 0.6rem;
}

.note h2 {
  margin: 0 0 0.5rem;
  padding: 0;
  border: 0;
  font-size: 1rem;
}

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

/* Buttons and actions */
.actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  margin: 0 0 1.5rem;
}

.button {
  display: inline-flex;
  align-items: center;
  min-height: 2.75rem;
  padding: 0.55rem 1.1rem;
  border: 2px solid var(--ink);
  background-color: var(--paper);
  color: var(--ink);
  font: inherit;
  font-weight: 700;
  text-decoration: none;
  cursor: pointer;
  transition: background-color 0.15s ease, color 0.15s ease;
}

.button:hover {
  background-color: var(--ink);
  color: var(--paper);
}

.button--solid {
  background-color: var(--signal);
}

.button--solid:hover {
  background-color: var(--ink);
  color: var(--signal);
}

/* Footer */
.site-footer {
  margin-top: clamp(3rem, 8vw, 5rem);
  padding: 1.5rem 0 2.25rem;
  border-top: 2px solid var(--ink);
  font-size: 0.9rem;
  color: var(--ink-soft);
}

.site-footer p {
  margin: 0 0 0.5rem;
}

.site-footer a {
  color: var(--ink);
  font-weight: 700;
}

/* Configurator form */
.configurator {
  margin: 0;
}

.status {
  max-width: 40rem;
  margin: 0 0 1.75rem;
  padding: 0.8rem 1rem;
  border: 2px solid var(--ink);
  border-left-width: 0.6rem;
  background-color: var(--paper);
  font-weight: 700;
}

.option-group {
  min-width: 0;
  max-width: 40rem;
  margin: 0 0 2.25rem;
  padding: 0;
  border: 0;
}

.option-group legend {
  margin: 0 0 0.3rem;
  padding: 0;
  font-size: clamp(1.05rem, 1rem + 0.3vw, 1.2rem);
  font-weight: 700;
}

.group-help {
  margin: 0 0 0.9rem;
  font-size: 0.92rem;
  color: var(--ink-soft);
}

.option {
  position: relative;
  display: grid;
  grid-template-columns: 1.25rem 1fr;
  gap: 0.3rem 0.9rem;
  align-items: start;
  margin: 0 0 0.6rem;
  padding: 0.85rem 1rem;
  border: 2px solid var(--ink);
  background-color: var(--paper);
  cursor: pointer;
}

.option.is-selected {
  background-color: var(--signal);
}

/* The native control stays in the tab order but is visually hidden;
   the sibling .mark draws it and carries the focus ring. */
.option input {
  position: absolute;
  width: 1px;
  height: 1px;
  margin: -1px;
  padding: 0;
  border: 0;
  overflow: hidden;
  clip: rect(0 0 0 0);
  clip-path: inset(50%);
  white-space: nowrap;
}

.mark {
  position: relative;
  display: block;
  width: 1.25rem;
  height: 1.25rem;
  margin-top: 0.15rem;
  border: 2px solid var(--ink);
  background-color: var(--paper);
}

.mark--radio {
  border-radius: 50%;
}

.mark--radio::after {
  content: "";
  position: absolute;
  inset: 0.2rem;
  border-radius: 50%;
  background-color: var(--ink);
  transform: scale(0);
}

.mark--check::after {
  content: "";
  position: absolute;
  left: 0.36rem;
  top: 0.08rem;
  width: 0.36rem;
  height: 0.7rem;
  border: solid var(--ink);
  border-width: 0 3px 3px 0;
  transform: rotate(45deg) scale(0);
}

input:checked + .mark {
  background-color: var(--signal);
}

input:checked + .mark--radio::after {
  transform: scale(1);
}

input:checked + .mark--check::after {
  transform: rotate(45deg) scale(1);
}

input:focus-visible + .mark {
  outline: 3px solid var(--ink);
  outline-offset: 3px;
}

.option-title {
  display: block;
  font-weight: 700;
}

.option-body {
  display: block;
  margin-top: 0.15rem;
  font-size: 0.92rem;
  line-height: 1.5;
  color: var(--ink-soft);
}

.option.is-selected .option-body {
  color: var(--ink);
}

.form-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  margin: 0 0 2.5rem;
}

/* Drafting panel */
.panel-head {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 0.25rem 1rem;
  margin: 0;
  padding-bottom: 0.7rem;
  border-bottom: 1px solid var(--signal);
  font-size: 0.72rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--signal);
}

.schematic {
  display: block;
  flex: none;
  width: min(100%, 50vh);
  height: auto;
  margin: 0 auto;
}

.schematic--compact {
  width: min(100%, 44vh);
}

.panel-caption {
  margin: 0;
  font-size: 0.92rem;
  line-height: 1.55;
  max-width: 36rem;
}

.panel h2 {
  margin: 0 0 0.75rem;
  padding: 0;
  border: 0;
  font-size: 0.8rem;
  line-height: 1.4;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--signal);
}

.panel h3 {
  margin: 1.25rem 0 0.5rem;
  font-size: 0.8rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--signal);
}

.panel p {
  max-width: 36rem;
}

.summary {
  padding-top: 1rem;
  border-top: 1px solid var(--signal);
}

.summary-list {
  margin: 0;
}

.summary-list > div {
  display: grid;
  grid-template-columns: 6.5rem 1fr;
  gap: 0.75rem;
  padding: 0.6rem 0;
  border-bottom: 1px solid var(--signal);
}

.summary-list dt {
  font-size: 0.85rem;
  color: var(--signal);
}

.summary-list dd {
  margin: 0;
  font-size: 0.92rem;
  line-height: 1.5;
}

.notes {
  margin: 0;
  padding-left: 1.1rem;
  font-size: 0.92rem;
  line-height: 1.5;
}

.notes li {
  margin-bottom: 0.55rem;
}

/* Schematic parts (inline SVG, styled by class only) */
.grid-bg {
  fill: url(#grid);
}

.grid-line {
  fill: none;
  stroke: var(--signal);
  stroke-opacity: 0.16;
  stroke-width: 1;
}

.label-sm {
  fill: var(--signal);
  font-size: 12px;
  letter-spacing: 0.08em;
}

.boundary {
  fill: none;
  stroke: var(--signal);
  stroke-width: 1.5;
  stroke-dasharray: 8 6;
}

.wire {
  stroke: var(--paper);
  stroke-width: 1.5;
}

.wire-flow {
  stroke: var(--signal);
  stroke-width: 2;
  stroke-dasharray: 6 6;
}

.node rect,
.band rect,
.opt rect,
.mod rect {
  fill: var(--panel);
  stroke: var(--signal);
  stroke-width: 1.5;
}

.node-title,
.band-title,
.opt-title,
.mod text,
.node-sub,
.band-sub,
.opt-sub {
  fill: var(--paper);
}

.node-title {
  font-size: 16px;
  font-weight: 700;
}

.node-sub {
  font-size: 13px;
}

.node.core rect {
  fill: var(--paper);
  stroke: var(--paper);
}

.node.core text {
  fill: var(--ink);
}

.outside rect {
  fill: none;
  stroke: var(--paper);
  stroke-dasharray: 4 4;
}

.opt-title,
.band-title {
  font-size: 16px;
  font-weight: 700;
}

.opt-sub,
.band-sub {
  font-size: 14px;
}

.mod text {
  font-size: 14px;
}

.opt rect,
.mod rect {
  stroke-dasharray: 5 4;
}

.opt.is-on rect,
.mod.is-on rect {
  fill: var(--signal);
  stroke: var(--signal);
  stroke-dasharray: none;
}

.opt.is-on text,
.mod.is-on text {
  fill: var(--ink);
}

.core rect {
  fill: var(--paper);
  stroke: var(--paper);
  stroke-width: 1.5;
}

.core text {
  fill: var(--ink);
}

.core-title {
  font-size: 18px;
  font-weight: 700;
}

.core-sub {
  font-size: 14px;
}

.frame {
  fill: none;
  stroke: var(--signal);
  stroke-width: 1;
}

.frame-label {
  fill: var(--signal);
  font-size: 12px;
  letter-spacing: 0.14em;
}

.band.is-hot rect {
  fill: var(--signal);
  stroke: var(--signal);
}

.band.is-hot text {
  fill: var(--ink);
}

.band-no {
  fill: var(--signal);
  font-size: 13px;
}

.band.is-hot .band-no {
  fill: var(--ink);
}

.link {
  stroke: var(--paper);
  stroke-width: 1.5;
}

.sheet {
  fill: var(--panel);
  stroke: var(--signal);
  stroke-width: 1.5;
}

.tick {
  fill: none;
  stroke: var(--paper);
  stroke-width: 2;
}

.tick-mark {
  fill: none;
  stroke: var(--paper);
  stroke-width: 2.5;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.row-line {
  fill: var(--paper);
  fill-opacity: 0.55;
}

.tick.is-hot,
.row-line.is-hot {
  fill: var(--signal);
  stroke: var(--signal);
  fill-opacity: 1;
}

.envelope {
  fill: var(--panel);
  stroke: var(--signal);
  stroke-width: 2;
}

.flap,
.fold {
  fill: none;
  stroke: var(--paper);
  stroke-width: 1.5;
}

.address {
  fill: var(--signal);
  font-size: 17px;
  font-weight: 700;
}

/* Motion: flowing line only when the reader has not asked for less motion */
@media (prefers-reduced-motion: no-preference) {
  html {
    scroll-behavior: smooth;
  }

  .wire-flow {
    animation: flow 1.2s linear infinite;
  }

  .mark::after,
  .button {
    transition: transform 0.15s ease, background-color 0.15s ease, color 0.15s ease;
  }
}

@keyframes flow {
  to {
    stroke-dashoffset: -24;
  }
}

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

/* Print: the plan prints on paper, with the schematic drawn in ink */
@media print {
  .skip-link,
  .nav-list,
  .form-actions,
  .site-footer,
  .status {
    display: none !important;
  }

  .split {
    display: block;
  }

  .panel,
  .column {
    position: static !important;
    width: auto !important;
    height: auto !important;
    margin-left: 0 !important;
    overflow: visible !important;
  }

  .panel {
    padding: 0 0 1rem;
    background-color: var(--paper);
    color: var(--ink);
  }

  .panel-head,
  .panel h2,
  .panel h3,
  .summary-list dt {
    color: var(--ink) !important;
  }

  .panel-head,
  .summary-list > div,
  .summary {
    border-color: var(--ink) !important;
  }

  .panel .schematic rect,
  .panel .schematic line,
  .panel .schematic path {
    fill: none !important;
    stroke: var(--ink) !important;
  }

  .panel .schematic .grid-bg,
  .panel .schematic .label-sm,
  .panel .schematic .frame-label {
    display: none !important;
  }

  .panel .schematic text {
    fill: var(--ink) !important;
  }

  .panel .schematic .is-on rect,
  .panel .schematic .is-on {
    stroke-width: 3px !important;
    stroke-dasharray: none !important;
  }

  .panel .schematic .core rect {
    fill: none !important;
  }
}
