/* Meme generator — poetic.software / Hershey aesthetic (matches Postcard-tool) */

@font-face {
  font-family: "Hershey Simplex Plus";
  src: url("/fonts/HersheySimplexPlus.woff2") format("woff2");
  font-weight: 400; font-display: swap;
}
@font-face {
  font-family: "Hershey Simplex Plus";
  src: url("/fonts/HersheySimplexPlus-Bold.woff2") format("woff2");
  font-weight: 700; font-display: swap;
}
@font-face {
  font-family: 'Anton';
  src: url('/fonts/Anton.woff2') format('woff2');
  font-weight: 400; font-display: swap;
}

:root {
  --font: "Hershey Simplex Plus", ui-monospace, monospace;
  --bg: #ffffff;
  --ink: #200010;
  --muted: #58404d;
  --mint: #dfffef;
  --sage: #a7bfb2;
  --err: #ff5a3c;
  --meme-font: 'Impact', 'Anton', 'Haettenschweiler', 'Arial Narrow', sans-serif;
}

* { box-sizing: border-box; }
html, body { height: 100%; margin: 0; }
body {
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font);
  font-weight: 400;
  -webkit-font-smoothing: antialiased;
}

a { color: var(--ink); }

/* ---- buttons ---- */
.btn, button {
  appearance: none;
  background: var(--ink);
  color: #fff;
  border: none;
  border-radius: 0;
  font: 700 19px/1 var(--font);
  letter-spacing: .3px;
  padding: 11px 15px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
}
.btn:hover, button:hover { background: #3a0f24; }
.btn:active, button:active { background: var(--ink); }
.btn:disabled, button:disabled { opacity: .45; cursor: not-allowed; }
.btn.sq, button.sq { width: 46px; height: 46px; padding: 0; font-size: 22px; }
.btn.on, button.on { background: var(--mint); color: var(--ink); }
.btn.solid, button.solid { background: var(--mint); color: var(--ink); }
.btn.solid:hover, button.solid:hover { background: #c9fbe2; }

/* ============================= EDITOR ============================= */
body.editor { overflow: hidden; }

/* top floating controls */
#top {
  position: fixed; top: 14px; left: 14px; right: 14px;
  display: flex; justify-content: space-between; align-items: flex-start;
  pointer-events: none; z-index: 20; gap: 8px; flex-wrap: wrap;
}
#top .cluster { display: flex; gap: 8px; pointer-events: auto; align-items: center; }
.brand {
  pointer-events: auto;
  display: flex; align-items: center; gap: 10px;
  background: var(--ink); color: #fff; height: 46px; padding: 0 14px;
}
.brand .logo { font-family: var(--meme-font); font-size: 26px; line-height: 1; color: var(--mint); }
.brand .sub { font: 700 12px var(--font); letter-spacing: 1px; text-transform: uppercase; opacity: .8; }
.nav-link {
  pointer-events: auto;
  background: #fff; color: var(--ink);
  border: 2px solid var(--ink);
  height: 46px; padding: 0 14px;
  font: 700 14px var(--font); letter-spacing: .3px;
  display: inline-flex; align-items: center; text-decoration: none;
}
.nav-link:hover { background: var(--mint); }

/* center stage */
#stage {
  position: fixed; inset: 0;
  display: flex; align-items: center; justify-content: center;
  overflow: hidden;
  padding: 74px 14px 74px;
  touch-action: none;
}
.wrap { line-height: 0; max-width: 100%; max-height: 100%; }
canvas#board {
  background: #fff;
  display: block;
  max-width: 100%;
  max-height: calc(100dvh - 160px);
  border: 1px solid var(--ink);
  box-shadow: 0 10px 44px rgba(32,0,16,.14);
  touch-action: none;
}
.stage-hint {
  position: fixed; left: 50%; bottom: 74px; transform: translateX(-50%);
  font: 400 12px var(--font); color: var(--muted);
  background: rgba(255,255,255,.85); padding: 4px 10px;
  pointer-events: none; white-space: nowrap; z-index: 10;
}

/* bottom floating bar: selected-layer controls */
#imgbar {
  position: fixed; left: 50%; bottom: 14px; transform: translateX(-50%);
  display: none; gap: 6px; z-index: 25; max-width: calc(100vw - 28px);
  align-items: stretch;
}
#imgbar.active { display: flex; }
#imgbar textarea {
  background: #fff; color: var(--ink);
  border: 2px solid var(--ink); border-radius: 0;
  font: 700 15px var(--font); letter-spacing: .3px;
  height: 46px; min-height: 46px; max-height: 46px;
  padding: 12px 14px; width: min(360px, 60vw); min-width: 0;
  resize: none; overflow: hidden; white-space: nowrap;
}
#imgbar textarea:focus { outline: none; background: var(--mint); }

/* toast */
#toast {
  position: fixed; left: 50%; bottom: 74px; transform: translateX(-50%);
  background: var(--ink); color: #fff; padding: 12px 18px;
  font: 400 14px var(--font); z-index: 50; max-width: 80vw; text-align: center;
  display: none; align-items: center; gap: 12px;
}
#toast.show { display: inline-flex; }
#toast.err { color: var(--err); }
#toast a { color: var(--mint); font-weight: 700; text-decoration: none; }
#toast a:hover { text-decoration: underline; }

/* ============================= OVERVIEW ============================= */
.topbar {
  position: sticky; top: 0; z-index: 10;
  display: flex; align-items: center; gap: 12px;
  background: var(--bg); border-bottom: 1px solid var(--ink);
  padding: 12px 16px;
}
.topbar .brand { height: 44px; }
.topbar .spacer { flex: 1; }
.ov-wrap { max-width: 1200px; margin: 0 auto; padding: 16px 16px 80px; }
.grid { columns: 240px; column-gap: 14px; }
.card {
  display: block; break-inside: avoid; margin: 0 0 14px;
  border: 1px solid var(--ink); background: #fff; line-height: 0;
}
.card img { display: block; width: 100%; height: auto; background: #fff; }
.empty { text-align: center; color: var(--muted); padding: 80px 20px; font-size: 15px; }
.empty a { color: var(--ink); font-weight: 700; }
.hidden { display: none !important; }

/* ============================= MOBILE ============================= */
@media (max-width: 560px) {
  #top { top: 10px; left: 10px; right: 10px; gap: 6px; }
  .brand { height: 42px; padding: 0 12px; }
  .brand .sub { display: none; }
  .nav-link { height: 42px; padding: 0 12px; }
  .btn, button { font-size: 15px; padding: 9px 11px; letter-spacing: 0; }
  .btn.sq, button.sq { width: 42px; height: 42px; font-size: 20px; }
  #top .cluster.actions { order: 3; width: 100%; }
  #top .cluster.actions .btn, #top .cluster.actions button { flex: 1; }
  #stage { padding: 108px 8px 70px; }
  canvas#board { max-height: calc(100dvh - 190px); }
  #imgbar textarea { width: 52vw; }
}
