/* Hallmark · pre-emit critique: P5 H4 E5 S5 R4 V5 */
@import url("/tokens.css");

*, *::before, *::after { box-sizing: border-box; }
html, body { overflow-x: clip; }
html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  background: var(--color-paper);
  color: var(--color-ink);
  font-family: var(--font-body);
  font-size: var(--text-base);
  line-height: 1.55;
  /* newsprint: coarse halftone dust + paper fibre */
  background-image:
    radial-gradient(circle at 1px 1px, oklch(21% 0.014 62 / 0.10) 0.9px, transparent 1.1px),
    radial-gradient(circle at 3px 4px, oklch(21% 0.014 62 / 0.05) 0.7px, transparent 0.9px);
  background-size: 5px 5px, 9px 9px;
}

img { max-width: 100%; height: auto; display: block; }
a { color: var(--color-accent-deep); text-decoration-thickness: 1px; text-underline-offset: 3px; }
a:hover { color: var(--color-accent); }
:focus-visible { outline: 3px solid var(--color-focus); outline-offset: 2px; }
button { font: inherit; color: inherit; }

h1, h2, h3 {
  font-family: var(--font-display);
  font-style: normal;
  font-weight: 400;
  line-height: 0.92;
  margin: 0;
  overflow-wrap: anywhere;
  min-width: 0;
}
p { margin: 0 0 var(--space-md); }

/* misregistered colour plates — the red and yellow sit a hair off the black line */
.plate {
  text-shadow:
    0.055em 0.03em 0 oklch(54.5% 0.198 27 / 0.55),
    -0.04em -0.025em 0 oklch(80% 0.155 82 / 0.7);
}

.wrap { width: min(1180px, 100% - 32px); margin-inline: auto; }
.hand { font-family: var(--font-hand); font-size: 1.32em; line-height: 1.15; color: var(--color-grease); }
.lede { font-size: var(--text-lg); max-width: 34ch; }

/* ─── N6 newspaper masthead, link row rendered as tear-off tabs ───────── */
.mast { border-bottom: var(--rule-slab) solid var(--color-ink); background: var(--color-paper); position: relative; z-index: 40; }
.mast__top {
  display: flex; align-items: baseline; justify-content: center; gap: var(--space-sm);
  flex-wrap: wrap; padding: var(--space-sm) 0 var(--space-2xs); text-align: center;
}
.mast__name {
  font-family: var(--font-display);
  font-size: clamp(1.9rem, 7vw, 3.4rem);
  letter-spacing: -0.01em;
  line-height: 0.9;
  text-decoration: none; color: var(--color-ink);
}
.mast__dateline { font-size: var(--text-sm); color: var(--color-ink-soft); font-style: italic; }
.mast__rule { border-top: var(--rule-hair) solid var(--color-ink); margin: 0 0 var(--space-2xs); }
.tabs { display: flex; flex-wrap: wrap; gap: var(--space-2xs); padding-bottom: var(--space-xs); justify-content: center; }
.tab {
  font-family: var(--font-body); font-size: var(--text-sm); font-weight: 600;
  text-decoration: none; color: var(--color-ink);
  padding: 5px 13px 6px; background: var(--color-paper-2);
  border: var(--rule-hair) dashed var(--color-ink);
  border-radius: var(--radius-sm);
  white-space: nowrap;
  transition: transform var(--dur-fast) var(--ease-out), background var(--dur-fast) var(--ease-out);
}
.tab:hover, .tab:focus-visible { background: var(--color-mustard); transform: rotate(-1.4deg) translateY(-2px); }
.tab[aria-current="page"] { background: var(--color-ink); color: var(--color-paper); border-style: solid; }
.tab--wallet { border-style: solid; border-width: var(--rule-mid); background: var(--color-accent); color: var(--color-paper); cursor: pointer; }
.tab--wallet:hover { background: var(--color-accent-deep); color: var(--color-paper); }

/* ─── coupon box: the page's only container idiom ─────────────────────── */
.coupon {
  position: relative;
  background: var(--color-paper-2);
  border: var(--rule-mid) dashed var(--color-ink);
  padding: var(--space-md);
  border-radius: var(--radius-sm);
}
.coupon::after {
  content: ""; position: absolute; inset: 4px; pointer-events: none;
  border: var(--rule-hair) solid oklch(21% 0.014 62 / 0.22);
}
.coupon--solid { border-style: solid; background: var(--color-paper); }
.coupon--red { background: var(--color-accent); color: var(--color-paper); border-color: var(--color-ink); }
.coupon--red a { color: var(--color-mustard); }
.coupon--mustard { background: var(--color-mustard); }
.coupon--tilt-a { transform: rotate(-0.75deg); }
.coupon--tilt-b { transform: rotate(0.6deg); }

.btn {
  display: inline-flex; align-items: center; gap: var(--space-xs);
  font-family: var(--font-display); font-size: var(--text-lg);
  background: var(--color-ink); color: var(--color-paper);
  border: var(--rule-mid) solid var(--color-ink); border-radius: var(--radius-sm);
  padding: 10px 20px 12px; cursor: pointer; max-width: 100%; overflow-wrap: anywhere; text-align: left;
  transition: transform var(--dur-fast) var(--ease-out), box-shadow var(--dur-fast) var(--ease-out);
  box-shadow: 4px 4px 0 var(--color-accent);
}
.btn:hover:not(:disabled), .btn.is-hover { transform: translate(-1px, -1px); box-shadow: 6px 6px 0 var(--color-accent); }
.btn:active:not(:disabled), .btn.is-active { transform: translate(3px, 3px); box-shadow: 1px 1px 0 var(--color-accent); }
.btn:disabled { opacity: 0.45; cursor: not-allowed; box-shadow: 4px 4px 0 var(--color-paper-3); }
.btn[data-state="loading"] { cursor: progress; }
.btn--mustard { background: var(--color-mustard); color: var(--color-ink); box-shadow: 4px 4px 0 var(--color-ink); }
.btn--mustard:hover:not(:disabled) { box-shadow: 6px 6px 0 var(--color-ink); }
.btn--sm { font-size: var(--text-base); padding: 7px 14px 8px; }

.note { font-size: var(--text-xs); color: var(--color-ink-soft); }
.say { font-family: var(--font-hand); font-size: var(--text-xl); color: var(--color-accent-deep); line-height: 1.2; }
.say--ink { color: var(--color-ink); }

/* Melty sprite */
.melty { position: relative; width: 100%; max-width: 380px; }
.melty img { width: 100%; }
.melty__pose { position: absolute; inset: 0; opacity: 0; transition: opacity var(--dur-mid) var(--ease-out); }
.melty__pose.is-on { opacity: 1; position: relative; }
@keyframes melty-breathe { 0%, 100% { transform: translateY(0) rotate(-0.4deg); } 50% { transform: translateY(-9px) rotate(0.5deg); } }
.melty--live { animation: melty-breathe 3.4s var(--ease-in-out) infinite; will-change: transform; }

.grease {
  position: absolute; width: 10px; height: 10px; border-radius: 999px;
  background: var(--color-grease); opacity: 0.55; pointer-events: none;
}

/* chain slots — small print at the foot of the circular */
.smallprint { display: flex; flex-wrap: wrap; gap: var(--space-sm) var(--space-lg); align-items: center; font-size: var(--text-sm); }
.smallprint > * { min-width: 0; }
.ca { display: inline-flex; gap: var(--space-xs); align-items: center; flex-wrap: wrap; word-break: break-all; }
.ca code { font-family: var(--font-body); font-weight: 600; word-break: break-all; }

/* footer Ft6 — letter close */
.close { border-top: var(--rule-slab) solid var(--color-ink); margin-top: var(--space-2xl); padding: var(--space-xl) 0 var(--space-2xl); }
.close__sig { font-family: var(--font-hand); font-size: clamp(2rem, 7vw, 3.4rem); color: var(--color-accent-deep); line-height: 1; }
.close__ps { max-width: 46ch; }

/* toast / character speech */
.crier {
  position: fixed; left: 50%; bottom: 16px; transform: translateX(-50%) translateY(140%);
  z-index: 90; width: min(560px, calc(100% - 24px));
  background: var(--color-ink); color: var(--color-paper);
  border: var(--rule-mid) solid var(--color-ink); border-radius: var(--radius-sm);
  padding: var(--space-sm) var(--space-md);
  box-shadow: 6px 6px 0 var(--color-accent);
  transition: transform var(--dur-slow) var(--ease-out);
}
.crier.is-up { transform: translateX(-50%) translateY(0); }
.crier a { color: var(--color-mustard); }
.crier__line { font-family: var(--font-hand); font-size: var(--text-xl); }

.stack > * + * { margin-top: var(--space-md); }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); }

/* the circular grid — irregular coupon boxes, never an even 3-up */
.circular { display: grid; gap: var(--space-md); grid-template-columns: minmax(0, 1fr); padding: var(--space-xl) 0; }
@media (min-width: 860px) {
  .circular { grid-template-columns: repeat(6, minmax(0, 1fr)); }
  .c-span-2 { grid-column: span 2; }
  .c-span-3 { grid-column: span 3; }
  .c-span-4 { grid-column: span 4; }
  .c-span-6 { grid-column: span 6; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important; animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important; scroll-behavior: auto !important;
  }
  .melty--live { animation: none; }
}
