/* ============================================================
   03 — Challenge · "Poster Press"
   Screen-printed contest poster. Flat, hard borders, zero blur.
   Font: Bebas Neue (display, uppercase by design).
   ============================================================ */

@font-face {
  font-family: "Bebas Neue";
  src: url("/assets/fonts/BebasNeue-Regular.woff2") format("woff2");
  font-weight: 400; font-style: normal; font-display: swap;
}

:root {
  --bg: #F4F1EA;
  --ink: #14110E;
  --accent: #BB3D18;
  --accent-2: #1B4079;
  --highlight: #F2C14E;
  --paper: #FFFFFF;

  --display: "Bebas Neue", "Arial Narrow", Impact, sans-serif;
  --body: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --mono: ui-monospace, "SFMono-Regular", Menlo, Consolas, monospace;
}

* { box-sizing: border-box; }

/* The UA's `[hidden] { display: none }` loses to any author `display` rule
   below, and every demo here toggles `element.hidden` to show and hide
   panels. Without this, hiding silently stops working. */
[hidden] { display: none !important; }

/* A long unbroken token -- a pasted URL, a 200-character "word" -- must wrap
   rather than push its container past its grid track and break the row.
   `anywhere` rather than `break-word` on purpose: only `anywhere` reduces the
   element's min-content width, and a grid or flex item defaults to
   `min-width: auto`, which refuses to shrink below its longest word. With
   `break-word` alone, demo-06 and demo-10 still blew 1.4k px past the viewport.
   The `min-width: 0` below is the other half of the same fix. */
h1, h2, h3, h4, p, li, a, span, strong, em, code, label, time,
button, input, textarea { overflow-wrap: anywhere; }
.card, .post, .listing, .idea, .topic, .question, .profile-card, .submission,
.lesson, .resource, .nominee, .archive-item, .member-card, .comment, .reply,
.answer, .idea-body-wrap { min-width: 0; }


body {
  margin: 0;
  padding-block-end: 72px;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--body);
  font-size: 15px;
  line-height: 1.6;
}

.wrap { max-width: 1120px; margin-inline: auto; padding: 0 20px; }
@media (min-width: 900px) { .wrap { padding: 0 40px; } }

h1, h2 { margin: 0; font-family: var(--display); font-weight: 400; letter-spacing: 0.005em; line-height: 0.92; }
p { margin: 0 0 12px; }
p:last-child { margin-bottom: 0; }
a { color: var(--accent); }

:focus-visible { outline: 3px solid var(--accent-2); outline-offset: 2px; }

.visually-hidden { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }

/* ---------- Masthead ---------- */

.topbar {
  padding-block: clamp(36px, 6vw, 64px) 24px;
  display: grid; gap: 18px;
}
.topbar h1 {
  font-size: clamp(52px, 11vw, 118px);
  text-transform: uppercase;
  max-width: 14ch;
}
.topbar > div > p { font-size: 16px; max-width: 52ch; }

.identity-picker { font-family: var(--mono); font-size: 11px; letter-spacing: 0.1em; text-transform: uppercase; }
.identity-picker select {
  font-family: var(--mono); font-size: 13px; text-transform: uppercase;
  margin-left: 8px; min-height: 44px; padding: 8px 12px;
  background: var(--paper); color: var(--ink);
  border: 2px solid var(--ink); border-radius: 0;
}

/* ---------- Hard-edge block system (no blur anywhere) ---------- */

.challenge-card,
.new-submission,
.submission {
  background: var(--paper);
  border: 2px solid var(--ink);
  border-radius: 0;
  box-shadow: 6px 6px 0 var(--ink);
}

/* Asymmetric: the prompt dominates, submissions sit offset below-right. */
.challenge-card { padding: clamp(22px, 3.5vw, 38px); margin-bottom: 34px; }
@media (min-width: 1000px) { .challenge-card { width: 78%; } }

.challenge-card h2 {
  font-size: clamp(34px, 5.4vw, 62px);
  text-transform: uppercase;
  margin-block: 12px 14px;
}
.challenge-dates { font-family: var(--mono); font-size: 12px; letter-spacing: 0.05em; text-transform: uppercase; }

/* Status badge as a rotated rubber stamp (constrained element — style only). */
.status-badge {
  display: inline-block;
  font-family: var(--display); font-size: 22px;
  letter-spacing: 0.06em; text-transform: uppercase;
  color: var(--accent);
  background: var(--paper);
  border: 3px solid var(--accent);
  padding: 2px 14px 0;
  transform: rotate(-4deg);
}

.admin-controls { margin-top: 20px; display: flex; gap: 12px; align-items: center; flex-wrap: wrap; }
.admin-controls span { font-family: var(--mono); font-size: 11px; max-width: 46ch; }

/* ---------- Forms ---------- */

.new-submission { padding: 24px; margin-bottom: 34px; }
@media (min-width: 1000px) { .new-submission { width: 78%; margin-left: auto; } }
.new-submission h2 { font-size: 30px; text-transform: uppercase; margin-bottom: 16px; }

.field { display: block; margin-bottom: 14px; }
.field label { display: block; font-family: var(--mono); font-size: 11px; letter-spacing: 0.1em; text-transform: uppercase; margin-bottom: 6px; }
.field input, .field textarea {
  width: 100%; font: inherit; color: var(--ink);
  background: var(--bg); border: 2px solid var(--ink);
  border-radius: 0; padding: 10px 12px; min-height: 44px;
}
.field textarea { resize: vertical; min-height: 5rem; }
.field input:focus, .field textarea:focus { border-color: var(--accent); }

.btn {
  font-family: var(--display); font-size: 22px; letter-spacing: 0.05em;
  text-transform: uppercase; cursor: pointer;
  min-height: 44px; padding: 10px 24px 6px;
  background: var(--accent); color: var(--paper);
  border: 2px solid var(--ink); border-radius: 0;
  box-shadow: 4px 4px 0 var(--ink);
  transition: transform 120ms ease, box-shadow 120ms ease;
}
.btn:hover { transform: translate(2px, 2px); box-shadow: 2px 2px 0 var(--ink); }

.btn-ghost {
  font-family: var(--mono); font-size: 11px; letter-spacing: 0.08em;
  text-transform: uppercase; cursor: pointer;
  min-height: 44px; padding: 10px 16px;
  background: var(--paper); color: var(--ink);
  border: 2px solid var(--ink); border-radius: 0;
}
.btn-ghost:hover { background: var(--highlight); }

/* ---------- Submissions grid ---------- */

.submission-grid {
  list-style: none; margin: 0; padding: 0;
  display: grid; gap: 22px;
  grid-template-columns: repeat(auto-fill, minmax(19rem, 1fr));
}

.submission {
  position: relative;
  padding: 20px;
  display: flex; flex-direction: column; gap: 10px;
}
.submission-author { font-family: var(--mono); font-size: 11px; letter-spacing: 0.06em; text-transform: uppercase; margin: 0; }
.submission-author strong { font-weight: 700; }
.submission-desc { margin: 0; font-size: 15px; flex: 1; }
.submission-meta { display: none; }

.submission-foot {
  margin-top: auto; padding-top: 12px;
  border-top: 2px solid var(--ink);
  display: flex; align-items: center; gap: 12px; flex-wrap: wrap;
}
.vote-count { font-family: var(--display); font-size: 30px; line-height: 1; font-variant-numeric: tabular-nums; }

.btn-vote {
  font-family: var(--display); font-size: 20px; letter-spacing: 0.05em;
  text-transform: uppercase; cursor: pointer;
  min-height: 44px; padding: 8px 18px 4px;
  background: var(--accent-2); color: var(--paper);
  border: 2px solid var(--ink); border-radius: 0;
}
.btn-vote:hover { background: var(--ink); }
.btn-vote:disabled { opacity: 0.45; cursor: not-allowed; }

/* Winner ribbon — CSS only, no markup change. */
.submission.is-winner { border-color: var(--accent); box-shadow: 6px 6px 0 var(--accent); }
.submission.is-winner::before {
  content: "WINNER";
  position: absolute; top: 14px; right: -8px;
  font-family: var(--display); font-size: 18px; letter-spacing: 0.1em;
  background: var(--highlight); color: var(--ink);
  border: 2px solid var(--ink);
  padding: 3px 12px 1px;
  transform: rotate(3deg);
}
.winner-tag { font-family: var(--display); font-size: 18px; letter-spacing: 0.06em; color: var(--accent); }

/* ---------- Toasts ---------- */

.toast-stack { position: fixed; right: 16px; bottom: 88px; display: grid; gap: 8px; z-index: 50; }
.toast {
  font-family: var(--mono); font-size: 12px;
  background: var(--ink); color: var(--bg);
  border: 2px solid var(--ink); border-radius: 0;
  padding: 11px 16px; box-shadow: 4px 4px 0 var(--accent);
}
.toast.error { background: var(--accent); color: var(--paper); box-shadow: 4px 4px 0 var(--ink); }

/* ---------- Motion ---------- */

.motion .submission { opacity: 0; }
.motion .headline-clip > span { transform: translateY(140%); }
/* The mask has to be tall enough for the glyphs it hides. Measured at 118px:
   the inline box is 154px against a 109px line box, escaping 11px above and
   15px below, so plain `overflow: hidden` shaved the tops and tails off the
   headline. Padding opens the mask; the matching negative margin gives the
   space back so the two lines keep their tight stacked rhythm. */
.headline-clip {
  display: block;
  overflow: hidden;
  padding-block: 0.22em 0.20em;
  margin-block: -0.20em -0.18em;
}
/* The line itself has to be a block box. `transform` is ignored on
   non-replaced inline boxes, so as a bare inline <span> the slam animation
   was silently doing nothing -- both the CSS start state and the anime
   tween resolved to no transform at all. */
.headline-clip > span { display: block; }

@media (prefers-reduced-motion: reduce) {
  .motion .submission { opacity: 1 !important; }
  .motion .headline-clip > span { transform: none !important; }
  .btn { transition: none !important; }
}


/* ---------- Ink block ---------- */
/* Already strong; it wanted one bold move. A screen-printed poster puts a slab
   of flat ink behind the title. */

body { position: relative; z-index: 0; }
.topbar { position: relative; }
.topbar::before {
  content: "";
  position: absolute; left: -8vw; right: 46%; top: -10px; bottom: 46%;
  background: var(--highlight);
  z-index: -1;
}


/* ---------- Compose affordance ---------- */
/* A screen-printed poster does not open with a blank text box. */
.compose-jump { margin: 0 0 22px; }
.btn-jump {
  font: inherit; font-size: 13px; font-weight: 800; cursor: pointer;
  letter-spacing: 0.09em; text-transform: uppercase;
  min-height: 44px; padding: 13px 24px;
  background: var(--ink); color: var(--paper);
  border: 0; border-radius: 0;
}
.btn-jump:hover { background: var(--accent); }
.new-submission { margin-top: 36px; }
