/* DabJokes · Sticky Note Minimal (light, default) + Late Night Set (dark). Tokens: CLAUDE.md §7. */

@font-face {
  font-family: "Schibsted Grotesk";
  src: url("/assets/fonts/schibsted-grotesk-latin.woff2") format("woff2");
  font-weight: 400 900;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: "Caveat";
  src: url("/assets/fonts/caveat-700-latin.woff2") format("woff2");
  font-weight: 700;
  font-style: normal;
  font-display: swap;
}

:root {
  color-scheme: light;
  --paper: #F7F6F2;
  --ink: #1A1A1A;
  --note: #FFEE8C;
  --note-ink: #1A1A1A;
  --note-edge: transparent;
  --pen: #2F5BEA;
  --pen-hover: #1C3FB8;
  --note-pen: #2F5BEA;
  --pencil: #6B6A65;
  --note-pencil: #6B6A65;
  --surface: #FFFFFF;
  --line: #DAD8D0;
  --fill: #ECEBE5;
  --action: #1A1A1A;
  --on-action: #FFFFFF;
  --edgy: #B23A2E;
  --tape: rgba(255, 255, 255, 0.6);
  --note-shadow: 0 14px 24px rgba(26, 26, 26, 0.12), 0 2px 4px rgba(26, 26, 26, 0.08);
  --font: "Schibsted Grotesk", ui-sans-serif, system-ui, -apple-system, "Segoe UI", sans-serif;
  --pen-font: "Caveat", "Segoe Print", "Bradley Hand", cursive;
  --radius-pill: 999px;
  --gutter: 16px;
}

:root[data-theme="dark"] {
  color-scheme: dark;
  --paper: #0D1330;
  --ink: #F4ECDD;
  --note: #161E45;
  --note-ink: #F4ECDD;
  --note-edge: #2C3878;
  --pen: #FFB547;
  --pen-hover: #FFD08A;
  --note-pen: #FFB547;
  --pencil: #A9B0D0;
  --note-pencil: #A9B0D0;
  --surface: #161E45;
  --line: #2C3878;
  --fill: #1B2452;
  --action: #FFB547;
  --on-action: #0D1330;
  --edgy: #FF6F61;
  --tape: rgba(255, 181, 71, 0.85);
  --note-shadow: 0 16px 32px rgba(0, 0, 0, 0.35);
}

*, *::before, *::after { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  min-height: 100vh;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--font);
  font-size: 16px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

a { color: var(--pen); text-underline-offset: 3px; }
a:hover { color: var(--pen-hover); }

:focus-visible { outline: 3px solid var(--pen); outline-offset: 2px; }

img { max-width: 100%; height: auto; }

button { font: inherit; color: inherit; }

[hidden] { display: none !important; }

.sr-only {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}

.skip {
  position: absolute; left: 12px; top: -48px; z-index: 10;
  padding: 8px 14px; border-radius: var(--radius-pill);
  background: var(--action); color: var(--on-action); font-weight: 700; text-decoration: none;
}
.skip:focus { top: 12px; color: var(--on-action); }

/* ---------- Header ---------- */

.site-header {
  width: 100%;
  max-width: 1080px;
  margin: 0 auto;
  padding: 16px var(--gutter) 8px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  color: var(--ink);
  text-decoration: none;
}
.brand:hover { color: var(--ink); }
.brand__mascot { width: 32px; height: auto; display: block; }

.wordmark {
  font-weight: 900;
  font-size: 26px;
  line-height: 1;
  letter-spacing: -0.04em;
}
.wordmark__dot { color: var(--pen); }

.header-tools { display: flex; align-items: center; gap: 10px; }

.streak {
  font-size: 13px;
  font-weight: 700;
  color: var(--pencil);
  white-space: nowrap;
}

.icon-btn {
  width: 44px;
  height: 44px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius-pill);
  border: 1.5px solid var(--line);
  background: var(--surface);
  color: var(--ink);
  cursor: pointer;
}
.icon-btn:hover { border-color: var(--ink); }
.icon-btn svg { width: 20px; height: 20px; }
.theme-icon--sun { display: none; }
:root[data-theme="dark"] .theme-icon--sun { display: block; }
:root[data-theme="dark"] .theme-icon--moon { display: none; }

/* ---------- Topic tabs ---------- */

.topics {
  width: 100%;
  max-width: 1080px;
  margin: 0 auto;
  padding: 0 var(--gutter);
  display: flex;
  gap: 18px;
  overflow-x: auto;
  scrollbar-width: none;
  -webkit-mask-image: linear-gradient(90deg, #000 calc(100% - 24px), transparent);
  mask-image: linear-gradient(90deg, #000 calc(100% - 24px), transparent);
}
.topics::-webkit-scrollbar { display: none; }

.topic {
  flex-shrink: 0;
  padding: 10px 0 6px;
  border: none;
  border-bottom: 2px solid transparent;
  background: none;
  color: var(--pencil);
  font-size: 15px;
  font-weight: 700;
  text-decoration: none;
  white-space: nowrap;
  cursor: pointer;
}
.topic:hover { color: var(--ink); }
.topic[aria-pressed="true"], .topic[aria-current="page"] {
  color: var(--ink);
  border-bottom-color: var(--ink);
}
.topic:last-child { margin-right: 24px; }

/* ---------- Stage + sticky note ---------- */

.stage {
  flex: 1 0 auto;
  width: 100%;
  max-width: 1080px;
  margin: 0 auto;
  padding: 28px var(--gutter) 24px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 22px;
  position: relative;
}

.stage__mascot {
  position: absolute;
  left: var(--gutter);
  bottom: 24px;
  width: 150px;
  pointer-events: none;
  display: none;
}
.stage__mascot--dark { display: none; }

.note-wrap { width: 100%; max-width: 520px; touch-action: pan-y; }

.note {
  position: relative;
  width: 100%;
  min-height: 260px;
  padding: 40px 30px 30px;
  background: var(--note);
  color: var(--note-ink);
  border: 1px solid var(--note-edge);
  box-shadow: var(--note-shadow);
  transform: rotate(-1.2deg);
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 14px;
  transition: transform 0.25s ease, opacity 0.25s ease;
}
.note::before {
  content: "";
  position: absolute;
  top: -11px;
  left: 50%;
  width: 84px;
  height: 22px;
  margin-left: -42px;
  background: var(--tape);
  transform: rotate(2deg);
}
.note.is-leaving { transform: translateX(-120%) rotate(-8deg); opacity: 0; }
.note.is-entering { transform: translateX(40%) rotate(4deg); opacity: 0; transition: none; }

.note__tag {
  margin: 0;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--note-pencil);
  display: flex;
  flex-wrap: wrap;
  gap: 4px 10px;
}
.note__edgy { color: var(--edgy); }

.note__setup {
  margin: 0;
  font-size: clamp(24px, 2.2vw + 16px, 32px);
  font-weight: 800;
  line-height: 1.15;
  letter-spacing: -0.02em;
}

.note__punchline {
  margin: 0;
  font-family: var(--pen-font);
  font-weight: 700;
  font-size: clamp(32px, 3vw + 20px, 44px);
  line-height: 1.05;
  color: var(--note-pen);
}

.reveal {
  align-self: flex-start;
  min-height: 44px;
  padding: 0;
  border: none;
  background: none;
  color: var(--note-pen);
  font-family: var(--pen-font);
  font-weight: 700;
  font-size: 28px;
  line-height: 1;
  cursor: pointer;
}
.reveal:hover { text-decoration: underline; text-underline-offset: 4px; }

/* ---------- Votes, actions ---------- */

.votes, .actions {
  width: 100%;
  max-width: 520px;
  display: flex;
  gap: 8px;
}
.actions { flex-wrap: wrap; }
.share-row { display: contents; }

.btn {
  flex: 1;
  min-height: 46px;
  padding: 10px 12px;
  border-radius: var(--radius-pill);
  border: 1.5px solid var(--ink);
  background: var(--surface);
  color: var(--ink);
  font-size: 15px;
  font-weight: 700;
  line-height: 1.2;
  text-align: center;
  text-decoration: none;
  white-space: nowrap;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
}
.btn:hover { color: var(--ink); background: var(--fill); }
.btn--primary { background: var(--action); border-color: var(--action); color: var(--on-action); }
.btn--primary:hover { background: var(--action); color: var(--on-action); opacity: 0.88; }
.btn--quiet { border-color: var(--line); }
.btn[aria-pressed="true"] { background: var(--action); border-color: var(--action); color: var(--on-action); }
.votes.is-voted .btn:not([aria-pressed="true"]) { opacity: 0.55; }

.hint {
  margin: 0;
  font-size: 13px;
  color: var(--pencil);
  text-align: center;
  display: none;
}
.hint kbd {
  font-family: var(--font);
  font-size: 12px;
  font-weight: 700;
  padding: 1px 6px;
  border: 1px solid var(--line);
  border-bottom-width: 2px;
  border-radius: 5px;
  background: var(--surface);
}

.settings {
  display: flex;
  gap: 8px;
  justify-content: center;
  flex-wrap: wrap;
}
.chip-toggle {
  min-height: 36px;
  padding: 6px 14px;
  border-radius: var(--radius-pill);
  border: 1.5px solid var(--line);
  background: none;
  color: var(--pencil);
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
}
.chip-toggle[aria-pressed="true"] { border-color: var(--edgy); color: var(--edgy); }

.toast {
  position: fixed;
  left: 50%;
  bottom: 24px;
  transform: translateX(-50%);
  padding: 10px 18px;
  border-radius: var(--radius-pill);
  background: var(--action);
  color: var(--on-action);
  font-size: 14px;
  font-weight: 700;
  z-index: 20;
}

/* ---------- Prose pages (about, terms, 404) ---------- */

.prose {
  flex: 1 0 auto;
  width: 100%;
  max-width: 680px;
  margin: 0 auto;
  padding: 28px var(--gutter) 48px;
}
.prose h1 { font-size: clamp(32px, 4vw + 16px, 48px); font-weight: 900; letter-spacing: -0.03em; line-height: 1.05; margin: 8px 0 18px; }
.prose h2 { font-size: 22px; font-weight: 800; letter-spacing: -0.01em; margin: 32px 0 8px; }
.prose p, .prose li { font-size: 17px; }
.prose .pen { font-family: var(--pen-font); font-weight: 700; font-size: 1.6em; color: var(--pen); line-height: 1; }

/* ---------- Footer ---------- */

.site-footer {
  width: 100%;
  max-width: 1080px;
  margin: 0 auto;
  padding: 20px var(--gutter) 28px;
  border-top: 1px solid var(--line);
  display: flex;
  flex-wrap: wrap;
  gap: 8px 20px;
  font-size: 14px;
  color: var(--pencil);
}
.site-footer a { color: var(--pencil); font-weight: 600; }
.site-footer a:hover { color: var(--ink); }

/* ---------- Breakpoints ---------- */

@media (min-width: 760px) {
  :root { --gutter: 32px; }
  .stage { padding-top: 48px; gap: 26px; }
  .note { min-height: 300px; padding: 46px 40px 36px; }
  .hint { display: block; }
}

@media (min-width: 1000px) {
  .stage__mascot--light { display: block; }
  :root[data-theme="dark"] .stage__mascot--light { display: none; }
  :root[data-theme="dark"] .stage__mascot--dark { display: block; }
}

@media (max-width: 759px) {
  .note { transform: rotate(-1deg); min-height: 46vh; min-height: 46dvh; }
  .actions .btn--primary { flex-basis: 100%; order: -1; }
  .site-header { padding-top: 12px; }
  .wordmark { font-size: 22px; }
}

/* Tiny screens (watch-size browsers): flatten everything. /w/ is the real watch page. */
@media (max-width: 260px) {
  :root { --gutter: 8px; }
  .brand__mascot, .streak, .topics, .hint, .actions .btn--quiet, .settings { display: none; }
  .note { transform: none; min-height: 0; padding: 22px 14px 16px; }
  .note::before { display: none; }
  .note__setup { font-size: 18px; }
  .note__punchline { font-size: 26px; }
  .votes { flex-wrap: wrap; }
  .btn { min-height: 44px; font-size: 13px; padding: 8px; }
}

@media (prefers-reduced-motion: reduce) {
  .note, .note.is-leaving, .note.is-entering { transition: none; }
  .note.is-leaving, .note.is-entering { transform: rotate(-1.2deg); opacity: 1; }
}
