/* OBJEKT core - tokens, primitives, components. Print, not screen:
   no gradients, no radius, no blur, no transparency effects.

   Token names are roles. The four paper stocks are named for the job each
   label does, not for the paper it happens to be in daylight - in the night
   theme the lead stock is the palest label on the sheet, and the name stays
   true. */

:root {
  /* ---- day sheet (default) ---- */
  --ground: #d7d5d0;          /* the sheet everything is stuck to */
  --frame: #0e0e0e;           /* press frame; also every hard lift shadow */
  --shade: #bcbab4;           /* resting shadow a label casts on the sheet */
  --frame-ink: #b9b5aa;       /* registration marks and edge captions on the frame */

  --stock-lead: #161616;      /* the loudest label: section strips, primary stamps */
  --stock-mark: #c7ac83;      /* marking stock: tags, secondary stamps, notes */
  --stock-plate: #a4a8ab;     /* plate stock: technical and serial labels */
  --stock-base: #edeae2;      /* base stock: forms, tables, reading surfaces */

  --ink: #1a1a1a;             /* ink on mark, plate, base and ground */
  --ink-2: #34312b;           /* secondary step of the same ink */
  --ink-dis: #989791;         /* disabled ink on base stock (solid mix, no opacity) */
  --ink-dis-mark: #7e7059;    /* disabled ink on mark stock */
  --ink-dis-plate: #6d7072;   /* disabled ink on plate stock */
  --ink-on-lead: #eae7df;     /* ink on lead stock */
  --ink-on-lead-2: #b9b5aa;   /* secondary ink on lead stock */
  --ink-on-lead-dis: #6b6a66; /* disabled ink on lead stock */

  --font-display: "Anton", "Arial Narrow", Impact, sans-serif;
  --font-mono: ui-monospace, "SF Mono", Menlo, Consolas, "Liberation Mono", monospace;
  --font-fine: "Arial Narrow", "Helvetica Neue", Arial, sans-serif;

  --rule-w: 3px;
  --lift: 4px 4px 0 var(--frame);
  --frame-w: 28px;

  --t-lift: 120ms;
  --ease-lift: cubic-bezier(0.2, 0.9, 0.2, 1);

  /* contextual inks: the stock a thing sits on decides these */
  --c-ink-2: var(--ink-2);
  --c-ink-dis: var(--ink-dis);
}

/* ---- night sheet: hand-authored, not inverted by formula ---- */
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --ground: #1f1e1b;
    --frame: #080808;
    --shade: #0a0a09;
    --frame-ink: #8f8b81;

    --stock-lead: #e6e2d8;
    --stock-mark: #4f412e;
    --stock-plate: #3c4044;
    --stock-base: #35342f;

    --ink: #ece8de;
    --ink-2: #bdb8ac;
    --ink-dis: #7a776e;
    --ink-dis-mark: #837154;
    --ink-dis-plate: #71757a;
    --ink-on-lead: #161616;
    --ink-on-lead-2: #3e3a33;
    --ink-on-lead-dis: #8a877f;
  }
}

/* an explicit choice wins in both directions - the catalog has a toggle */
:root[data-theme="dark"] {
  --ground: #1f1e1b;
  --frame: #080808;
  --shade: #0a0a09;
  --frame-ink: #8f8b81;

  --stock-lead: #e6e2d8;
  --stock-mark: #4f412e;
  --stock-plate: #3c4044;
  --stock-base: #35342f;

  --ink: #ece8de;
  --ink-2: #bdb8ac;
  --ink-dis: #7a776e;
  --ink-dis-mark: #837154;
  --ink-dis-plate: #71757a;
  --ink-on-lead: #161616;
  --ink-on-lead-2: #3e3a33;
  --ink-on-lead-dis: #8a877f;
}

* { margin: 0; padding: 0; box-sizing: border-box; }

html { background: var(--frame); }

body {
  background: var(--frame);
  padding: var(--frame-w);
  color: var(--ink);
  font-family: var(--font-fine);
  font-size: 14px;
  line-height: 1.45;
}

::selection { background: var(--stock-lead); color: var(--ink-on-lead); }

:focus-visible { outline: 2px solid currentColor; outline-offset: 2px; }

img, svg { display: block; max-width: 100%; }

/* ---------- stocks: color is material ---------- */

.stock-lead  { background: var(--stock-lead);  color: var(--ink-on-lead); --c-ink-2: var(--ink-on-lead-2); --c-ink-dis: var(--ink-on-lead-dis); }
.stock-mark  { background: var(--stock-mark);  color: var(--ink); --c-ink-2: var(--ink-2); --c-ink-dis: var(--ink-dis-mark); }
.stock-plate { background: var(--stock-plate); color: var(--ink); --c-ink-2: var(--ink-2); --c-ink-dis: var(--ink-dis-plate); }
.stock-base  { background: var(--stock-base);  color: var(--ink); --c-ink-2: var(--ink-2); --c-ink-dis: var(--ink-dis); }

/* ---------- frame chrome: registration marks + edge captions ---------- */

.frame-cross { position: fixed; z-index: 40; color: var(--frame-ink); width: 12px; height: 12px; }
.frame-cross.tl { top: 8px; left: 8px; }
.frame-cross.tr { top: 8px; right: 8px; }
.frame-cross.bl { bottom: 8px; left: 8px; }
.frame-cross.br { bottom: 8px; right: 8px; }

.frame-cap {
  position: fixed; z-index: 40;
  font-family: var(--font-mono); font-size: 9px; letter-spacing: 0.14em;
  text-transform: uppercase; color: var(--frame-ink); white-space: nowrap;
}
.frame-cap.top { top: 0; left: 48px; height: var(--frame-w); line-height: var(--frame-w); }
.frame-cap.bottom { bottom: 0; right: 48px; height: var(--frame-w); line-height: var(--frame-w); }
.frame-cap.left,
.frame-cap.right {
  writing-mode: vertical-rl; width: var(--frame-w);
  text-align: left; line-height: var(--frame-w);
}
.frame-cap.left { left: 0; top: 48px; transform: rotate(180deg); }
.frame-cap.right { right: 0; bottom: 48px; }

/* the concrete sheet inside the frame */
.sheet {
  background: var(--ground);
  min-height: calc(100vh - 2 * var(--frame-w));
  padding: clamp(20px, 4vw, 56px) clamp(16px, 4vw, 56px) clamp(28px, 4vw, 64px);
}
.sheet-inner { max-width: 1120px; margin: 0 auto; }

/* ---------- type voices ---------- */

.t-display {
  font-family: var(--font-display);
  text-transform: uppercase;
  letter-spacing: -0.01em;
  font-weight: 400;
  line-height: 0.96;
}
.t-data {
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  line-height: 1.7;
}
.t-data-sec { color: var(--c-ink-2); }
.t-fine {
  font-family: var(--font-fine);
  font-size: 10.5px;
  line-height: 1.5;
  text-align: justify;
}

.v-text { writing-mode: vertical-rl; transform: rotate(180deg); }

/* ---------- primitives ---------- */

/* thick rule with "I" end ticks */
.rule { position: relative; height: var(--rule-w); background: currentColor; }
.rule::before, .rule::after {
  content: ""; position: absolute; top: -4px;
  width: 2px; height: calc(var(--rule-w) + 8px); background: currentColor;
}
.rule::before { left: 0; }
.rule::after { right: 0; }
.rule-thin { height: 1px; background: currentColor; }

/* barcode: svg bars + digits beneath */
.barcode { color: inherit; }
.barcode svg { width: 100%; height: 30px; }
.barcode .digits {
  font-family: var(--font-mono); font-size: 9px; letter-spacing: 0.28em;
  text-transform: uppercase; margin-top: 4px; white-space: nowrap;
}

/* index stamp: bordered box, 01/007 style */
.stamp-index {
  display: inline-block; border: 1.5px solid currentColor;
  font-family: var(--font-mono); font-size: 10px; letter-spacing: 0.14em;
  padding: 4px 8px 3px; text-transform: uppercase;
}
.stamp-index.lg { font-size: 13px; padding: 6px 12px 5px; }

/* serial plate: stacked mono rows, optional rotated rows */
.serial-plate { border: 1.5px solid currentColor; padding: 8px 10px; display: flex; gap: 10px; }
.serial-plate .rows { flex: 1; }
.serial-plate .row {
  font-family: var(--font-mono); font-size: 9.5px; letter-spacing: 0.12em;
  text-transform: uppercase; padding: 3px 0; border-bottom: 1px solid currentColor;
}
.serial-plate .row:last-child { border-bottom: 0; }
.serial-plate .row-rot {
  writing-mode: vertical-rl; transform: rotate(180deg);
  font-family: var(--font-mono); font-size: 9.5px; letter-spacing: 0.12em;
  text-transform: uppercase; border-left: 1px solid currentColor; padding-left: 8px;
}

/* technical line drawings: stroke attrs live on the symbols themselves */
.tdraw svg { width: 100%; height: auto; }

/* registration cross specimen (in-flow, not the fixed frame ones) */
.regmark { width: 14px; height: 14px; color: inherit; }

/* ---------- strip label: the card primitive ---------- */

.strip {
  display: flex; flex-direction: column;
  width: 100%; max-width: 220px;
  padding: 14px 14px 16px;
  box-shadow: 6px 6px 0 var(--shade); /* resting sticker lift off the sheet */
}
.strip-word-area { flex: 1; display: flex; justify-content: center; min-height: 300px; padding: 6px 0 14px; }
.strip-word {
  writing-mode: vertical-rl; transform: rotate(180deg);
  font-family: var(--font-display); font-weight: 400;
  text-transform: uppercase; letter-spacing: -0.01em; line-height: 1;
  font-size: clamp(56px, 7.2vw, 92px);
}
.strip .rule { margin: 0 0 10px; }
.strip-rev {
  display: flex; justify-content: space-between;
  font-family: var(--font-mono); font-size: 9.5px; letter-spacing: 0.12em;
  text-transform: uppercase; margin-bottom: 12px;
}
.strip-mid { display: flex; gap: 10px; margin-bottom: 12px; min-height: 120px; }
.strip-data {
  writing-mode: vertical-rl; transform: rotate(180deg);
  font-family: var(--font-mono); font-size: 9px; letter-spacing: 0.1em;
  text-transform: uppercase; line-height: 1.8; color: var(--c-ink-2);
}
.strip-draw { flex: 1; display: flex; align-items: center; }
.strip .barcode { margin-bottom: 12px; }
.strip-foot { display: flex; justify-content: space-between; align-items: center; }
.strip-foot .made {
  font-family: var(--font-mono); font-size: 8.5px; letter-spacing: 0.12em;
  text-transform: uppercase; color: var(--c-ink-2);
}

/* ---------- section header: a lead label strip, not a heading ---------- */

.sec { margin-top: clamp(40px, 6vw, 72px); scroll-margin-top: 84px; }
.sec-head {
  background: var(--stock-lead); color: var(--ink-on-lead);
  --c-ink-2: var(--ink-on-lead-2);
  display: flex; align-items: baseline; justify-content: space-between;
  gap: 16px; padding: 10px 16px 8px; margin-bottom: 24px;
}
.sec-head h2 {
  font-family: var(--font-display); font-weight: 400; text-transform: uppercase;
  letter-spacing: -0.01em; font-size: clamp(20px, 3vw, 30px); line-height: 1;
}
.sec-head .idx {
  font-family: var(--font-mono); font-size: 10px; letter-spacing: 0.14em;
  text-transform: uppercase; color: var(--ink-on-lead-2); white-space: nowrap;
}

/* plates: rectangular specimen surfaces inside sections */
.plate { padding: 16px; box-shadow: 4px 4px 0 var(--shade); }
.plate-cap {
  font-family: var(--font-mono); font-size: 9px; letter-spacing: 0.14em;
  text-transform: uppercase; color: var(--c-ink-2); margin-bottom: 10px;
}

/* ---------- components ---------- */

/* stamp button: the one authored motion is the sticker lift */
.btn {
  display: inline-block; border: 0; cursor: pointer;
  background: var(--stock-lead); color: var(--ink-on-lead);
  font-family: var(--font-display); font-weight: 400;
  font-size: 14px; letter-spacing: 0.01em; text-transform: uppercase;
  padding: 10px 18px 9px; text-decoration: none; text-align: center;
  transition: transform var(--t-lift) var(--ease-lift),
              box-shadow var(--t-lift) var(--ease-lift);
}
.btn:hover, .btn.is-lifted { transform: translate(-2px, -2px); box-shadow: var(--lift); }
.btn:active, .btn.is-pressed { transform: translate(0, 0); box-shadow: none; }
.btn:disabled, .btn.is-disabled {
  cursor: not-allowed; color: var(--ink-on-lead-dis);
  outline: 1.5px dashed var(--ink-on-lead-dis); outline-offset: -4px;
  transform: none; box-shadow: none;
}
/* focus draws in the sheet's own ink, never in the stamp's ink - the ring sits
   on the surface around the stamp, so it must contrast with that surface */
.btn:focus-visible { outline: 2px solid var(--ink); outline-offset: 2px; }
.btn-base { background: var(--stock-base); color: var(--ink); border: 2px solid var(--ink); padding: 8px 16px 7px; }
.btn-base:disabled, .btn-base.is-disabled { color: var(--ink-dis); border-color: var(--ink-dis); border-style: dashed; outline: 0; }
.btn-mark { background: var(--stock-mark); color: var(--ink); border: 2px solid var(--ink); padding: 8px 16px 7px; }
.btn-mark:disabled, .btn-mark.is-disabled { color: var(--ink-dis-mark); border-color: var(--ink-dis-mark); border-style: dashed; outline: 0; }
/* frozen focus specimen for the catalog only */
.btn.is-focused { outline: 2px solid var(--ink); outline-offset: 2px; }

/* text field: ruled underline on base stock */
.field { display: block; }
.field .field-label {
  display: block; font-family: var(--font-mono); font-size: 9.5px;
  letter-spacing: 0.14em; text-transform: uppercase; margin-bottom: 6px;
}
.field input, .field select {
  width: 100%; border: 0; border-radius: 0; border-bottom: 2px solid var(--ink);
  background: var(--stock-base); color: var(--ink);
  font-family: var(--font-mono); font-size: 13px; letter-spacing: 0.08em;
  text-transform: uppercase; padding: 4px 2px 5px;
}
.field input::placeholder { color: var(--ink-2); opacity: 1; }
.field input:focus-visible { outline: 2px solid var(--ink); outline-offset: 3px; }
.field.is-error input { border-bottom-width: 3px; }
.field .field-error {
  display: inline-block; margin-top: 8px;
  background: var(--stock-lead); color: var(--ink-on-lead);
  font-family: var(--font-mono); font-size: 9px; letter-spacing: 0.12em;
  text-transform: uppercase; padding: 4px 8px 3px;
}
.field:not(.is-error) .field-error { display: none; }
.field input:disabled {
  color: var(--ink-dis); border-bottom-style: dashed; border-bottom-color: var(--ink-dis);
}
.field.is-disabled .field-label { color: var(--ink-dis); }

/* badges: small stock chips */
.badge {
  display: inline-block; font-family: var(--font-mono); font-size: 9px;
  letter-spacing: 0.14em; text-transform: uppercase; padding: 4px 8px 3px;
}
.badge.stock-mark, .badge.stock-plate, .badge.stock-base { border: 1px solid var(--ink); }
.badge.is-disabled { color: var(--c-ink-dis); border-style: dashed; }
.badge.stock-lead.is-disabled { color: var(--ink-on-lead-dis); border: 1px dashed var(--ink-on-lead-dis); }

/* spec table: thick top rule, thin row rules, mono values */
.spec-table { width: 100%; border-collapse: collapse; border-top: var(--rule-w) solid var(--ink); }
.spec-table caption {
  text-align: left; font-family: var(--font-mono); font-size: 9px;
  letter-spacing: 0.14em; text-transform: uppercase; color: var(--c-ink-2);
  padding: 0 0 8px;
}
.spec-table th, .spec-table td { border-bottom: 1px solid var(--ink); padding: 7px 4px 6px; vertical-align: top; }
.spec-table th {
  text-align: left; font-family: var(--font-fine); font-weight: 700;
  font-size: 11px; text-transform: uppercase; letter-spacing: 0.06em;
}
.spec-table td {
  text-align: right; font-family: var(--font-mono); font-size: 11px;
  letter-spacing: 0.08em; text-transform: uppercase;
}

/* checkbox: a stamp box struck with an X */
.check { display: flex; align-items: center; gap: 10px; cursor: pointer; position: relative; }
.check input { position: absolute; width: 18px; height: 18px; opacity: 0.0001; cursor: pointer; }
.check .box { width: 18px; height: 18px; border: 2px solid var(--ink); position: relative; flex: none; }
.check .box::before, .check .box::after {
  content: ""; position: absolute; left: 50%; top: 50%;
  width: 2px; height: 13px; background: var(--ink);
  transform: translate(-50%, -50%) rotate(45deg) scale(0);
}
.check .box::after { transform: translate(-50%, -50%) rotate(-45deg) scale(0); }
.check input:checked + .box::before { transform: translate(-50%, -50%) rotate(45deg) scale(1); }
.check input:checked + .box::after { transform: translate(-50%, -50%) rotate(-45deg) scale(1); }
.check input:focus-visible + .box { outline: 2px solid var(--ink); outline-offset: 2px; }
.check .check-label {
  font-family: var(--font-mono); font-size: 10px; letter-spacing: 0.12em;
  text-transform: uppercase;
}
.check.is-disabled { cursor: not-allowed; }
/* 1.5px keeps the dash fine enough to read as an edge, not corner marks */
.check.is-disabled .box { border: 1.5px dashed var(--c-ink-dis); }
.check.is-disabled .box::before, .check.is-disabled .box::after { background: var(--c-ink-dis); }
.check.is-disabled .check-label { color: var(--c-ink-dis); }
.check.is-disabled input { cursor: not-allowed; }

/* ---------- motion restraint ---------- */

@media (prefers-reduced-motion: reduce) {
  .btn { transition: none; }
}

/* ---------- responsive ---------- */

@media (max-width: 900px) {
  :root { --frame-w: 20px; }
}
@media (max-width: 720px) {
  :root { --frame-w: 14px; }
  .frame-cap { display: none; }
  .frame-cross { width: 9px; height: 9px; }
  .frame-cross.tl, .frame-cross.tr { top: 3px; }
  .frame-cross.bl, .frame-cross.br { bottom: 3px; }
  .frame-cross.tl, .frame-cross.bl { left: 3px; }
  .frame-cross.tr, .frame-cross.br { right: 3px; }
}
