/* NGT Certificate Studio — interface
   Chrome: printer's press-room dark navy. Accent: the certificates' own gold foil.
   All fonts self-hosted, SIL OFL. */

/* ---------- fonts ---------- */
@font-face { font-family: 'Cinzel'; font-weight: 400; font-style: normal; font-display: swap;
  src: url('fonts/Cinzel-Regular.woff2?v=1') format('woff2'); }
@font-face { font-family: 'Cinzel'; font-weight: 700; font-style: normal; font-display: swap;
  src: url('fonts/Cinzel-Bold.woff2?v=1') format('woff2'); }
@font-face { font-family: 'Cormorant Garamond'; font-weight: 400; font-style: normal; font-display: swap;
  src: url('fonts/CormorantGaramond-Regular.woff2?v=1') format('woff2'); }
@font-face { font-family: 'Cormorant Garamond'; font-weight: 500; font-style: normal; font-display: swap;
  src: url('fonts/CormorantGaramond-Medium.woff2?v=1') format('woff2'); }
@font-face { font-family: 'Cormorant Garamond'; font-weight: 600; font-style: normal; font-display: swap;
  src: url('fonts/CormorantGaramond-SemiBold.woff2?v=1') format('woff2'); }
@font-face { font-family: 'Cormorant Garamond'; font-weight: 400; font-style: italic; font-display: swap;
  src: url('fonts/CormorantGaramond-Italic.woff2?v=1') format('woff2'); }
@font-face { font-family: 'Great Vibes'; font-weight: 400; font-style: normal; font-display: swap;
  src: url('fonts/GreatVibes-Regular.woff2?v=1') format('woff2'); }
@font-face { font-family: 'Inter'; font-weight: 400; font-style: normal; font-display: swap;
  src: url('fonts/Inter-Regular.woff2?v=1') format('woff2'); }
@font-face { font-family: 'Inter'; font-weight: 500; font-style: normal; font-display: swap;
  src: url('fonts/Inter-Medium.woff2?v=1') format('woff2'); }
@font-face { font-family: 'Inter'; font-weight: 600; font-style: normal; font-display: swap;
  src: url('fonts/Inter-SemiBold.woff2?v=1') format('woff2'); }
@font-face { font-family: 'JetBrains Mono'; font-weight: 400; font-style: normal; font-display: swap;
  src: url('fonts/JetBrainsMono-Regular.woff2?v=1') format('woff2'); }
@font-face { font-family: 'JetBrains Mono'; font-weight: 600; font-style: normal; font-display: swap;
  src: url('fonts/JetBrainsMono-SemiBold.woff2?v=1') format('woff2'); }

/* ---------- tokens ---------- */
:root {
  --bg: #0E1320;
  --bg-2: #141A2B;
  --panel: #171E31;
  --panel-2: #1C2439;
  --edge: #263049;
  --text: #E9ECF4;
  --text-dim: #9BA5BD;
  --text-faint: #6B7690;
  --foil: #B08D3F;
  --foil-bright: #D3B269;
  --paper: #F6F3EC;
  --ok: #4CAF7D;
  --radius: 10px;
  --ui: 'Inter', system-ui, sans-serif;
  --mono: 'JetBrains Mono', ui-monospace, monospace;
  --display: 'Cinzel', serif;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  background: radial-gradient(1200px 700px at 70% -10%, #182036 0%, var(--bg) 55%);
  color: var(--text);
  font-family: var(--ui);
  font-size: 14px;
  line-height: 1.5;
  min-height: 100vh;
}

/* ---------- header ---------- */
.hdr {
  display: flex; align-items: center; gap: 14px;
  padding: 14px 22px;
  border-bottom: 1px solid var(--edge);
  background: linear-gradient(180deg, rgba(23,30,49,.9), rgba(20,26,43,.9));
  position: sticky; top: 0; z-index: 20;
  backdrop-filter: blur(6px);
}
.hdr::before {
  content: ''; position: absolute; top: 0; left: 0; right: 0; height: 2px;
  background: linear-gradient(90deg, transparent, var(--foil) 18%, var(--foil-bright) 50%, var(--foil) 82%, transparent);
}
.brand { display: flex; align-items: center; gap: 12px; text-decoration: none; color: inherit; }
.brand canvas { width: 30px; height: 30px; display: block; }
.brand .wordmark { font-family: var(--display); font-weight: 700; font-size: 17px; letter-spacing: .08em; }
.brand .wordmark small { display: block; font-family: var(--ui); font-weight: 500; font-size: 10px;
  letter-spacing: .28em; color: var(--foil-bright); text-transform: uppercase; }
.hdr .spacer { flex: 1; }
.pill {
  font-family: var(--mono); font-size: 11.5px; letter-spacing: .04em;
  padding: 7px 12px; border-radius: 999px; border: 1px solid var(--edge);
  color: var(--text-dim); background: var(--bg-2); white-space: nowrap;
}
.pill.unlocked { color: #BFE8D2; border-color: rgba(76,175,125,.5); background: rgba(76,175,125,.12); }

.btn {
  appearance: none; border: 1px solid var(--edge); border-radius: 8px;
  background: var(--panel-2); color: var(--text);
  font-family: var(--ui); font-weight: 600; font-size: 13px;
  padding: 9px 14px; cursor: pointer; text-decoration: none; display: inline-flex;
  align-items: center; gap: 8px; transition: border-color .15s, background .15s, transform .05s;
}
.btn:hover { border-color: var(--foil); }
.btn:active { transform: translateY(1px); }
.btn:focus-visible, input:focus-visible, select:focus-visible, textarea:focus-visible, .swatch:focus-visible {
  outline: 2px solid var(--foil-bright); outline-offset: 2px;
}
.btn.primary {
  background: linear-gradient(180deg, var(--foil-bright), var(--foil));
  border-color: var(--foil); color: #171204;
}
.btn.primary:hover { filter: brightness(1.06); }
.btn[disabled] { opacity: .45; cursor: not-allowed; }
.btn.small { padding: 6px 10px; font-size: 12px; }

/* ---------- layout ---------- */
.wrap {
  display: grid; grid-template-columns: 384px minmax(0, 1fr);
  gap: 20px; padding: 20px 22px 30px; max-width: 1720px; margin: 0 auto;
  align-items: start;
}

/* ---------- controls ---------- */
.controls { display: flex; flex-direction: column; gap: 14px; }
.card {
  background: var(--panel); border: 1px solid var(--edge); border-radius: var(--radius);
  padding: 14px 16px 16px;
}
.card h2 {
  margin: 0 0 10px; font-size: 11px; font-weight: 600; letter-spacing: .22em;
  text-transform: uppercase; color: var(--foil-bright);
  display: flex; align-items: center; gap: 8px;
}
.card h2 .line { flex: 1; height: 1px; background: var(--edge); }
label { display: block; font-size: 12px; color: var(--text-dim); margin: 10px 0 5px; }
label:first-of-type { margin-top: 0; }
input[type=text], select, textarea {
  width: 100%; background: var(--bg-2); color: var(--text);
  border: 1px solid var(--edge); border-radius: 7px;
  font-family: var(--ui); font-size: 13.5px; padding: 9px 11px;
}
textarea { resize: vertical; min-height: 74px; line-height: 1.45; }
select { cursor: pointer; }
.row2 { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }

.swatches { display: flex; gap: 10px; align-items: center; margin-top: 4px; }
.swatch {
  width: 30px; height: 30px; border-radius: 50%; cursor: pointer; border: 2px solid var(--edge);
  padding: 0; position: relative; flex: none;
}
.swatch.active { border-color: var(--foil-bright); box-shadow: 0 0 0 3px rgba(211,178,105,.25); }
.swatch span { position: absolute; inset: 3px; border-radius: 50%; display: block; }
.swatch small { position: absolute; top: 110%; left: 50%; transform: translateX(-50%);
  font-size: 9.5px; color: var(--text-faint); letter-spacing: .04em; }
.swatches { padding-bottom: 16px; }

/* CSV */
.drop {
  border: 1.5px dashed var(--edge); border-radius: 8px; padding: 16px 12px;
  text-align: center; color: var(--text-dim); cursor: pointer; transition: border-color .15s, background .15s;
  background: var(--bg-2);
}
.drop:hover, .drop.over { border-color: var(--foil); background: rgba(176,141,63,.06); }
.drop strong { color: var(--text); font-weight: 600; }
.drop .hint { font-size: 11.5px; color: var(--text-faint); margin-top: 4px; }
.drop input { display: none; }
.csv-meta { font-family: var(--mono); font-size: 11.5px; color: var(--text-dim); margin-top: 10px; }
.csv-meta b { color: var(--foil-bright); font-weight: 600; }
.rec-list { margin: 8px 0 0; padding: 0; list-style: none; max-height: 148px; overflow: auto;
  border: 1px solid var(--edge); border-radius: 7px; background: var(--bg-2); }
.rec-list li { padding: 6px 10px; font-size: 12.5px; display: flex; gap: 8px; cursor: pointer;
  border-bottom: 1px solid rgba(38,48,73,.6); }
.rec-list li:last-child { border-bottom: 0; }
.rec-list li:hover { background: var(--panel-2); }
.rec-list li.active { background: rgba(176,141,63,.14); }
.rec-list li .n { font-family: var(--mono); color: var(--text-faint); min-width: 26px; }
.rec-list li .c { color: var(--text-faint); margin-left: auto; max-width: 46%; overflow: hidden;
  text-overflow: ellipsis; white-space: nowrap; }
.samplelink { font-size: 11.5px; color: var(--foil-bright); text-decoration: none; }
.samplelink:hover { text-decoration: underline; }

details.wording > summary { cursor: pointer; list-style: none; }
details.wording > summary::-webkit-details-marker { display: none; }
details.wording > summary h2 { margin-bottom: 0; }
details.wording > summary h2::after { content: '+'; color: var(--text-faint); font-size: 14px; }
details.wording[open] > summary h2::after { content: '–'; }
details.wording[open] > summary { margin-bottom: 10px; }

/* ---------- stage ---------- */
.stage { display: flex; flex-direction: column; gap: 14px; min-width: 0; }
.bed {
  background:
    radial-gradient(900px 420px at 50% 0%, rgba(211,178,105,.06), transparent 60%),
    var(--bg-2);
  border: 1px solid var(--edge); border-radius: var(--radius);
  padding: clamp(14px, 3vw, 34px);
  display: flex; align-items: center; justify-content: center;
}
.paper { position: relative; width: 100%; max-width: 1180px; }
.paper canvas {
  display: block; width: 100%; height: auto; border-radius: 3px;
  box-shadow: 0 1px 0 rgba(255,255,255,.06), 0 12px 32px rgba(0,0,0,.55), 0 40px 90px rgba(0,0,0,.45);
  background: var(--paper);
}
.loading {
  position: absolute; inset: 0; display: flex; align-items: center; justify-content: center;
  color: var(--text-faint); font-family: var(--mono); font-size: 12px; letter-spacing: .12em;
}

/* export bar */
.exportbar {
  display: flex; flex-wrap: wrap; gap: 10px; align-items: center;
  background: var(--panel); border: 1px solid var(--edge); border-radius: var(--radius);
  padding: 12px 14px;
}
.exportbar .grow { flex: 1; }
.stepper { display: inline-flex; align-items: center; gap: 8px; font-family: var(--mono); font-size: 12px;
  color: var(--text-dim); }
.stepper button { width: 28px; height: 28px; border-radius: 6px; border: 1px solid var(--edge);
  background: var(--bg-2); color: var(--text); cursor: pointer; font-size: 14px; line-height: 1; }
.stepper button:hover { border-color: var(--foil); }
.wm-note { font-size: 12px; color: var(--text-dim); }
.wm-note a { color: var(--foil-bright); }
.progress { font-family: var(--mono); font-size: 12px; color: var(--foil-bright); min-height: 16px; }

/* footer */
.foot {
  padding: 18px 22px 34px; color: var(--text-faint); font-size: 12px;
  max-width: 1720px; margin: 0 auto; display: flex; gap: 18px; flex-wrap: wrap; align-items: center;
}
.foot .privacy { color: var(--text-dim); }
.foot .privacy b { color: var(--foil-bright); font-weight: 600; }
.foot a { color: var(--text-dim); }
.foot .spacer { flex: 1; }

/* toast */
.toast {
  position: fixed; left: 50%; bottom: 26px; transform: translateX(-50%) translateY(20px);
  background: var(--panel-2); border: 1px solid var(--foil); color: var(--text);
  border-radius: 8px; padding: 10px 16px; font-size: 13px; opacity: 0; pointer-events: none;
  transition: opacity .2s, transform .2s; z-index: 50; max-width: 90vw;
}
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }

/* responsive */
@media (max-width: 980px) {
  .wrap { grid-template-columns: 1fr; padding: 14px; }
  .stage { order: -1; }
  .hdr { padding: 12px 14px; flex-wrap: wrap; }
  .hdr .pill { order: 3; }
}
@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; }
}
