/* Sympathetic: a catalogue plate and a tuning chart on cream card. Tokens in tokens.css, unmodified. */

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font: 15px/1.45 var(--font-body);
  font-variant-numeric: tabular-nums;
  -webkit-text-size-adjust: 100%;
}

main {
  width: min(100% - 32px, 640px);
  margin: 40px auto 64px;
}

@media (min-width: 1280px) {
  main { width: calc(var(--cell-w) * 16); }
}

/* The cream card stays paper in both schemes: ink is re-declared locally. */
.card {
  --ink: #1A1A1A;
  --ink-soft: #5B5B5B;
  color-scheme: light;
  background: var(--c-cream);
  color: var(--ink);
  border: 1px solid var(--ink);
}

.label, dt, th, caption {
  font-variant-caps: all-small-caps;
  letter-spacing: 0.06em;
  font-weight: 500;
  color: var(--ink-soft);
}

p { margin: 0; }

/* The plate */
.plate { padding: 20px 24px 22px; }

.plate-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  gap: 16px;
  padding-bottom: 12px;
  margin-bottom: 12px;
  border-bottom: 1px solid var(--ink);
}

h1 {
  margin: 0;
  font-size: 30px;
  line-height: 1.1;
  font-weight: 500;
  font-variant-caps: all-small-caps;
  letter-spacing: 0.06em;
}

.examined { text-align: right; }

dl { margin: 0; }
dl > div {
  display: grid;
  grid-template-columns: 10.5em 1fr;
  gap: 12px;
  padding: 3px 0;
}
dt { padding-top: 1px; }
dd { margin: 0; text-wrap: pretty; }
#dampers span { white-space: nowrap; }

input {
  font: inherit;
  font-variant-numeric: tabular-nums;
  color: var(--ink);
  background: var(--c-cream);
  border: 1px solid var(--ink);
  border-radius: 0;
  padding: 0 4px;
  margin: 0 2px;
  width: 6.2em;
}
#gate { width: 4.2em; }
input:focus-visible { outline: 2px solid var(--ink); outline-offset: 1px; }

/* Outside the card: the tokens' own ink on the ground */
.controls { margin: 28px 0 32px; }
.advice { margin-bottom: 12px; }

button {
  font: inherit;
  color: var(--ink);
  background: var(--bg);
  border: 1px solid var(--ink);
  border-radius: 0;
  padding: 9px 18px;
  cursor: pointer;
}
button:hover { background: var(--ink); color: var(--bg); }
button:focus-visible { outline: 2px solid var(--ink); outline-offset: 2px; }
button:disabled { cursor: progress; }

.line {
  margin-top: 14px;
  padding: 2px 0 2px 10px;
  border-left: 2px solid var(--c-brick);
}

/* The tuning chart */
.chart { padding: 16px 18px 14px; }

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 14px;
}
caption {
  text-align: left;
  padding-bottom: 6px;
  font-size: 15px;
}
th, td {
  padding: 3px 8px;
  text-align: right;
  white-space: nowrap;
  font-weight: 400;
}
th:first-child, td:first-child { padding-left: 0; text-align: left; }
th.lvl, td.lvl { padding-right: 0; width: 50%; }
thead tr:first-child th { vertical-align: bottom; font-weight: 500; }
thead th.lvl { text-align: left; }
.words { text-align: left; color: var(--ink-soft); }
tbody th { text-align: left; color: var(--ink); font-variant-caps: normal; letter-spacing: 0; }
#row-in > * { border-bottom: 1px solid var(--ink); padding-bottom: 6px; }
#row-out > * { border-top: 1px solid var(--ink); padding-top: 6px; }
tr.string:nth-child(2) > * { padding-top: 6px; }

.meter { display: flex; align-items: center; gap: 8px; }
.num { flex: none; width: 3.6em; text-align: right; }
.track {
  position: relative;
  flex: 1;
  height: 7px;
  border-bottom: 1px solid var(--ink);
}
.bar {
  position: absolute;
  left: 0;
  bottom: 0;
  height: 6px;
  width: 0;
  background: var(--c-moss);
}
.tick {
  position: absolute;
  bottom: -3px;
  width: 2px;
  height: 13px;
  margin-left: -1px;
  background: var(--c-brick);
}
.tick[hidden] { display: none; }

.scale td { padding-top: 0; padding-bottom: 4px; }
.ticks {
  position: relative;
  flex: 1;
  height: 1.3em;
  font-size: 11px;
  color: var(--ink-soft);
}
.ticks span { position: absolute; top: 0; transform: translateX(-50%); }
.ticks span:last-child { transform: translateX(-100%); }

.colophon { margin-top: 18px; line-height: 0; }
.colophon img { display: block; width: 105px; height: auto; }

/* The construction, for whoever looks closer */
.construction { margin-top: 28px; font-size: 14px; }
.construction summary { cursor: pointer; }
.construction p { margin: 10px 0; max-width: 62ch; }
.construction table { width: auto; margin: 12px 0; font-size: 13px; }
.construction th { color: var(--ink-soft); font-variant-caps: normal; letter-spacing: 0; }

@media (max-width: 520px) {
  main { margin-top: 16px; }
  .plate { padding: 14px 14px 16px; }
  .plate-head { flex-wrap: wrap; align-items: flex-start; gap: 6px; }
  .examined { text-align: left; }
  h1 { font-size: 24px; }
  dl > div { grid-template-columns: 7.6em 1fr; gap: 8px; font-size: 14px; }
  .chart { padding: 12px 8px 12px; }
  table { font-size: 11.5px; }
  th, td { padding: 3px 3px; }
  thead tr:first-child th { white-space: normal; }
  th.lvl, td.lvl { width: 42%; }
  .num { width: 3.3em; }
  .meter { gap: 4px; }
  .ticks { font-size: 9.5px; }
}

@page { size: A4; margin: 14mm; }

@media print {
  body { --ink: #1A1A1A; --ink-soft: #5B5B5B; background: none; color: var(--ink); font-size: 9.5pt; }
  main { width: auto; margin: 0; }
  button, .construction:not([open]) { display: none; }
  .controls { margin: 10px 0; }
  .card { break-inside: avoid; print-color-adjust: exact; -webkit-print-color-adjust: exact; }
  .plate { padding: 12px 18px 14px; }
  .plate-head { padding-bottom: 8px; margin-bottom: 8px; }
  h1 { font-size: 20pt; }
  dl > div { padding: 1px 0; }
  .chart { padding: 10px 14px; }
  table { font-size: 9.5pt; }
  th, td { padding: 2px 6px; }
  .colophon { margin-top: 10px; }
}
