/* ==========================================================================
   Tokens
   ========================================================================== */
:root {
  --paper:        #F5F4EE;
  --card:         #FFFFFF;
  --ink:          #16171C;
  --ink-soft:     #5A5C66;
  --line:         #DEDAD0;
  --caution:      #FFC629;
  --caution-ink:  #16171C;
  --accent:       #E8384F;
  --accent-ink:   #FFFFFF;
  --focus:        #1C6DD0;

  --font-display: 'Space Grotesk', system-ui, sans-serif;
  --font-body:    'Inter', system-ui, sans-serif;
  --font-mono:    'JetBrains Mono', ui-monospace, 'SFMono-Regular', monospace;

  --radius: 10px;
  --shadow-card: 0 1px 2px rgba(22,23,28,0.06), 0 12px 28px -12px rgba(22,23,28,0.18);
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--font-body);
  -webkit-font-smoothing: antialiased;
}

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

:focus-visible {
  outline: 3px solid var(--focus);
  outline-offset: 2px;
  border-radius: 4px;
}

/* ==========================================================================
   Signature element: hazard-stripe edge
   ========================================================================== */
.tape-strip {
  height: 10px;
  width: 100%;
  background: repeating-linear-gradient(
    -45deg,
    var(--caution),
    var(--caution) 14px,
    var(--caution-ink) 14px,
    var(--caution-ink) 28px
  );
}

/* ==========================================================================
   Layout shell
   ========================================================================== */
.page {
  max-width: 1080px;
  margin: 0 auto;
  padding: 48px 24px 64px;
}

.site-header {
  text-align: center;
  margin-bottom: 40px;
}

.eyebrow {
  font-family: var(--font-mono);
  font-size: 12px;
  letter-spacing: 0.18em;
  font-weight: 700;
  color: var(--accent);
  margin: 0 0 10px;
}

.title {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: clamp(32px, 5vw, 48px);
  letter-spacing: -0.02em;
  margin: 0 0 10px;
}

.subtitle {
  font-size: 16px;
  color: var(--ink-soft);
  margin: 0;
  max-width: 46ch;
  margin-inline: auto;
}

.layout {
  display: grid;
  grid-template-columns: 340px 1fr;
  gap: 24px;
  align-items: start;
}

@media (max-width: 800px) {
  .layout { grid-template-columns: 1fr; }
}

.panel {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 24px;
}

/* ==========================================================================
   Form controls
   ========================================================================== */
.field { margin-bottom: 18px; }

.field-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
  margin-bottom: 18px;
}

label {
  display: block;
  font-size: 13px;
  font-weight: 600;
  margin-bottom: 6px;
}

input[type="text"],
select {
  width: 100%;
  padding: 11px 12px;
  font-family: var(--font-mono);
  font-size: 15px;
  color: var(--ink);
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: 6px;
}

select { font-family: var(--font-body); }

input[type="range"] {
  width: 100%;
  accent-color: var(--accent);
}

.hint {
  font-size: 12px;
  color: var(--ink-soft);
  margin: 6px 0 0;
  line-height: 1.4;
}

.checks {
  grid-template-columns: 1fr 1fr;
}

.checkbox {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
}

.checkbox input { accent-color: var(--accent); width: 16px; height: 16px; }

.btn {
  font-family: var(--font-body);
  font-weight: 600;
  font-size: 14px;
  padding: 11px 16px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: var(--card);
  color: var(--ink);
  cursor: pointer;
  transition: transform 0.12s ease, background 0.12s ease, border-color 0.12s ease;
}

.btn:hover { border-color: var(--ink); }
.btn:active { transform: scale(0.97); }

.btn-primary {
  width: 100%;
  background: var(--ink);
  color: var(--card);
  border-color: var(--ink);
}
.btn-primary:hover { background: #000; }

.btn-accent {
  background: var(--accent);
  color: var(--accent-ink);
  border-color: var(--accent);
}
.btn-accent:hover { background: #d12a40; }

.error {
  margin-top: 12px;
  font-size: 13px;
  color: var(--accent);
  font-weight: 600;
}

.panel-footnote {
  margin-top: 22px;
  padding-top: 18px;
  border-top: 1px dashed var(--line);
  font-size: 12px;
  color: var(--ink-soft);
}

.panel-footnote p { margin: 0 0 6px; }

.link-mono {
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--focus);
  word-break: break-all;
}

/* ==========================================================================
   Preview / label card
   ========================================================================== */
.preview {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 20px;
}

.label-card {
  position: relative;
  width: 100%;
  background: var(--card);
  border: 1px dashed var(--line);
  border-radius: 14px;
  box-shadow: var(--shadow-card);
  padding: 40px 24px 24px;
  display: flex;
  flex-direction: column;
  align-items: center;
  overflow: hidden;
}

.punch {
  position: absolute;
  top: 14px;
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: var(--paper);
  border: 1px solid var(--line);
}
.punch-left { left: 16px; }
.punch-right { right: 16px; }

.svg-wrap {
  width: 100%;
  display: flex;
  justify-content: center;
  overflow-x: auto;
  padding: 6px 0;
}

#barcode-svg, #scan-overlay-svg { max-width: 100%; height: auto; }

.label-caption {
  margin: 14px 0 0;
  font-family: var(--font-mono);
  font-size: 12px;
  letter-spacing: 0.08em;
  color: var(--ink-soft);
  text-transform: uppercase;
}

.label-card.dark {
  background: var(--ink);
  border-color: #34353d;
}
.label-card.dark .label-caption { color: #9EA0AA; }
.label-card.dark .punch { background: var(--ink); border-color: #34353d; }

.scan-line {
  position: absolute;
  left: 0;
  right: 0;
  top: 0;
  height: 3px;
  background: linear-gradient(90deg, transparent, var(--accent), transparent);
  opacity: 0;
  pointer-events: none;
}

.scan-line.sweep {
  animation: sweep 0.9s ease-out;
}

@keyframes sweep {
  0%   { top: 10%; opacity: 1; }
  100% { top: 92%; opacity: 0; }
}

@media (prefers-reduced-motion: reduce) {
  .scan-line.sweep { animation: none; opacity: 0; }
}

.actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  justify-content: center;
}

.copy-status {
  min-height: 18px;
  font-size: 13px;
  color: var(--ink-soft);
  margin: 0;
}

/* ==========================================================================
   Full-screen scan mode
   ========================================================================== */
.scan-overlay {
  position: fixed;
  inset: 0;
  background: #FFFFFF;
  z-index: 999;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 24px;
}

.scan-overlay[hidden] {
  display: none;
}

.scan-overlay-inner {
  width: 100%;
  max-width: 900px;
  text-align: center;
}

.scan-overlay-caption {
  margin-top: 18px;
  font-family: var(--font-mono);
  font-size: 16px;
  letter-spacing: 0.08em;
  color: #16171C;
}

.scan-overlay-close {
  position: absolute;
  top: 20px;
  right: 20px;
  border: 1px solid var(--line);
  background: var(--paper);
  border-radius: 999px;
  padding: 8px 16px;
  font-family: var(--font-body);
  font-weight: 600;
  font-size: 13px;
  cursor: pointer;
}

.scan-overlay-hint {
  position: absolute;
  bottom: 28px;
  font-size: 13px;
  color: var(--ink-soft);
}

/* ==========================================================================
   Footer
   ========================================================================== */
.site-footer {
  margin-top: 40px;
  text-align: center;
  font-size: 12px;
  color: var(--ink-soft);
  max-width: 56ch;
  margin-inline: auto;
}
