/* GoEast: a customs manifest for quality imports.
   Kraft paper and stamp ink by day, warehouse sodium light by night.
   Self-hosted fonts only; the CSP forbids anything off-origin. */

@font-face {
  font-family: "Plex Mono";
  src: url("/static/fonts/IBMPlexMono-Regular.ttf") format("truetype");
  font-weight: 400;
  font-display: swap;
}
@font-face {
  font-family: "Plex Mono";
  src: url("/static/fonts/IBMPlexMono-SemiBold.ttf") format("truetype");
  font-weight: 600;
  font-display: swap;
}
@font-face {
  font-family: "Saira Stencil";
  src: url("/static/fonts/SairaStencilOne-Regular.ttf") format("truetype");
  font-weight: 400;
  font-display: swap;
}

:root {
  color-scheme: light dark;

  --paper: #e7d7b8;
  --card: #f7f0e1;
  --ink: #241c13;
  --muted: #6d5e49;
  --rule: #b8a482;
  --stamp-higher: #b0261c;
  --stamp-similar: #1d4f8f;
  --accent: #b0261c;
  --warn: #8a5a00;
  --grain-opacity: 0.35;
  --shadow: 0 1px 0 #fff8 inset, 0 0.6rem 1.2rem -0.8rem #3b2a1466;

  --font-mono: "Plex Mono", ui-monospace, "SFMono-Regular", Menlo, Consolas, monospace;
  --font-stencil: "Saira Stencil", "Arial Narrow", "Roboto Condensed", sans-serif-condensed, sans-serif;
  --radius: 0.25rem;
  --gap: clamp(0.9rem, 0.6rem + 1.2vw, 1.4rem);

  accent-color: var(--accent);
}

@media (prefers-color-scheme: dark) {
  :root {
    --paper: #16181b;
    --card: #20242a;
    --ink: #ece3d2;
    --muted: #a49a88;
    --rule: #3b4048;
    --stamp-higher: #ff7a66;
    --stamp-similar: #86b6ff;
    --accent: #f2b33d;
    --warn: #f2b33d;
    --grain-opacity: 0.12;
    --shadow: 0 0.6rem 1.4rem -0.8rem #000c;
  }
}

html {
  background: var(--paper);
  color: var(--ink);
  font-family: var(--font-mono);
  font-size: 100%;
  line-height: 1.55;
  -webkit-text-size-adjust: 100%;
}

body {
  margin: 0;
  min-block-size: 100dvh;
  font-size: 0.95rem;
  font-size-adjust: from-font;
  /* Paper grain: an inline SVG turbulence tile (img-src data: is allowed). */
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='160' height='160'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.9' numOctaves='2' stitchTiles='stitch'/%3E%3CfeColorMatrix values='0 0 0 0 .35 0 0 0 0 .27 0 0 0 0 .17 0 0 0 .55 0'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
  background-blend-mode: multiply;
  background-color: var(--paper);
}

body::before {
  /* Keep the grain subtle and theme-aware without a second image. */
  content: "";
  position: fixed;
  inset: 0;
  background: var(--paper);
  opacity: calc(1 - var(--grain-opacity));
  pointer-events: none;
  z-index: -1;
}

main,
.masthead,
.colophon {
  max-inline-size: 46rem;
  margin-inline: auto;
  padding-inline: clamp(1rem, 0.5rem + 3vw, 2rem);
}

a {
  color: inherit;
  text-decoration-thickness: 0.08em;
  text-underline-offset: 0.2em;
}

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

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

/* ---- Masthead ---------------------------------------------------------- */

.masthead {
  padding-block: clamp(1.4rem, 1rem + 3vw, 2.6rem) 0.6rem;
}

.wordmark {
  display: inline-block;
  font-family: var(--font-stencil);
  font-size: clamp(2.6rem, 1.6rem + 6vw, 4.4rem);
  line-height: 0.9;
  letter-spacing: 0.02em;
  text-transform: uppercase;
  text-decoration: none;
  font-size-adjust: cap-height from-font;
}

.wordmark span {
  color: var(--accent);
}

.tagline {
  margin: 0.5rem 0 0.9rem;
  font-size: 0.8rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--muted);
}

.tagline em {
  font-style: normal;
  white-space: nowrap;
  color: var(--ink);
  font-weight: 600;
}

.barcode {
  block-size: 0.9rem;
  background: repeating-linear-gradient(90deg,
      var(--ink) 0 2px, transparent 2px 4px,
      var(--ink) 4px 5px, transparent 5px 8px,
      var(--ink) 8px 11px, transparent 11px 12px,
      var(--ink) 12px 13px, transparent 13px 17px);
  opacity: 0.8;
  mask-image: linear-gradient(90deg, #000 70%, transparent);
}

/* ---- Search ------------------------------------------------------------ */

.search {
  margin-block: 1.4rem 1.8rem;
}

.search label {
  display: block;
  margin-block-end: 0.4rem;
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: 0.16em;
  text-transform: uppercase;
}

.search-row {
  display: flex;
  gap: 0.5rem;
}

.search input {
  flex: 1;
  min-inline-size: 0;
  min-block-size: 3rem;
  padding: 0.6rem 0.8rem;
  font: inherit;
  font-size: 1.05rem;
  color: var(--ink);
  background: var(--card);
  border: 2px solid var(--ink);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

.search input::placeholder {
  color: var(--muted);
  opacity: 0.8;
}

.search button {
  min-block-size: 3rem;
  padding-inline: 1.1rem;
  font: inherit;
  font-family: var(--font-stencil);
  font-size: 1.25rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--paper);
  background: var(--ink);
  border: 2px solid var(--ink);
  border-radius: var(--radius);
  cursor: pointer;
  transition: translate 120ms ease, background-color 120ms ease;
}

.search button:hover {
  background: var(--accent);
  border-color: var(--accent);
}

.search button:active {
  translate: 0 2px;
}

/* ---- Results ----------------------------------------------------------- */

.manifest-title {
  margin: 0 0 0.6rem;
  font-family: var(--font-stencil);
  font-weight: 400;
  font-size: clamp(1.9rem, 1.3rem + 3vw, 2.8rem);
  line-height: 1.05;
  text-wrap: balance;
  overflow-wrap: anywhere;
}

.kicker {
  display: block;
  margin-block-end: 0.2rem;
  font-family: var(--font-mono);
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--accent);
}

.notice {
  margin: 0 0 1rem;
  padding: 0.6rem 0.8rem;
  border: 1.5px dashed var(--rule);
  border-radius: var(--radius);
  text-wrap: pretty;
}

.notice.subtle {
  color: var(--muted);
  font-size: 0.85rem;
}

.category {
  margin-block: 1.6rem 2.2rem;
}

.category-name {
  display: flex;
  align-items: baseline;
  gap: 0.6rem;
  margin: 0 0 0.8rem;
  padding-block-end: 0.5rem;
  font-size: 1.05rem;
  font-weight: 600;
  /* Perforated tear line. */
  background: radial-gradient(circle, var(--rule) 1.5px, transparent 2px) bottom left / 9px 4px repeat-x;
}

.category-name span {
  padding: 0.05rem 0.4rem;
  font-size: 0.65rem;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--paper);
  background: var(--ink);
  border-radius: 2px;
}

.ownership {
  margin: 0 0 1rem;
  font-size: 0.85rem;
  color: var(--muted);
  text-wrap: pretty;
}

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

.labels {
  display: grid;
  gap: var(--gap);
}

/* A shipping label per alternative. */
.label {
  position: relative;
  padding: 1rem 1.1rem 0.9rem;
  background: var(--card);
  border: 1px solid var(--rule);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  container-type: inline-size;
}

.label.unverified {
  border-style: dashed;
}

.label > header {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.4rem 0.8rem;
}

.label h3 {
  margin: 0;
  font-family: var(--font-stencil);
  font-weight: 400;
  font-size: 1.7rem;
  line-height: 1.1;
  letter-spacing: 0.01em;
}

.stamp {
  display: inline-block;
  padding: 0.15rem 0.5rem;
  font-size: 0.68rem;
  font-weight: 600;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  border: 3px double currentColor;
  border-radius: 0.2rem;
  rotate: -4deg;
  opacity: 0.9;
}

.tier-higher {
  color: var(--stamp-higher);
}

.tier-similar {
  color: var(--stamp-similar);
}

.pair-note {
  margin: 0.5rem 0 0;
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--accent);
}

.summary {
  margin: 0.5rem 0 0.7rem;
  text-wrap: pretty;
}

.signals {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
  margin: 0 0 0.8rem;
  padding: 0;
  list-style: none;
}

.signals li {
  padding: 0.1rem 0.45rem;
  font-size: 0.7rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  border: 1px solid var(--rule);
  border-radius: 2px;
}

.signals li.warn {
  color: var(--warn);
  border-color: currentColor;
  border-style: dashed;
}

.links {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  margin: 0;
  padding: 0;
  list-style: none;
}

.links a {
  display: inline-flex;
  align-items: center;
  min-block-size: 2rem;
  padding: 0.2rem 0.7rem;
  font-size: 0.8rem;
  font-weight: 600;
  text-decoration: none;
  border: 1.5px solid var(--ink);
  border-radius: 999px;
}

.links li:first-child a {
  color: var(--paper);
  background: var(--ink);
}

.links a:hover {
  color: var(--paper);
  background: var(--accent);
  border-color: var(--accent);
}

@media (pointer: coarse) {
  .links a {
    min-block-size: 2.75rem;
    padding-inline: 0.9rem;
  }
}

.sources {
  margin-block-start: 0.8rem;
  font-size: 0.78rem;
  color: var(--muted);
}

.sources summary {
  cursor: pointer;
  inline-size: fit-content;
  min-block-size: 1.5rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.sources ol {
  margin: 0.4rem 0 0;
  padding-inline-start: 1.3rem;
}

.sources li {
  overflow-wrap: anywhere;
}

.src-host {
  opacity: 0.7;
}

/* ---- Intro, empty, browse --------------------------------------------- */

.intro p,
.empty p {
  text-wrap: pretty;
}

.examples {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  padding: 0;
  list-style: none;
}

.examples a {
  display: inline-block;
  padding: 0.35rem 0.7rem;
  font-size: 0.85rem;
  text-decoration: none;
  border: 1.5px dashed var(--ink);
  border-radius: var(--radius);
}

.manifest {
  display: grid;
  grid-template-columns: max-content 1fr;
  gap: 0.3rem 1rem;
  margin: 0;
}

.manifest dt {
  font-size: 0.7rem;
  font-weight: 600;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--muted);
  padding-block-start: 0.2em;
}

.manifest dd {
  margin: 0;
}

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

.colophon {
  padding-block: 1.5rem 2.5rem;
  font-size: 0.75rem;
  color: var(--muted);
  border-block-start: 1px solid var(--rule);
}

.colophon p {
  margin: 0.4rem 0;
  text-wrap: pretty;
}

.version {
  opacity: 0.7;
}

/* ---- Motion: labels slide onto the counter, one after another ----------- */

@media (prefers-reduced-motion: no-preference) {
  .label {
    animation: arrive 420ms cubic-bezier(0.2, 0.7, 0.2, 1) both;
  }

  .label:nth-child(2) { animation-delay: 60ms; }
  .label:nth-child(3) { animation-delay: 120ms; }
  .label:nth-child(4) { animation-delay: 180ms; }
  .label:nth-child(5) { animation-delay: 240ms; }
  .label:nth-child(n + 6) { animation-delay: 300ms; }

  .stamp {
    animation: thunk 360ms 260ms cubic-bezier(0.3, 1.6, 0.5, 1) both;
  }
}

@keyframes arrive {
  from {
    opacity: 0;
    translate: 0 0.6rem;
  }
}

@keyframes thunk {
  from {
    opacity: 0;
    scale: 1.6;
  }
}

@media (forced-colors: active) {
  .stamp,
  .links a,
  .category-name span {
    border-color: CanvasText;
  }
}

/* Wider screens: two labels per row. */
@media (min-width: 44rem) {
  .labels {
    grid-template-columns: repeat(auto-fill, minmax(19rem, 1fr));
  }
}
