/* ============================================================
   Presscode — design tokens
   A print-shop / registration-mark aesthetic: QR codes are ink
   on paper, so the UI borrows from proof sheets, crop marks and
   plate stock rather than generic app "cards".
   ============================================================ */

:root {
  --ink:        #15181C;
  --ink-70:     rgba(21, 24, 28, 0.7);
  --ink-45:     rgba(21, 24, 28, 0.45);
  --line:       rgba(21, 24, 28, 0.14);
  --line-strong: rgba(21, 24, 28, 0.28);

  --paper:      #EEF0EC;
  --paper-2:    #E4E7E0;
  --stock:      #FFFFFF;

  --red:        #E3402F;
  --red-ink:    #B72E20;
  --mint:       #2FA86D;

  --grey:       #787E82;

  --font-display: 'Space Mono', 'IBM Plex Mono', ui-monospace, 'SF Mono', Menlo, monospace;
  --font-body:    'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;

  --radius: 3px;
  --shadow-flat: 0 1px 0 var(--line);
  --container: 1180px;
}

* { box-sizing: border-box; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.001ms !important;
    scroll-behavior: auto !important;
  }
}

html { scroll-behavior: smooth; }

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--font-body);
  font-size: 16px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

a { color: inherit; }

:focus-visible {
  outline: 2px solid var(--red);
  outline-offset: 2px;
}

.wrap {
  max-width: var(--container);
  margin: 0 auto;
  padding: 0 28px;
}

/* ---------------- background texture ---------------- */
/* Faint repeating QR "finder pattern" corner squares — the one
   decorative signature of the page, kept subtle everywhere. */
.finder-field {
  position: fixed;
  inset: 0;
  z-index: -1;
  pointer-events: none;
  background-image:
    repeating-linear-gradient(0deg, var(--line) 0 1px, transparent 1px 64px),
    repeating-linear-gradient(90deg, var(--line) 0 1px, transparent 1px 64px);
  opacity: 0.35;
  mask-image: radial-gradient(ellipse 90% 60% at 50% 0%, black 0%, transparent 75%);
}

/* ---------------- header ---------------- */

.site-header {
  border-bottom: 1px solid var(--line);
  background: var(--paper);
  position: sticky;
  top: 0;
  z-index: 30;
}

.site-header .wrap {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 64px;
}

.brand {
  display: flex;
  align-items: baseline;
  gap: 10px;
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 17px;
  letter-spacing: 0.02em;
  text-decoration: none;
  color: var(--ink);
}

.brand .mark {
  display: inline-grid;
  grid-template-columns: repeat(3, 5px);
  grid-template-rows: repeat(3, 5px);
  gap: 2px;
}
.brand .mark span { background: var(--ink); display: block; }
.brand .mark span:nth-child(2),
.brand .mark span:nth-child(4),
.brand .mark span:nth-child(6),
.brand .mark span:nth-child(8) { background: transparent; }
.brand .mark span:nth-child(5) { background: var(--red); }

.brand small {
  font-family: var(--font-body);
  font-weight: 500;
  font-size: 12px;
  color: var(--grey);
  letter-spacing: 0;
}

.header-tag {
  font-family: var(--font-display);
  font-size: 12px;
  color: var(--grey);
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

@media (max-width: 640px) {
  .header-tag { display: none; }
}

/* ---------------- hero copy ---------------- */

.hero {
  padding: 56px 0 28px;
}

.hero .eyebrow {
  font-family: var(--font-display);
  font-size: 12px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--red-ink);
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 18px;
}

.hero .eyebrow::before {
  content: '';
  width: 18px;
  height: 1px;
  background: var(--red);
}

.hero h1 {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: clamp(32px, 5vw, 54px);
  line-height: 1.05;
  letter-spacing: -0.01em;
  margin: 0 0 18px;
  max-width: 16ch;
}

.hero p.lede {
  font-size: 17px;
  color: var(--ink-70);
  max-width: 52ch;
  margin: 0;
}

/* ---------------- the tool: a "proof sheet" ---------------- */

.proof {
  position: relative;
  background: var(--stock);
  border: 1px solid var(--line-strong);
  margin: 36px 0 64px;
  padding: 2px;
}

/* registration / crop marks at each corner — the signature element */
.reg-mark {
  position: absolute;
  width: 22px;
  height: 22px;
  pointer-events: none;
}
.reg-mark::before, .reg-mark::after {
  content: '';
  position: absolute;
  background: var(--red);
}
.reg-mark::before { width: 100%; height: 1px; top: 50%; left: 0; transform: translateY(-50%); }
.reg-mark::after  { width: 1px; height: 100%; left: 50%; top: 0; transform: translateX(-50%); }
.reg-mark .dot {
  position: absolute;
  width: 5px; height: 5px;
  border-radius: 50%;
  border: 1px solid var(--red);
  top: 50%; left: 50%;
  transform: translate(-50%, -50%);
}
.reg-mark.tl { top: -11px; left: -11px; }
.reg-mark.tr { top: -11px; right: -11px; }
.reg-mark.bl { bottom: -11px; left: -11px; }
.reg-mark.br { bottom: -11px; right: -11px; }

.proof-inner {
  padding: 8px;
  display: grid;
  grid-template-columns: minmax(0, 1.25fr) minmax(0, 1fr);
  gap: 0;
}

@media (max-width: 900px) {
  .proof-inner { grid-template-columns: 1fr; }
}

/* ------------- tabs (mode selector) ------------- */

.tabs {
  display: flex;
  border-bottom: 1px solid var(--line);
  padding: 0 24px;
  overflow-x: auto;
}

.tab {
  font-family: var(--font-display);
  font-size: 13px;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  background: none;
  border: none;
  padding: 18px 4px;
  margin-right: 26px;
  color: var(--grey);
  cursor: pointer;
  position: relative;
  white-space: nowrap;
}

.tab:hover { color: var(--ink); }

.tab[aria-selected="true"] {
  color: var(--ink);
}
.tab[aria-selected="true"]::after {
  content: '';
  position: absolute;
  left: 0; right: 0; bottom: -1px;
  height: 2px;
  background: var(--red);
}

/* ------------- form area ------------- */

.form-pane { padding: 26px 24px 22px; }

.field { margin-bottom: 18px; }

.field label {
  display: block;
  font-family: var(--font-display);
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--grey);
  margin-bottom: 7px;
}

.field .hint {
  font-size: 12.5px;
  color: var(--grey);
  margin-top: 6px;
}

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

textarea { resize: vertical; min-height: 84px; }

input:focus, textarea:focus, select:focus {
  outline: none;
  border-color: var(--red);
  box-shadow: 0 0 0 3px rgba(227, 64, 47, 0.14);
}

.char-count {
  font-family: var(--font-display);
  font-size: 11px;
  color: var(--grey);
  text-align: right;
  margin-top: 6px;
}
.char-count.over { color: var(--red-ink); }

.row-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
@media (max-width: 480px) { .row-2 { grid-template-columns: 1fr; } }

.check-row {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13.5px;
  color: var(--ink-70);
}

/* ------------- options strip ------------- */

.options {
  border-top: 1px dashed var(--line-strong);
  margin-top: 4px;
  padding-top: 18px;
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 14px;
}
@media (max-width: 620px) { .options { grid-template-columns: 1fr 1fr; } }

.swatch-input {
  display: flex;
  align-items: center;
  gap: 8px;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius);
  padding: 6px 10px;
  background: var(--paper);
}
.swatch-input input[type="color"] {
  width: 24px; height: 24px;
  border: none;
  background: none;
  padding: 0;
  cursor: pointer;
}
.swatch-input span {
  font-family: var(--font-display);
  font-size: 12.5px;
  color: var(--ink-70);
}

/* ------------- buttons ------------- */

.btn {
  font-family: var(--font-display);
  font-size: 13px;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  border: 1px solid var(--ink);
  background: var(--ink);
  color: var(--paper);
  padding: 13px 22px;
  border-radius: var(--radius);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 9px;
  transition: transform 0.08s ease, background 0.15s ease;
}
.btn:hover { background: #262b31; }
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: 0.45; cursor: not-allowed; }

.btn.primary { background: var(--red); border-color: var(--red); color: #fff; }
.btn.primary:hover { background: var(--red-ink); }

.btn.ghost {
  background: transparent;
  color: var(--ink);
  border-color: var(--line-strong);
}
.btn.ghost:hover { border-color: var(--ink); }

.btn.block { width: 100%; justify-content: center; }

.actions-row { display: flex; gap: 10px; margin-top: 22px; flex-wrap: wrap; }

/* ------------- preview panel ------------- */

.preview-pane {
  background: var(--paper-2);
  border-left: 1px solid var(--line);
  padding: 26px 24px;
  display: flex;
  flex-direction: column;
}

@media (max-width: 900px) {
  .preview-pane { border-left: none; border-top: 1px solid var(--line); }
}

.preview-label {
  font-family: var(--font-display);
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--grey);
  margin-bottom: 14px;
}

.preview-stage {
  flex: 1;
  min-height: 260px;
  background: var(--stock);
  border: 1px solid var(--line-strong);
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  overflow: hidden;
}

.preview-stage img {
  width: 78%;
  max-width: 260px;
  image-rendering: pixelated;
  display: block;
}

.preview-empty {
  text-align: center;
  color: var(--grey);
  font-size: 13.5px;
  padding: 20px;
  max-width: 220px;
}

.preview-empty .ghost-modules {
  width: 96px; height: 96px;
  margin: 0 auto 16px;
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  grid-template-rows: repeat(6, 1fr);
  gap: 3px;
  opacity: 0.35;
}
.preview-empty .ghost-modules span {
  background: var(--ink);
  border-radius: 1px;
}
.preview-empty .ghost-modules span:nth-child(3n) { background: transparent; }
.preview-empty .ghost-modules span:nth-child(7n) { background: var(--red); }

/* assembling-dots loading animation */
.assembling {
  display: grid;
  grid-template-columns: repeat(7, 12px);
  grid-template-rows: repeat(7, 12px);
  gap: 3px;
}
.assembling span {
  width: 12px; height: 12px;
  background: var(--ink);
  opacity: 0;
  animation: pc-pop 900ms ease-in-out infinite;
}
@keyframes pc-pop {
  0% { opacity: 0; transform: scale(0.4); }
  35% { opacity: 1; transform: scale(1); }
  70% { opacity: 1; }
  100% { opacity: 0; transform: scale(0.4); }
}

.preview-error {
  color: var(--red-ink);
  font-size: 13.5px;
  text-align: center;
  padding: 20px;
  max-width: 240px;
}

.preview-data {
  margin-top: 16px;
  font-family: var(--font-display);
  font-size: 12px;
  color: var(--ink-70);
  word-break: break-all;
  background: var(--stock);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 10px 12px;
  display: none;
}
.preview-data.show { display: block; }

.preview-actions { margin-top: 16px; display: flex; gap: 10px; flex-wrap: wrap; }

/* ------------- multi-url rows ------------- */

.url-rows { display: flex; flex-direction: column; gap: 10px; margin-bottom: 8px; }

.url-row { display: flex; gap: 8px; align-items: center; }
.url-row input { flex: 1; }

.row-remove {
  background: none;
  border: 1px solid var(--line-strong);
  color: var(--grey);
  width: 40px;
  height: 42px;
  flex-shrink: 0;
  border-radius: var(--radius);
  cursor: pointer;
  font-size: 16px;
  line-height: 1;
}
.row-remove:hover { color: var(--red-ink); border-color: var(--red); }

.batch-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
  gap: 12px;
  margin-top: 6px;
}

.batch-item {
  background: var(--stock);
  border: 1px solid var(--line);
  padding: 10px;
  text-align: center;
}
.batch-item img { width: 100%; display: block; image-rendering: pixelated; }
.batch-item .u {
  font-size: 10.5px;
  color: var(--grey);
  margin-top: 6px;
  word-break: break-all;
  font-family: var(--font-display);
}
.batch-item.failed { border-color: var(--red); }
.batch-item .fail-msg { font-size: 11px; color: var(--red-ink); padding: 14px 0; }

/* ------------- social platform grid ------------- */

.platform-grid {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 8px;
  margin-bottom: 20px;
}
@media (max-width: 620px) { .platform-grid { grid-template-columns: repeat(3, 1fr); } }

.platform-btn {
  font-family: var(--font-display);
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.02em;
  border: 1px solid var(--line-strong);
  background: var(--paper);
  padding: 12px 6px;
  border-radius: var(--radius);
  cursor: pointer;
  text-align: center;
  color: var(--ink-70);
}
.platform-btn[aria-pressed="true"] {
  border-color: var(--red);
  color: var(--ink);
  background: var(--stock);
  box-shadow: inset 0 0 0 1px var(--red);
}
.platform-btn:hover { border-color: var(--ink); }

.social-fields { display: none; }
.social-fields.active { display: block; }

/* ------------- alerts ------------- */

.alert {
  border: 1px solid var(--red);
  background: rgba(227, 64, 47, 0.06);
  color: var(--red-ink);
  font-size: 13.5px;
  padding: 12px 14px;
  border-radius: var(--radius);
  margin-bottom: 16px;
  display: none;
}
.alert.show { display: block; }

/* ------------- info strip below tool ------------- */

.info-strip {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 24px;
  padding: 40px 0 60px;
  border-top: 1px solid var(--line);
}
@media (max-width: 760px) { .info-strip { grid-template-columns: 1fr; } }

.info-strip .col .k {
  font-family: var(--font-display);
  font-size: 12px;
  color: var(--red-ink);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  margin-bottom: 8px;
}
.info-strip .col p {
  margin: 0;
  color: var(--ink-70);
  font-size: 14px;
  line-height: 1.55;
}

/* ------------- footer ------------- */

.site-footer {
  border-top: 1px solid var(--line);
  padding: 22px 0;
}
.site-footer .wrap {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 12.5px;
  color: var(--grey);
  flex-wrap: wrap;
  gap: 8px;
}
.site-footer a { text-decoration: underline; }

.visually-hidden {
  position: absolute;
  width: 1px; height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
}
