/* GiftCase Studio — "Case File Noir" theme (single dark mode).
   Fonts are OFL files vendored in /fonts; fallbacks keep the layout if a file is missing. */

@font-face { font-family: 'Special Elite'; src: url('../fonts/SpecialElite-Regular.ttf') format('truetype'); font-display: swap; }
@font-face { font-family: 'Inter'; src: url('../fonts/Inter-Variable.ttf') format('truetype'); font-weight: 100 900; font-display: swap; }
@font-face { font-family: 'Courier Prime'; src: url('../fonts/CourierPrime-Regular.ttf') format('truetype'); font-display: swap; }
@font-face { font-family: 'Courier Prime'; src: url('../fonts/CourierPrime-Bold.ttf') format('truetype'); font-weight: 700; font-display: swap; }
@font-face { font-family: 'Atkinson Hyperlegible Next'; src: url('../fonts/AtkinsonHyperlegibleNext-Regular.ttf') format('truetype'); font-display: swap; }
@font-face { font-family: 'Atkinson Hyperlegible Next'; src: url('../fonts/AtkinsonHyperlegibleNext-Bold.ttf') format('truetype'); font-weight: 700; font-display: swap; }
@font-face { font-family: 'Be Vietnam Pro'; src: url('../fonts/BeVietnamPro-Regular.ttf') format('truetype'); font-display: swap; }
@font-face { font-family: 'Be Vietnam Pro'; src: url('../fonts/BeVietnamPro-Bold.ttf') format('truetype'); font-weight: 700; font-display: swap; }

:root {
  color-scheme: dark;
  --bg: #16171b;
  --surface: #1d1f24;
  --surface-2: #23252b;
  --raised: #2a2c33;
  --ink: #ece6d9;
  --muted: #a39d8f;
  --line: #33353c;
  --accent: #e0a63a;
  --accent-hover: #ebb757;
  --accent-ink: #16171b;
  --danger: #e0675b;
  --ok: #5b9f6f;
  --ok-bg: #1f2b23;
  --ok-ink: #a6d8b4;
  --err-bg: #2e1e1d;
  --err-ink: #f0aaa2;
  --paper: #efe6d2;
  --paper-ink: #2b2418;
  --paper-line: #b8a98a;
  --stamp: #b3261e;
  --radius: 6px;
  --font-ui: 'Inter', 'Be Vietnam Pro', system-ui, -apple-system, 'Segoe UI', sans-serif;
  --font-display: 'Special Elite', 'Be Vietnam Pro', 'Courier New', monospace;
  --font-book: 'Atkinson Hyperlegible Next', 'Be Vietnam Pro', 'Verdana', sans-serif;
  --font-book-head: 'Courier Prime', 'Be Vietnam Pro', 'Courier New', monospace;
  --focus: 0 0 0 3px rgba(224, 166, 58, .45);
}

* { box-sizing: border-box; }
html, body { margin: 0; min-height: 100%; }
body { background: var(--bg); color: var(--ink); font: 15px/1.5 var(--font-ui); -webkit-font-smoothing: antialiased; }
button, input, select, textarea { font: inherit; color: inherit; }
a { color: var(--accent); }
:focus-visible { outline: none; box-shadow: var(--focus); }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* ---------- top bar ---------- */
.topbar { position: sticky; top: 0; z-index: 10; display: flex; align-items: center; gap: 14px; padding: 12px 22px; background: var(--surface); border-bottom: 1px solid var(--line); }
.logo { display: flex; align-items: center; gap: 10px; font: 700 20px var(--font-display); color: var(--ink); text-decoration: none; letter-spacing: .02em; }
.logo .mark { width: 32px; height: 32px; border-radius: 8px; display: block; flex: none; }
.signin-logo { display: block; width: 88px; height: 88px; border-radius: 20px; margin: 0 0 18px; box-shadow: 0 8px 30px rgba(224,166,58,.25); }
.topbar .project-name { color: var(--muted); font-size: 14px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 30ch; }
.spacer { flex: 1; }
.badge { font-size: 12px; padding: 4px 10px; border-radius: 999px; border: 1px solid var(--line); color: var(--muted); white-space: nowrap; }
a.badge { text-decoration: none; }
a.badge:hover { color: var(--ink); border-color: var(--muted); }
.badge.warn { color: var(--accent); border-color: var(--accent); }
.banner { background: #3a2a10; border-bottom: 1px solid var(--accent); padding: 10px 22px; font-size: 14px; }
.banner a { color: var(--accent); }
.save-state { font-size: 12px; color: var(--muted); min-width: 60px; text-align: right; }

/* ---------- buttons ---------- */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; font-weight: 600; font-size: 14px; border: 1px solid transparent; padding: 10px 18px; border-radius: var(--radius); background: var(--accent); color: var(--accent-ink); cursor: pointer; text-decoration: none; transition: background .15s; }
.btn:hover { background: var(--accent-hover); }
.btn:disabled { opacity: .45; cursor: not-allowed; }
.btn.ghost { background: transparent; color: var(--ink); border-color: var(--line); }
.btn.ghost:hover { background: var(--raised); }
.btn.danger { background: transparent; color: var(--danger); border-color: var(--line); }
.btn.small { padding: 6px 12px; font-size: 13px; }
.btn.lg { padding: 14px 24px; font-size: 16px; }

/* ---------- forms ---------- */
label, .label { display: block; font-size: 12px; font-weight: 600; color: var(--muted); margin: 0 0 6px; text-transform: uppercase; letter-spacing: .12em; }
.field { margin-bottom: 18px; }
.hint { font-size: 13px; color: var(--muted); margin: 6px 0 0; }
.input, select.input, textarea.input { width: 100%; background: var(--surface-2); border: 1px solid var(--line); border-radius: var(--radius); padding: 11px 13px; font-size: 15px; color: var(--ink); }
.input:focus { border-color: var(--accent); }
textarea.input { resize: vertical; min-height: 72px; }
.row { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
input[type=range] { width: 100%; accent-color: var(--accent); }
.check { display: flex; gap: 8px; align-items: center; font-size: 14px; text-transform: none; letter-spacing: 0; color: var(--ink); }

.seg { display: inline-flex; flex-wrap: wrap; border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; background: var(--surface-2); }
.seg button { border: 0; border-right: 1px solid var(--line); background: transparent; padding: 9px 16px; font-size: 14px; color: var(--muted); cursor: pointer; }
.seg button:last-child { border-right: 0; }
.seg button[aria-pressed=true] { background: var(--accent); color: var(--accent-ink); font-weight: 600; }
.seg button:disabled { cursor: not-allowed; opacity: .6; }
.lock { font-size: 10px; font-weight: 700; margin-left: 6px; padding: 1px 5px; border: 1px solid currentColor; border-radius: 3px; letter-spacing: .06em; }

.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip { display: inline-flex; align-items: center; gap: 6px; padding: 7px 8px 7px 12px; border-radius: 999px; background: var(--raised); font-size: 14px; border: 1px solid transparent; }
.chip b { font-weight: 700; }
.chip .x { border: 0; background: transparent; color: var(--muted); cursor: pointer; width: 22px; height: 22px; border-radius: 50%; font-size: 14px; line-height: 1; }
.chip .x:hover { background: var(--line); color: var(--ink); }
.chip.add { background: transparent; border: 1px dashed var(--line); color: var(--muted); cursor: pointer; padding: 7px 14px; }
.chip.add:hover { color: var(--ink); border-color: var(--muted); }
.fact-editor { margin-top: 12px; padding: 16px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); }

.alert { padding: 10px 12px; border-radius: var(--radius); font-size: 14px; display: flex; gap: 8px; align-items: flex-start; }
.alert.ok { background: var(--ok-bg); color: var(--ok-ink); }
.alert.err { background: var(--err-bg); color: var(--err-ink); }
.alert.info { background: var(--surface-2); color: var(--muted); }

/* ---------- projects screen ---------- */
.projects { max-width: 1100px; margin: 0 auto; padding: 40px 22px 60px; }
.projects h1 { font: 700 34px var(--font-display); margin: 0 0 6px; letter-spacing: .02em; }
.projects .lead { color: var(--muted); margin: 0 0 28px; }
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 18px; }
.card { position: relative; background: var(--surface); border: 1px solid var(--line); border-radius: 8px; padding: 20px; display: flex; flex-direction: column; gap: 10px; min-height: 180px; }
.card.folder::before { content: ''; position: absolute; top: -9px; left: 18px; width: 90px; height: 10px; background: var(--surface); border: 1px solid var(--line); border-bottom: 0; border-radius: 6px 6px 0 0; }
.card h3 { margin: 0; font: 700 19px var(--font-display); }
.card .meta { color: var(--muted); font-size: 13px; }
.card .actions { margin-top: auto; display: flex; gap: 8px; }
.card.new { border-style: dashed; align-items: center; justify-content: center; text-align: center; cursor: pointer; color: var(--muted); background: transparent; }
.card.new:hover { border-color: var(--accent); color: var(--ink); }
.card.new .plus { font: 700 36px var(--font-display); color: var(--accent); }
.empty { text-align: center; padding: 50px 20px; border: 1px dashed var(--line); border-radius: 8px; }
.empty h2 { font: 700 24px var(--font-display); margin: 0 0 8px; }
.empty p { color: var(--muted); margin: 0 0 20px; }

/* ---------- wizard ---------- */
.wizard { display: grid; grid-template-columns: 220px minmax(0, 1fr) 420px; min-height: calc(100vh - 57px); }
.steps { padding: 22px 14px; border-right: 1px solid var(--line); }
.steps button { display: flex; width: 100%; align-items: center; gap: 10px; padding: 10px 12px; border-radius: var(--radius); font-size: 14px; color: var(--muted); margin-bottom: 4px; background: transparent; border: 0; cursor: pointer; text-align: left; }
.steps button:hover { background: var(--surface); color: var(--ink); }
.steps i { font-style: normal; width: 24px; height: 24px; flex: none; border-radius: 4px; display: grid; place-items: center; font-size: 12px; font-weight: 700; border: 1px solid var(--line); }
.steps .done i { background: var(--ok); color: #fff; border-color: transparent; }
.steps .on { background: var(--raised); color: var(--ink); font-weight: 600; }
.steps .on i { background: var(--accent); color: var(--accent-ink); border-color: transparent; }
.steps .missing i { border-color: var(--accent); color: var(--accent); }
.panel { padding: 30px 34px 40px; max-width: 760px; }
.panel h2 { font: 700 28px/1.2 var(--font-display); margin: 0 0 6px; letter-spacing: .02em; }
.panel .sub { color: var(--muted); margin: 0 0 26px; }
.panel .nav { display: flex; gap: 10px; margin-top: 28px; }

.preview { background: #121316; border-left: 1px solid var(--line); padding: 22px; display: flex; flex-direction: column; gap: 14px; position: sticky; top: 57px; align-self: start; height: calc(100vh - 57px); overflow: auto; }
.wizard.no-aside { grid-template-columns: 220px minmax(0, 1fr); }
.wizard.no-aside .preview { display: none; }
.page-empty { position: absolute; inset: 30% 12% auto; text-align: center; font: calc(14 * var(--pt)) / 1.5 var(--font-book); color: var(--paper-line); }
.pv-head { display: flex; justify-content: space-between; align-items: center; font-size: 13px; color: var(--muted); }

/* the paper page: everything inside .page is sized in real points (--pt = 1/72 in at
   the trim width), so the preview has the same proportions as the printed 18pt book. */
.sheet { container-type: inline-size; position: relative; overflow: hidden; background: var(--paper); color: var(--paper-ink); border-radius: 3px; box-shadow: 0 8px 28px rgba(0,0,0,.45); background-image: radial-gradient(circle at 85% 8%, rgba(120,90,40,.13), transparent 45%); }
.sheet.trim-6x9 { aspect-ratio: 432 / 648; --w: 432; }
.sheet.trim-letter { aspect-ratio: 612 / 792; --w: 612; }
.sheet.trim-a4 { aspect-ratio: 595.28 / 841.89; --w: 595.28; }
.page { --pt: calc(100cqw / var(--w)); position: absolute; inset: 0; padding: calc(36 * var(--pt)) calc(36 * var(--pt)) calc(40 * var(--pt)); }
.page .rh { font: 700 calc(12 * var(--pt)) var(--font-book-head); letter-spacing: .14em; text-transform: uppercase; border-bottom: calc(1.5 * var(--pt)) solid var(--paper-ink); padding-bottom: calc(4 * var(--pt)); margin-bottom: calc(6 * var(--pt)); display: flex; justify-content: space-between; }
.page .cols { display: grid; gap: 0 calc(18 * var(--pt)); }
.trim-letter .page .cols, .trim-a4 .page .cols { grid-template-columns: 1fr 1fr; }
.entry { display: grid; grid-template-columns: max-content minmax(0, 1fr); column-gap: .45em; font-family: var(--font-book); font-size: calc(18 * var(--pt)); line-height: 1.2; padding: calc(3 * var(--pt)) 0; border-bottom: calc(.75 * var(--pt)) dotted var(--paper-line); }
.entry > span { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.entry .no { font-weight: 700; grid-row: span 2; }
.entry .facts { font-size: calc(16 * var(--pt)); opacity: .8; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.entry.culprit { background: rgba(224,166,58,.35); }
.page .foot { position: absolute; bottom: calc(16 * var(--pt)); left: 0; right: 0; text-align: center; font-size: calc(10 * var(--pt)); opacity: .6; }
.stamp { position: absolute; right: calc(30 * var(--pt)); bottom: calc(44 * var(--pt)); transform: rotate(8deg); border: calc(2.5 * var(--pt)) solid var(--stamp); color: var(--stamp); font: calc(15 * var(--pt)) var(--font-display); text-transform: uppercase; padding: calc(2 * var(--pt)) calc(8 * var(--pt)); opacity: .5; pointer-events: none; }

.clues { list-style: none; counter-reset: clue; margin: 0; padding: 0; }
.clues li { counter-increment: clue; display: grid; grid-template-columns: 34px 1fr; gap: 8px; padding: 10px 0; border-bottom: 1px solid var(--line); }
.clues li::before { content: counter(clue); font: 700 15px var(--font-display); color: var(--accent); }
.clues .tag { font-size: 11px; color: var(--muted); margin-left: 6px; text-transform: uppercase; letter-spacing: .1em; }
.cipher { font: 17px/1.5 var(--font-book-head); background: var(--surface-2); border: 1px dashed var(--line); border-radius: var(--radius); padding: 14px; word-break: break-word; }
.pager { display: flex; justify-content: space-between; align-items: center; gap: 10px; margin: 10px 0 24px; font-size: 13px; color: var(--muted); }
.solution { margin-top: 12px; padding: 14px; border: 1px solid var(--line); border-radius: var(--radius); font-size: 14px; }
.solution p { margin: 4px 0; }
.section-title { font: 700 18px var(--font-display); margin: 28px 0 10px; }
.preview-big .sheet { max-width: 520px; }

/* ---------- responsive ---------- */
@media (max-width: 1180px) {
  .wizard, .wizard.no-aside { grid-template-columns: 200px minmax(0, 1fr); }
  .preview { display: none; }
}
@media (max-width: 760px) {
  .wizard.no-aside { grid-template-columns: 1fr; }
  .topbar { padding: 10px 16px; gap: 10px; }
  .topbar .project-name, .badge { display: none; }
  .wizard { grid-template-columns: 1fr; }
  .steps { display: flex; overflow-x: auto; gap: 4px; border-right: 0; border-bottom: 1px solid var(--line); padding: 10px 16px; }
  .steps button { white-space: nowrap; width: auto; margin: 0; }
  .panel { padding: 22px 16px 32px; }
  .row { grid-template-columns: 1fr; }
  .projects { padding: 28px 16px 40px; }
}

/* ---------- upgrades / locked features ---------- */
.toplink { color: var(--muted); text-decoration: none; font-size: 14px; }
.toplink:hover { color: var(--ink); }
.badge.ok { color: var(--ok-ink); border-color: var(--ok); }
.lock { color: var(--accent); }
.card.upgrade { gap: 12px; }
.card.upgrade.off { border-style: dashed; }
.upgrade-head { display: flex; gap: 12px; align-items: flex-start; }
.upgrade-head > div { flex: 1; }
.upgrade-icon { width: 38px; height: 38px; flex: none; border-radius: 6px; display: grid; place-items: center; font-size: 20px; background: var(--raised); color: var(--accent); }
.upgrade-list { margin: 0; padding-left: 18px; color: var(--muted); font-size: 14px; }
.upgrade-list li { margin: 2px 0; }
.locked-box { border: 1px dashed var(--accent); border-radius: var(--radius); padding: 14px 16px; background: rgba(224,166,58,.06); margin: 12px 0; }
.locked-box p { margin: 6px 0 12px; color: var(--muted); font-size: 14px; }
.locked-head { display: flex; gap: 10px; align-items: center; }
.tool-row { display: flex; gap: 10px; flex-wrap: wrap; margin: 10px 0; }

/* ---------- etsy order desk ---------- */
.etsy-step { border-top: 1px solid var(--line); padding-top: 6px; margin-top: 18px; }
.table-wrap { overflow-x: auto; border: 1px solid var(--line); border-radius: var(--radius); margin-top: 12px; max-height: 420px; overflow-y: auto; }
table.data { width: 100%; border-collapse: collapse; font-size: 14px; }
table.data th, table.data td { text-align: left; padding: 8px 10px; border-bottom: 1px solid var(--line); white-space: nowrap; }
table.data th { position: sticky; top: 0; background: var(--surface); color: var(--muted); font-weight: 600; }
table.data tr.bad td { color: var(--err-ink); }
.progress { position: relative; height: 26px; border: 1px solid var(--line); border-radius: var(--radius); margin: 14px 0; overflow: hidden; max-width: 480px; }
.progress .bar { position: absolute; inset: 0 auto 0 0; background: rgba(224,166,58,.35); transition: width .2s; }
.progress span { position: relative; display: block; text-align: center; line-height: 24px; font-size: 13px; }

/* ---------- prominent upgrades entry ---------- */
.upgrade-btn { position: relative; display: inline-flex; align-items: center; gap: 8px; margin-left: 10px; padding: 8px 14px 8px 12px; border-radius: 999px; background: linear-gradient(135deg, #f2c25b, #e0a63a 55%, #c98a1e); color: var(--accent-ink); font-weight: 700; font-size: 14px; text-decoration: none; box-shadow: 0 0 0 1px rgba(224,166,58,.5), 0 4px 18px rgba(224,166,58,.35); transition: transform .15s, box-shadow .15s; }
.upgrade-btn:hover { transform: translateY(-1px); box-shadow: 0 0 0 1px rgba(224,166,58,.7), 0 6px 24px rgba(224,166,58,.5); }
.upgrade-btn[aria-current=page] { box-shadow: 0 0 0 2px var(--ink); }
.upgrade-star { font-size: 15px; }
.upgrade-count { min-width: 20px; height: 20px; padding: 0 6px; border-radius: 999px; background: var(--accent-ink); color: var(--accent); font-size: 12px; display: grid; place-items: center; }
.upgrade-pulse { position: absolute; top: -3px; right: -3px; width: 10px; height: 10px; border-radius: 50%; background: #e0675b; box-shadow: 0 0 0 0 rgba(224,103,91,.7); animation: upgrade-pulse 2s infinite; }
@keyframes upgrade-pulse { 0% { box-shadow: 0 0 0 0 rgba(224,103,91,.7); } 70% { box-shadow: 0 0 0 10px rgba(224,103,91,0); } 100% { box-shadow: 0 0 0 0 rgba(224,103,91,0); } }
@media (prefers-reduced-motion: reduce) { .upgrade-pulse { animation: none; } }
.upgrade-btn.all { background: transparent; color: var(--ok-ink); box-shadow: 0 0 0 1px var(--ok); font-weight: 600; padding: 6px 12px; }
.upgrade-strip { display: flex; align-items: center; gap: 18px; justify-content: space-between; flex-wrap: wrap; padding: 16px 20px; margin: 0 0 26px; border-radius: 10px; text-decoration: none; color: var(--ink); background: linear-gradient(120deg, rgba(224,166,58,.18), rgba(224,166,58,.04) 60%), var(--surface); border: 1px solid rgba(224,166,58,.55); }
.upgrade-strip:hover { border-color: var(--accent); }
.upgrade-strip-text { display: flex; flex-direction: column; gap: 4px; }
.upgrade-strip-text b { font: 700 18px var(--font-display); color: var(--accent); }
.upgrade-strip-text span { color: var(--muted); font-size: 14px; }
@media (max-width: 760px) {
  .upgrade-btn { margin-left: 4px; padding: 6px 10px; font-size: 13px; }
  .topbar .logo { font-size: 0; gap: 0; }
}

/* ---------- in-app dialogs and file picker (no browser-language UI) ---------- */
.dialog-overlay { position: fixed; inset: 0; z-index: 100; background: rgba(0,0,0,.6); display: grid; place-items: center; padding: 16px; }
.dialog { max-width: 440px; width: 100%; background: var(--surface); border: 1px solid var(--line); border-radius: 10px; padding: 22px; box-shadow: 0 20px 60px rgba(0,0,0,.5); }
.dialog p { margin: 0 0 18px; font-size: 15px; }
.dialog-actions { display: flex; justify-content: flex-end; gap: 10px; }
.btn.danger-solid { background: var(--danger); color: #fff; }
.btn.danger-solid:hover { background: #ea7d72; }
.drop-zone { border: 1.5px dashed var(--line); border-radius: var(--radius); padding: 16px; background: var(--surface); transition: border-color .15s, background .15s; }
.drop-zone.over { border-color: var(--accent); background: rgba(224,166,58,.08); }
.file-row { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.file-name { color: var(--muted); font-size: 14px; word-break: break-all; }
.drop-zone .hint { margin-bottom: 0; }

/* OTO2 Marketplace Seller Kit */
.kit-questions { list-style: none; counter-reset: kq; padding: 0; margin: 0 0 12px; display: grid; gap: 10px; }
.kit-questions > li { counter-increment: kq; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface-2); padding: 12px 14px; }
.kit-q-head { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; }
.kit-q-head::before { content: counter(kq) "."; font-family: 'Courier Prime', monospace; color: var(--accent); }
.kit-q-head .btn { margin-left: auto; }
.kit-questions .chips { margin: 6px 0; }
.kit-how { margin: 8px 0; padding-left: 20px; color: var(--muted); font-size: 14px; }
.kit-book { border: 1px solid var(--line); border-radius: var(--radius); padding: 10px 14px; margin-bottom: 18px; }
.kit-book summary { cursor: pointer; font-weight: 600; }
.kit-book[open] summary { margin-bottom: 12px; }
@media (max-width: 640px) { .kit-q-head .btn { margin-left: 0; } }
