/* Catchword Press: screen and print styles.
   Colours come from tokens.css; its radius variables are not used, every corner is square.
   The sheet and the fold card are paper: literal white and black in both schemes. */

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

html { background: var(--bg); color: var(--ink); }
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font: 15px/1.45 var(--font-body);
  -webkit-text-size-adjust: 100%;
}
:focus-visible { outline: 2px solid var(--c-peach); outline-offset: 2px; }

/* masthead */
.masthead {
  max-width: 1200px;
  margin: 0 auto;
  padding: 16px 16px 0;
  display: flex;
  justify-content: space-between;
  align-items: center;
}
.plate {
  display: inline-block;
  background: var(--c-cream);
  border: 1px solid var(--ink);
  padding: 4px 7px 2px;
  line-height: 0;
}
.plate img { display: block; width: 104px; height: auto; }
.formno { font-size: 12px; letter-spacing: 0.06em; color: var(--ink-soft); }

/* the order form */
.desk { max-width: 1200px; margin: 0 auto; padding: 8px 16px 80px; }
.press {
  margin: 32px 0 0;
  font: 700 clamp(38px, 8vw, 64px)/1 var(--font-body);
  letter-spacing: -0.02em;
  color: var(--c-earth);
}
[data-theme="dark"] .press { color: var(--ink); }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .press { color: var(--ink); }
}

.conditions { margin: 14px 0 32px; font-size: 13px; line-height: 1.55; color: var(--ink-soft); }
.conditions h2 { margin: 0 0 2px; font: inherit; font-weight: 500; color: inherit; }
.conditions p { margin: 0; }

.order {
  max-width: 820px;
  margin: 0;
  display: grid;
  grid-template-columns: 1fr 1fr;
  border: 1px solid var(--ink);
}
.field { min-width: 0; margin: 0; padding: 12px 14px 16px; border: 0; }
.field-text, .field-title { grid-column: 1 / -1; border-bottom: 1px solid var(--ink); }
.field-paper { border-right: 1px solid var(--ink); }
.caption {
  display: block;
  float: left;
  width: 100%;
  padding: 0;
  margin: 0 0 8px;
  font-size: 12px;
  color: var(--ink-soft);
}
.field-text > .caption { font-size: 15px; color: var(--ink); }
.field > :not(.caption) { clear: both; }

textarea {
  display: block;
  width: 100%;
  min-height: 240px;
  resize: vertical;
  margin: 0;
  padding: 10px 12px;
  border: 1px solid var(--ink);
  background: transparent;
  color: var(--ink);
  font: 14px/1.5 var(--font-body);
}
textarea.drop { outline: 2px dashed var(--ink); outline-offset: 3px; }
textarea:focus-visible { outline: 2px solid var(--c-peach); outline-offset: 2px; }

input[type="text"] {
  display: block;
  width: 100%;
  margin: 0;
  padding: 4px 0 6px;
  border: 0;
  border-bottom: 1px solid var(--ink);
  background: transparent;
  color: var(--ink);
  font: 16px/1.3 var(--font-body);
}

.choice {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  min-height: 32px;
  margin-right: 22px;
  cursor: pointer;
}
input[type="radio"], input[type="checkbox"] {
  appearance: none;
  -webkit-appearance: none;
  flex: none;
  width: 16px;
  height: 16px;
  margin: 0;
  padding: 3px;
  border: 1px solid var(--ink);
  background: transparent;
  cursor: pointer;
}
input[type="radio"]:checked, input[type="checkbox"]:checked { background: content-box var(--ink); }

.file {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px 14px;
  margin-top: 12px;
  font-size: 13px;
  color: var(--ink-soft);
}
#file { position: absolute; width: 1px; height: 1px; opacity: 0; overflow: hidden; }
#file:focus-visible + label { outline: 2px solid var(--c-peach); outline-offset: 2px; }

button, .button {
  display: inline-block;
  margin: 0;
  padding: 11px 16px;
  border: 1px solid var(--ink);
  background: transparent;
  color: var(--ink);
  font: 500 14px/1 var(--font-body);
  cursor: pointer;
}
button:hover:not(:disabled), .button:hover { background: var(--ink); color: var(--bg); }
button:disabled { border-color: var(--ink-soft); color: var(--ink-soft); cursor: not-allowed; }

.rule {
  margin: 0 0 14px;
  padding-top: 8px;
  border-top: 1px solid var(--ink);
  font-size: 12px;
  font-weight: 500;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--ink-soft);
}

/* proof */
.proof { margin-top: 40px; }
.status { margin: 0; font-size: 16px; }
.status-small { min-height: 1.45em; margin: 2px 0 16px; font-size: 13px; color: var(--ink-soft); }
.sheet-fit { position: relative; overflow: hidden; }
.note { margin: 12px 0 14px; font-size: 13px; color: var(--ink-soft); }
.sheet-fit:empty + .note { display: none; }

/* the sheet: paper, whatever the scheme */
.sheet {
  position: relative;
  overflow: hidden;
  transform-origin: 0 0;
  background: #ffffff;
  color: #000000;
  font-weight: 400;
  font-style: normal;
  font-kerning: normal;
  font-variant-ligatures: none;
  text-rendering: geometricPrecision;
  letter-spacing: 0;
  word-spacing: 0;
  line-height: 1.3;
  text-align: left;
}
.sheet .cell, .sheet .block, .sheet .title, .sheet .colo, .sheet .cw, .sheet .marks { position: absolute; }
.sheet .title { left: 0; }
.sheet .colo { left: 0; bottom: 0; }
.sheet .ln { width: var(--measure); height: 1.3em; line-height: 1.3; white-space: pre; }
.sheet .ind { text-indent: 1.5em; }
.sheet .title .ln { text-align: center; }
.sheet .cw { line-height: 1.3; white-space: pre; }
.sheet .marks { left: 0; top: 0; pointer-events: none; }
.sheet .tick { stroke: #000000; }
.sheet .cut { stroke: var(--c-brick); }

/* fold card: paper too */
.fold { margin-top: 56px; }
.card { margin-bottom: 14px; padding: 20px 20px 24px; background: #ffffff; color: #000000; }
.card-head { margin: 0 0 18px; font-size: 13px; }
.steps {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 26px 22px;
}
.steps svg { display: block; width: 100%; height: auto; overflow: visible; }
.steps p { margin: 8px 0 0; font-size: 13px; line-height: 1.45; }
.steps svg * { fill: none; stroke: #000000; stroke-width: 0.7; stroke-linecap: square; }
.steps svg .thin { stroke-width: 0.35; }
.steps svg .faint { stroke-width: 0.35; stroke-dasharray: 1 2; }
.steps svg .crease { stroke-width: 0.5; stroke-dasharray: 6 2 1 2; }
.steps svg .heavy { stroke-width: 1.3; }
.steps svg .cutline { stroke-width: 1.1; stroke-dasharray: 3 2; stroke-linecap: butt; }
.steps svg .ghost { stroke-width: 0.5; stroke-dasharray: 1.5 1.5; }
.steps svg .box { stroke-width: 0.5; }
.steps svg text { fill: #000000; stroke: none; font-family: var(--font-body); font-size: 11px; }
.steps svg text.cap { font-size: 7px; }

@media (min-width: 720px) {
  .masthead { padding: 20px 32px 0; }
  .desk { padding: 12px 32px 96px; }
}
@media (min-width: 900px) {
  .order { max-width: none; grid-template-columns: minmax(0, 2fr) minmax(0, 1fr); grid-template-rows: auto auto 1fr; }
  .field-text { grid-column: 1; grid-row: 1 / span 3; border-bottom: 0; border-right: 1px solid var(--ink); }
  .field-title, .field-paper, .field-options { grid-column: 2; }
  .field-paper { border-right: 0; border-bottom: 1px solid var(--ink); }
  textarea { min-height: 220px; height: 220px; }
}
@media (max-width: 960px) {
  .steps { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 560px) {
  .order { grid-template-columns: 1fr; }
  .field-paper { border-right: 0; border-bottom: 1px solid var(--ink); }
  .steps { grid-template-columns: 1fr; }
  .steps svg { max-width: 320px; }
}

/* print: the sheet alone by default, the fold card alone when asked for */
@media print {
  html, body { margin: 0 !important; padding: 0 !important; background: #ffffff !important; }
  .masthead, .press, .conditions, .order, noscript, .proof > :not(.sheet-fit), .fold { display: none !important; }
  .desk, .proof { max-width: none; margin: 0; padding: 0; }
  .sheet-fit { height: auto !important; overflow: visible; }
  .sheet { transform: none !important; break-after: avoid; page-break-after: avoid; }
  .sheet .cut { stroke: #000000; }

  html[data-print="card"] .proof { display: none !important; }
  html[data-print="card"] .fold { display: block !important; margin: 0; }
  html[data-print="card"] .fold > :not(.card) { display: none !important; }
  html[data-print="card"] .card { margin: 0; padding: 12mm 14mm; overflow: hidden; break-after: avoid; page-break-after: avoid; }
  html[data-print="card"] .card-head { margin-bottom: 8mm; font-size: 10pt; }
  html[data-print="card"] .steps { grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 8mm 8mm; }
  html[data-print="card"] .steps svg { max-width: none; }
  html[data-print="card"] .steps p { font-size: 9pt; }
}
