:root {
  color-scheme: light;
  --paper: #f5f3ed;
  --paper-deep: #ebe8df;
  --ink: #111111;
  --muted: #6d6a63;
  --line: #d8d4ca;
  --accent: #eb382f;
  --white: #ffffff;
  --shadow: 0 22px 50px rgb(18 18 18 / 12%);
  font-family: Inter, ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-synthesis: none;
  text-rendering: optimizeLegibility;
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  min-width: 320px;
  margin: 0;
  color: var(--ink);
  background: var(--paper);
}

button,
input,
a {
  font: inherit;
}

button,
a,
label {
  -webkit-tap-highlight-color: transparent;
}

.skip-link {
  position: fixed;
  z-index: 100;
  top: 0.75rem;
  left: 0.75rem;
  padding: 0.7rem 1rem;
  color: var(--white);
  background: var(--ink);
  border-radius: 99px;
  transform: translateY(-180%);
}

.skip-link:focus {
  transform: translateY(0);
}

.site-header {
  position: relative;
  z-index: 10;
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 76px;
  padding: 0 4vw;
  border-bottom: 1px solid rgb(17 17 17 / 12%);
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 0.7rem;
  color: inherit;
  font-size: 1.02rem;
  font-weight: 800;
  letter-spacing: -0.02em;
  text-decoration: none;
}

.brand-face {
  width: 42px;
  height: 42px;
  object-fit: contain;
  filter: drop-shadow(0 3px 3px rgb(0 0 0 / 10%));
}

.collection {
  padding: clamp(1rem, 2vw, 2rem) 4vw 11rem;
}

.select-all {
  display: flex;
  align-items: center;
  gap: 0.7rem;
  padding: 0.6rem 0;
  font-size: 0.9rem;
  font-weight: 700;
  cursor: pointer;
}

.select-all input {
  width: 19px;
  height: 19px;
  margin: 0;
  accent-color: var(--accent);
}

.sticker-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  column-gap: clamp(1rem, 2.2vw, 2.5rem);
  row-gap: clamp(2.5rem, 5vw, 5rem);
}

.sticker-item {
  min-width: 0;
  opacity: 0;
  transform: translateY(16px);
  animation: item-in 520ms cubic-bezier(0.22, 1, 0.36, 1) forwards;
  animation-delay: calc(var(--item-index) * 32ms);
}

.sticker-stage {
  position: relative;
  display: grid;
  aspect-ratio: 1;
  overflow: hidden;
  background-color: var(--paper-deep);
  background-image:
    linear-gradient(45deg, rgb(17 17 17 / 2.5%) 25%, transparent 25%),
    linear-gradient(-45deg, rgb(17 17 17 / 2.5%) 25%, transparent 25%),
    linear-gradient(45deg, transparent 75%, rgb(17 17 17 / 2.5%) 75%),
    linear-gradient(-45deg, transparent 75%, rgb(17 17 17 / 2.5%) 75%);
  background-position: 0 0, 0 12px, 12px -12px, -12px 0;
  background-size: 24px 24px;
  border-radius: 3px;
  transition: background-color 200ms ease, box-shadow 260ms ease, transform 260ms ease;
}

.sticker-stage::after {
  position: absolute;
  inset: 0;
  pointer-events: none;
  content: "";
  border: 1px solid rgb(17 17 17 / 8%);
  border-radius: inherit;
}

.sticker-stage > img {
  align-self: center;
  justify-self: center;
  width: 100%;
  height: 100%;
  padding: 7%;
  object-fit: contain;
  filter: drop-shadow(0 13px 9px rgb(0 0 0 / 9%));
  transition: transform 280ms cubic-bezier(0.22, 1, 0.36, 1);
}

.sticker-item:hover .sticker-stage,
.sticker-item:focus-within .sticker-stage {
  z-index: 1;
  background-color: #efede7;
  box-shadow: var(--shadow);
  transform: translateY(-4px);
}

.sticker-item:hover .sticker-stage > img,
.sticker-item:focus-within .sticker-stage > img {
  transform: translateY(-4%) scale(1.025);
}

.sticker-select {
  position: absolute;
  z-index: 3;
  top: 0.85rem;
  left: 0.85rem;
  cursor: pointer;
}

.sticker-select input {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  opacity: 0;
}

.checkmark {
  display: grid;
  width: 28px;
  height: 28px;
  place-items: center;
  color: var(--white);
  background: rgb(255 255 255 / 88%);
  border: 1px solid rgb(17 17 17 / 20%);
  border-radius: 50%;
  box-shadow: 0 2px 9px rgb(17 17 17 / 8%);
  opacity: 0;
  transition: opacity 160ms ease, background-color 160ms ease, border-color 160ms ease;
}

.checkmark svg {
  width: 15px;
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 2.2;
}

.sticker-item:hover .checkmark,
.sticker-item:focus-within .checkmark,
.sticker-select input:checked + .checkmark {
  opacity: 1;
}

.sticker-select input:checked + .checkmark {
  background: var(--accent);
  border-color: var(--accent);
}

.sticker-select input:focus-visible + .checkmark {
  outline: 3px solid var(--ink);
  outline-offset: 3px;
}

.item-download {
  position: absolute;
  z-index: 2;
  right: 0.75rem;
  bottom: 0.75rem;
  left: 0.75rem;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.55rem;
  min-height: 48px;
  color: var(--white);
  background: var(--ink);
  border-radius: 2px;
  font-size: 0.82rem;
  font-weight: 800;
  text-decoration: none;
  opacity: 0;
  transform: translateY(10px);
  transition: opacity 180ms ease, transform 220ms cubic-bezier(0.22, 1, 0.36, 1), background 160ms ease;
}

.item-download:hover {
  background: var(--accent);
}

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

.item-download svg,
.primary-button svg {
  width: 19px;
  height: 19px;
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 1.8;
}

.sticker-item:hover .item-download,
.sticker-item:focus-within .item-download {
  opacity: 1;
  transform: translateY(0);
}

.sticker-meta {
  display: flex;
  align-items: start;
  justify-content: space-between;
  gap: 0.75rem;
  padding: 1rem 0.1rem 0;
}

.sticker-meta h3 {
  margin: 0;
  overflow: hidden;
  font-size: 0.98rem;
  letter-spacing: -0.025em;
  text-overflow: ellipsis;
  text-transform: capitalize;
  white-space: nowrap;
}

.sticker-meta p {
  flex: 0 0 auto;
  margin: 0.15rem 0 0;
  color: var(--muted);
  font-size: 0.7rem;
  line-height: 1.3;
  white-space: nowrap;
}

.selection-bar {
  position: fixed;
  z-index: 20;
  right: 50%;
  bottom: max(1rem, env(safe-area-inset-bottom));
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 3rem;
  width: min(92vw, 620px);
  padding: 0.65rem 0.7rem 0.65rem 1rem;
  color: var(--white);
  background: var(--ink);
  border: 1px solid rgb(255 255 255 / 14%);
  border-radius: 5px;
  box-shadow: 0 22px 70px rgb(0 0 0 / 28%);
  transform: translateX(50%);
}

.selection-bar[hidden] {
  display: none;
}

.selection-bar:not([hidden]) {
  animation: bar-in 280ms cubic-bezier(0.22, 1, 0.36, 1) both;
}

.selection-summary {
  display: flex;
  align-items: center;
  gap: 0.8rem;
  min-width: 0;
}

.selection-summary > span:last-child {
  display: grid;
  gap: 0.12rem;
  font-size: 0.82rem;
}

.selection-summary small {
  color: rgb(255 255 255 / 55%);
  font-size: 0.65rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.selection-count {
  display: grid;
  min-width: 36px;
  height: 36px;
  padding: 0 0.4rem;
  place-items: center;
  color: var(--ink);
  background: var(--white);
  border-radius: 2px;
  font-size: 0.86rem;
  font-weight: 850;
}

.selection-actions {
  display: flex;
  align-items: center;
  gap: 0.35rem;
}

.text-button,
.primary-button {
  border: 0;
  cursor: pointer;
}

.text-button {
  padding: 0.7rem 0.9rem;
  color: rgb(255 255 255 / 65%);
  background: transparent;
  font-size: 0.76rem;
  font-weight: 750;
}

.text-button:hover {
  color: var(--white);
}

.primary-button {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  min-height: 46px;
  padding: 0 1.05rem;
  color: var(--white);
  background: var(--accent);
  border-radius: 2px;
  font-size: 0.78rem;
  font-weight: 850;
}

.primary-button:hover {
  background: #ff463d;
}

.text-button:focus-visible,
.primary-button:focus-visible {
  outline: 3px solid var(--white);
  outline-offset: 2px;
}

.download-notice {
  position: fixed;
  z-index: 30;
  top: 1rem;
  left: 50%;
  max-width: min(90vw, 460px);
  padding: 0.8rem 1rem;
  color: var(--white);
  background: var(--ink);
  border-radius: 3px;
  font-size: 0.8rem;
  font-weight: 700;
  box-shadow: var(--shadow);
  transform: translateX(-50%);
}

.download-notice:not([hidden]) {
  animation: notice-in 220ms ease both;
}

.load-error {
  margin: 4rem 0;
  color: var(--accent);
  font-weight: 700;
  text-align: center;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

@keyframes item-in {
  to { opacity: 1; transform: translateY(0); }
}

@keyframes bar-in {
  from { opacity: 0; transform: translate(50%, 20px); }
}

@keyframes notice-in {
  from { opacity: 0; transform: translate(-50%, -12px); }
}

@media (max-width: 980px) {
  .sticker-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}

@media (max-width: 700px) {
  .site-header {
    height: 66px;
    padding: 0 1rem;
  }

  .brand-face {
    width: 38px;
    height: 38px;
  }

  .collection {
    padding: 1rem 1rem 9rem;
  }

  .sticker-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    column-gap: 0.75rem;
    row-gap: 2.2rem;
  }

  .checkmark {
    width: 27px;
    height: 27px;
    opacity: 1;
  }

  .sticker-select {
    top: 0.55rem;
    left: 0.55rem;
  }

  .item-download {
    right: 0.45rem;
    bottom: 0.45rem;
    left: auto;
    width: 42px;
    min-height: 42px;
    padding: 0;
    font-size: 0;
    opacity: 1;
    transform: none;
  }

  .item-download svg {
    width: 20px;
    height: 20px;
  }

  .sticker-meta {
    display: block;
    padding-top: 0.8rem;
  }

  .sticker-meta h3 {
    font-size: 0.9rem;
  }

  .sticker-meta p {
    margin-top: 0.25rem;
    font-size: 0.65rem;
  }

  .selection-bar {
    gap: 0.8rem;
    width: calc(100vw - 1rem);
    padding-left: 0.65rem;
  }

  .selection-summary > span:last-child,
  .text-button {
    display: none;
  }
}

@media (max-width: 390px) {
  .select-all {
    padding-top: 0;
  }

  .select-all span {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip: rect(0 0 0 0);
  }
}

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

  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}
