/* Print Desk — same inks as the Two Cat site: one black, one fluorescent orange, uncoated paper.
   Orange is only for the main action, the active choice and focus. */
:root {
  --paper: #EFEBE2;
  --paper-2: #F6F3EC;
  --ink: #1B1A18;
  --ink-soft: #4A4742;
  --orange: #FF5A1F;
  --rule: rgba(27, 26, 24, .22);
  --err: #B3261E;
  --display: "Bricolage Grotesque", "Arial Black", system-ui, sans-serif;
  --body: "Instrument Sans", system-ui, -apple-system, sans-serif;
  --gutter: clamp(16px, 4vw, 48px);
  --hard: 4px 4px 0 var(--ink);
  --hard-sm: 2px 2px 0 var(--ink);
  --mis-x: 3px; --mis-y: -2px;
  color-scheme: light;
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; color: var(--ink); font: 400 16px/1.5 var(--body); -webkit-font-smoothing: antialiased;
  background-color: var(--paper);
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='160' height='160'><filter id='n'><feTurbulence type='fractalNoise' baseFrequency='.9' numOctaves='2' stitchTiles='stitch'/><feColorMatrix values='0 0 0 0 .1  0 0 0 0 .1  0 0 0 0 .09  0 0 0 .07 0'/></filter><rect width='100%' height='100%' filter='url(%23n)'/></svg>");
}
h1, h2, h3 { margin: 0; font-family: var(--display); font-weight: 800; letter-spacing: -.035em; line-height: .95; }
p { margin: 0 0 8px; }
code { background: var(--rule); padding: 0 4px; font-size: 12px; }
[hidden] { display: none !important; }

.skip { position: absolute; left: -999px; top: 8px; background: var(--ink); color: var(--paper); padding: 8px 12px; z-index: 10; }
.skip:focus { left: 8px; }

/* header */
.top { display: flex; justify-content: space-between; gap: 24px; align-items: flex-end; padding: 32px var(--gutter) 20px; max-width: 1360px; margin: 0 auto; border-bottom: 2px solid var(--ink); }
.top h1 { font-size: clamp(44px, 8vw, 92px); letter-spacing: -.05em; line-height: .82; position: relative; display: inline-block; }
.top h1::after { content: attr(data-text); position: absolute; inset: 0; color: var(--orange); transform: translate(var(--mis-x), var(--mis-y)); mix-blend-mode: multiply; z-index: -1; pointer-events: none; }
.top h1 { z-index: 0; isolation: isolate; }
.top p { max-width: 52ch; margin: 14px 0 0; color: var(--ink-soft); }
.unit { font-size: 13px; font-weight: 600; display: flex; gap: 8px; align-items: center; white-space: nowrap; }
.unit select { width: auto; margin: 0; }

.layout { display: grid; grid-template-columns: minmax(320px, 460px) 1fr; gap: clamp(20px, 3vw, 40px); padding: 28px var(--gutter) 64px; max-width: 1360px; margin: 0 auto; align-items: start; }
@media (max-width: 880px) { .layout { grid-template-columns: 1fr; } .top { align-items: flex-start; flex-direction: column; } }

/* cards: a sheet laid on the paper */
.card { background: var(--paper-2); border: 2px solid var(--ink); box-shadow: var(--hard); padding: 18px 18px 8px; margin-bottom: 24px; }
.card h2 { font-size: 22px; margin-bottom: 14px; display: flex; align-items: baseline; gap: 10px; }
.card h2 .n { font-size: 13px; font-family: var(--body); font-weight: 700; letter-spacing: 0; border: 2px solid var(--ink); border-radius: 50%; width: 24px; height: 24px; display: inline-grid; place-items: center; flex: none; }

label { display: block; font-size: 13px; font-weight: 600; color: var(--ink); margin-bottom: 12px; }
label.check { display: flex; gap: 10px; align-items: flex-start; font-size: 14px; font-weight: 500; min-height: 24px; }
label.check input { margin-top: 3px; width: 18px; height: 18px; accent-color: var(--ink); flex: none; }
input[type=text], input[type=number], select {
  display: block; width: 100%; margin-top: 4px; padding: 9px 10px; font: 400 15px/1.3 var(--body); color: var(--ink);
  background: var(--paper); border: 2px solid var(--ink); border-radius: 0; min-height: 40px;
}
select { appearance: none; background-image: linear-gradient(45deg, transparent 50%, var(--ink) 50%), linear-gradient(135deg, var(--ink) 50%, transparent 50%); background-position: calc(100% - 17px) 55%, calc(100% - 12px) 55%; background-size: 5px 5px; background-repeat: no-repeat; padding-right: 30px; }
input::placeholder { color: var(--ink-soft); opacity: .7; }
:focus-visible { outline: 3px solid var(--orange); outline-offset: 2px; }
input[type=text]:focus-visible, input[type=number]:focus-visible, select:focus-visible { outline-offset: 0; box-shadow: var(--hard-sm); }
.hint { display: block; font-size: 12.5px; font-weight: 400; color: var(--ink-soft); margin-top: 4px; line-height: 1.4; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 0 14px; }
.grid2 .check { grid-column: 1 / -1; }
.stamp { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 0 12px; margin-top: 4px; border-top: 2px dashed var(--rule); padding-top: 14px; }
.stamp .hint { grid-column: 1 / -1; margin-bottom: 8px; }
.opts .opt { display: grid; grid-template-columns: 1fr 1fr; gap: 0 14px; margin-top: 16px; padding-top: 16px; border-top: 2px dashed var(--rule); }
.opts .opt > .check, .opts .opt > .hint, .opts .opt > label:has(select) { grid-column: 1 / -1; }
.opts .opt > label:has(.dim) { grid-column: auto; }
.custom { display: none; }
body.custom-paper .custom { display: block; }

/* buttons */
button { font: 600 14px/1 var(--body); cursor: pointer; padding: 12px 16px; min-height: 44px; border: 2px solid var(--ink); background: var(--ink); color: var(--paper); border-radius: 0; transition: transform .12s cubic-bezier(.3, 1.5, .55, 1), box-shadow .12s; touch-action: manipulation; }
button:hover:not(:disabled) { transform: translate(-1px, -1px); box-shadow: var(--hard-sm); }
button:active:not(:disabled) { transform: translate(1px, 1px); box-shadow: none; }
button.ghost { background: var(--paper-2); color: var(--ink); }
button.primary { background: var(--orange); color: var(--ink); box-shadow: var(--hard-sm); font-size: 15px; }
button.primary:hover:not(:disabled) { box-shadow: 3px 3px 0 var(--ink); }
button:disabled { opacity: .4; cursor: not-allowed; }
.row { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; margin: 4px 0 14px; }
.row select { width: auto; flex: 1 1 160px; margin: 0; }

/* files */
.drop { border: 2px dashed var(--ink); padding: 18px; text-align: center; background: var(--paper); margin-bottom: 14px; transition: background .15s; }
.drop.over { background: color-mix(in srgb, var(--orange) 22%, var(--paper)); border-style: solid; }
.drop input { position: absolute; width: 1px; height: 1px; opacity: 0; }
.drop:focus-within { outline: 3px solid var(--orange); outline-offset: 2px; }
.link { color: var(--ink); text-decoration: underline; text-underline-offset: 3px; text-decoration-thickness: 2px; cursor: pointer; display: inline; font-size: inherit; font-weight: 700; }
.files { list-style: none; margin: 0 0 4px; padding: 0; display: grid; gap: 10px; }
.files:empty { display: none; }
.files li { display: grid; grid-template-columns: 48px 1fr auto; gap: 12px; align-items: center; background: var(--paper); border: 2px solid var(--ink); padding: 8px; cursor: grab; }
.files li.dragging { opacity: .35; }
.files img, .files .blank { width: 48px; height: 60px; object-fit: contain; background: #fff; border: 1.5px solid var(--ink); }
.files .blank { background: repeating-linear-gradient(45deg, var(--paper), var(--paper) 4px, #fff 4px, #fff 8px); }
.files .name { font-weight: 700; font-size: 14px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.files .meta { font-size: 12.5px; color: var(--ink-soft); }
.files .range { margin-top: 6px; padding: 5px 8px; font-size: 13px; min-height: 32px; }
.files .btns { display: flex; flex-direction: column; gap: 4px; }
.files .btns button { min-height: 28px; min-width: 32px; padding: 2px 8px; font-size: 14px; background: var(--paper-2); color: var(--ink); }

/* layout chips */
.chips { display: grid; gap: 10px; }
.chip { margin: 0; position: relative; }
.chip input { position: absolute; opacity: 0; inset: 0; width: 100%; height: 100%; margin: 0; cursor: pointer; }
.chip > span { display: flex; gap: 12px; align-items: center; border: 2px solid var(--ink); padding: 10px 14px; background: var(--paper); transition: transform .12s cubic-bezier(.3, 1.5, .55, 1), box-shadow .12s; }
.chip b { display: block; font: 800 17px/1.1 var(--display); letter-spacing: -.02em; }
.chip i { display: block; font-style: normal; font-weight: 400; font-size: 13px; color: var(--ink-soft); margin-top: 2px; }
.chip:hover span { transform: translate(-1px, -1px); box-shadow: var(--hard-sm); }
.chip input:checked + span { background: #fff; box-shadow: 4px 4px 0 var(--orange), 4px 4px 0 2px var(--ink); transform: translate(-2px, -2px); }
.chip input:checked + span b::before { content: "● "; color: var(--orange); }
.chip input:focus-visible + span { outline: 3px solid var(--orange); outline-offset: 3px; }

/* preview */
.preview .stickyPane { position: sticky; top: 16px; max-height: calc(100vh - 32px); overflow: auto; padding: 4px 8px 12px 4px; margin: -4px -8px -12px -4px; }
@media (max-width: 880px) { .preview .stickyPane { position: static; max-height: none; overflow: visible; } }
.summary { font: 800 22px/1.1 var(--display); letter-spacing: -.02em; margin-bottom: 12px; min-height: 26px; }
.summary.err { color: var(--err); font-family: var(--body); font-size: 15px; font-weight: 600; }
.nav { display: flex; align-items: center; gap: 12px; margin-bottom: 10px; font-size: 14px; font-weight: 600; }
.nav button { padding: 4px 14px; font-size: 20px; min-height: 44px; min-width: 44px; background: var(--paper-2); color: var(--ink); }
.stage {
  border: 2px solid var(--ink); box-shadow: var(--hard); padding: 20px; min-height: 300px;
  display: flex; flex-wrap: wrap; gap: 16px; justify-content: center; align-items: flex-start;
  background-color: #D9D1C4;
  background-image: radial-gradient(circle, rgba(27, 26, 24, .28) 1px, transparent 1.6px);
  background-size: 8px 8px;
}
.stage.tiles { display: grid; gap: 3px; justify-content: center; }
.stage figure { margin: 0; text-align: center; }
.stage canvas { display: block; background: #fff; border: 1.5px solid var(--ink); box-shadow: 4px 4px 0 var(--orange); max-width: 100%; height: auto; }
.stage.tiles canvas { box-shadow: none; }
.stage figcaption { font-size: 12.5px; font-weight: 700; margin-top: 8px; }
.stage .empty { align-self: center; text-align: center; padding: 56px 16px; background: var(--paper-2); border: 2px solid var(--ink); font-weight: 600; max-width: 34ch; }
.export { margin-top: 18px; padding: 16px 16px 4px; background: var(--paper-2); border: 2px solid var(--ink); }
.howto { margin-top: 20px; padding: 16px 18px 8px; background: var(--paper-2); border: 2px solid var(--ink); font-size: 14.5px; }
.howto h3 { font-size: 20px; margin-bottom: 10px; }
.howto ol { margin: 0; padding-left: 22px; }
.howto li { margin-bottom: 10px; max-width: 68ch; }
.howto li::marker { font-weight: 800; }

@media (max-width: 520px) { .grid2, .opts .opt, .stamp { grid-template-columns: 1fr; } }
@media (prefers-reduced-motion: reduce) { * { transition: none !important; } }

.chip .ico { width: 56px; height: 40px; flex: none; color: var(--ink); }
.chip .txt { display: block; }
.explain { margin-top: 14px; padding: 12px 14px; border-left: 4px solid var(--orange); background: var(--paper); font-size: 14px; }
.explain b { display: block; font: 800 15px/1.2 var(--display); letter-spacing: -.01em; margin-bottom: 4px; }
.explain p { margin: 0 0 6px; max-width: 60ch; }
.explain p:last-child { margin: 0; }
.manual { margin-bottom: 4px; }

.sitenav { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 16px; }
.sitenav a { font-weight: 700; font-size: 14px; color: var(--ink); text-decoration: none; padding: 8px 14px; border: 2px solid var(--ink); background: var(--paper-2); min-height: 40px; display: inline-flex; align-items: center; }
.sitenav a[aria-current=page] { background: var(--ink); color: var(--paper); }
.sitenav a:hover:not([aria-current=page]) { box-shadow: var(--hard-sm); transform: translate(-1px, -1px); }
.tpl-stage { background-color: #D9D1C4; background-image: radial-gradient(circle, rgba(27, 26, 24, .28) 1px, transparent 1.6px); background-size: 8px 8px; border: 2px solid var(--ink); box-shadow: var(--hard); padding: 20px; display: grid; gap: 18px; justify-items: center; }
.tpl-stage figure { margin: 0; text-align: center; width: 100%; }
.tpl-stage svg { max-width: 100%; height: auto; max-height: 420px; background: #fff; border: 1.5px solid var(--ink); box-shadow: 4px 4px 0 var(--orange); }
.tpl-stage figcaption { font-size: 12.5px; font-weight: 700; margin-top: 8px; }
.tpl-stage .paper svg { box-shadow: none; max-height: 260px; }
table.panels { width: 100%; border-collapse: collapse; font-size: 14px; margin-bottom: 10px; }
table.panels th, table.panels td { text-align: left; padding: 6px 8px; border-bottom: 1.5px solid var(--rule); }
table.panels th { font-weight: 700; font-size: 12.5px; }
.artname { font-size: 13px; margin: 0 0 12px; }

.proof { margin-bottom: 12px; padding: 12px 14px 2px; background: var(--paper-2); border: 2px solid var(--ink); }
.proof select { max-width: 380px; }

.patStage { background-color: #D9D1C4; background-image: radial-gradient(circle, rgba(27, 26, 24, .28) 1px, transparent 1.6px); background-size: 8px 8px; border: 2px solid var(--ink); box-shadow: var(--hard); padding: 12px; display: grid; justify-items: center; overflow: auto; max-height: 76vh; }
.patStage canvas { display: block; border: 1.5px solid var(--ink); box-shadow: 4px 4px 0 var(--orange); max-width: none; }
.patStage:not(.actual) canvas { max-width: 100%; height: auto !important; }
.swatchRow { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; margin-bottom: 12px; }
.swlabel { font-size: 13px; font-weight: 600; min-width: 90px; }
.swatches { display: flex; flex-wrap: wrap; gap: 6px; }
.sw { width: 32px; height: 32px; min-height: 32px; padding: 0; border: 2px solid var(--ink); border-radius: 0; }
.sw[aria-pressed=true] { box-shadow: 0 0 0 2px var(--paper-2), 0 0 0 4px var(--ink); }
input[type=color] { width: 44px; height: 36px; min-height: 36px; padding: 2px; margin: 0; background: var(--paper); border: 2px solid var(--ink); border-radius: 0; cursor: pointer; }

.pair { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.pair .drop { margin-bottom: 8px; padding: 14px 8px; }
.thumbBox { display: grid; gap: 4px; justify-items: center; font-size: 12px; margin-bottom: 8px; }
.thumbBox img { max-width: 100%; max-height: 110px; border: 1.5px solid var(--ink); background: #fff; }
.thumbBox span { color: var(--ink-soft); overflow-wrap: anywhere; text-align: center; }
.cardStage { grid-template-columns: 1fr 1fr; align-items: start; }
@media (max-width: 520px) { .cardStage { grid-template-columns: 1fr; } .pair { grid-template-columns: 1fr; } }

.alignBox { margin-top: 14px; padding: 12px 14px 4px; background: var(--paper); border: 2px dashed var(--ink); }
.alignBox h3 { font-size: 17px; margin-bottom: 6px; }
