/* Tamsvale: a card catalogue. Each section is an index card with a tab,
   the page is the pile, and the next card always lies over the last one. */

:root {
  --bg: #DCEFE8;
  --card: #F6FBF9;
  --ink: #0E3534;
  --muted: #3F6462;
  --line: #B9D8CE;
  --accent: #C8321E;
  --on-accent: #FFFFFF;
  --shade: rgba(14, 53, 52, .3);

  --display: "Urbanist", "Segoe UI", system-ui, sans-serif;
  --text: "DM Sans", "Segoe UI", system-ui, sans-serif;

  --r: 14px;
  --rule: 28px;
  --wrap: 1240px;
  --gutter: clamp(16px, 3vw, 40px);
  --pad: clamp(20px, 4.4vw, 56px);
  --overlap: clamp(18px, 3vw, 38px);
  --tabh: 40px;
  --head: 66px;
  --inset: clamp(3px, .8vw, 10px);
  --settle: cubic-bezier(.18, .84, .24, 1);
}

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

html {
  -webkit-text-size-adjust: 100%;
  scroll-padding-top: calc(var(--head) + var(--tabh) + 16px);
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font: 400 1.0625rem/1.55 var(--text);
  -webkit-font-smoothing: antialiased;
}

h1, h2, h3, h4, p, ol, ul, dl, dd, figure { margin: 0; }
ol, ul { padding: 0; list-style: none; }
img, svg { display: block; max-width: 100%; }
a { color: inherit; }

h1, h2, h3, h4 {
  font-family: var(--display);
  overflow-wrap: break-word;
  text-wrap: balance;
}

h1 {
  font-size: clamp(2.6rem, 6vw, 5.4rem);
  font-weight: 800;
  line-height: .98;
  letter-spacing: -.028em;
}

h2 {
  font-size: clamp(1.95rem, 3.7vw, 3.25rem);
  font-weight: 800;
  line-height: 1.05;
  letter-spacing: -.02em;
}

h3 {
  font-size: clamp(1.2rem, 1.7vw, 1.45rem);
  font-weight: 700;
  line-height: 1.2;
  letter-spacing: -.008em;
}

h4 {
  font-size: 1.16rem;
  font-weight: 700;
  line-height: 1.22;
}

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

.skip {
  position: absolute;
  top: 8px;
  left: var(--gutter);
  z-index: 200;
  padding: 10px 16px;
  border-radius: var(--r);
  background: var(--ink);
  color: var(--card);
  transform: translateY(-200%);
}
.skip:focus { transform: none; }


/* Rail: the tab row along the top of the drawer */

.railhead {
  position: sticky;
  top: 0;
  z-index: 100;
  background: var(--bg);
  border-bottom: 1px solid var(--muted);
}

.railhead-in {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 20px;
  max-width: var(--wrap);
  min-height: var(--head);
  margin-inline: auto;
  padding-inline: var(--gutter);
}

.plate {
  display: inline-flex;
  flex: none;
  align-items: center;
  align-self: center;
  gap: 9px;
  padding: 6px 15px 6px 10px;
  border: 1px solid var(--muted);
  border-radius: var(--r);
  background: var(--card);
  color: var(--ink);
  font: 800 1.28rem/1.2 var(--display);
  letter-spacing: -.012em;
  text-decoration: none;
}
.plate-mark { width: 22px; height: 20px; }

.tabrow {
  display: flex;
  align-items: flex-end;
  gap: 3px;
  margin-bottom: -1px;
}

.tabrow a {
  display: flex;
  align-items: baseline;
  gap: 6px;
  padding: 8px 12px 7px;
  border: 1px solid var(--muted);
  border-radius: var(--r) var(--r) 0 0;
  background: transparent;
  color: var(--muted);
  font: 600 .93rem/1.2 var(--display);
  text-decoration: none;
  white-space: nowrap;
  transition: padding-bottom .24s var(--settle), background-color .2s, color .2s;
}
.tabrow a i {
  color: var(--muted);
  font: 500 .75rem/1 var(--text);
  font-style: normal;
}
.tabrow a:hover {
  padding-bottom: 14px;
  background: var(--card);
  color: var(--ink);
}
.tabrow a[aria-current] {
  padding-bottom: 14px;
  border-bottom-color: var(--card);
  background: var(--card);
  box-shadow: inset 0 3px 0 var(--accent);
  color: var(--ink);
}
.tabrow a.is-flag,
.tabrow a.is-flag[aria-current] {
  border-color: var(--accent);
  background: var(--accent);
  box-shadow: none;
  color: var(--on-accent);
}
.tabrow a.is-flag i { color: var(--on-accent); }
.tabrow a.is-flag:hover {
  border-color: var(--ink);
  background: var(--ink);
  color: var(--on-accent);
}

.burger {
  display: none;
  align-items: center;
  align-self: center;
  gap: 10px;
  min-height: 44px;
  padding: 0 14px;
  border: 1px solid var(--muted);
  border-radius: var(--r);
  background: var(--card);
  color: var(--ink);
  font: 700 1rem/1 var(--display);
  cursor: pointer;
}
.burger-bars { display: grid; gap: 4px; width: 18px; }
.burger-bars i {
  display: block;
  height: 2px;
  background: var(--ink);
  transition: transform .22s var(--settle), opacity .15s;
}
.burger[aria-expanded="true"] .burger-bars i:nth-child(1) { transform: translateY(6px) rotate(45deg); }
.burger[aria-expanded="true"] .burger-bars i:nth-child(2) { opacity: 0; }
.burger[aria-expanded="true"] .burger-bars i:nth-child(3) { transform: translateY(-6px) rotate(-45deg); }


/* The pile */

.pile {
  max-width: var(--wrap);
  margin-inline: auto;
  padding: calc(var(--tabh) + 26px) var(--gutter) var(--gutter);
}

.slip {
  position: relative;
  z-index: var(--n, 1);
  margin-top: calc(var(--overlap) * -1);
  padding: var(--pad);
  padding-bottom: calc(var(--pad) + var(--overlap) + var(--tabh));
  border: 1px solid var(--line);
  border-radius: var(--r);
  background: var(--card);
  box-shadow: 0 -12px 26px -18px var(--shade);
}
main > .slip:first-child { margin-top: 0; }
main > .slip:nth-of-type(even) { margin-inline: var(--inset); }

#front { --n: 1; --s: .03; }
#formats { --n: 2; --s: .22; }
#factory { --n: 3; --s: .44; }
#order { --n: 4; --s: .97; }
#playbooks { --n: 5; --s: .66; }
#services { --n: 6; --s: .1; }
#method { --n: 7; --s: .34; }
#extras { --n: 8; --s: .58; }
#about { --n: 9; --s: .82; }
#stack { --n: 10; --s: .03; }
#questions { --n: 11; --s: .27; }
#contact { --n: 12; --s: .76; }
#back { --n: 13; --s: .48; }

/* The tab. Its left and its shift share one fraction, so it stays on the
   card's straight top edge whatever its width and whatever the screen. */
.tag {
  position: absolute;
  bottom: 100%;
  left: calc(var(--r) + var(--s) * (100% - 2 * var(--r)));
  display: flex;
  align-items: baseline;
  gap: .55em;
  max-width: calc(100% - 2 * var(--r));
  min-height: var(--tabh);
  padding: 11px 18px 8px;
  overflow: hidden;
  border: 1px solid var(--line);
  border-bottom: 0;
  border-radius: var(--r) var(--r) 0 0;
  background: var(--card);
  font: 600 .95rem/1.2 var(--display);
  white-space: nowrap;
  transform: translateX(calc(var(--s) * -100%));
  transition: padding-bottom .3s var(--settle);
}
.tag b { color: var(--accent); font-weight: 800; }

.slip--flag { border-top: 2px solid var(--accent); }
.slip--flag > .tag {
  border-color: var(--accent);
  background: var(--accent);
  color: var(--on-accent);
}
.slip--flag > .tag b { color: var(--on-accent); }

.subject {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 2px 20px;
  margin-bottom: clamp(22px, 3vw, 38px);
  padding-bottom: 10px;
  border-bottom: 2px solid var(--accent);
  color: var(--muted);
  font-size: .875rem;
  font-weight: 500;
  line-height: 1.35;
}

/* Lined paper: type sits on the rule, descenders cross it. */
.ruled {
  background-image: linear-gradient(to bottom, transparent calc(var(--rule) - 1px), var(--line) calc(var(--rule) - 1px));
  background-position: 0 -6px;
  background-size: 100% var(--rule);
  line-height: var(--rule);
}

.intro { color: var(--muted); }

.headrow {
  display: grid;
  grid-template-columns: minmax(0, 7fr) minmax(0, 5fr);
  align-items: end;
  gap: 16px clamp(24px, 4vw, 56px);
  margin-bottom: clamp(26px, 3.6vw, 44px);
}
.headrow--wide { align-items: start; }

.solo-h {
  max-width: 21em;
  margin-bottom: clamp(24px, 3.4vw, 40px);
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 50px;
  padding: 12px 22px;
  border: 1.5px solid transparent;
  border-radius: var(--r);
  font: 700 1.02rem/1.2 var(--display);
  text-decoration: none;
  white-space: nowrap;
  cursor: pointer;
  transition: background-color .2s, border-color .2s, color .2s, transform .24s var(--settle);
}
.btn:hover { transform: translateY(-3px); }
.btn--solid { background: var(--accent); color: var(--on-accent); }
.btn--solid:hover { background: var(--ink); color: var(--on-accent); }
.btn--plain { border-color: var(--ink); background: transparent; color: var(--ink); }
.btn--plain:hover { background: var(--ink); color: var(--card); }
.btn--full { width: 100%; }
.btn[disabled] { opacity: .7; cursor: progress; transform: none; }

.link {
  color: var(--ink);
  font-weight: 500;
  text-decoration: underline;
  text-decoration-color: var(--accent);
  text-decoration-thickness: 2px;
  text-underline-offset: 3px;
  transition: color .18s;
}
.link:hover { color: var(--accent); }

/* Small tab used inside a card */
.nib {
  position: absolute;
  bottom: 100%;
  left: calc(var(--r) + var(--s, 0) * (100% - 2 * var(--r)));
  display: flex;
  align-items: baseline;
  gap: .45em;
  max-width: calc(100% - 2 * var(--r));
  padding: 5px 12px 3px;
  overflow: hidden;
  border: 1px solid var(--line);
  border-bottom: 0;
  border-radius: var(--r) var(--r) 0 0;
  background: var(--nib, var(--bg));
  color: var(--ink);
  font: 600 .84rem/1.25 var(--display);
  white-space: nowrap;
  transform: translateX(calc(var(--s, 0) * -100%));
  transition: padding-bottom .26s var(--settle);
}
.nib b { font-weight: 800; }

@media (hover: hover) {
  .slip:hover > .tag, .tag:hover { padding-bottom: 16px; }
  .spec:hover > .nib,
  .panel:hover > .nib,
  .cycle > li:hover > .nib,
  .extra:hover > .nib { padding-bottom: 9px; }
}


/* Card 01 */

.front-grid {
  display: grid;
  grid-template-columns: minmax(0, 7fr) minmax(0, 5fr);
  gap: clamp(28px, 4vw, 56px);
}
.front-lede {
  max-width: 35em;
  margin-top: clamp(20px, 2.6vw, 30px);
  font-size: 1.08rem;
}
.actions {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin-top: clamp(24px, 3vw, 34px);
}

.cabinet {
  --ch: 468px;
  --top: 42px;
  --face: 132px;
  position: relative;
  min-height: var(--ch);
}
.divider {
  position: absolute;
  top: calc(var(--top) + var(--i) * (100% - var(--face) - var(--top) - 20px) / 5);
  right: calc((5 - var(--i)) * 4px);
  bottom: 40px;
  left: calc((5 - var(--i)) * 4px);
  border: 1px solid var(--line);
  border-radius: var(--r);
  background: var(--bg);
  box-shadow: 0 -8px 16px -13px var(--shade);
  color: var(--ink);
  text-decoration: none;
  transition: transform .3s var(--settle);
}
.divider:nth-child(even) { background: var(--card); }
.divider span {
  position: absolute;
  bottom: 100%;
  left: calc(var(--r) + var(--s) * (100% - 2 * var(--r)));
  padding: 6px 14px 3px;
  border: 1px solid var(--line);
  border-bottom: 0;
  border-radius: var(--r) var(--r) 0 0;
  background: inherit;
  font: 700 .95rem/1.25 var(--display);
  white-space: nowrap;
  transform: translateX(calc(var(--s) * -100%));
}
.divider:hover { transform: translateY(-11px); }
.divider.divider--flag { border-color: var(--accent); background: var(--accent); color: var(--on-accent); }
.divider--flag span { border-color: var(--accent); }

.cabinet-face {
  position: absolute;
  right: 0;
  bottom: 0;
  left: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 12px;
  height: var(--face);
  border-radius: var(--r);
  background: var(--ink);
  box-shadow: 0 -10px 20px -14px var(--shade);
}
.holder {
  display: flex;
  flex-direction: column;
  align-items: center;
  min-width: 56%;
  padding: 5px 18px 6px;
  border: 2px solid var(--line);
  border-radius: var(--r);
  background: var(--card);
  color: var(--ink);
  text-align: center;
}
.holder b { font: 800 1.14rem/1.2 var(--display); }
.holder small { color: var(--muted); font-size: .78rem; font-weight: 500; line-height: 1.2; }
.pull {
  width: 84px;
  height: 14px;
  border: 3px solid var(--line);
  border-top: 0;
  border-radius: 0 0 var(--r) var(--r);
}

.tally {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  margin-top: clamp(30px, 4vw, 46px);
  border-top: 1px solid var(--line);
}
.tally > div {
  padding: 14px clamp(14px, 2.2vw, 28px) 0;
  border-left: 1px solid var(--line);
}
.tally > div:first-child { padding-left: 0; border-left: 0; }
.tally dt { color: var(--muted); font-size: .875rem; }
.tally dd { color: var(--muted); }
.tally strong {
  display: block;
  color: var(--ink);
  font: 800 clamp(2rem, 3.7vw, 3.3rem)/1.08 var(--display);
  letter-spacing: -.02em;
}


/* Card 02: specimens */

.specimens { display: flex; flex-direction: column; gap: 34px; }
.rowline {
  display: flex;
  align-items: flex-start;
  gap: clamp(14px, 2.1vw, 26px);
}
.spec { position: relative; min-width: 0; margin-top: 28px; }
.spec--v { flex: .5625 1 0; }
.spec--p { flex: .8 1 0; }
.spec--q { flex: 1 1 0; }
.ad {
  width: 100%;
  height: auto;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: var(--r);
}
.spec figcaption { padding-top: 12px; color: var(--muted); font-size: .95rem; line-height: 1.4; }
.spec figcaption strong {
  display: block;
  margin-bottom: 2px;
  color: var(--ink);
  font: 700 1.14rem/1.25 var(--display);
}

.k-ink { fill: var(--ink); }
.k-card { fill: var(--card); }
.k-bg { fill: var(--bg); }
.k-line { fill: var(--line); }
.k-mute { fill: var(--muted); }
.k-acc { fill: var(--accent); }
.k-white { fill: var(--on-accent); }
.ks-line, .ks-mute, .ks-acc, .ks-ink, .ks-ink2, .ks-acc2, .ks-white, .ks-white1 {
  fill: none;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.ks-line { stroke: var(--line); stroke-width: 1.5; }
.ks-mute { stroke: var(--muted); stroke-width: 1.5; }
.ks-acc { stroke: var(--accent); stroke-width: 2; }
.ks-ink { stroke: var(--ink); stroke-width: 3; }
.ks-ink2 { stroke: var(--ink); stroke-width: 2.5; }
.ks-acc2 { stroke: var(--accent); stroke-width: 36; }
.ks-white { stroke: var(--on-accent); stroke-width: 3; }
.ks-white1 { stroke: var(--on-accent); stroke-width: 2; }
.ax { font-family: var(--display); font-weight: 800; letter-spacing: -.01em; }
.at { font-family: var(--text); font-weight: 500; }


/* Card 03: spec sheet and routing slip */

.factory-body {
  display: grid;
  grid-template-columns: minmax(0, 5fr) minmax(0, 7fr);
  gap: clamp(26px, 4vw, 52px);
  align-items: start;
}
.sheet {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  border: 1px solid var(--line);
  border-radius: var(--r);
  background: var(--bg);
}
.sheet > div { padding: 16px clamp(14px, 1.8vw, 22px) 20px; }
.sheet-b, .sheet-d { border-left: 1px solid var(--line); }
.sheet-c, .sheet-d { border-top: 1px solid var(--line); }
.sheet dt { color: var(--muted); font-size: .875rem; }
.sheet dd { color: var(--ink); font-size: .95rem; line-height: 1.42; }
.sheet strong {
  display: block;
  margin-block: 2px 6px;
  font: 800 clamp(1.5rem, 2.5vw, 2.15rem)/1.1 var(--display);
  letter-spacing: -.015em;
}

.routing-wrap h3 { margin-bottom: 10px; }
.routing { border-top: 2px solid var(--ink); }
.routing li {
  display: grid;
  grid-template-columns: 34px minmax(0, 11em) minmax(0, 1fr);
  align-items: baseline;
  gap: 2px 12px;
  padding-block: 11px;
  border-bottom: 1px solid var(--line);
  line-height: 1.4;
}
.routing-no { color: var(--accent); font: 800 .95rem/1.4 var(--display); }
.routing strong { font: 700 1.06rem/1.3 var(--display); }
.routing li > span:last-child { color: var(--muted); font-size: .98rem; }
.routing-foot {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 16px 24px;
  margin-top: 22px;
}
.stamp {
  padding: 8px 14px;
  border: 2px solid var(--accent);
  border-radius: var(--r);
  color: var(--accent);
  font: 700 .96rem/1.25 var(--display);
  transform: rotate(-1.6deg);
}


/* Card 04: order card */

.order {
  display: grid;
  grid-template-columns: minmax(0, 1.55fr) minmax(0, 1fr);
  gap: clamp(24px, 3.4vw, 44px);
}
.order h2 { margin-bottom: 14px; }
.order-lines {
  margin-top: 22px;
  border-top: 2px solid var(--ink);
}
.order-lines > div {
  display: grid;
  grid-template-columns: 7em minmax(0, 1fr);
  gap: 12px;
  padding-block: 8px;
  border-bottom: 1px solid var(--line);
}
.order-lines dt { color: var(--muted); }
.order-lines dd { font-weight: 500; }

.qtybox { margin-top: 26px; }
.qty-label {
  display: block;
  margin-bottom: 4px;
  font: 700 1.14rem/1.3 var(--display);
}
.qty {
  --t: .33333;
  --fill: calc(15px + (100% - 30px) * var(--t));
  display: block;
  width: 100%;
  height: 46px;
  margin: 0;
  background: transparent;
  cursor: grab;
  -webkit-appearance: none;
  appearance: none;
}
.qty:active { cursor: grabbing; }
.qty:focus { outline: none; }
.qty::-webkit-slider-runnable-track {
  height: 14px;
  border-radius: var(--r);
  background: linear-gradient(to right, var(--accent) var(--fill), var(--line) var(--fill));
}
.qty::-webkit-slider-thumb {
  box-sizing: border-box;
  width: 30px;
  height: 40px;
  margin-top: -13px;
  border: 2px solid var(--card);
  border-radius: var(--r) var(--r) 0 0;
  background: linear-gradient(var(--on-accent), var(--on-accent)) center / 2px 14px no-repeat, var(--accent);
  box-shadow: 0 2px 6px var(--shade);
  -webkit-appearance: none;
  appearance: none;
}
.qty::-moz-range-track { height: 14px; border-radius: var(--r); background: var(--line); }
.qty::-moz-range-progress { height: 14px; border-radius: var(--r); background: var(--accent); }
.qty::-moz-range-thumb {
  box-sizing: border-box;
  width: 30px;
  height: 40px;
  border: 2px solid var(--card);
  border-radius: var(--r) var(--r) 0 0;
  background: linear-gradient(var(--on-accent), var(--on-accent)) center / 2px 14px no-repeat, var(--accent);
  box-shadow: 0 2px 6px var(--shade);
}
.qty:focus-visible::-webkit-slider-thumb { outline: 3px solid var(--ink); outline-offset: 2px; }
.qty:focus-visible::-moz-range-thumb { outline: 3px solid var(--ink); outline-offset: 2px; }

.scale {
  display: flex;
  justify-content: space-between;
  padding-inline: 15px;
  color: var(--muted);
  font-size: .84rem;
  font-variant-numeric: tabular-nums;
}
.scale span {
  display: flex;
  flex-direction: column;
  align-items: center;
  width: 0;
}
.scale span::before {
  content: "";
  flex: none;
  width: 1px;
  height: 8px;
  margin-bottom: 3px;
  background: var(--muted);
}

.order-stub {
  position: relative;
  display: flex;
  flex-direction: column;
  padding: 46px clamp(18px, 2.2vw, 28px) clamp(20px, 2.2vw, 28px);
  border: 1.5px dashed var(--muted);
  border-radius: var(--r);
  background: var(--bg);
}
.punch {
  position: absolute;
  top: 14px;
  left: 50%;
  width: 20px;
  height: 20px;
  margin-left: -10px;
  border: 1px solid var(--muted);
  border-radius: 50%;
  background: var(--card);
}
.stub-title { font: 700 1.14rem/1.3 var(--display); }
.stub-sum { margin-top: 12px; border-top: 2px solid var(--ink); }
.stub-sum > div { padding-block: 10px; border-bottom: 1px solid var(--muted); }
.stub-sum dt { color: var(--muted); font-size: .875rem; }
.stub-sum dd { font-weight: 500; }
#planCount {
  font: 800 clamp(1.9rem, 3vw, 2.6rem)/1.1 var(--display);
  letter-spacing: -.015em;
  font-variant-numeric: tabular-nums;
}
#planTotal {
  font: 800 clamp(1.9rem, 3vw, 2.6rem)/1.1 var(--display);
  letter-spacing: -.015em;
  font-variant-numeric: tabular-nums;
}
.stub-note {
  margin-block: 12px 18px;
  color: var(--muted);
  font-size: .92rem;
  line-height: 1.42;
}
.order-stub .btn { margin-top: auto; }


/* Card 05: ledger */

.ledger { border-top: 2px solid var(--ink); }
.ledger-row {
  display: grid;
  grid-template-columns: minmax(0, 3.1fr) minmax(0, 4.6fr) minmax(0, 2.2fr) minmax(0, 2fr);
  align-items: start;
  gap: 10px clamp(18px, 2.4vw, 30px);
  padding-block: clamp(16px, 2vw, 24px);
  border-bottom: 1px solid var(--line);
}
.ledger-note { color: var(--muted); font-size: .98rem; line-height: 1.45; }
.ledger-chan { margin-bottom: 3px; color: var(--ink); font-weight: 500; }
.ledger-fig span { display: block; color: var(--muted); font-size: .84rem; }
.ledger-fig strong {
  display: block;
  color: var(--accent);
  font: 800 clamp(1.3rem, 1.9vw, 1.6rem)/1.15 var(--display);
  letter-spacing: -.01em;
}
.ledger-row .link { justify-self: end; text-align: right; font-size: .97rem; line-height: 1.4; }


/* Card 06: three drawers, unequal on purpose */

.drawers {
  display: grid;
  grid-template-columns: minmax(0, 7fr) minmax(0, 6fr);
  gap: 48px clamp(18px, 2.4vw, 30px);
  padding-top: 26px;
}
.panel {
  position: relative;
  padding: clamp(18px, 2.3vw, 30px);
  border: 1px solid var(--line);
  border-radius: var(--r);
  background: var(--card);
}
.panel--a { grid-row: span 2; --nib: var(--card); }
.panel--b { background: var(--bg); }
.panel--c { --nib: var(--card); }
.panel h3 { margin-bottom: 8px; }
.panel p { color: var(--muted); }
.panel--b p { color: var(--ink); }
.panel .link { display: inline-block; margin-top: 14px; }
.panel--b .link:hover { color: var(--ink); text-decoration-thickness: 3px; }

.channels { margin-top: 16px; border-top: 2px solid var(--ink); }
.channels > div {
  display: grid;
  grid-template-columns: 7.2em minmax(0, 1fr);
  gap: 2px 14px;
  align-items: baseline;
  padding-block: 11px;
  border-bottom: 1px solid var(--line);
}
.channels dt { font: 700 1.06rem/1.3 var(--display); }
.channels dd { color: var(--muted); font-size: .98rem; line-height: 1.4; }

.measures { margin-top: 12px; }
.measures > div {
  display: grid;
  grid-template-columns: 3.4em minmax(0, 1fr);
  gap: 2px 10px;
  align-items: baseline;
  padding-block: 8px;
  border-top: 1px solid var(--line);
}
.measures dt { font: 800 1rem/1.35 var(--display); }
.measures dd { color: var(--muted); font-size: .95rem; line-height: 1.4; }


/* Card 07: cross-reference chain and the staircase of four cards */

.xref {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: clamp(16px, 2vw, 26px);
}
.xref li {
  position: relative;
  padding-top: 12px;
  border-top: 2px solid var(--ink);
  line-height: 1.42;
}
.xref li:not(:last-child)::after {
  content: "→";
  position: absolute;
  top: -15px;
  right: 0;
  padding-left: 8px;
  background: var(--card);
  color: var(--accent);
  font: 800 1.1rem/1.5 var(--display);
}
.xref strong {
  display: block;
  margin-bottom: 3px;
  font: 800 1.26rem/1.25 var(--display);
}
.xref span { color: var(--muted); font-size: .97rem; }

.cycle-h { margin-top: clamp(38px, 5vw, 60px); }
.cycle {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: clamp(12px, 1.6vw, 20px);
  align-items: start;
}
.cycle > li {
  --nib: var(--card);
  position: relative;
  margin-top: 46px;
  padding: 18px clamp(14px, 1.6vw, 20px) 20px;
  border: 1px solid var(--line);
  border-radius: var(--r);
  background: var(--card);
  box-shadow: 0 -8px 16px -13px var(--shade);
}
.cycle > li:nth-child(2) { margin-top: 78px; }
.cycle > li:nth-child(3) { margin-top: 110px; }
.cycle > li:nth-child(4) { margin-top: 142px; }
.cycle p { margin-top: 8px; color: var(--muted); font-size: .97rem; line-height: 1.46; }
.cycle ul {
  --rule: 26px;
  margin-top: 12px;
  border-top: 1px solid var(--line);
}
.cycle ul li {
  padding-block: 7px;
  border-bottom: 1px solid var(--line);
  font-size: .92rem;
  line-height: 1.34;
}


/* Card 08: supplements */

.extras {
  display: grid;
  grid-template-columns: repeat(12, minmax(0, 1fr));
  gap: 42px clamp(12px, 1.6vw, 20px);
  padding-top: 18px;
}
.extra {
  position: relative;
  padding: 18px clamp(14px, 1.6vw, 20px) 20px;
  border: 1px solid var(--line);
  border-radius: var(--r);
  background: var(--bg);
}
.extra--n { grid-column: span 3; }
.extra--w { grid-column: span 4; }
.extra h3 { font-size: 1.2rem; }
.extra p { margin-top: 7px; font-size: .97rem; line-height: 1.44; }


/* Card 09: house rules on lined paper */

.about-grid {
  display: grid;
  grid-template-columns: minmax(0, 5fr) minmax(0, 7fr);
  gap: clamp(26px, 4vw, 56px);
}
.about-left .intro { margin-top: 18px; }

.rules {
  padding: var(--rule) clamp(14px, 2vw, 26px) 0 0;
  border: 1px solid var(--line);
  border-radius: var(--r);
  background-color: var(--card);
  background-image:
    linear-gradient(to right, transparent 55px, var(--accent) 55px, var(--accent) 56px, transparent 56px),
    linear-gradient(to bottom, transparent calc(var(--rule) - 1px), var(--line) calc(var(--rule) - 1px));
  background-position: 0 0, 0 -6px;
  background-size: 100% 100%, 100% var(--rule);
}
.rules li {
  display: grid;
  grid-template-columns: 56px minmax(0, 1fr);
  margin-bottom: var(--rule);
  line-height: var(--rule);
}
.rules-no {
  padding-right: 12px;
  color: var(--accent);
  font: 800 1rem/var(--rule) var(--display);
  text-align: right;
}
.rules li > div { padding-left: 14px; }
.rules h3 { font-size: 1.28rem; line-height: var(--rule); }
.rules p { color: var(--ink); font-size: 1.02rem; line-height: var(--rule); }


/* Card 10: cross index, names only */

.xindex { border-top: 2px solid var(--ink); }
.xindex > div {
  display: grid;
  grid-template-columns: minmax(0, 13em) minmax(0, 1fr);
  align-items: end;
  gap: 8px 20px;
  padding-top: 18px;
  border-bottom: 1px solid var(--muted);
}
.xindex dt { padding-bottom: 9px; color: var(--muted); font-weight: 500; }
.xindex dd { display: flex; flex-wrap: wrap; align-items: flex-end; gap: 4px 5px; }
.xindex dd span {
  padding: 9px 17px 7px;
  border: 1px solid var(--muted);
  border-bottom: 0;
  border-radius: var(--r) var(--r) 0 0;
  background: var(--bg);
  font: 700 1.04rem/1.2 var(--display);
  transition: padding-bottom .24s var(--settle), margin-top .24s var(--settle);
}
.xindex dd span:hover { margin-top: -6px; padding-bottom: 13px; }
.xindex-m dd span { border-color: var(--ink); background: var(--ink); color: var(--card); }


/* Card 11: questions */

.asks-grid {
  display: grid;
  grid-template-columns: minmax(0, 4fr) minmax(0, 8fr);
  gap: clamp(20px, 4vw, 56px);
}
.asks-left .intro { margin-top: 14px; }
.asks { border-top: 2px solid var(--ink); }
.asks details { border-bottom: 1px solid var(--line); }
.asks summary {
  display: grid;
  grid-template-columns: 40px minmax(0, 1fr) 22px;
  align-items: baseline;
  gap: 8px;
  padding-block: 16px;
  font: 700 clamp(1.08rem, 1.6vw, 1.26rem)/1.3 var(--display);
  cursor: pointer;
  list-style: none;
  transition: color .18s;
}
.asks summary::-webkit-details-marker { display: none; }
.asks summary:hover { color: var(--accent); }
.asks-no { color: var(--accent); font-size: .95rem; font-weight: 800; }
.asks-mark {
  position: relative;
  align-self: center;
  width: 16px;
  height: 16px;
  justify-self: end;
}
.asks-mark::before, .asks-mark::after {
  content: "";
  position: absolute;
  top: 7px;
  left: 0;
  width: 16px;
  height: 2px;
  background: var(--ink);
  transition: transform .24s var(--settle);
}
.asks-mark::after { transform: rotate(90deg); }
.asks details[open] .asks-mark::after { transform: rotate(0deg); }
.asks-a { padding: 0 0 22px 48px; }
.asks-a p {
  background-image: linear-gradient(to bottom, transparent calc(var(--rule) - 1px), var(--line) calc(var(--rule) - 1px));
  background-position: 0 -6px;
  background-size: 100% var(--rule);
  line-height: var(--rule);
}


/* Card 12: request slip */

.contact-grid {
  display: grid;
  grid-template-columns: minmax(0, 5fr) minmax(0, 7fr);
  gap: clamp(28px, 4vw, 56px);
}
.contact-left .intro { margin-top: 14px; }
.onfile {
  margin-block: 22px 20px;
  border-top: 2px solid var(--ink);
}
.onfile li {
  padding-block: 9px;
  border-bottom: 1px solid var(--line);
  font-weight: 500;
  line-height: 1.35;
}

.slipform, .filed-note {
  position: relative;
  padding: clamp(18px, 2.4vw, 30px);
  border: 1px solid var(--line);
  border-radius: var(--r);
  background: var(--card);
  box-shadow: 0 10px 22px -18px var(--shade);
}
.slipform-h { margin-bottom: 16px; padding-bottom: 8px; border-bottom: 2px solid var(--accent); }
.hp { position: absolute; left: -9999px; width: 1px; height: 1px; overflow: hidden; }
.slipform-two {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0 clamp(14px, 2vw, 24px);
}
.field { margin-bottom: 18px; }
.field label {
  display: block;
  margin-bottom: 2px;
  color: var(--muted);
  font-size: .9rem;
  font-weight: 500;
}
.field input, .field textarea {
  display: block;
  width: 100%;
  border: 0;
  border-radius: 0;
  background-color: transparent;
  color: var(--ink);
  font: 400 1.02rem/var(--rule) var(--text);
  transition: box-shadow .18s;
}
.field input {
  min-height: 44px;
  padding: 8px 2px 4px;
  border-bottom: 1px solid var(--muted);
}
.field textarea {
  display: block;
  min-height: calc(var(--rule) * 5 + 2px);
  padding: 0 2px;
  resize: vertical;
  border-bottom: 1px solid var(--muted);
  background-attachment: local;
  background-image: linear-gradient(to bottom, transparent calc(var(--rule) - 1px), var(--line) calc(var(--rule) - 1px));
  background-position: 0 -6px;
  background-size: 100% var(--rule);
}
.field input:focus, .field textarea:focus {
  outline: none;
  border-bottom-color: var(--accent);
  box-shadow: 0 2px 0 var(--accent);
}
.form-status { margin: 0; font-size: .98rem; line-height: 1.42; }
.form-status:not(:empty) {
  margin-bottom: 16px;
  padding: 10px 14px;
  border: 1px solid var(--accent);
  border-left-width: 4px;
  border-radius: var(--r);
  background: var(--bg);
  color: var(--ink);
}
.slipform-foot {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 12px 18px;
}
.slipform-note {
  flex: 1 1 15em;
  color: var(--muted);
  font-size: .92rem;
  line-height: 1.4;
}

.filed-note { outline: none; }
.filed-note h3 { font-size: clamp(1.5rem, 2.6vw, 2.1rem); font-weight: 800; overflow-wrap: anywhere; }
.filed-note p { margin-top: 10px; color: var(--muted); }
.filed-note .stamp { display: inline-block; margin-top: 16px; color: var(--accent); }


/* Back of the file */

.slip.slip--back {
  padding-bottom: clamp(20px, 3vw, 34px);
  border-color: var(--ink);
  background: var(--ink);
  color: var(--card);
}
.slip--back > .tag { border-color: var(--ink); background: var(--ink); color: var(--card); }
.slip--back > .tag b { color: var(--line); }
.slip--back :focus-visible { outline-color: var(--card); }

.back-grid {
  display: grid;
  grid-template-columns: minmax(0, 5fr) minmax(0, 7fr);
  gap: 28px clamp(28px, 4vw, 56px);
}
.back-name {
  font: 800 clamp(3rem, 8vw, 6.6rem)/.96 var(--display);
  letter-spacing: -.03em;
}
.back-line { max-width: 26em; margin-top: 14px; color: var(--line); }
.back-label { margin-bottom: 10px; color: var(--line); font-size: .875rem; font-weight: 500; }
.allcards {
  column-gap: clamp(18px, 3vw, 36px);
  columns: 2;
}
.allcards li { break-inside: avoid; border-top: 1px solid var(--muted); }
.allcards a {
  display: flex;
  align-items: baseline;
  gap: 10px;
  padding-block: 8px;
  color: var(--card);
  line-height: 1.3;
  text-decoration: none;
  transition: padding-left .22s var(--settle);
}
.allcards a:hover { padding-left: 6px; text-decoration: underline; text-decoration-color: var(--line); text-underline-offset: 3px; }
.allcards i { color: var(--line); font: 600 .84rem/1.3 var(--display); font-style: normal; }
.back-cabinet { width: 100%; height: auto; margin-top: clamp(26px, 4vw, 44px); }
.back-end {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 6px 20px;
  margin-top: 16px;
  color: var(--line);
  font-size: .92rem;
}
.back-end a { color: var(--card); text-decoration-color: var(--line); text-underline-offset: 3px; }


/* Tablet and below: burger, single-column drawers */

@media (max-width: 1119.98px) {
  :root { --head: 62px; }

  /* Without JS the tabs simply wrap below the plate. */
  .railhead-in { flex-wrap: wrap; padding-block: 8px 0; }
  .tabrow { flex-wrap: wrap; }

  .js .railhead-in { flex-wrap: nowrap; padding-block: 0; align-items: center; }
  .js .burger { display: inline-flex; }
  .js .tabrow {
    position: absolute;
    top: 100%;
    right: var(--gutter);
    left: var(--gutter);
    display: none;
    max-height: calc(100vh - var(--head) - 16px);
    max-height: calc(100dvh - var(--head) - 16px);
    margin: 0;
    padding: 4px 16px 16px;
    overflow-y: auto;
    border: 1px solid var(--muted);
    border-top: 0;
    border-radius: 0 0 var(--r) var(--r);
    background: var(--card);
    box-shadow: 0 20px 30px -20px var(--shade);
  }
  .js .tabrow.is-open { display: block; }
  .js .tabrow a,
  .js .tabrow a:hover,
  .js .tabrow a[aria-current] {
    padding: 13px 2px;
    border: 0;
    border-bottom: 1px solid var(--line);
    border-radius: 0;
    background: none;
    box-shadow: none;
    color: var(--ink);
    font-size: 1.08rem;
  }
  .js .tabrow a[aria-current] { color: var(--accent); }
  .js .tabrow a.is-flag,
  .js .tabrow a.is-flag:hover,
  .js .tabrow a.is-flag[aria-current] {
    justify-content: center;
    margin-top: 14px;
    padding: 14px;
    border: 0;
    border-radius: var(--r);
    background: var(--accent);
    color: var(--on-accent);
  }

  .cycle { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .cycle > li,
  .cycle > li:nth-child(2),
  .cycle > li:nth-child(3),
  .cycle > li:nth-child(4) { margin-top: 34px; }
  .cycle > li:nth-child(even) { margin-top: 58px; }

  .xref { grid-template-columns: repeat(3, minmax(0, 1fr)); row-gap: 24px; }
  .xref li:nth-child(3)::after { content: none; }

  .extra--n { grid-column: span 6; }
  .extra--w { grid-column: span 6; }
  .extra--w:last-child { grid-column: span 12; }
}

@media (max-width: 960px) {
  .front-grid { grid-template-columns: minmax(0, 1fr); }
  .cabinet { width: 100%; max-width: 520px; justify-self: center; }

  .headrow, .headrow--wide { grid-template-columns: minmax(0, 1fr); }
  .factory-body,
  .order,
  .about-grid,
  .asks-grid,
  .contact-grid,
  .back-grid { grid-template-columns: minmax(0, 1fr); }

  .drawers { grid-template-columns: minmax(0, 1fr); }
  .panel--a { grid-row: auto; }

  .ledger-row { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }
  .ledger-row h3 { grid-column: 1 / -1; }
  .ledger-note { grid-column: 1 / -1; }
  .ledger-row .link { align-self: end; }
}

@media (max-width: 860px) {
  .specimens {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 10px 14px;
  }
  .rowline { display: contents; }
  .spec { margin-top: 26px; }
  .spec figcaption { font-size: .9rem; }
}

@media (max-width: 640px) {
  :root { --tabh: 36px; --head: 60px; }
  body { font-size: 1rem; }

  .subject { flex-direction: column; }
  .tag { padding: 9px 14px 7px; font-size: .88rem; }

  .front-lede { font-size: 1rem; }
  .btn { white-space: normal; text-align: center; }
  .actions .btn { flex: 1 1 100%; }

  .cabinet { --ch: 366px; --top: 34px; --face: 104px; }
  .divider { bottom: 30px; }
  .divider span { padding: 4px 11px 2px; font-size: .84rem; }
  .divider:hover { transform: translateY(-7px); }
  .holder { padding-block: 3px 4px; }

  .tally { grid-template-columns: minmax(0, 1fr); }
  .tally > div,
  .tally > div:first-child {
    display: grid;
    grid-template-columns: minmax(0, 6.2em) minmax(0, 1fr);
    gap: 10px;
    padding: 12px 0;
    border-bottom: 1px solid var(--line);
    border-left: 0;
  }
  .tally strong { font-size: 1.85rem; }

  .sheet { grid-template-columns: minmax(0, 1fr); }
  .sheet-b, .sheet-d { border-left: 0; }
  .sheet-b, .sheet-c { border-top: 1px solid var(--line); }

  .routing li { grid-template-columns: 30px minmax(0, 1fr); }
  .routing li > span:last-child { grid-column: 2; }

  .order-lines > div { grid-template-columns: 5.6em minmax(0, 1fr); }

  .ledger-row { grid-template-columns: minmax(0, 1fr); }
  .ledger-row .link { justify-self: start; text-align: left; }

  .channels > div { grid-template-columns: minmax(0, 1fr); }

  .xref { grid-template-columns: minmax(0, 1fr); row-gap: 0; }
  .xref li {
    padding: 10px 0 12px;
    border-top: 0;
    border-bottom: 1px solid var(--line);
  }
  .xref li:not(:last-child)::after { content: "↓"; top: 8px; padding-left: 0; }

  .cycle { grid-template-columns: minmax(0, 1fr); }
  .cycle > li,
  .cycle > li:nth-child(2),
  .cycle > li:nth-child(3),
  .cycle > li:nth-child(4),
  .cycle > li:nth-child(even) { margin-top: 34px; }

  .extra--n, .extra--w, .extra--w:last-child { grid-column: 1 / -1; }
  .extras { gap: 36px 0; }

  .rules { padding-right: 12px; background-image:
    linear-gradient(to right, transparent 39px, var(--accent) 39px, var(--accent) 40px, transparent 40px),
    linear-gradient(to bottom, transparent calc(var(--rule) - 1px), var(--line) calc(var(--rule) - 1px)); }
  .rules li { grid-template-columns: 40px minmax(0, 1fr); }
  .rules-no { padding-right: 8px; font-size: .9rem; }
  .rules li > div { padding-left: 10px; }
  .rules p { font-size: 1rem; }

  .xindex > div { grid-template-columns: minmax(0, 1fr); gap: 0; padding-top: 12px; }
  .xindex dt { padding-bottom: 6px; }

  .asks summary { grid-template-columns: 34px minmax(0, 1fr) 20px; }
  .asks-a { padding-left: 0; }

  .slipform-two { grid-template-columns: minmax(0, 1fr); }
  .slipform-foot .btn { width: 100%; }

  .allcards { columns: 1; }
}


/* Motion: cards come up from below and settle on the pile.
   The hidden state exists only once main.js has added .js. */

@media (prefers-reduced-motion: no-preference) {
  html { scroll-behavior: smooth; }

  .js .slip {
    transition: transform .85s var(--settle), opacity .4s ease-out, box-shadow .85s ease-out;
  }
  .js .slip:not(.is-laid) {
    box-shadow: 0 34px 60px -24px var(--shade);
    opacity: 0;
    transform: translateY(104px);
  }
  .js .slip:not(.is-laid) > .tag { padding-bottom: 24px; }
  .js .slip.is-laid > .tag { transition-delay: .18s; }
  .js .slip.is-laid:hover > .tag { transition-delay: 0s; }

  .slip--front { animation: lay-first .9s var(--settle) backwards; }
  .divider { animation: tab-up .75s var(--settle) backwards; animation-delay: calc(.25s + var(--i) * 80ms); }
  .cabinet-face { animation: lay-first .8s var(--settle) .2s backwards; }

  .ad-run { animation: ad-run 7s ease-in-out infinite alternate; }
  .ad-run--b { animation-duration: 9s; animation-direction: alternate-reverse; }
  .ad-run--c { animation-duration: 6s; }
  .ad-play { animation: ad-play 8s linear infinite; }
  .ad-fill { animation: ad-fill 5s linear infinite; transform-box: fill-box; transform-origin: 0 50%; }
  .asks details[open] .asks-a { animation: unfold .32s var(--settle); }
}

@keyframes lay-first {
  from { opacity: 0; transform: translateY(46px); }
}
@keyframes tab-up {
  from { opacity: 0; transform: translateY(46px); }
}
@keyframes ad-run {
  from { transform: translateX(-34px); }
  to { transform: translateX(34px); }
}
@keyframes ad-play {
  from { transform: translateX(0); }
  to { transform: translateX(406px); }
}
@keyframes ad-fill {
  from { transform: scaleX(.04); }
  to { transform: scaleX(1); }
}
@keyframes unfold {
  from { opacity: 0; transform: translateY(-6px); }
}

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