/* app.css — CARD.
 *
 * The house look: light and corporate by default, warm rather than clinical
 * because the product is greeting cards. One stylesheet, no framework, no
 * webfont — the page must render immediately and completely on a phone with a
 * bad connection, since the whole site is server-rendered HTML anyway.
 *
 * The cards themselves bring their own colour. Everything around them is
 * deliberately quiet so twenty-five of them in a grid do not fight the
 * furniture.
 */

:root {
  --paper: #fffdfa;
  --card: #ffffff;
  --ink: #23201c;
  --muted: #6d6459;
  --line: #e8e1d7;
  --accent: #c0451f;
  --accent-soft: #fdf0ea;
  --ok: #2f7d54;
  --warn: #a8541a;
  --err: #b3261e;
  --radius: 12px;
  --shadow: 0 1px 2px rgba(35,32,28,.06), 0 8px 24px rgba(35,32,28,.06);
}

@media (prefers-color-scheme: dark) {
  :root {
    --paper: #17161a;
    --card: #1f1e23;
    --ink: #f0ece5;
    --muted: #a49c92;
    --line: #34323a;
    --accent: #ef7a52;
    --accent-soft: #2a211d;
    --shadow: 0 1px 2px rgba(0,0,0,.4), 0 10px 28px rgba(0,0,0,.35);
  }
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font: 16px/1.65 Georgia, "Iowan Old Style", "Times New Roman", serif;
  -webkit-text-size-adjust: 100%;
}

a { color: var(--accent); text-decoration-thickness: 1px; text-underline-offset: 2px; }
code { font-family: ui-monospace, "SF Mono", Menlo, Consolas, monospace; font-size: .88em; }

/* ---------------------------------------------------------------- chrome */
.top {
  display: flex; align-items: center; justify-content: space-between;
  gap: 16px; padding: 14px 24px; border-bottom: 1px solid var(--line);
  background: var(--card); position: sticky; top: 0; z-index: 10;
}
.brand {
  font-weight: 700; font-size: 20px; letter-spacing: .04em;
  text-decoration: none; color: var(--ink);
}
.brand .mark { color: var(--accent); margin-right: 6px; }
.top nav { display: flex; gap: 18px; font-size: 15px; }
.top nav a { text-decoration: none; color: var(--muted); }
.top nav a.on, .top nav a:hover { color: var(--ink); }

main { max-width: 1120px; margin: 0 auto; padding: 32px 24px 64px; }

footer {
  border-top: 1px solid var(--line); padding: 28px 24px 48px;
  color: var(--muted); text-align: center; font-size: 14px;
}
.fine { color: var(--muted); font-size: 13.5px; }

/* ------------------------------------------------------------------ hero */
.hero { text-align: center; padding: 28px 0 12px; }
.hero h1 {
  font-size: clamp(30px, 5vw, 48px); line-height: 1.15; margin: 0 0 16px;
  letter-spacing: -.01em;
}
.lede { font-size: 18px; color: var(--muted); max-width: 62ch; margin: 0 auto 22px; }
.cta { display: flex; gap: 12px; justify-content: center; flex-wrap: wrap; }

.btn {
  display: inline-block; background: var(--accent); color: #fff;
  border: 1px solid var(--accent); border-radius: 999px;
  padding: 11px 22px; font: inherit; font-size: 16px; cursor: pointer;
  text-decoration: none;
}
.btn:hover { filter: brightness(1.06); }
.btn.ghost { background: transparent; color: var(--accent); }
.btn.danger { background: var(--err); border-color: var(--err); }

.section {
  font-size: 14px; text-transform: uppercase; letter-spacing: .12em;
  color: var(--muted); border-bottom: 1px solid var(--line);
  padding-bottom: 8px; margin: 44px 0 22px; font-weight: 400;
}

/* ------------------------------------------------------------- card grid */
.grid {
  display: grid; gap: 22px;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
}
.tile {
  display: block; text-decoration: none; color: inherit;
  background: var(--card); border: 1px solid var(--line);
  border-radius: var(--radius); overflow: hidden; box-shadow: var(--shadow);
  transition: transform .12s ease, box-shadow .12s ease;
}
.tile:hover { transform: translateY(-2px); box-shadow: 0 10px 30px rgba(35,32,28,.12); }
.tile .art { background: #f6f2ec; display: block; }
.tile .art svg { display: block; width: 100%; height: auto; }
.tile .meta { padding: 12px 14px 16px; }
.tile h3 { margin: 0 0 4px; font-size: 17px; }
.tile p { margin: 0; font-size: 13.5px; color: var(--muted); line-height: 1.5; }

/* ---------------------------------------------------------- single card */
.single { display: grid; gap: 36px; grid-template-columns: minmax(0,1fr) minmax(0,1fr);
  align-items: start; padding-top: 10px; }
.single-art svg, .batch-art svg, .preview-art svg {
  display: block; width: 100%; height: auto; border: 1px solid var(--line);
  border-radius: var(--radius); box-shadow: var(--shadow);
}
.crumb { margin: 0 0 8px; font-size: 14px; }
.single-copy h1 { margin: 0 0 10px; font-size: clamp(26px, 4vw, 38px); }

.facts { display: grid; grid-template-columns: auto 1fr; gap: 6px 18px;
  margin: 22px 0 0; font-size: 15px; }
.facts dt { color: var(--muted); }
.facts dd { margin: 0; }

.alts { list-style: none; padding: 0; display: grid; gap: 22px;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); }
.alts .alt-art svg { width: 100%; height: auto; border: 1px solid var(--line);
  border-radius: var(--radius); }
.alts p { font-size: 14px; color: var(--muted); }

.chips { display: flex; flex-wrap: wrap; gap: 8px 14px; }
.chips a { font-size: 14.5px; }

/* ---------------------------------------------------------------- forms */
.builder { display: grid; gap: 36px; grid-template-columns: minmax(0,420px) minmax(0,1fr);
  align-items: start; }
.form h1 { margin: 0 0 8px; }
label { display: block; margin: 0 0 14px; font-size: 14px; color: var(--muted); }
label .hint { font-size: 12.5px; opacity: .8; }
input, select, textarea {
  display: block; width: 100%; margin-top: 5px; padding: 9px 11px;
  font: inherit; font-size: 15px; color: var(--ink);
  background: var(--card); border: 1px solid var(--line); border-radius: 8px;
}
textarea { resize: vertical; line-height: 1.5; }
input:focus, select:focus, textarea:focus {
  outline: 2px solid var(--accent); outline-offset: 1px; border-color: transparent;
}
.row { display: grid; gap: 14px; grid-template-columns: 1fr 1fr; }

.preview { position: sticky; top: 84px; }
.sendbox { margin-top: 20px; padding: 16px 18px; background: var(--accent-soft);
  border: 1px solid var(--line); border-radius: var(--radius); }
.sendbox h2 { margin: 0 0 6px; font-size: 17px; }
.sendbox p { margin: 0 0 8px; font-size: 14.5px; }

.prose { max-width: 68ch; }
.prose h1 { font-size: clamp(28px, 4vw, 40px); margin: 0 0 18px; }
.prose h2 { margin: 32px 0 8px; font-size: 21px; }

/* -------------------------------------------------------------- operator */
body.admin { font-family: -apple-system, BlinkMacSystemFont, "Segoe UI",
  Roboto, Helvetica, Arial, sans-serif; }
body.admin main { max-width: 1240px; }

.statusbar { display: grid; gap: 14px; grid-template-columns: repeat(auto-fit, minmax(230px,1fr));
  margin-bottom: 24px; }
.stat { background: var(--card); border: 1px solid var(--line);
  border-radius: var(--radius); padding: 12px 16px; }
.stat .k { display: block; font-size: 12px; text-transform: uppercase;
  letter-spacing: .1em; color: var(--muted); }
.stat .v { font-size: 15px; }
.gate.live { color: var(--err); font-weight: 700; }
.gate.closed { color: var(--ok); font-weight: 600; }

.panel { background: var(--card); border: 1px solid var(--line);
  border-radius: var(--radius); padding: 20px 22px; margin-bottom: 22px; }
.panel h2 { margin: 0 0 14px; font-size: 18px; }
.panel form.inline { margin-top: 18px; padding-top: 18px; border-top: 1px dashed var(--line); }
.panel.send { border-color: var(--accent); }

.grid-table { width: 100%; border-collapse: collapse; font-size: 14px; }
.grid-table th { text-align: left; font-weight: 600; color: var(--muted);
  border-bottom: 1px solid var(--line); padding: 8px 10px; font-size: 12px;
  text-transform: uppercase; letter-spacing: .08em; }
.grid-table td { padding: 8px 10px; border-bottom: 1px solid var(--line);
  vertical-align: top; }
.grid-table td.err { color: var(--err); font-size: 13px; }
.empty { color: var(--muted); text-align: center; padding: 22px; }

.state { font-size: 12px; padding: 2px 8px; border-radius: 999px;
  background: var(--line); }
.state.sent { background: #d8f0e2; color: #14532d; }
.state.failed { background: #fbdedb; color: #7f1d1d; }
.state.sending { background: #fdeccd; color: #7c3a06; }
.state.skipped { background: #e8e6f0; color: #3f3a52; }

.batchhead { display: grid; gap: 28px; grid-template-columns: 280px 1fr;
  align-items: start; margin-bottom: 24px; }

.flash { padding: 10px 14px; border-radius: 8px; margin: 0 0 18px; font-size: 14.5px; }
.flash.ok { background: #e6f4ec; color: #14532d; }
.flash.err { background: #fbe9e7; color: #7f1d1d; }

/* --------------------------------------------------------------- narrow */
@media (max-width: 860px) {
  .single, .builder, .batchhead { grid-template-columns: 1fr; }
  .preview { position: static; }
  .row { grid-template-columns: 1fr; }
  main { padding: 22px 16px 48px; }
}
