/* ==========================================================================
   Kit Label Generator — screen UI + the four printable label layouts.
   Inherits tokens from ../../css/styles.css
   ========================================================================== */

.tool-body { background: var(--paper-2); }

.tool-head {
  position: sticky; top: 0; z-index: 100;
  background: rgba(255,255,255,0.94);
  backdrop-filter: saturate(1.4) blur(10px);
  border-bottom: 1px solid var(--line);
}
.tool-name {
  margin-right: auto;
  font-family: var(--f-mono); font-size: 12.5px; font-weight: 500;
  letter-spacing: 0.12em; text-transform: uppercase; color: var(--slate-2);
  padding-left: 22px; margin-left: 22px; border-left: 1px solid var(--line);
}
@media (max-width: 640px) { .tool-name { display: none; } }

.tool-main { padding-block: 56px 90px; }

/* Author-set `display` beats the UA rule for [hidden], and .btn sets
   display:inline-flex — so hidden buttons need this to actually hide. */
[hidden] { display: none !important; }

/* ---------------- shared form bits ---------------- */

.field { margin-bottom: 20px; }
.field label {
  display: block; margin-bottom: 7px;
  font-size: 14px; font-weight: 600; color: var(--ink);
}
.field .opt { font-weight: 400; color: var(--slate-2); }
.field input[type="text"],
.field input[type="email"],
.field textarea {
  width: 100%; min-height: 46px; padding: 11px 14px;
  font-family: inherit; font-size: 16px; color: var(--ink);
  background: #fff; border: 1px solid var(--line); border-radius: 3px;
  transition: border-color 150ms var(--ease), box-shadow 150ms var(--ease);
}
.field textarea { min-height: 78px; resize: vertical; line-height: 1.5; }
.field input:focus, .field textarea:focus {
  outline: none; border-color: var(--cobalt);
  box-shadow: 0 0 0 3px rgba(37,99,235,0.13);
}
.field-error { margin: 7px 0 0; font-size: 14px; color: #C0261F; font-weight: 500; }
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 0 22px; }
@media (max-width: 640px) { .grid-2 { grid-template-columns: 1fr; } }

/* ---------------- email gate ---------------- */

.gate { max-width: 620px; margin-inline: auto; }
.gate h1 {
  margin: 0 0 20px; font-size: clamp(34px, 5vw, 46px);
  line-height: 1.08; letter-spacing: -0.032em; font-weight: 600; color: var(--ink);
}
.gate-lede { margin: 0 0 28px; font-size: 18.5px; line-height: 1.6; color: var(--slate); }
.gate-points { list-style: none; margin: 0 0 34px; padding: 0; border-top: 1px solid var(--line); }
.gate-points li {
  position: relative; padding: 13px 0 13px 30px;
  border-bottom: 1px solid var(--line);
  font-size: 16.5px; color: var(--slate);
}
.gate-points li::before {
  content: ''; position: absolute; left: 2px; top: 21px;
  width: 8px; height: 8px; background: var(--cobalt);
}
.gate-form {
  background: #fff; border: 1px solid var(--line); border-radius: 4px;
  padding: 28px 26px 24px;
}
.gate-form .btn { width: 100%; }
.gate-fine { margin: 16px 0 0; font-size: 13.5px; line-height: 1.55; color: var(--slate-2); }
.gate-fine a { color: var(--slate); }

/* ---------------- setup ---------------- */

.setup-h {
  margin: 0 0 44px; font-size: clamp(30px, 4vw, 42px);
  letter-spacing: -0.03em; font-weight: 600; color: var(--ink);
}
.step {
  display: grid; grid-template-columns: 76px 1fr; gap: 20px;
  padding: 32px 0; border-top: 1px solid var(--line);
}
.step-no {
  font-family: var(--f-mono); font-size: 22px; color: var(--cobalt); line-height: 1.2;
}
.step-body h2 {
  margin: 0 0 6px; font-size: 24px; font-weight: 600;
  letter-spacing: -0.02em; color: var(--ink);
}
.step-hint { margin: 0 0 20px; font-size: 15.5px; line-height: 1.55; color: var(--slate); }
@media (max-width: 640px) {
  .step { grid-template-columns: 1fr; gap: 6px; }
}

.swatches { display: flex; flex-wrap: wrap; gap: 10px; }
.swatch {
  width: 42px; height: 42px; border-radius: 3px; cursor: pointer;
  border: 2px solid transparent; box-shadow: inset 0 0 0 1px rgba(0,0,0,0.12);
  transition: transform 140ms var(--ease);
}
.swatch:hover { transform: translateY(-2px); }
.swatch[aria-checked="true"] { border-color: var(--ink); }

.layouts { display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px; }
@media (max-width: 860px) { .layouts { grid-template-columns: repeat(2, 1fr); } }
.layout-opt {
  cursor: pointer; background: #fff; border: 1px solid var(--line);
  border-radius: 4px; padding: 12px; text-align: left;
  transition: border-color 150ms var(--ease), box-shadow 150ms var(--ease);
}
.layout-opt:hover { border-color: var(--slate-2); }
.layout-opt[aria-checked="true"] {
  border-color: var(--cobalt); box-shadow: 0 0 0 3px rgba(37,99,235,0.13);
}
.layout-opt h3 { margin: 10px 0 3px; font-size: 15px; font-weight: 600; color: var(--ink); }
.layout-opt p { margin: 0; font-size: 13px; line-height: 1.45; color: var(--slate-2); }
.layout-thumb {
  aspect-ratio: 210 / 297; background: #fff; border: 1px solid var(--line);
  display: block; overflow: hidden;
}

.fieldpicker { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; }
@media (max-width: 640px) { .fieldpicker { grid-template-columns: 1fr; } }
.fp-row {
  display: flex; align-items: center; gap: 12px;
  background: #fff; border: 1px solid var(--line); border-radius: 3px;
  padding: 12px 14px;
}
.fp-row input[type="checkbox"] { width: 19px; height: 19px; accent-color: var(--cobalt); flex: none; }
.fp-label { font-size: 15.5px; color: var(--ink); margin-right: auto; }
.fp-head {
  font-family: var(--f-mono); font-size: 10.5px; font-weight: 500;
  letter-spacing: 0.1em; text-transform: uppercase;
  padding: 4px 9px; border-radius: 2px; cursor: pointer;
  border: 1px solid var(--line); color: var(--slate-2); background: transparent;
  transition: all 140ms var(--ease);
}
.fp-head:hover { border-color: var(--slate-2); color: var(--slate); }
.fp-head[aria-pressed="true"] {
  background: var(--cobalt); border-color: var(--cobalt); color: #fff;
}

.setup-actions { padding-top: 32px; border-top: 1px solid var(--line); }

/* ---------------- generator ---------------- */

.gen { display: grid; grid-template-columns: minmax(0, 400px) minmax(0, 1fr); gap: 52px; align-items: start; }
@media (max-width: 1024px) { .gen { grid-template-columns: 1fr; gap: 40px; } }

.gen-h {
  margin: 0 0 26px; font-size: clamp(28px, 3.4vw, 38px);
  letter-spacing: -0.03em; font-weight: 600; color: var(--ink);
}
.gen-actions { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 8px; }
.gen-form .btn-lg { flex: 1; min-width: 180px; }

.preview-cap {
  margin: 0 0 12px;
  font-family: var(--f-mono); font-size: 11.5px; letter-spacing: 0.08em; color: var(--slate-2);
}
.preview-cap span { color: var(--cobalt); margin-right: 8px; }

/* The sheet is authored at true A4 mm, then scaled down for screen. */
.sheet-scaler {
  width: 100%;
  /* 210mm wide sheet scaled to fit the column */
  container-type: inline-size;
}
.sheet {
  width: 210mm; height: 297mm;
  background: #fff; box-shadow: 0 2px 20px rgba(15,23,42,0.13);
  transform-origin: top left;
  overflow: hidden;
}

/* ==========================================================================
   LABEL LAYOUTS — shared internals. All four are authored inside .sheet at
   real A4 size so screen preview and print output are identical.
   ========================================================================== */

.lb { width: 100%; height: 100%; box-sizing: border-box; font-family: var(--f-sans); color: #111; }
.lb * { box-sizing: border-box; }
.lb-co { font-size: 11pt; font-weight: 700; letter-spacing: 0.02em; }
.lb-site { font-size: 9.5pt; color: #555; }
.lb-key-lab {
  font-family: var(--f-mono); font-size: 9pt; letter-spacing: 0.16em;
  text-transform: uppercase; color: #666;
}
.lb-key-val { font-weight: 700; line-height: 0.95; letter-spacing: -0.02em; word-break: break-word; }
.lb-f-lab {
  font-family: var(--f-mono); font-size: 8.5pt; letter-spacing: 0.12em;
  text-transform: uppercase; color: #6b7280;
}
.lb-f-val { font-size: 15pt; font-weight: 600; line-height: 1.2; word-break: break-word; }
.lb-foot { font-size: 8pt; color: #9099a6; }
.lb-notes { font-size: 11pt; line-height: 1.4; color: #333; white-space: pre-wrap; }

/* --- A. BANDED : coloured bands top and bottom, tape strip, big centre --- */
.lb-banded { display: flex; flex-direction: column; padding: 8mm; }
.lb-banded .band {
  height: 22mm; display: flex; align-items: center; justify-content: space-between;
  padding: 0 8mm; color: #fff;
}
.lb-banded .band .lb-co, .lb-banded .band .lb-site { color: #fff; }
.lb-banded .tape {
  height: 16mm; background: #ececec; display: flex; align-items: center; justify-content: center;
  font-family: var(--f-mono); font-size: 8.5pt; letter-spacing: 0.3em; color: #98a0ab;
}
.lb-banded .body { flex: 1; border: 1.2mm solid; border-top: 0; border-bottom: 0; padding: 10mm 8mm; display: flex; flex-direction: column; }
.lb-banded .lb-hero { text-align: center; padding: 6mm 0 10mm; }
.lb-banded .lb-hero .lb-key-val { font-size: 74pt; }
.lb-banded .fields { display: grid; grid-template-columns: 1fr 1fr; gap: 7mm 8mm; }

/* --- B. GRID : bordered table, industrial and compact --- */
.lb-grid { padding: 10mm; display: flex; flex-direction: column; }
.lb-grid .head {
  display: flex; align-items: flex-end; justify-content: space-between;
  padding-bottom: 4mm; border-bottom: 1mm solid;
}
.lb-grid .lb-hero { padding: 9mm 0; text-align: left; }
.lb-grid .lb-hero .lb-key-val { font-size: 62pt; }
/* align-content:start stops rows stretching to fill the page when there are
   only a few fields — otherwise six fields become six enormous empty cells. */
.lb-grid .cells {
  flex: 1; display: grid; grid-template-columns: 1fr 1fr;
  align-content: start;
  border: 0.4mm solid #cfd4da; border-bottom: 0;
}
.lb-grid .cell { padding: 5mm 6mm; border-bottom: 0.4mm solid #cfd4da; }
.lb-grid .cell:nth-child(odd) { border-right: 0.4mm solid #cfd4da; }
.lb-grid .cell.full { grid-column: 1 / -1; border-right: 0; }

/* --- C. BIG : one enormous number, readable across an aisle --- */
.lb-big { padding: 12mm; display: flex; flex-direction: column; text-align: center; }
.lb-big .head { display: flex; justify-content: space-between; align-items: baseline; }
.lb-big .lb-hero { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; }
.lb-big .lb-hero .lb-key-lab { font-size: 12pt; margin-bottom: 4mm; }
.lb-big .lb-hero .lb-key-val { font-size: 118pt; }
.lb-big .rule { height: 3mm; margin: 8mm 0; }
.lb-big .fields { display: flex; flex-wrap: wrap; justify-content: center; gap: 6mm 12mm; }
.lb-big .fields > div { min-width: 38mm; }

/* --- D. SPLIT : key info left, details and a tick area right --- */
.lb-split { display: flex; }
.lb-split .left { width: 58%; padding: 12mm 8mm 10mm 12mm; display: flex; flex-direction: column; color: #fff; }
.lb-split .left .lb-key-lab, .lb-split .left .lb-f-lab { color: rgba(255,255,255,0.72); }
.lb-split .left .lb-co { color: #fff; }
.lb-split .left .lb-site { color: rgba(255,255,255,0.72); }
.lb-split .lb-hero { flex: 1; display: flex; flex-direction: column; justify-content: center; }
.lb-split .lb-hero .lb-key-val { font-size: 60pt; color: #fff; }
.lb-split .left .lb-f-val { color: #fff; font-size: 14pt; }
.lb-split .left .fields { display: grid; gap: 6mm; }
.lb-split .right { width: 42%; padding: 12mm 12mm 10mm 8mm; display: flex; flex-direction: column; }
.lb-split .right .fields { display: grid; gap: 6mm; }
.lb-split .checks { margin-top: auto; border-top: 0.4mm solid #cfd4da; padding-top: 5mm; }
.lb-split .check-row { display: flex; align-items: center; gap: 4mm; margin-top: 4mm; }
.lb-split .box { width: 7mm; height: 7mm; border: 0.5mm solid #98a0ab; flex: none; }
.lb-split .check-row span { font-size: 10pt; color: #555; }

/* ==========================================================================
   PRINT — isolate a single sheet at true A4 with no browser chrome.
   ========================================================================== */
@page { size: A4 portrait; margin: 0; }

@media print {
  .tool-head, .tool-foot, .gen-form, .preview-cap, .screen:not(.gen) { display: none !important; }
  html, body { background: #fff !important; margin: 0; padding: 0; }
  .tool-main { padding: 0 !important; max-width: none !important; }
  .gen { display: block !important; gap: 0 !important; }
  .sheet-scaler { width: auto !important; }
  .sheet {
    box-shadow: none !important;
    transform: none !important;
    width: 210mm !important; height: 297mm !important;
    page-break-after: avoid;
  }
  /* Colour bands must survive the print pipeline. */
  * { -webkit-print-color-adjust: exact !important; print-color-adjust: exact !important; }
}
