:root {
  color-scheme: light;
  --shell: #f8f6f0;
  --ink: #24211d;
  --muted: #59534c;
  --serif: "Iowan Old Style", "Palatino Linotype", Georgia, serif;
  --sans: -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  --mono: "SFMono-Regular", Consolas, "Liberation Mono", monospace;
  --measure: 76rem;
  --gutter: clamp(1rem, 4vw, 3rem);
  font-family: var(--sans);
  background: var(--shell);
  color: var(--ink);
}

* { box-sizing: border-box; }
body { margin: 0; }
body,
.product-card {
  --paper: color-mix(in srgb, var(--accent) 5%, var(--shell));
  --surface: color-mix(in srgb, var(--accent) 9%, #fffdf9);
  --wash: color-mix(in srgb, var(--accent) 16%, #fffdf9);
  --line: color-mix(in srgb, var(--accent) 26%, #e0d8cb);
  --accent-ink: color-mix(in srgb, var(--accent) 65%, #20140e);
  --deep: color-mix(in srgb, var(--accent) 43%, #211916);
}
body { background: var(--paper); }
a { color: inherit; text-underline-offset: .23em; }
a:focus-visible { outline: 2px solid currentColor; outline-offset: 4px; }
h1, h2, p, figure, ol, dl, dd { margin: 0; }
img { width: 100%; height: auto; display: block; }
.skip { position: absolute; inset-inline-start: 1rem; top: -5rem; padding: .75rem; background: var(--paper); }
.skip:focus { top: .5rem; z-index: 2; }

.site-header, footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
  padding: .95rem max(var(--gutter), calc((100% - var(--measure)) / 2));
  font-size: .875rem;
}
.site-header { background: #fffcf6; border-bottom: 1px solid var(--line); }
.brand { font-family: var(--mono); font-weight: 750; letter-spacing: .09em; text-decoration: none; }
.site-header a:last-child { color: var(--accent-ink); font-weight: 650; }
footer { border-top: 1px solid var(--line); color: var(--muted); background: var(--surface); }
.hero, .reader, .directory { max-width: var(--measure); width: calc(100% - var(--gutter) * 2); margin-inline: auto; }

h1, .chapter h2 {
  font-family: var(--serif);
  font-weight: 650;
  line-height: 1.04;
  letter-spacing: -.048em;
  text-wrap: balance;
}
.hero-band {
  color: #fff8ed;
  background: linear-gradient(112deg, var(--deep), color-mix(in srgb, var(--accent) 69%, #281918));
  border-bottom: 3px solid var(--accent);
}
.hero {
  display: grid;
  grid-template-columns: minmax(0, 5fr) minmax(0, 7fr);
  gap: clamp(1.5rem, 5vw, 4rem);
  align-items: center;
  padding-block: clamp(1.75rem, 5vw, 3.75rem);
}
.hero h1 { font-size: clamp(2.65rem, 6vw, 5.75rem); }
.instrument {
  font: 650 .73rem/1.45 var(--mono);
  letter-spacing: .085em;
  text-transform: uppercase;
  color: #ffebd5;
  margin-bottom: .8rem;
}
.intro { margin-top: 1rem; color: #fff2e5; font-size: clamp(1.07rem, 1.6vw, 1.27rem); line-height: 1.55; max-width: 34ch; }
.shortcuts { display: flex; align-items: center; gap: .8rem 1.2rem; flex-wrap: wrap; margin-top: 1.4rem; font-size: .9rem; font-weight: 680; }
.button, .store-link { display: inline-flex; align-items: center; gap: .35em; min-height: 2.75rem; }
.button { padding: .55rem .85rem; background: #fff8ed; color: var(--deep); border-radius: 4px; text-decoration: none; }
.button:hover { background: #fff; }
.button:focus-visible { outline-color: #fff8ed; }
.store-link { color: #fff8ed; }
.cover a { display: grid; justify-items: end; gap: .45rem; text-decoration: none; }
.case-image {
  display: block;
  width: 100%;
  filter: drop-shadow(0 .6rem .8rem #20140e49);
}
.case-image img {
  /* Match the physical corner radius of the photographed faceplate. */
  clip-path: inset(.06% .06% round 1.53% / 2.17%);
}
[data-product="plicata"] .case-image img { clip-path: inset(.06% .06% round 1.72% / 2.44%); }
.cover-zoom { padding: .35rem .05rem .35rem .6rem; color: #fff8ed; font-size: .8rem; font-weight: 650; }
.cover-zoom span { margin-inline-start: .25rem; }
.cover a:hover .cover-zoom, .cover a:focus-visible .cover-zoom { text-decoration: underline; }
.illustration a { display: block; position: relative; }
.illustration img { border-radius: .28rem; }
.expand {
  position: absolute;
  inset-inline-end: .5rem;
  inset-block-end: .5rem;
  display: grid;
  place-items: center;
  width: 2rem;
  height: 2rem;
  border-radius: .3rem;
  background: var(--deep);
  color: #fff8ed;
}
.illustration a:hover .expand { background: var(--accent-ink); }
.reader {
  display: grid;
  grid-template-columns: minmax(0, 14rem) minmax(0, 1fr);
  gap: clamp(1.25rem, 4vw, 4rem);
  align-items: start;
  padding-block: clamp(1.4rem, 4vw, 3rem) 3rem;
}
.toc { position: sticky; top: 1.25rem; }
.toc-inner {
  padding: .55rem;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: .65rem;
}
.toc p {
  display: flex;
  align-items: center;
  gap: .75rem;
  margin: .35rem .5rem .7rem;
  color: var(--deep);
  font: 660 1.18rem/1.2 var(--serif);
}
.toc p::after { content: ""; height: 1px; flex: 1; background: var(--line); }
.toc ol { padding: 0; display: grid; gap: .3rem; list-style: none; }
.toc a {
  display: grid;
  grid-template-columns: 2ch minmax(0, 1fr);
  align-items: center;
  gap: .6rem;
  min-height: 2.8rem;
  height: 100%;
  padding: .48rem .55rem;
  color: var(--ink);
  border: 1px solid transparent;
  border-radius: .32rem;
  font-size: .91rem;
  line-height: 1.3;
  font-weight: 580;
  text-decoration: none;
}
.chapter-number {
  color: var(--accent-ink);
  font: 660 .73rem/1.4 var(--mono);
  font-variant-numeric: tabular-nums;
}
.toc a:hover, .toc a:focus-visible { background: #fffdf9; color: var(--accent-ink); }
.toc a[aria-current="location"] {
  background: var(--wash);
  border-color: var(--line);
  box-shadow: inset .16rem 0 var(--accent-ink);
  color: var(--deep);
  font-weight: 720;
}
.chapter {
  border-top: 1px solid var(--line);
  padding-block: clamp(1.6rem, 5vw, 3rem);
  scroll-margin-top: 1.25rem;
}
.chapter:first-child { border-top: 0; padding-top: 0; }
.chapter:last-child { padding-bottom: 0; }
.chapter h2 {
  display: flex;
  align-items: baseline;
  gap: .65rem;
  margin-bottom: 1.3rem;
  font-size: clamp(1.8rem, 3.6vw, 3rem);
  color: var(--deep);
}
.chapter h2 .chapter-number { letter-spacing: 0; flex: 0 0 auto; }
.chapter:target h2 { color: var(--accent-ink); }
.steps {
  padding: 0;
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: .8rem;
  counter-reset: procedure;
  list-style: none;
}
.steps li {
  padding: 1rem;
  background: #fffdf9;
  border: 1px solid var(--line);
  border-radius: .42rem;
  counter-increment: procedure;
}
.steps li::before {
  content: counter(procedure);
  display: grid;
  width: 1.65rem;
  height: 1.65rem;
  place-items: center;
  border-radius: 50%;
  background: var(--wash);
  color: var(--accent-ink);
  font: 750 .78rem/1 var(--mono);
  margin-bottom: .7rem;
}
.steps strong { font-size: 1.03rem; }
.steps p, .reference dd { color: var(--muted); font-size: 1rem; line-height: 1.6; }
.steps p { margin-top: .4rem; }
.steps b { color: var(--accent-ink); }
.signal {
  display: flex;
  flex-wrap: wrap;
  gap: .5rem 1.6rem;
  list-style: none;
  padding: .75rem;
  margin-bottom: 1.15rem;
  background: var(--wash);
  border: 1px solid var(--line);
  border-radius: .38rem;
}
.signal li {
  position: relative;
  padding: .5rem .65rem;
  background: #fffdf8;
  border: 1px solid var(--line);
  border-radius: .25rem;
  font: 650 .8rem/1.35 var(--mono);
  color: var(--accent-ink);
}
.signal li:not(:last-child)::after { content: "→"; position: absolute; inset-inline-end: -1.2rem; top: .48rem; }
.illustration { margin-bottom: 1.2rem; background: var(--surface); border: 1px solid var(--line); border-radius: .48rem; }
.illustration a { padding: .5rem; }
.illustration .expand { inset-inline-end: .95rem; inset-block-end: .95rem; }
.illustration figcaption { padding: .65rem .85rem; border-top: 1px solid var(--line); color: var(--muted); font-size: .87rem; line-height: 1.5; }
.reference {
  background: #fffdf9;
  border: 1px solid var(--line);
  border-radius: .42rem;
}
.reference > div {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 2.3fr);
  align-items: baseline;
  gap: .3rem 1rem;
  padding: .85rem 1rem;
}
.reference > div + div { border-top: 1px solid var(--line); }
.reference dt { font: 720 .79rem/1.52 var(--mono); color: var(--accent-ink); }
.reference dd { max-width: 65ch; }

.directory { padding-block: clamp(2.75rem, 8vw, 6.25rem); }
.directory h1 { color: var(--deep); font-size: clamp(2.8rem, 6vw, 5.65rem); }
.product-grid { margin-top: clamp(1.6rem, 4vw, 2.75rem); display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: clamp(.8rem, 2.5vw, 1.45rem); }
.product-card {
  display: block;
  background: #fffdf9;
  border: 1px solid var(--line);
  border-top: .25rem solid var(--accent);
  border-radius: .52rem;
  overflow: hidden;
  text-decoration: none;
}
.product-card:hover { border-color: var(--accent); }
.card-image { background: var(--wash); padding: clamp(.65rem, 2vw, 1rem); }
.card-image .case-image { filter: drop-shadow(0 .2rem .3rem #20140e33); }
.card-caption { display: flex; justify-content: space-between; align-items: center; gap: .5rem; padding: 1rem; border-top: 1px solid var(--line); }
.card-caption h2 { color: var(--deep); font: 700 clamp(1.4rem, 2.45vw, 2rem)/1.12 var(--serif); letter-spacing: -.035em; }
.card-caption p { margin-top: .32rem; color: var(--muted); font-size: .91rem; }
.card-caption span { color: var(--accent-ink); font-size: 1.2rem; }

/* Tablet gives chapters their own band, keeping tables and screenshots full width. */
@media (max-width: 68.75rem) {
  .reader { grid-template-columns: minmax(0, 1fr); gap: clamp(1.35rem, 4vw, 2.5rem); }
  .toc { position: static; }
  .toc ol { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .toc a:not([aria-current]) { background: #fffdf9; }
  .toc a:hover, .toc a:focus-visible { border-color: var(--line); }
  .hero { gap: clamp(1.25rem, 4vw, 2rem); }
}
@media (max-width: 56.25rem) {
  .product-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 41.25rem) {
  .hero, .steps, .reference > div { grid-template-columns: minmax(0, 1fr); }
  .hero { padding-block: 1.6rem .75rem; }
  .hero h1 { font-size: clamp(2.45rem, 10vw, 3.6rem); }
  .cover-zoom { padding-block: .5rem; }
  .toc ol { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .toc a { min-height: 3rem; font-size: .86rem; }
  .steps li { display: grid; grid-template-columns: 1.65rem minmax(0, 1fr); column-gap: .65rem; align-items: center; }
  .steps li::before { margin: 0; }
  .steps p { grid-column: 2; margin-top: .25rem; }
}
@media (max-width: 35rem) {
  .product-grid { grid-template-columns: minmax(0, 1fr); }
  .site-header, footer { gap: .55rem; }
  .signal { flex-direction: column; gap: 1rem; }
  .signal li { text-align: center; }
  .signal li:not(:last-child)::after { content: "↓"; inset-inline-end: 0; width: 100%; top: 100%; }
}
@media print {
  .site-header, .shortcuts, .toc, footer, .expand, .cover-zoom { display: none; }
  .reader, .hero { display: block; }
  .hero-band, .hero-band p { color: var(--ink); background: white; }
  .cover { max-width: 65%; margin-top: 1rem; }
  .case-image { filter: none; }
  figure, .steps li, .reference > div { break-inside: avoid; }
}

.footer-links { display:flex; flex-wrap:wrap; align-items:center; gap:.5rem 1rem; }
