:root {
  color-scheme: light;
  --ink: #1d2521;
  --muted: #5d6a63;
  --paper: #f2f1e9;
  --card: #ffffff;
  --line: #ddddd0;
  --sign: #0d6a3f;
  --sign-deep: #0a5432;
  --sign-line: rgb(255 255 255 / 28%);
  --plate-face: #f8f5e7;
  --plate-rim: #e3ddc4;
  --plate-ink: #274b8f;
  --yellow: #f7bb0e;
  --green: #17754a;
  --green-soft: #e3f2e9;
  --red: #b23a30;
  --red-soft: #f9e8e6;
  --blue: #23589f;
  --blue-soft: #e8f0fb;
  --gold: #91600d;
  --gold-soft: #fbf0d2;
  --display: "Barlow Condensed", "Arial Narrow", sans-serif;
  --body: Barlow, ui-sans-serif, system-ui, -apple-system, sans-serif;
}

* {
  box-sizing: border-box;
}

[hidden] {
  display: none !important;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  min-height: 100vh;
  color: var(--ink);
  background: var(--paper);
  font-family: var(--body);
  line-height: 1.5;
}

h1,
h2,
h3,
p {
  margin: 0;
}

a {
  color: inherit;
  text-decoration: none;
}

button {
  font: inherit;
  cursor: pointer;
}

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

.sign :focus-visible {
  outline-color: var(--yellow);
}

/* ---------- header ---------- */

.site-header {
  position: sticky;
  top: 0;
  z-index: 10;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  min-height: 60px;
  padding: 0 max(20px, calc((100vw - 1040px) / 2));
  border-bottom: 1px solid var(--line);
  background: rgb(242 241 233 / 90%);
  backdrop-filter: blur(14px);
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
}

.brand-plate {
  display: inline-grid;
  place-items: center;
  min-width: 44px;
  height: 26px;
  padding: 0 6px;
  border: 2px solid var(--plate-ink);
  border-radius: 4px;
  background: var(--plate-face);
  color: var(--plate-ink);
  font-family: var(--display);
  font-size: 0.95rem;
  font-weight: 700;
  letter-spacing: 0.08em;
}

.brand-name {
  font-family: var(--display);
  font-size: 1.25rem;
  font-weight: 600;
  letter-spacing: 0.01em;
}

.site-nav {
  display: flex;
  gap: 4px;
}

.site-nav a {
  border-radius: 6px;
  padding: 8px 12px;
  color: var(--muted);
  font-weight: 600;
  font-size: 0.95rem;
}

.site-nav a:hover {
  background: #e7e6db;
  color: var(--ink);
}

/* ---------- layout ---------- */

main {
  width: min(1040px, 100% - 40px);
  margin: 0 auto;
  padding: 28px 0 64px;
}

/* ---------- hero: the guide sign ---------- */

.sign {
  position: relative;
  border-radius: 18px;
  padding: clamp(28px, 5vw, 52px) clamp(22px, 6vw, 72px) clamp(26px, 4vw, 44px);
  background: linear-gradient(172deg, #107446, var(--sign) 55%, var(--sign-deep));
  color: #fff;
  box-shadow: 0 20px 45px rgb(13 106 63 / 25%);
}

.sign::before {
  content: "";
  position: absolute;
  inset: 10px;
  border: 3px solid rgb(255 255 255 / 88%);
  border-radius: 12px;
  pointer-events: none;
}

.sign-eyebrow {
  margin-bottom: 14px;
  font-family: var(--display);
  font-size: 0.92rem;
  font-weight: 600;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: rgb(255 255 255 / 82%);
}

.sign h1 {
  max-width: 640px;
  font-family: var(--display);
  font-size: clamp(2.5rem, 6vw, 4.1rem);
  font-weight: 700;
  line-height: 1.02;
  letter-spacing: 0.005em;
}

.sign-sub {
  max-width: 560px;
  margin-top: 14px;
  color: rgb(255 255 255 / 86%);
  font-size: 1.06rem;
}

/* ---------- the plate ---------- */

.plate {
  container-type: inline-size;
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  width: min(430px, 100%);
  aspect-ratio: 2 / 1;
  margin: clamp(24px, 4vw, 36px) auto;
  border-radius: 14px;
  background: linear-gradient(180deg, #fdfbf1, var(--plate-face) 40%, #efeada);
  box-shadow:
    inset 0 0 0 3px var(--plate-rim),
    inset 0 -6px 12px rgb(29 37 33 / 7%),
    0 12px 26px rgb(10 40 25 / 35%);
  cursor: text;
  user-select: none;
}

.plate-bolt {
  position: absolute;
  width: 5.5%;
  aspect-ratio: 1;
  border-radius: 50%;
  background: radial-gradient(circle at 35% 30%, #f5f1de, #cfc9ac 70%);
  box-shadow: inset 0 1px 2px rgb(29 37 33 / 35%);
}

.plate-bolt-tl { top: 6%; left: 7%; }
.plate-bolt-tr { top: 6%; right: 7%; }
.plate-bolt-bl { bottom: 6%; left: 7%; }
.plate-bolt-br { bottom: 6%; right: 7%; }

.plate-state {
  margin-bottom: 1cqw;
  color: var(--plate-ink);
  font-family: var(--display);
  font-size: 5.4cqw;
  font-weight: 600;
  letter-spacing: 0.42em;
  text-indent: 0.42em;
  text-transform: uppercase;
}

.plate-text {
  max-width: 88%;
  color: var(--plate-ink);
  font-family: var(--display);
  font-size: 24cqw;
  font-weight: 700;
  line-height: 1;
  letter-spacing: 0.06em;
  white-space: nowrap;
  text-shadow:
    0 -1px 0 rgb(255 255 255 / 70%),
    0 2px 1px rgb(23 38 74 / 30%);
}

.plate-text.is-empty {
  color: #b9b39a;
  text-shadow: none;
}

.plate-stamp {
  position: absolute;
  right: -3.5%;
  bottom: -8%;
  transform: rotate(-11deg);
  border: 3px solid currentColor;
  border-radius: 8px;
  padding: 2cqw 3cqw;
  background: #fffdf4;
  box-shadow: 0 6px 16px rgb(10 40 25 / 30%);
  font-family: var(--display);
  font-size: 6.4cqw;
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--green);
}

.plate-stamp[data-kind="taken"],
.plate-stamp[data-kind="invalid"] {
  color: var(--red);
}

.plate-stamp[data-kind="format-ok"] {
  color: var(--blue);
}

@keyframes stamp-in {
  0% { opacity: 0; transform: rotate(-11deg) scale(1.7); }
  60% { opacity: 1; transform: rotate(-11deg) scale(0.94); }
  100% { opacity: 1; transform: rotate(-11deg) scale(1); }
}

.plate-stamp.stamping {
  animation: stamp-in 0.28s cubic-bezier(0.2, 0.9, 0.3, 1.4) both;
}

/* ---------- controls on the sign ---------- */

.controls {
  display: grid;
  grid-template-columns: minmax(150px, 210px) minmax(0, 1fr) auto;
  gap: 12px;
  align-items: end;
}

.control span {
  display: block;
  margin-bottom: 6px;
  font-family: var(--display);
  font-size: 0.84rem;
  font-weight: 600;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: rgb(255 255 255 / 80%);
}

.controls select,
.controls input {
  width: 100%;
  height: 52px;
  border: 0;
  border-radius: 8px;
  padding: 0 14px;
  color: var(--ink);
  background: #fff;
  font: inherit;
  font-weight: 600;
}

.controls select {
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8'%3E%3Cpath d='M1 1l5 5 5-5' fill='none' stroke='%231d2521' stroke-width='2'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 14px center;
  padding-right: 36px;
}

.controls input {
  font-family: var(--display);
  font-size: 1.5rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.controls input::placeholder {
  color: #b9b39a;
}

#submitBtn {
  height: 52px;
  border: 0;
  border-radius: 8px;
  padding: 0 26px;
  background: var(--yellow);
  color: #211b04;
  font-family: var(--display);
  font-size: 1.15rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  white-space: nowrap;
  box-shadow: 0 3px 0 #c99504;
}

#submitBtn:hover {
  background: #ffc71f;
}

#submitBtn:active {
  transform: translateY(2px);
  box-shadow: 0 1px 0 #c99504;
}

#submitBtn:disabled {
  cursor: wait;
  opacity: 0.75;
}

.sign-note {
  margin-top: 16px;
  color: rgb(255 255 255 / 78%);
  font-size: 0.94rem;
}

.result {
  display: none;
  margin-top: 10px;
  border-radius: 8px;
  padding: 10px 14px;
  background: rgb(0 0 0 / 22%);
  font-size: 0.98rem;
  font-weight: 500;
}

.result.show {
  display: block;
}

.result strong {
  font-weight: 700;
}

.result.ok strong { color: #8fe6b4; }
.result.bad strong { color: #ffb4a8; }

.result a {
  color: var(--yellow);
  text-decoration: underline;
}

/* ---------- recent checks ---------- */

.recent {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
  margin-top: 16px;
  padding: 0 6px;
}

.recent-label {
  color: var(--muted);
  font-family: var(--display);
  font-size: 0.84rem;
  font-weight: 600;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}

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

.recent-chip {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 5px 10px;
  background: var(--card);
  font-family: var(--display);
  font-size: 0.95rem;
  font-weight: 600;
  letter-spacing: 0.04em;
}

.recent-chip:hover {
  border-color: var(--ink);
}

.recent-chip small {
  color: var(--muted);
  font-family: var(--body);
  font-size: 0.74rem;
  font-weight: 600;
  text-transform: uppercase;
}

.recent-chip .dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--muted);
}

.recent-chip[data-status="available"] .dot { background: var(--green); }
.recent-chip[data-status="valid"] .dot { background: var(--blue); }
.recent-chip[data-status="unavailable"] .dot,
.recent-chip[data-status="invalid"] .dot { background: var(--red); }

/* ---------- sections ---------- */

.section {
  margin-top: 56px;
}

.section-head {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

h2 {
  font-family: var(--display);
  font-size: clamp(1.7rem, 3vw, 2.2rem);
  font-weight: 700;
  line-height: 1.1;
}

.section-lede {
  max-width: 640px;
  margin-top: 8px;
  color: var(--muted);
}

.tier-chip {
  display: inline-flex;
  align-items: center;
  border-radius: 999px;
  padding: 6px 12px;
  font-size: 0.82rem;
  font-weight: 700;
  color: var(--muted);
  background: #e7e6db;
}

.tier-chip[data-tier="live-api"] { color: var(--green); background: var(--green-soft); }
.tier-chip[data-tier="rules-only"] { color: var(--gold); background: var(--gold-soft); }
.tier-chip[data-tier="official-ui"] { color: var(--blue); background: var(--blue-soft); }

/* ---------- rules card ---------- */

.rules-row {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  align-items: flex-start;
  justify-content: space-between;
  margin-top: 18px;
}

.rule-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.rule-chip {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 130px;
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 12px 16px;
  background: var(--card);
}

.rule-chip b {
  font-family: var(--display);
  font-size: 1.45rem;
  font-weight: 700;
  line-height: 1.05;
}

.rule-chip span {
  color: var(--muted);
  font-size: 0.88rem;
}

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

.official-links a {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  border: 1px solid #c6d4e6;
  border-radius: 8px;
  padding: 9px 13px;
  color: var(--blue);
  background: var(--card);
  font-size: 0.9rem;
  font-weight: 600;
}

.official-links a::after {
  content: "\2197";
  font-size: 0.8em;
}

.official-links a:hover {
  background: var(--blue-soft);
}

/* ---------- ideas ---------- */

.ghost-btn {
  height: 40px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 0 16px;
  background: var(--card);
  color: var(--ink);
  font-weight: 600;
}

.ghost-btn:hover {
  border-color: var(--ink);
}

.ghost-btn:disabled {
  cursor: wait;
  opacity: 0.7;
}

.category-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px;
  margin-top: 18px;
}

.category {
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 16px;
  background: var(--card);
}

.category h3 {
  margin-bottom: 12px;
  font-family: var(--display);
  font-size: 1.15rem;
  font-weight: 600;
  letter-spacing: 0.03em;
}

.category-empty {
  grid-column: 1 / -1;
}

.category-empty p {
  color: var(--muted);
}

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

.plate-chip {
  min-width: 68px;
  border: 2px solid var(--plate-ink);
  border-radius: 5px;
  padding: 6px 10px;
  background: var(--plate-face);
  color: var(--plate-ink);
  box-shadow: inset 0 0 0 1px #efe9d2;
  font-family: var(--display);
  font-size: 1.02rem;
  font-weight: 700;
  letter-spacing: 0.07em;
  text-align: center;
}

.plate-chip:hover {
  background: #fffdf3;
  transform: translateY(-1px);
}

.plate-chip.checking {
  opacity: 0.55;
}

.plate-chip.unavailable {
  border-color: #c4beab;
  color: #a29c85;
  text-decoration: line-through;
  box-shadow: none;
}

.plate-chip.free {
  border-color: var(--green);
  color: var(--green);
}

/* ---------- coverage ---------- */

.coverage-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px;
  margin-top: 18px;
}

.coverage-card {
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--card);
}

.coverage-card header {
  padding: 14px 14px 12px;
  border-bottom: 1px solid var(--line);
}

.coverage-card h3 {
  font-family: var(--display);
  font-size: 1.2rem;
  font-weight: 700;
  letter-spacing: 0.02em;
}

.coverage-card header p {
  margin-top: 4px;
  color: var(--muted);
  font-size: 0.85rem;
  line-height: 1.45;
}

.coverage-list {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  padding: 12px;
}

.coverage-state {
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 6px 10px;
  background: var(--card);
  color: var(--ink);
  font-size: 0.88rem;
  font-weight: 600;
}

.coverage-state:hover {
  border-color: var(--ink);
  background: var(--paper);
}

.coverage-card[data-tier="live-api"] header { background: var(--green-soft); border-bottom-color: transparent; }
.coverage-card[data-tier="rules-only"] header { background: var(--gold-soft); border-bottom-color: transparent; }
.coverage-card[data-tier="official-ui"] header { background: var(--blue-soft); border-bottom-color: transparent; }
.coverage-card[data-tier="research-pending"] header { background: #ecece3; border-bottom-color: transparent; }

/* ---------- footer ---------- */

.site-footer {
  border-top: 1px solid var(--line);
  padding: 26px max(20px, calc((100vw - 1040px) / 2)) 40px;
}

.site-footer p {
  max-width: 720px;
  color: var(--muted);
  font-size: 0.88rem;
  line-height: 1.55;
}

/* ---------- responsive ---------- */

@media (max-width: 900px) {
  .category-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .coverage-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 640px) {
  main {
    width: min(100% - 24px, 640px);
    padding-top: 16px;
  }

  .site-header {
    padding: 10px 16px;
  }

  .brand-name {
    display: none;
  }

  .sign {
    padding: 26px 20px 24px;
  }

  .sign-eyebrow {
    font-size: 0.78rem;
    letter-spacing: 0.14em;
  }

  .controls {
    grid-template-columns: 1fr;
  }

  #submitBtn {
    width: 100%;
  }

  .category-grid,
  .coverage-grid {
    grid-template-columns: 1fr;
  }

  .rules-row {
    flex-direction: column;
  }
}

@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }

  .plate-stamp.stamping {
    animation: none;
  }

  .plate-chip:hover {
    transform: none;
  }
}
