:root {
  --dusk: #232650;
  --dusk-deep: #1a1c40;
  --lamp: #ffc53d;
  --lamp-soft: rgba(255, 197, 61, 0.18);
  --pave: #e9ecf2;
  --pave-2: #d8dde9;
  --ink: #1b1e42;
  --ink-soft: #545a80;
  --on-dusk: #fff6e0;
  --on-dusk-soft: #bcc0e6;
  --danger: #a82a22;
  --danger-on-dusk: #ffb4a6;

  --font-display: "Bricolage Grotesque", system-ui, sans-serif;
  --font-body: "Hanken Grotesk", system-ui, sans-serif;

  --wrap: 56rem;
  --gutter: clamp(1.25rem, 5vw, 2rem);
  --scene-h: 9.5rem;
  --bin-h: 7.25rem;
  --radius: 14px;
}

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

[hidden] {
  display: none !important;
}

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

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

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

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
}

.wrap {
  width: min(var(--wrap), 100% - 2 * var(--gutter));
  margin-inline: auto;
}

/* ---------- Stage: the street at dusk ---------- */

.stage {
  position: relative;
  overflow: hidden;
  padding-bottom: var(--scene-h);
  color: var(--on-dusk);
  background:
    radial-gradient(48rem 24rem at 92% 100%, rgba(255, 197, 61, 0.26), transparent 62%),
    linear-gradient(180deg, var(--dusk-deep) 0%, var(--dusk) 48%, #4a3f80 100%);
}

.stage-content {
  position: relative;
  z-index: 2;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1.25rem 0 0;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 0.55rem;
  font-family: var(--font-display);
  font-size: 1.5rem;
  font-weight: 800;
  font-stretch: 85%;
  letter-spacing: -0.015em;
  color: var(--on-dusk);
  text-decoration: none;
}

.brand-mark {
  height: 1.65rem;
  width: auto;
  color: var(--lamp);
}

.locale {
  margin: 0;
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--on-dusk-soft);
}

.intro,
.answer {
  padding: clamp(2.25rem, 7vw, 4.5rem) 0 clamp(2rem, 5vw, 3rem);
}

h1 {
  margin: 0;
  max-width: 12ch;
  font-family: var(--font-display);
  font-weight: 800;
  font-stretch: 82%;
  font-size: clamp(3.25rem, 11.5vw, 6.5rem);
  line-height: 0.95;
  letter-spacing: -0.025em;
  color: var(--on-dusk);
  text-wrap: balance;
}

h1:focus {
  outline: none;
}

.lede,
.answer-sub {
  margin: 1.1rem 0 0;
  max-width: 30rem;
  font-size: 1.2rem;
  line-height: 1.45;
  color: var(--on-dusk-soft);
}

/* Lookup form */

.lookup {
  margin-top: 1.75rem;
  max-width: 34rem;
}

.lookup label {
  display: block;
  margin-bottom: 0.45rem;
  font-weight: 600;
  font-size: 0.95rem;
  color: var(--on-dusk);
}

.lookup-row {
  display: flex;
  gap: 0.6rem;
  flex-wrap: wrap;
}

.lookup input {
  flex: 1 1 11rem;
  min-width: 0;
  height: 3.5rem;
  padding: 0 1.1rem;
  border: 2px solid transparent;
  border-radius: var(--radius);
  background: #fff;
  color: var(--ink);
  font: inherit;
  font-size: 1.25rem;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.lookup input::placeholder {
  color: #9aa0bf;
  font-weight: 500;
}

.lookup input[aria-invalid="true"] {
  border-color: var(--danger-on-dusk);
}

button,
.tip-link {
  font-family: inherit;
}

.lookup button {
  height: 3.5rem;
  padding: 0 1.5rem;
  border: 0;
  border-radius: var(--radius);
  background: var(--lamp);
  color: var(--ink);
  font-size: 1.05rem;
  font-weight: 700;
  cursor: pointer;
  transition: transform 0.15s ease, background 0.15s ease;
}

.lookup button:hover {
  background: #ffd266;
}

.lookup button:active {
  transform: translateY(1px);
}

.lookup button:disabled {
  cursor: progress;
  background: #d9b04a;
}

.hint {
  margin: 0.7rem 0 0;
  font-size: 0.95rem;
  color: var(--on-dusk-soft);
}

.status {
  margin: 0.9rem 0 0;
  display: flex;
  align-items: flex-start;
  gap: 0.6rem;
  font-weight: 500;
  color: var(--on-dusk);
}

.status[data-tone="error"] {
  color: var(--danger-on-dusk);
  font-weight: 600;
}

.status[data-tone="busy"]::before {
  content: "";
  flex: none;
  width: 1rem;
  height: 1rem;
  margin-top: 0.22rem;
  border: 2.5px solid currentColor;
  border-right-color: transparent;
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

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

.status-paper[data-tone="error"] {
  color: var(--danger);
}

/* Answer */

.answer h1 {
  max-width: 10ch;
}

.whose {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 0.25rem 1rem;
  margin: 1.5rem 0 0;
  font-weight: 600;
  color: var(--on-dusk);
}

.link {
  appearance: none;
  padding: 0;
  border: 0;
  background: none;
  font: inherit;
  font-weight: 600;
  color: var(--lamp);
  text-decoration: underline;
  text-underline-offset: 4px;
  cursor: pointer;
}

.link:hover {
  color: #ffd98a;
}

/* Scene */

.scene {
  position: absolute;
  inset: auto 0 0 0;
  height: var(--scene-h);
  z-index: 1;
  pointer-events: none;
}

.skyline {
  position: absolute;
  bottom: 0;
  left: 50%;
  height: 100%;
  aspect-ratio: 3200 / 180;
  transform: translateX(-50%);
}

.skyline svg {
  display: block;
  width: 100%;
  height: 100%;
}

/* The kerbstone the bins stand on */
.scene::after {
  content: "";
  position: absolute;
  inset: auto 0 0 0;
  height: 0.7rem;
  background: linear-gradient(180deg, #c3c9dc, #aab1c9);
}

.lamp {
  display: none;
}

@media (min-width: 52rem) {
  .lamp {
    display: block;
    position: absolute;
    bottom: 0;
    right: calc((100% - var(--wrap)) / 2 + 3rem);
    width: 3.6rem;
    height: 15rem;
  }

  .lamp::before {
    content: "";
    position: absolute;
    top: 0.5rem;
    right: -1rem;
    width: 20rem;
    height: 20rem;
    transform: translate(0, -20%);
    border-radius: 50%;
    background: radial-gradient(circle, rgba(255, 197, 61, 0.34), transparent 62%);
  }

  .lamp svg {
    position: relative;
    display: block;
    width: 100%;
    height: 100%;
  }
}

/* ---------- Kerb: the bins ---------- */

.kerb {
  --gap: clamp(0.35rem, 2.4vw, 1.5rem);
  position: relative;
  z-index: 3;
  display: flex;
  flex-wrap: wrap;
  gap: 1.5rem var(--gap);
  margin-top: calc(var(--bin-h) * -1);
  padding-bottom: 0.5rem;
}

.kerb:empty {
  display: none;
}

.bin {
  flex: 1 1 3.4rem;
  max-width: 7.5rem;
  min-width: 0;
  margin: 0;
}

.bin-art {
  display: block;
  width: 100%;
  height: var(--bin-h);
}

.bin figcaption {
  margin-top: 0.7rem;
  font-size: 0.8rem;
  font-weight: 700;
  line-height: 1.2;
  overflow-wrap: anywhere;
}

.bin figcaption small {
  display: block;
  margin-top: 0.2rem;
  font-size: 0.75rem;
  font-weight: 500;
  color: var(--ink-soft);
}

@media (min-width: 40rem) {
  .bin figcaption {
    font-size: 0.95rem;
  }

  .bin figcaption small {
    font-size: 0.85rem;
  }
}

.bin-decor {
  pointer-events: none;
}

.bin-ghost .ghost-svg {
  display: block;
  width: 100%;
  height: var(--bin-h);
  color: #6a6fb0;
  opacity: 0.35;
  animation: breathe 1.6s ease-in-out infinite;
}

.bin-ghost .bar {
  display: block;
  height: 0.8rem;
  margin-top: 0.8rem;
  border-radius: 6px;
  background: var(--pave-2);
}

.bin-ghost .bar + .bar {
  width: 60%;
  height: 0.65rem;
  margin-top: 0.4rem;
}

/* One orchestrated moment: the bins roll out onto the kerb. */
.kerb[data-arrive] .bin:not(.bin-ghost) .bin-art {
  animation: roll-out 0.7s cubic-bezier(0.2, 0.9, 0.25, 1) both;
  animation-delay: calc(var(--i) * 90ms);
  transform-origin: 50% 100%;
}

.kerb[data-arrive] .bin:not(.bin-ghost) figcaption {
  animation: fade-in 0.5s ease both;
  animation-delay: calc(var(--i) * 90ms + 250ms);
}

/* ---------- Pavement: lists ---------- */

main {
  padding-bottom: 1rem;
}

h2 {
  margin: 0;
  font-family: var(--font-display);
  font-weight: 800;
  font-stretch: 88%;
  font-size: 1.75rem;
  letter-spacing: -0.015em;
  line-height: 1.15;
}

h2:focus {
  outline: none;
}

.picker,
.later {
  padding-top: 2.5rem;
}

.picker-count {
  margin: 0.35rem 0 1rem;
  color: var(--ink-soft);
}

.filter input {
  width: 100%;
  height: 3rem;
  margin-bottom: 0.75rem;
  padding: 0 1rem;
  border: 2px solid var(--pave-2);
  border-radius: var(--radius);
  background: #fff;
  font: inherit;
  color: var(--ink);
}

.filter input:focus-visible {
  outline: none;
  border-color: var(--dusk);
  box-shadow: 0 0 0 3px var(--lamp);
}

.address-list,
.later-list {
  margin: 0;
  padding: 0;
  list-style: none;
}

.address-list {
  border-top: 1px solid var(--pave-2);
}

.address-list li {
  border-bottom: 1px solid var(--pave-2);
}

.address-list button {
  display: block;
  width: 100%;
  padding: 0.95rem 0.5rem;
  border: 0;
  border-radius: 10px;
  background: none;
  font: inherit;
  font-size: 1.1rem;
  text-align: left;
  color: var(--ink);
  cursor: pointer;
  transition: background 0.12s ease;
}

.address-list button b {
  display: inline-block;
  min-width: 2.2ch;
  margin-right: 0.35ch;
  font-family: var(--font-display);
  font-weight: 800;
  font-stretch: 85%;
  font-size: 1.2em;
}

.address-list button:hover {
  background: var(--lamp-soft);
}

/* One street: a tile per house number */
.address-list.is-tiles {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(4.5rem, 1fr));
  gap: 0.6rem;
  border-top: 0;
}

.address-list.is-tiles li {
  border: 0;
}

.address-list.is-tiles button {
  height: 3.5rem;
  padding: 0;
  border: 2px solid var(--pave-2);
  border-radius: var(--radius);
  background: #fff;
  font-family: var(--font-display);
  font-weight: 800;
  font-stretch: 85%;
  font-size: 1.3rem;
  text-align: center;
  transition: background 0.12s ease, border-color 0.12s ease, transform 0.12s ease;
}

.address-list.is-tiles button:hover {
  border-color: var(--dusk);
  background: var(--lamp);
}

.address-list.is-tiles button:active {
  transform: translateY(1px);
}

.no-match {
  margin: 1rem 0 0;
  color: var(--ink-soft);
}

.later-list li {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 0.35rem 1.25rem;
  padding: 1.1rem 0;
  border-top: 1px solid var(--pave-2);
}

.later-list li:last-child {
  border-bottom: 1px solid var(--pave-2);
}

.later {
  margin-top: 0.5rem;
}

.later h2 {
  margin-bottom: 0.9rem;
}

.later-when {
  display: flex;
  flex-direction: column;
}

.later-date {
  font-family: var(--font-display);
  font-weight: 700;
  font-stretch: 88%;
  font-size: 1.25rem;
  line-height: 1.2;
}

.later-rel {
  font-size: 0.95rem;
  color: var(--ink-soft);
}

.later-bins {
  display: flex;
  align-items: flex-end;
  gap: 0.9rem;
  grid-row: span 1;
}

.later-bin {
  display: flex;
  align-items: flex-end;
  gap: 0.45rem;
  font-size: 0.95rem;
  font-weight: 600;
}

.later-bin svg {
  height: 2.4rem;
  width: auto;
  aspect-ratio: 64 / 88;
}

.later-bin small {
  display: block;
  font-weight: 500;
  color: var(--ink-soft);
}

/* Tip + footer */

.tip {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 1rem 2rem;
  margin: 3rem 0 0;
  padding: 1.5rem 0 0;
  border-top: 2px solid var(--dusk);
}

.tip p {
  margin: 0;
  max-width: 28rem;
}

.tip-link {
  display: inline-flex;
  align-items: center;
  height: 3rem;
  padding: 0 1.4rem;
  border-radius: var(--radius);
  background: var(--dusk);
  color: var(--on-dusk);
  font-weight: 700;
  text-decoration: none;
  transition: background 0.15s ease;
}

.tip-link:hover {
  background: var(--dusk-deep);
}

.site-footer {
  padding: 2.25rem 0 3rem;
  font-size: 0.9rem;
  color: var(--ink-soft);
}

.site-footer p {
  margin: 0 0 0.6rem;
  max-width: 44rem;
}

.site-footer a {
  color: var(--ink);
}

/* ---------- Motion ---------- */

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

@keyframes breathe {
  50% {
    opacity: 0.6;
  }
}

@keyframes fade-in {
  from {
    opacity: 0;
  }
}

@keyframes roll-out {
  from {
    opacity: 0;
    transform: translateX(-2.5rem) rotate(-7deg);
  }
  60% {
    transform: translateX(0.2rem) rotate(1.5deg);
  }
  to {
    opacity: 1;
    transform: none;
  }
}

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