/* Ninth Bar Espresso Service
   Visual system: a service-manual plate. Pale manual stock, ink linework,
   brass for anything live, and exactly one red — the gauge needle. */

:root {
  --plate:      #d9dcd2;
  --plate-deep: #c7cbbe;
  --plate-lift: #e4e7de;
  --ink:        #14170f;
  --ink-soft:   #4a5142;
  --brass:      #8a6a2f;
  --brass-lift: #b08c47;
  --patina:     #4e6b5c;
  --needle:     #b0281e;
  --rule:       rgba(20, 23, 15, 0.22);
  --rule-firm:  rgba(20, 23, 15, 0.42);

  --display: 'Archivo', 'Helvetica Neue', system-ui, sans-serif;
  --body:    'Newsreader', Georgia, 'Times New Roman', serif;
  --mono:    'DM Mono', ui-monospace, 'SFMono-Regular', Consolas, monospace;

  --gutter: clamp(1.25rem, 4vw, 3.5rem);
  --measure: 1140px;
}

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

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

body {
  margin: 0;
  background: var(--plate);
  color: var(--ink);
  font-family: var(--body);
  font-size: clamp(1.0625rem, 0.4vw + 1rem, 1.1875rem);
  line-height: 1.62;
  font-variant-numeric: oldstyle-numeric;
}

/* Faint plate tooth, so the ground reads as stock rather than a flat fill. */
body::before {
  content: '';
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 0;
  opacity: 0.4;
  background-image:
    repeating-linear-gradient(0deg, rgba(20,23,15,0.035) 0 1px, transparent 1px 3px);
}

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

a { color: inherit; }

img, svg { max-width: 100%; }

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

.skip {
  position: absolute;
  left: -9999px;
  top: 0;
  background: var(--ink);
  color: var(--plate);
  padding: 0.6rem 1rem;
  font-family: var(--mono);
  font-size: 0.8rem;
  z-index: 50;
}
.skip:focus { left: 0; }

:where(a, button, input, [tabindex]):focus-visible {
  outline: 2px solid var(--brass);
  outline-offset: 3px;
  border-radius: 1px;
}

/* ---------- type roles ---------- */

.eyebrow {
  font-family: var(--mono);
  font-size: 0.7rem;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--patina);
  margin: 0 0 1.1rem;
  font-variant-numeric: tabular-nums;
}

h1, h2, h3, .display {
  font-family: var(--display);
  font-variation-settings: 'wdth' 118, 'wght' 640;
  font-weight: 640;
  letter-spacing: -0.012em;
  line-height: 1.07;
  margin: 0;
  text-wrap: balance;
}

h1 {
  font-size: clamp(2.1rem, 4.6vw, 3.55rem);
  max-width: 19ch;
}

h2 {
  font-size: clamp(1.65rem, 3vw, 2.4rem);
  max-width: 22ch;
}

h3 {
  font-size: clamp(1.1rem, 1.4vw, 1.32rem);
  font-variation-settings: 'wdth' 112, 'wght' 640;
}

.lede {
  font-size: clamp(1.1rem, 0.6vw + 1rem, 1.3rem);
  max-width: 54ch;
  color: var(--ink-soft);
  margin: 1.15rem 0 0;
}

p { max-width: 66ch; }

.mono {
  font-family: var(--mono);
  font-variant-numeric: tabular-nums;
  letter-spacing: 0.02em;
}

/* ---------- masthead ---------- */

.masthead {
  border-bottom: 1px solid var(--rule-firm);
  background: var(--plate);
}

.masthead-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1.5rem;
  flex-wrap: wrap;
  padding-block: 1.1rem;
}

.wordmark {
  display: inline-flex;
  align-items: baseline;
  gap: 0.55rem;
  text-decoration: none;
}

.wordmark-name {
  font-family: var(--display);
  font-variation-settings: 'wdth' 125, 'wght' 700;
  font-size: 1.02rem;
  letter-spacing: 0.03em;
  text-transform: uppercase;
}

.wordmark-sub {
  font-family: var(--mono);
  font-size: 0.66rem;
  letter-spacing: 0.17em;
  text-transform: uppercase;
  color: var(--patina);
}

.nav {
  display: flex;
  align-items: center;
  gap: clamp(0.9rem, 2vw, 1.85rem);
  flex-wrap: wrap;
}

.nav a {
  font-family: var(--mono);
  font-size: 0.78rem;
  letter-spacing: 0.06em;
  text-decoration: none;
  padding-bottom: 2px;
  border-bottom: 1px solid transparent;
}

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

.nav a[aria-current='page'] {
  color: var(--brass);
  border-bottom-color: var(--brass);
}

.nav-call {
  color: var(--needle) !important;
  border-bottom-color: currentColor !important;
}

/* ---------- section rhythm ---------- */

.section { padding-block: clamp(3.5rem, 7vw, 6rem); }
.section + .section { border-top: 1px solid var(--rule); }
.section-band { background: var(--plate-deep); }

.section-head { margin-bottom: clamp(2rem, 4vw, 3rem); }
.section-head .lede { margin-top: 0.9rem; }

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

.hero { padding-block: clamp(2.5rem, 5vw, 4rem) clamp(3rem, 6vw, 4.5rem); }

.hero-head { max-width: 46rem; }

.plate {
  margin: clamp(2rem, 4vw, 3rem) 0 0;
  border: 1px solid var(--rule-firm);
  background: var(--plate-lift);
  position: relative;
}

/* Drafting-sheet corner ticks. */
.plate::before,
.plate::after {
  content: '';
  position: absolute;
  width: 14px;
  height: 14px;
  border: 1px solid var(--rule-firm);
  pointer-events: none;
}
.plate::before { top: 7px; left: 7px; border-right: 0; border-bottom: 0; }
.plate::after  { bottom: 7px; right: 7px; border-left: 0; border-top: 0; }

.plate-title {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 1rem;
  flex-wrap: wrap;
  padding: 0.85rem clamp(1rem, 2.5vw, 1.6rem);
  border-bottom: 1px solid var(--rule);
  font-family: var(--mono);
  font-size: 0.68rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--patina);
}

.plate-figure {
  padding: clamp(0.75rem, 2vw, 1.5rem);
  overflow-x: auto;
}

.plate-figure svg { display: block; min-width: 620px; width: 100%; height: auto; }

/* schematic ink */
.pipe, .part {
  fill: none;
  stroke: var(--ink);
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.part-fill { fill: var(--plate); stroke: var(--ink); stroke-width: 2; }
.hairline { fill: none; stroke: var(--ink-soft); stroke-width: 1.25; stroke-dasharray: 5 4; }
.arrow { fill: none; stroke: var(--ink); stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.dot { fill: var(--ink); }
.label {
  font-family: var(--mono);
  font-size: 10px;
  letter-spacing: 0.14em;
  fill: var(--ink-soft);
  text-anchor: middle;
}
/* drafting note block */
.note-box { fill: none; stroke: var(--rule-firm); stroke-width: 1; }
.note-rule { stroke: var(--rule-firm); stroke-width: 1; }
.note-head {
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: 0.16em;
  fill: var(--ink);
}
.note-line { font-family: var(--mono); font-size: 11px; letter-spacing: 0.08em; fill: var(--ink-soft); }
.note-val  { font-family: var(--mono); font-size: 11px; letter-spacing: 0.08em; fill: var(--brass); text-anchor: end; }

.gauge-face { fill: var(--plate); stroke: var(--ink); stroke-width: 2.5; }
.gauge-tick { stroke: var(--ink); stroke-width: 1.75; stroke-linecap: round; }
.gauge-danger { fill: none; stroke: var(--needle); stroke-width: 5; stroke-linecap: butt; }
.gauge-needle-line { stroke: var(--needle); stroke-width: 3; stroke-linecap: round; }
.gauge-hub { fill: var(--needle); }

.node { cursor: pointer; }
.node .badge-ring { fill: var(--ink); stroke: none; transition: fill 160ms ease; }
.node .badge-num {
  font-family: var(--mono);
  font-size: 13px;
  font-weight: 500;
  fill: var(--plate-lift);
  text-anchor: middle;
  dominant-baseline: central;
}
.node .part, .node .pipe { transition: stroke 160ms ease; }
/* hover previews in the lighter brass; selection commits to the full brass,
   a heavier stroke and a brass label, so the two never read the same */
.node:hover .part { stroke: var(--brass-lift); }
.node:hover .badge-ring { fill: var(--brass-lift); }
.node[data-active='true'] .part { stroke: var(--brass); stroke-width: 2.75; }
.node[data-active='true'] .badge-ring { fill: var(--brass); }
.node[data-active='true'] .label { fill: var(--brass); }

/* load sequence */
.flow {
  stroke-dasharray: var(--len, 400);
  stroke-dashoffset: var(--len, 400);
  animation: draw 1400ms cubic-bezier(0.4, 0, 0.2, 1) forwards;
}
@keyframes draw { to { stroke-dashoffset: 0; } }

.gauge-needle {
  transform-origin: 720px 165px;
  transform: rotate(-120deg);
  animation: sweep 1700ms cubic-bezier(0.34, 1.16, 0.64, 1) 500ms forwards;
}
@keyframes sweep {
  0%   { transform: rotate(-120deg); }
  62%  { transform: rotate(38deg); }
  100% { transform: rotate(15deg); }
}

/* ---------- legend chips + detail ---------- */

.legend {
  display: flex;
  flex-wrap: wrap;
  gap: 0;
  border-top: 1px solid var(--rule);
  border-bottom: 1px solid var(--rule);
}

.chip {
  appearance: none;
  flex: 1 1 auto;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  background: transparent;
  border: 0;
  border-right: 1px solid var(--rule);
  padding: 0.7rem 0.85rem;
  font-family: var(--mono);
  font-size: 0.72rem;
  letter-spacing: 0.05em;
  color: var(--ink-soft);
  cursor: pointer;
  text-align: left;
  transition: background-color 140ms ease, color 140ms ease;
}
.chip:last-child { border-right: 0; }
.chip:hover { background: var(--plate-deep); color: var(--ink); }

.chip-num {
  display: inline-grid;
  place-items: center;
  width: 1.35rem;
  height: 1.35rem;
  flex: none;
  border-radius: 50%;
  background: var(--ink);
  color: var(--plate-lift);
  font-size: 0.7rem;
}

.chip[aria-pressed='true'] { background: var(--ink); color: var(--plate-lift); }
.chip[aria-pressed='true'] .chip-num { background: var(--brass-lift); color: var(--ink); }

.detail {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr) minmax(0, 1fr);
  gap: 0;
  padding: 0;
}

.detail-cell { padding: clamp(1.1rem, 2.4vw, 1.7rem); border-right: 1px solid var(--rule); }
.detail-cell:last-child { border-right: 0; }

.detail-key {
  font-family: var(--mono);
  font-size: 0.66rem;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--patina);
  margin: 0 0 0.55rem;
}

.detail-val { margin: 0; font-size: 1rem; line-height: 1.5; max-width: 42ch; }

.detail-head {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: clamp(0.9rem, 2vw, 1.2rem) clamp(1.1rem, 2.4vw, 1.7rem);
  border-bottom: 1px solid var(--rule);
}

.detail-badge {
  display: inline-grid;
  place-items: center;
  width: 1.6rem;
  height: 1.6rem;
  flex: none;
  border-radius: 50%;
  background: var(--brass);
  color: var(--plate-lift);
  font-family: var(--mono);
  font-size: 0.78rem;
}

.detail-name {
  font-family: var(--display);
  font-variation-settings: 'wdth' 112, 'wght' 640;
  font-size: 1.12rem;
  letter-spacing: -0.005em;
  margin: 0;
}

/* ---------- work order ---------- */

.workorder { border-top: 1px solid var(--rule-firm); }

.step {
  display: grid;
  grid-template-columns: 6.5rem minmax(0, 16rem) minmax(0, 1fr);
  gap: clamp(1rem, 3vw, 2.5rem);
  padding-block: 1.5rem;
  border-bottom: 1px solid var(--rule);
  align-items: baseline;
}

.step-code {
  font-family: var(--mono);
  font-size: 0.72rem;
  letter-spacing: 0.12em;
  color: var(--patina);
  font-variant-numeric: tabular-nums;
}

.step-name {
  font-family: var(--display);
  font-variation-settings: 'wdth' 115, 'wght' 640;
  font-size: 1.15rem;
}

.step-body { margin: 0; color: var(--ink-soft); }

/* ---------- brands ---------- */

/* No separators: a middot can't be kept off the start or end of a wrapped
   line without stranding it, and the names hold the rhythm on their own. */
.brands {
  display: flex;
  flex-wrap: wrap;
  column-gap: 1.15em;
  row-gap: 0.2em;
  font-family: var(--display);
  font-variation-settings: 'wdth' 108, 'wght' 560;
  font-size: clamp(1.15rem, 2.4vw, 1.75rem);
  line-height: 1.4;
  letter-spacing: -0.008em;
  margin: 0;
  max-width: none;
}
.brands span { white-space: nowrap; }

/* ---------- rate sheet ---------- */

.rates { width: 100%; border-collapse: collapse; margin-top: 1rem; }

.rates caption {
  text-align: left;
  font-family: var(--mono);
  font-size: 0.68rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--patina);
  padding-bottom: 0.9rem;
}

.rates th, .rates td {
  text-align: left;
  vertical-align: top;
  padding: 1.15rem 1.1rem 1.15rem 0;
  border-bottom: 1px solid var(--rule);
}

.rates thead th {
  font-family: var(--mono);
  font-weight: 400;
  font-size: 0.66rem;
  letter-spacing: 0.15em;
  text-transform: uppercase;
  color: var(--patina);
  padding-block: 0.5rem 0.7rem;
  border-bottom: 1px solid var(--rule-firm);
}

.rates tbody th {
  font-family: var(--display);
  font-variation-settings: 'wdth' 112, 'wght' 640;
  font-weight: 640;
  font-size: 1.02rem;
  width: 15rem;
  padding-right: 1.5rem;
}

.rates .col-time, .rates .col-price {
  font-family: var(--mono);
  font-size: 0.85rem;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}
.rates .col-time { color: var(--ink-soft); width: 9rem; }
.rates .col-price { color: var(--brass); width: 9rem; padding-right: 0; }
.rates td.col-desc { color: var(--ink-soft); font-size: 0.98rem; }

/* ---------- generic content blocks ---------- */

.cols {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 17rem), 1fr));
  gap: clamp(1.75rem, 4vw, 3rem);
}

.split {
  display: grid;
  grid-template-columns: minmax(0, 0.85fr) minmax(0, 1.15fr);
  gap: clamp(2rem, 6vw, 5rem);
  align-items: start;
}

.note {
  border-left: 2px solid var(--brass);
  padding: 0.2rem 0 0.2rem 1.4rem;
  color: var(--ink-soft);
}

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

.checklist li {
  padding: 0.85rem 0 0.85rem 2.4rem;
  border-bottom: 1px solid var(--rule);
  position: relative;
  color: var(--ink-soft);
  max-width: 60ch;
}

.checklist li::before {
  content: '';
  position: absolute;
  left: 0;
  top: 1.35rem;
  width: 12px;
  height: 12px;
  border: 1.5px solid var(--brass);
}

.spec { display: grid; gap: 0; margin: 0; }

.spec div {
  display: flex;
  justify-content: space-between;
  gap: 1.5rem;
  padding: 0.8rem 0;
  border-bottom: 1px solid var(--rule);
}

.spec dt {
  font-family: var(--mono);
  font-size: 0.72rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--patina);
}

.spec dd { margin: 0; text-align: right; font-size: 0.98rem; }

/* ---------- calls to action ---------- */

.actions { display: flex; flex-wrap: wrap; gap: 0.9rem; margin-top: 2rem; }

.btn {
  display: inline-flex;
  align-items: center;
  gap: 0.55rem;
  font-family: var(--mono);
  font-size: 0.78rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  text-decoration: none;
  padding: 0.8rem 1.35rem;
  border: 1px solid var(--ink);
  background: var(--ink);
  color: var(--plate);
  transition: background-color 150ms ease, color 150ms ease, border-color 150ms ease;
}
.btn:hover { background: var(--brass); border-color: var(--brass); color: var(--plate-lift); }

.btn-quiet { background: transparent; color: var(--ink); }
.btn-quiet:hover { background: var(--ink); border-color: var(--ink); color: var(--plate); }

.tel {
  font-family: var(--mono);
  font-variant-numeric: tabular-nums;
  color: var(--needle);
  text-decoration: none;
  border-bottom: 1px solid currentColor;
  white-space: nowrap;
}

.big-tel {
  font-family: var(--mono);
  font-size: clamp(1.5rem, 4vw, 2.3rem);
  color: var(--needle);
  text-decoration: none;
  letter-spacing: -0.01em;
  border-bottom: 2px solid currentColor;
  white-space: nowrap;
}

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

.footer {
  border-top: 1px solid var(--rule-firm);
  background: var(--plate-deep);
  padding-block: clamp(2.5rem, 5vw, 3.5rem);
  font-size: 0.95rem;
}

.footer-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 13rem), 1fr));
  gap: 2rem;
  align-items: start;
}

.footer h2 {
  font-size: 0.68rem;
  font-family: var(--mono);
  font-variation-settings: normal;
  font-weight: 400;
  letter-spacing: 0.15em;
  text-transform: uppercase;
  color: var(--patina);
  margin-bottom: 0.85rem;
}

.footer ul { list-style: none; margin: 0; padding: 0; }
.footer li { margin-bottom: 0.4rem; }
.footer a { text-decoration: none; border-bottom: 1px solid var(--rule); }
.footer a:hover { border-bottom-color: var(--brass); color: var(--brass); }

.colophon {
  margin-top: 2.5rem;
  padding-top: 1.25rem;
  border-top: 1px solid var(--rule);
  font-family: var(--mono);
  font-size: 0.68rem;
  letter-spacing: 0.08em;
  color: var(--patina);
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  flex-wrap: wrap;
}

/* ---------- responsive ---------- */

@media (max-width: 900px) {
  .detail { grid-template-columns: 1fr; }
  .detail-cell { border-right: 0; border-bottom: 1px solid var(--rule); }
  .detail-cell:last-child { border-bottom: 0; }
  .split { grid-template-columns: 1fr; }
  .step { grid-template-columns: 4.5rem 1fr; }
  .step-body { grid-column: 2; }
}

@media (max-width: 640px) {
  .chip { flex: 1 1 45%; border-bottom: 1px solid var(--rule); }
  .rates thead { position: absolute; left: -9999px; }
  .rates tr { display: block; padding-block: 1.25rem; border-bottom: 1px solid var(--rule); }
  .rates th, .rates td { display: block; border-bottom: 0; padding: 0 0 0.45rem; width: auto; }
  .rates tbody th { width: auto; padding-right: 0; }
  .rates .col-time::before { content: 'Turnaround — '; color: var(--patina); }
  .step { grid-template-columns: 1fr; gap: 0.4rem; }
  .step-body { grid-column: 1; }
  .colophon { flex-direction: column; gap: 0.4rem; }
}

@media (prefers-reduced-motion: reduce) {
  .flow { animation: none; stroke-dashoffset: 0; }
  .gauge-needle { animation: none; transform: rotate(15deg); }
  *, *::before, *::after {
    transition-duration: 0.01ms !important;
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
  }
}

@media print {
  body::before, .nav, .actions { display: none; }
  body { background: #fff; }
}
