/*
 * SCRATCH - visual system.
 *
 * Letterpress rules, applied without exception:
 *   borders  3px solid var(--ink)
 *   shadows  6px 6px 0 var(--ink), never blurred
 *   corners  square, border-radius: 0 everywhere
 *   colour   flat fills only, no blends
 *
 * The foil hatching below is a repeating pattern built from hard colour stops,
 * so it prints as ruled lines rather than a blend. There is no soft gradient
 * anywhere in this file, and no external asset: a strict CSP is coming in
 * phase 6 and this stylesheet must not need an exception.
 */

:root {
  --paper:  #E8DCC0;
  --ink:    #14110E;
  --stamp:  #C1272D;
  --carbon: #3B2E7E;
  --alert:  #E8590C;
  --void:   #9A9086;

  /* Derived surfaces, kept in the same family as --paper. */
  --paper-sunk: #F4EBD8;
  --paper-worn: #C4BCAF;
  --ink-soft:   #5B534A;

  --rule: 3px solid var(--ink);
  --drop: 6px 6px 0 var(--ink);
  --drop-sm: 3px 3px 0 var(--ink);

  --font-display: "Helvetica Neue", Helvetica, Arial, sans-serif;
  --font-mono: ui-monospace, "Cascadia Mono", "Segoe UI Mono", Menlo, Consolas, monospace;

  --gap: 20px;
}

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

html {
  background: var(--paper);
  -webkit-text-size-adjust: 100%;
}

body {
  margin: 0;
  overflow-wrap: break-word;
  padding: 0 0 88px;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--font-mono);
  font-size: 15px;
  line-height: 1.5;
}

/* ---------- shell ---------- */

.wrap {
  width: 100%;
  max-width: 1060px;
  margin: 0 auto;
  padding: 0 20px;
}

.masthead {
  border-bottom: 6px solid var(--ink);
  margin-bottom: var(--gap);
  padding: 26px 0 14px;
}

.masthead__row {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  justify-content: space-between;
  gap: 8px 18px;
}

.masthead__brand {
  flex: 1 1 240px;
  min-width: 0;
}

.nav {
  flex: 0 0 auto;
}

.wordmark {
  display: inline-block;
  margin: 0;
  font-family: var(--font-display);
  font-size: clamp(38px, 9vw, 66px);
  font-weight: 800;
  letter-spacing: -0.045em;
  line-height: 0.92;
  text-transform: uppercase;
  color: var(--ink);
  text-decoration: none;
}

.wordmark em {
  font-style: normal;
  color: var(--stamp);
}

.tagline {
  margin: 6px 0 0;
  font-size: 13px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.nav {
  display: flex;
  gap: 16px;
  font-size: 12.5px;
  letter-spacing: 0.09em;
  text-transform: uppercase;
}

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

a:hover {
  color: var(--stamp);
}

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

/* ---------- blocks ---------- */

.panel {
  border: var(--rule);
  box-shadow: var(--drop);
  background: var(--paper);
  margin-bottom: 28px;
}

.panel__head {
  border-bottom: var(--rule);
  padding: 10px 15px;
  font-family: var(--font-display);
  font-weight: 800;
  font-size: 12.5px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  background: var(--ink);
  color: var(--paper);
}

.panel__body {
  padding: 17px 15px;
}

.stack > * + * {
  margin-top: 14px;
}

h2 {
  font-family: var(--font-display);
  font-weight: 800;
  font-size: 14px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  margin: 0 0 12px;
}

p {
  margin: 0 0 10px;
}

p:last-child {
  margin-bottom: 0;
}

.small {
  font-size: 12.5px;
  line-height: 1.6;
}

.muted {
  color: var(--ink-soft);
}

/* ---------- odds, above the fold ---------- */

.odds {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(148px, 1fr));
  border: var(--rule);
  box-shadow: var(--drop);
  background: var(--paper);
  margin-bottom: 28px;
}

.odds__cell {
  padding: 13px 15px 15px;
  border-right: var(--rule);
}

.odds__cell:last-child {
  border-right: 0;
}

.odds__tier {
  display: flex;
  align-items: center;
  gap: 8px;
  font-family: var(--font-display);
  font-weight: 800;
  font-size: 12.5px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.odds__pct {
  font-size: 30px;
  font-weight: 700;
  letter-spacing: -0.025em;
  line-height: 1.2;
  font-variant-numeric: tabular-nums;
}

.odds__note {
  font-size: 11px;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--ink-soft);
}

.pip {
  display: inline-block;
  flex: none;
  width: 13px;
  height: 13px;
  border: 2px solid var(--ink);
}

.pip--0 { background: var(--paper); }
.pip--1 { background: var(--carbon); }
.pip--2 { background: var(--stamp); }
.pip--3 { background: var(--ink); }

/* ---------- forms ---------- */

.finder {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  gap: 12px;
}

.field {
  flex: 1 1 300px;
  min-width: 0;
}

.field--narrow {
  flex: 0 1 150px;
}

label {
  display: block;
  margin-bottom: 6px;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

input[type="text"] {
  width: 100%;
  font: inherit;
  padding: 11px 12px;
  border: var(--rule);
  background: var(--paper-sunk);
  color: var(--ink);
}

input[type="text"]::placeholder {
  color: var(--void);
}

button {
  font-family: var(--font-display);
  font-weight: 800;
  font-size: 12.5px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  padding: 12px 22px;
  border: var(--rule);
  background: var(--ink);
  color: var(--paper);
  box-shadow: var(--drop-sm);
  cursor: pointer;
}

button:hover {
  background: var(--carbon);
}

button:active {
  transform: translate(3px, 3px);
  box-shadow: none;
}

button.ghost {
  background: var(--paper);
  color: var(--ink);
}

button.ghost:hover {
  background: var(--ink);
  color: var(--paper);
}

/* ---------- card grid ---------- */

.grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(192px, 1fr));
  gap: var(--gap);
}

.grid--single {
  grid-template-columns: minmax(0, 336px);
}

.card {
  display: flex;
  flex-direction: column;
  border: var(--rule);
  box-shadow: var(--drop);
  background: var(--paper);
}

.card__frame {
  position: relative;
  aspect-ratio: 1 / 1;
  border-bottom: var(--rule);
  overflow: hidden;
  background: var(--paper);
}

.card__img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

/* Flat void fill with printed diagonal ruling. Hard stops, no blend. */
.card__foil {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background-color: var(--void);
  background-image: repeating-linear-gradient(
    45deg,
    rgba(20, 17, 14, 0.30) 0 3px,
    rgba(20, 17, 14, 0) 3px 10px
  );
}

.card__foil-text {
  font-family: var(--font-display);
  font-weight: 800;
  font-size: 14px;
  letter-spacing: 0.34em;
  text-indent: 0.34em;
  text-transform: uppercase;
  color: var(--paper);
}

.card--expired .card__foil {
  background-color: var(--paper-worn);
  background-image: repeating-linear-gradient(
    45deg,
    rgba(20, 17, 14, 0.12) 0 3px,
    rgba(20, 17, 14, 0) 3px 10px
  );
}

.card--expired .card__foil-text {
  color: #8E867B;
}

.stamp {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%) rotate(-8deg);
  padding: 6px 14px;
  border: 4px solid var(--stamp);
  background: rgba(232, 220, 192, 0.74);
  color: var(--stamp);
  font-family: var(--font-display);
  font-weight: 800;
  font-size: clamp(17px, 5.6vw, 25px);
  letter-spacing: 0.16em;
  text-indent: 0.16em;
  text-transform: uppercase;
  white-space: nowrap;
}

.card__meta {
  display: flex;
  flex-direction: column;
  gap: 7px;
  padding: 11px 12px 12px;
}

.card__code {
  font-size: 17px;
  font-weight: 700;
  letter-spacing: 0.09em;
}

.card__code--void {
  color: var(--void);
}

.card__row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 4px 8px;
  min-height: 24px;
}

.tier {
  white-space: nowrap;
  padding: 3px 8px;
  border: 2px solid var(--ink);
  font-family: var(--font-display);
  font-weight: 800;
  font-size: 10.5px;
  letter-spacing: 0.13em;
  text-indent: 0.13em;
  text-transform: uppercase;
}

.tier--0 { background: var(--paper);  color: var(--ink); }
.tier--1 { background: var(--carbon); color: var(--paper); border-color: var(--carbon); }
.tier--2 { background: var(--stamp);  color: var(--paper); border-color: var(--stamp); }
.tier--3 { background: var(--ink);    color: var(--paper); }

.countdown {
  white-space: nowrap;
  font-size: 11.5px;
  font-weight: 700;
  letter-spacing: 0.06em;
  font-variant-numeric: tabular-nums;
}

.countdown--alert {
  color: var(--alert);
}

.card__hash {
  overflow: hidden;
  font-size: 11px;
  letter-spacing: 0.02em;
  color: var(--ink-soft);
  text-overflow: ellipsis;
  white-space: nowrap;
}

.card__hash a {
  color: inherit;
}

/* ---------- scratch surface ---------- */

.card__scratch {
  position: absolute;
  inset: 0;
  display: block;
  width: 100%;
  height: 100%;
  /* Without this the browser claims the drag for scrolling before the first
     pointermove arrives, and the card never gets scratched at all. */
  touch-action: none;
  cursor: crosshair;
  transition: opacity 220ms linear;
}

.card__scratch--gone {
  opacity: 0;
  pointer-events: none;
}

.card__actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.card__open {
  flex: 1 1 auto;
  padding: 8px 10px;
  font-size: 10.5px;
  letter-spacing: 0.1em;
  box-shadow: none;
  border-width: 2px;
}

.card__open:active {
  transform: none;
}

/* ---------- notices ---------- */

.notice {
  padding: 13px 15px;
  border: var(--rule);
  border-left-width: 10px;
  background: var(--paper-sunk);
  font-size: 13.5px;
}

.notice--error { border-left-color: var(--stamp); }
.notice--ok    { border-left-color: var(--carbon); }
.notice--warn  { border-left-color: var(--alert); }

.hidden {
  display: none !important;
}

/* ---------- verify ---------- */

.kv {
  width: 100%;
  border-collapse: collapse;
  font-size: 13.5px;
}

.kv th,
.kv td {
  padding: 8px 11px;
  border: 2px solid var(--ink);
  text-align: left;
  vertical-align: top;
}

.kv th {
  width: 38%;
  background: var(--paper-sunk);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.07em;
  text-transform: uppercase;
}

.kv td {
  word-break: break-all;
  font-variant-numeric: tabular-nums;
}

pre.source {
  margin: 0;
  padding: 16px;
  border: var(--rule);
  background: var(--paper-sunk);
  overflow-x: auto;
  font-size: 12.5px;
  line-height: 1.55;
  white-space: pre;
  tab-size: 2;
}

.verdict {
  padding: 12px 15px;
  border: var(--rule);
  font-family: var(--font-display);
  font-weight: 800;
  font-size: 14px;
  letter-spacing: 0.11em;
  text-transform: uppercase;
}

.verdict--match    { background: var(--carbon); color: var(--paper); }
.verdict--mismatch { background: var(--stamp);  color: var(--paper); }
.verdict--absent   { background: var(--paper-sunk); color: var(--ink); }

/* ---------- colophon ---------- */

.colophon {
  margin-top: 40px;
  padding-top: 16px;
  border-top: var(--rule);
  font-size: 12px;
  line-height: 1.65;
  color: var(--ink-soft);
}

.colophon strong {
  color: var(--ink);
}

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

  button:active {
    transform: none;
  }

  .card__scratch {
    transition: none;
  }
}

/* ---------- spacing utilities ---------- */
/* Present so no page needs a style attribute: the CSP allows inline styles,
   but nothing here should have to rely on that allowance. */

.mt-2 { margin-top: 12px; }
.mt-3 { margin-top: 20px; }
.mt-4 { margin-top: 28px; }
.mb-3 { margin-bottom: 16px; }
