/* Mobile-first layout for action figure deals feed */

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

:root {
  --bg: #0f1117;
  --surface: #1a1d27;
  --border: #2a2f3d;
  --text: #e8eaef;
  --muted: #9aa3b5;
  --accent: #ff6b35;
  --accent-hover: #ff8555;
  --discount: #3dd68c;
  --old-price: #7a8499;
}

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

body {
  margin: 0;
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.5;
  min-height: 100dvh;
}

header {
  position: sticky;
  top: 0;
  z-index: 10;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  padding: 0.75rem 1rem 0.5rem;
}

h1 {
  margin: 0 0 0.5rem;
  font-size: 1.125rem;
  font-weight: 700;
  letter-spacing: -0.02em;
}

.updated {
  margin: 0 0 0.75rem;
  font-size: 0.75rem;
  color: var(--muted);
}

/* Category filter checkboxes */

.filters {
  display: flex;
  flex-wrap: wrap;
  gap: 0.375rem 0.75rem;
  padding-bottom: 0.25rem;
}

.filter-label {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  font-size: 0.8125rem;
  color: var(--muted);
  cursor: pointer;
  user-select: none;
  white-space: nowrap;
}

.filter-label input {
  accent-color: var(--accent);
  width: 1rem;
  height: 1rem;
  margin: 0;
}

.filter-label:has(input:checked) {
  color: var(--text);
}

.sort-row {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.5rem 0 0.25rem;
}

.sort-label {
  font-size: 0.8125rem;
  color: var(--muted);
  white-space: nowrap;
}

.sort-select {
  flex: 1;
  min-width: 0;
  max-width: 14rem;
  padding: 0.375rem 0.5rem;
  font-size: 0.8125rem;
  color: var(--text);
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 0.375rem;
}

/* Deal feed */

main {
  padding: 0.75rem 1rem 1.5rem;
}

#feed {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.card {
  display: grid;
  grid-template-columns: 5.5rem 1fr;
  gap: 0.75rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 0.625rem;
  padding: 0.75rem;
}

.card-image {
  width: 5.5rem;
  height: 5.5rem;
  object-fit: contain;
  background: #fff;
  border-radius: 0.375rem;
}

.card-body {
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.card-title {
  margin: 0 0 0.375rem;
  font-size: 0.875rem;
  font-weight: 600;
  line-height: 1.35;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.card-category {
  margin: 0 0 0.375rem;
  font-size: 0.6875rem;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.prices {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 0.375rem 0.5rem;
  margin-bottom: 0.5rem;
}

.price-new {
  font-size: 1.0625rem;
  font-weight: 700;
  color: var(--text);
}

.price-old {
  font-size: 0.8125rem;
  color: var(--old-price);
  text-decoration: line-through;
}

.discount {
  font-size: 0.75rem;
  font-weight: 700;
  color: var(--discount);
  background: rgba(61, 214, 140, 0.12);
  padding: 0.125rem 0.375rem;
  border-radius: 0.25rem;
}

.card-link {
  display: inline-block;
  align-self: flex-start;
  margin-top: auto;
  padding: 0.4375rem 0.75rem;
  font-size: 0.8125rem;
  font-weight: 600;
  color: #fff;
  background: var(--accent);
  border-radius: 0.375rem;
  text-decoration: none;
  transition: background 0.15s;
}

.card-link:active,
.card-link:hover {
  background: var(--accent-hover);
}

.empty,
.error {
  text-align: center;
  padding: 2rem 1rem;
  color: var(--muted);
  font-size: 0.9375rem;
}

/* Footer disclaimer */

footer {
  padding: 1rem;
  border-top: 1px solid var(--border);
  font-size: 0.6875rem;
  color: var(--muted);
  text-align: center;
  line-height: 1.6;
}

@media (min-width: 480px) {
  header,
  main {
    max-width: 32rem;
    margin-left: auto;
    margin-right: auto;
  }

  footer {
    max-width: 32rem;
    margin: 0 auto;
  }
}
