/* Gauge House: a ruled-ledger layout with an editorial serif voice.
   Palette: six tokens on :root, all at hue 40. */

:root {
  --paper: #F6F0E4;
  --panel: #EDE4D1;
  --ink: #2B2416;
  --muted: #5D4C2A;
  --ochre: #7D5A14;
  --amber: #F2C25B;

  --gutter: clamp(1rem, 4vw, 3rem);
  --measure: 40rem;
  --wide: 72rem;
  --serif: ui-serif, Charter, Georgia, serif;
}

[hidden] { display: none !important; }

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

html {
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
  scroll-padding-top: 1.5rem;
}

body {
  margin: 0;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  font-family: var(--serif);
  font-size: clamp(1rem, 0.95rem + 0.25vw, 1.125rem);
  line-height: 1.6;
  color: var(--ink);
  background-color: var(--paper);
  overflow-wrap: break-word;
}

main { flex: 1 0 auto; width: 100%; min-width: 0; }
main:focus { outline: none; }
header, footer { width: 100%; }

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

/* Type */
h1, h2, h3, h4 {
  font-family: var(--serif);
  color: var(--ink);
  font-weight: 700;
  line-height: 1.15;
  letter-spacing: -0.012em;
  overflow-wrap: anywhere;
  margin: 0 0 0.6em;
}
h1 {
  font-size: clamp(2.2rem, 1.4rem + 3.6vw, 4.4rem);
  line-height: 1.02;
  letter-spacing: -0.02em;
}
h2 { font-size: clamp(1.7rem, 1.25rem + 1.8vw, 2.6rem); }
h3 { font-size: clamp(1.15rem, 1.02rem + 0.6vw, 1.5rem); line-height: 1.25; }

p { margin: 0 0 1em; max-width: var(--measure); overflow-wrap: anywhere; }
ul, ol { margin: 0 0 1em; padding-left: 1.25em; max-width: var(--measure); }
li { margin-bottom: 0.4em; }

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

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

.skip-link {
  position: absolute;
  left: var(--gutter);
  top: -6rem;
  z-index: 100;
  padding: 0.6em 1em;
  color: var(--ink);
  background-color: var(--paper);
  border: 2px solid var(--ink);
  font-weight: 700;
  text-decoration: none;
}
.skip-link:focus { top: 0.75rem; }

.wrap {
  width: 100%;
  max-width: var(--wide);
  margin-inline: auto;
  padding-inline: var(--gutter);
}

/* Masthead */
.masthead {
  border-bottom: 3px double var(--ink);
  padding-top: 1.25rem;
}
.kicker {
  margin: 0 0 0.4rem;
  font-size: 0.8rem;
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--ochre);
  max-width: none;
}
.brand {
  margin: 0;
  font-size: clamp(1.9rem, 1.4rem + 1.8vw, 2.8rem);
  font-weight: 700;
  line-height: 1;
  letter-spacing: -0.02em;
  max-width: none;
}
.brand a { color: var(--ink); text-decoration: none; }
.brand a:hover { text-decoration: underline; text-decoration-thickness: 2px; text-underline-offset: 0.12em; }

.site-nav { margin-top: 1rem; border-top: 1px solid var(--ink); }
.site-nav ul {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem 1.4rem;
  list-style: none;
  margin: 0;
  padding: 0.8rem 0 0.9rem;
  max-width: none;
}
.site-nav li { margin: 0; }
.site-nav a { color: var(--ink); text-decoration: none; font-size: 0.98rem; }
.site-nav a:hover { text-decoration: underline; text-decoration-thickness: 1px; text-underline-offset: 0.25em; }
.site-nav a[aria-current="page"] {
  font-weight: 700;
  text-decoration: underline;
  text-decoration-thickness: 2px;
  text-underline-offset: 0.3em;
}

/* Sections */
.hero { padding-block: clamp(2.5rem, 6vw, 5.5rem); }
.page-head { padding-block: clamp(2.25rem, 5vw, 4rem); }
.band { border-top: 1px solid var(--ink); padding-block: clamp(2.25rem, 5vw, 4.25rem); }
.lede {
  font-size: clamp(1.15rem, 1rem + 0.6vw, 1.4rem);
  line-height: 1.5;
  max-width: 38rem;
}
.hero-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.75rem 1.5rem;
  margin-top: 1.5rem;
}
.text-link { font-weight: 700; }

figure { margin: 0 0 1.5rem; }
figcaption {
  margin-top: 0.6rem;
  font-size: 0.92rem;
  color: var(--muted);
  max-width: var(--measure);
}

.hero-grid { display: grid; gap: 2.25rem; align-items: center; }
@media (min-width: 56rem) {
  .hero-grid { grid-template-columns: minmax(0, 1.3fr) minmax(0, 1fr); gap: 3.5rem; }
}
.hero-figure { margin: 0; }
.hero-figure svg { width: 100%; max-width: 28rem; margin-inline: auto; }
.hero-figure figcaption { text-align: center; margin-inline: auto; }

/* Dial illustration */
.dial-band-1 { fill: none; stroke: var(--muted); stroke-width: 20; }
.dial-band-2 { fill: none; stroke: var(--amber); stroke-width: 20; }
.dial-band-3 { fill: none; stroke: var(--ochre); stroke-width: 20; }
.dial-tick { fill: none; stroke: var(--ink); stroke-width: 2.5; stroke-linecap: round; }
.dial-base { fill: none; stroke: var(--ink); stroke-width: 1.5; }
.dial-needle { fill: none; stroke: var(--ink); stroke-width: 4; stroke-linecap: round; }
.dial-hub { fill: var(--ink); }

/* Decision panels (accordion) */
.panel-list {
  margin: 0;
  padding: 0;
  border-bottom: 1px solid var(--ink);
  max-width: none;
}
.panel { border-top: 1px solid var(--ink); }
.panel summary {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem;
  padding: 1.25rem 0;
  cursor: pointer;
  list-style: none;
}
.panel summary::-webkit-details-marker { display: none; }
.panel summary h3 { margin: 0; flex: 1 1 auto; min-width: 0; }
.panel-mark {
  position: relative;
  flex: 0 0 2.4rem;
  width: 2.4rem;
  height: 2.4rem;
  margin-top: 0.15rem;
  border: 2px solid var(--ink);
  transition: background-color 0.2s ease;
}
.panel-mark::before,
.panel-mark::after {
  content: "";
  position: absolute;
  left: 50%;
  top: 50%;
  background-color: var(--ink);
  transform: translate(-50%, -50%);
}
.panel-mark::before { width: 14px; height: 2px; }
.panel-mark::after { width: 2px; height: 14px; transition: transform 0.2s ease; }
.panel[open] .panel-mark::after { transform: translate(-50%, -50%) scaleY(0); }
.panel summary:hover .panel-mark { background-color: var(--amber); }
.panel-body { padding: 0 0 1.75rem; max-width: 42rem; }
.panel-body p:last-child { margin-bottom: 0; }
.panel-route {
  margin-bottom: 0.5rem;
  font-size: 0.8rem;
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--muted);
}

.panel-controls {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  margin: 0 0 0.5rem;
}

/* Buttons and status */
.btn {
  display: inline-block;
  font: inherit;
  font-size: 1rem;
  font-weight: 700;
  line-height: 1.2;
  padding: 0.7em 1.15em;
  color: var(--ink);
  background-color: var(--paper);
  border: 2px solid var(--ink);
  border-radius: 0;
  cursor: pointer;
  text-decoration: none;
  transition: background-color 0.2s ease, color 0.2s ease;
}
.btn:hover { background-color: var(--amber); color: var(--ink); }
.btn:active { background-color: var(--ink); color: var(--paper); }
.btn:focus-visible { outline: 3px solid var(--ink); outline-offset: 3px; }

.status {
  min-height: 1.6em;
  margin: 0.75rem 0 0;
  font-size: 0.95rem;
  color: var(--muted);
  max-width: none;
}

/* Habits */
.habits {
  list-style: none;
  padding: 0;
  margin: 0;
  display: grid;
  gap: 1.75rem;
  max-width: none;
}
@media (min-width: 52rem) {
  .habits { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 2.25rem; }
}
.habits li {
  margin: 0;
  padding-top: 1rem;
  border-top: 2px solid var(--ink);
}

/* Note box */
.note-box {
  margin: 2.5rem 0 0;
  padding: 1.25rem 1.5rem;
  max-width: 46rem;
  background-color: var(--panel);
  border: 2px solid var(--ink);
}
.note-box p:last-child { margin-bottom: 0; }
.note-box strong { font-weight: 700; }

/* Table of contents on the guide */
.toc-wrap {
  border-top: 2px solid var(--ink);
  border-bottom: 1px solid var(--ink);
  padding-block: 1.25rem;
  margin-top: 1.5rem;
}
.toc-title { font-size: 1.1rem; margin-bottom: 0.75rem; }
.toc {
  list-style: none;
  padding: 0;
  margin: 0;
  display: grid;
  gap: 0.45rem 1.5rem;
  max-width: none;
}
.toc li { margin: 0; }
@media (min-width: 40rem) {
  .toc { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

.split { display: grid; gap: 2rem; align-items: start; }
@media (min-width: 56rem) {
  .split { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 3.5rem; }
}
.anatomy-svg { width: 100%; max-width: 36rem; margin-inline: auto; }

.defs { margin: 0 0 1rem; max-width: var(--measure); }
.defs > div { padding: 0.9rem 0; border-top: 1px solid var(--ink); }
.defs dt { font-weight: 700; margin: 0 0 0.2rem; }
.defs dd { margin: 0; }

.axis-pair { display: grid; gap: 1.5rem; margin-block: 1rem 1.5rem; }
@media (min-width: 40rem) {
  .axis-pair { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
.axis-pair figure { margin: 0; max-width: 22rem; }
.axis-pair svg { width: 100%; max-width: 20rem; }
.axis-bar { fill: var(--ochre); }
.axis-base { fill: none; stroke: var(--ink); stroke-width: 2; stroke-linecap: square; }

/* Panel anatomy diagram */
.anat-frame { fill: var(--panel); stroke: var(--ink); stroke-width: 2; }
.anat-title { stroke: var(--ink); stroke-width: 8; stroke-linecap: round; }
.anat-unit { stroke: var(--muted); stroke-width: 5; stroke-linecap: round; }
.anat-legend { fill: var(--paper); stroke: var(--ink); stroke-width: 1.5; }
.anat-key-ink { stroke: var(--ink); stroke-width: 3; stroke-linecap: round; }
.anat-key-ochre { stroke: var(--ochre); stroke-width: 3; stroke-linecap: round; }
.anat-axes { fill: none; stroke: var(--ink); stroke-width: 2; }
.anat-baseline { fill: none; stroke: var(--muted); stroke-width: 2; stroke-dasharray: 6 5; }
.anat-trend { fill: none; stroke: var(--ochre); stroke-width: 4; stroke-linejoin: round; stroke-linecap: round; }
.anat-window { fill: none; stroke: var(--ink); stroke-width: 2; }
.anat-source { stroke: var(--muted); stroke-width: 4; stroke-linecap: round; }
.anat-marker circle { fill: var(--paper); stroke: var(--ink); stroke-width: 2; }
.anat-marker text {
  fill: var(--ink);
  font-family: var(--serif);
  font-size: 13px;
  font-weight: 700;
  text-anchor: middle;
  dominant-baseline: central;
}

/* Footer */
.site-footer {
  color: var(--paper);
  background-color: var(--ink);
  padding-block: clamp(2.25rem, 5vw, 3.5rem);
  margin-top: auto;
}
.site-footer p { color: var(--paper); max-width: 34rem; }
.site-footer a { color: var(--amber); }
.site-footer a:hover { color: var(--paper); }
.site-footer :focus-visible { outline-color: var(--amber); }
.footer-grid { display: grid; gap: 2rem; }
@media (min-width: 52rem) {
  .footer-grid { grid-template-columns: minmax(0, 2fr) minmax(0, 1fr) minmax(0, 1fr); gap: 3rem; }
}
.footer-brand { font-size: 1.5rem; font-weight: 700; margin-bottom: 0.5rem; }
.footer-list { list-style: none; padding: 0; margin: 0 0 1rem; max-width: none; }
.footer-list li { margin-bottom: 0.35rem; }

/* Contrast lab */
.lab-layout { display: grid; gap: 2.5rem; }
@media (min-width: 60rem) {
  .lab-layout { grid-template-columns: minmax(0, 1.1fr) minmax(0, 0.9fr); gap: 3rem; align-items: start; }
}
.mixer-grid { display: grid; gap: 1.5rem; }
@media (min-width: 40rem) {
  .mixer-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
fieldset {
  min-width: 0;
  margin: 0;
  padding: 1rem 1.1rem 1.2rem;
  border: 2px solid var(--ink);
}
legend { padding: 0 0.4rem; font-weight: 700; font-size: 1.1rem; }
.channel-row,
.hex-row {
  display: grid;
  grid-template-columns: 4.75rem minmax(0, 1fr) 3rem;
  align-items: center;
  gap: 0.5rem 0.75rem;
  margin-bottom: 0.75rem;
}
.hex-row {
  grid-template-columns: 4.75rem minmax(0, 1fr) 2.4rem;
  margin-bottom: 0;
  margin-top: 0.25rem;
}
.channel-row label,
.hex-row label { font-weight: 700; }
output {
  text-align: right;
  font-variant-numeric: tabular-nums;
}
input[type="range"] {
  width: 100%;
  min-height: 2rem;
  margin: 0;
  accent-color: var(--ink);
}
input[type="text"] {
  width: 100%;
  min-width: 0;
  font: inherit;
  padding: 0.35em 0.5em;
  color: var(--ink);
  background-color: var(--paper);
  border: 2px solid var(--ink);
  border-radius: 0;
}
.swatch {
  display: block;
  width: 2.4rem;
  height: 2.4rem;
  border: 2px solid var(--ink);
  background-color: var(--swatch, var(--paper));
}
.hint {
  margin: 1rem 0 0;
  font-size: 0.92rem;
  color: var(--muted);
}
.lab-controls { min-width: 0; }
.lab-tools { margin-top: 1.5rem; display: grid; gap: 1.25rem; }
.tool-label {
  margin: 0 0 0.5rem;
  font-size: 0.8rem;
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--muted);
}
.tool-row { display: flex; flex-wrap: wrap; gap: 0.6rem; }
.preview-col { display: grid; gap: 1rem; min-width: 0; }
.preview-surface {
  color: var(--preview-fg, var(--ink));
  background-color: var(--preview-bg, var(--paper));
  border: 2px solid var(--ink);
  padding: clamp(1.25rem, 4vw, 2rem);
}
.preview-surface p { color: inherit; max-width: none; }
.preview-surface .preview-kicker {
  margin-bottom: 0.5rem;
  font-size: 0.8rem;
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}
.preview-surface .preview-heading {
  margin-bottom: 0.6rem;
  font-size: clamp(1.5rem, 1.2rem + 1.2vw, 2.1rem);
  font-weight: 700;
  line-height: 1.2;
}
.preview-surface .preview-large {
  font-size: clamp(1.25rem, 1.05rem + 0.8vw, 1.6rem);
  font-weight: 700;
}
.chip {
  display: inline-block;
  margin: 0 0.4rem 0.4rem 0;
  padding: 0.15em 0.6em;
  border: 1px solid currentColor;
  font-size: 0.95rem;
}
.sample-control {
  display: inline-block;
  padding: 0.45em 1em;
  border: 2px solid currentColor;
  font-weight: 700;
}
.note-inline {
  max-width: 46rem;
  padding: 0.9rem 1.1rem;
  font-size: 0.98rem;
  background-color: var(--panel);
  border: 2px solid var(--ink);
}

.ratio-line {
  margin: 0 0 1.25rem;
  font-size: clamp(1.25rem, 1rem + 1vw, 1.75rem);
}
.ratio-line span { font-weight: 700; }
.result-list {
  list-style: none;
  margin: 0;
  padding: 0;
  max-width: 46rem;
  border-top: 2px solid var(--ink);
}
.result-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
  margin: 0;
  padding: 0.95rem 0;
  border-bottom: 1px solid var(--ink);
}
.result-name { display: block; font-weight: 700; }
.result-need { display: block; font-size: 0.92rem; color: var(--muted); }
.result-state {
  flex: 0 0 auto;
  min-width: 5.25rem;
  padding: 0.25em 0.7em;
  text-align: center;
  font-weight: 700;
  border: 2px solid var(--ink);
}
.result-state.is-fail { border-style: dashed; }

/* About: palette */
.palette-list {
  list-style: none;
  padding: 0;
  margin: 0;
  display: grid;
  gap: 1rem;
  max-width: 46rem;
}
@media (min-width: 40rem) {
  .palette-list { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 1.25rem 1.5rem; }
}
.palette-item {
  display: grid;
  grid-template-columns: 3.25rem minmax(0, 1fr);
  gap: 0.25rem 1rem;
  align-items: start;
  margin: 0;
  padding-top: 0.9rem;
  border-top: 1px solid var(--ink);
}
.palette-item p { margin: 0 0 0.25rem; }
.palette-swatch {
  grid-row: span 3;
  width: 3.25rem;
  height: 3.25rem;
  border: 2px solid var(--ink);
}
.palette-name { font-weight: 700; }
.palette-hex {
  font-size: 0.9rem;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
}
.swatch-paper { background-color: var(--paper); }
.swatch-panel { background-color: var(--panel); }
.swatch-ink { background-color: var(--ink); }
.swatch-muted { background-color: var(--muted); }
.swatch-ochre { background-color: var(--ochre); }
.swatch-amber { background-color: var(--amber); }

/* Contact */
.address {
  margin: 0 0 1.5rem;
  font-size: clamp(1.2rem, 1rem + 1.2vw, 2.2rem);
  font-weight: 700;
  overflow-wrap: anywhere;
}
.address a { text-decoration-thickness: 2px; }

/* Reduced motion: keep every state, drop the movement */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    transition: none !important;
    animation: none !important;
    scroll-behavior: auto !important;
  }
}
