:root {
  --accent: #14b8d4;
  --accent-pressed: #0fa3bc;
  --on-accent: #06262d;      /* dark text on teal: white would be too faint */
  --bg: #faf6ef;
  --surface: #ffffff;
  --text: #231f1b;
  --muted: #625a51;
  --border: #e7ded1;
  --control-border: #8f8478;
  --focus: #0b6e80;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #171412;
    --surface: #221e1b;
    --text: #f5f0e9;
    --muted: #bdb3a7;
    --border: #38322c;
    --control-border: #7d7368;
    --focus: #5fdcf0;
  }
}

* { box-sizing: border-box; }

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

body {
  margin: 0;
  min-height: 100vh;
  background: var(--bg);
  color: var(--text);
  font: 1rem/1.5 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  padding-top: env(safe-area-inset-top);
  padding-right: max(16px, env(safe-area-inset-right));
  padding-bottom: env(safe-area-inset-bottom);
  padding-left: max(16px, env(safe-area-inset-left));
}

.site-header,
main,
.site-footer {
  max-width: 720px;
  margin: 0 auto;
}

.site-header { text-align: center; padding: 24px 0 16px; }

.logo {
  display: block;
  margin: 0 auto 10px;
  width: 96px;
  height: 96px;
  border-radius: 50%;
  object-fit: cover;
  border: 3px solid var(--accent);
}

h1 { margin: 0; font-size: 1.5rem; overflow-wrap: anywhere; }

.tagline { margin: 4px auto 0; max-width: 30ch; color: var(--muted); }

.controls { margin-bottom: 18px; }

#search {
  width: 100%;
  min-height: 48px;
  padding: 0 18px;
  font: inherit; /* 16px or more stops iOS zooming on focus */
  color: var(--text);
  background: var(--surface);
  border: 1px solid var(--control-border);
  border-radius: 999px;
  -webkit-appearance: none;
  appearance: none;
}

#search::placeholder { color: var(--muted); }

.chips {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 8px;
  margin-top: 12px;
}

.chip {
  min-height: 44px;
  padding: 0 16px;
  font: inherit;
  font-weight: 600;
  color: var(--text);
  background: var(--surface);
  border: 1px solid var(--control-border);
  border-radius: 999px;
  cursor: pointer;
  touch-action: manipulation;
}

.chip[aria-pressed="true"] {
  color: var(--on-accent);
  background: var(--accent);
  border-color: var(--accent);
}

/* Keeps all four chips on one line on very narrow phones */
@media (max-width: 359px) {
  .chips { gap: 6px; }
  .chip { min-width: 44px; padding: 0 11px; font-size: 0.9375rem; }
}

.products {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 16px;
  margin: 0;
  padding: 0;
  list-style: none;
}

@media (min-width: 600px) {
  .products { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

.card {
  position: relative; /* anchors the full-card link */
  display: flex;
  flex-direction: column;
  height: 100%;
  overflow: hidden;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 20px;
}

.card-image {
  display: block;
  width: 100%;
  height: auto;
  aspect-ratio: 1 / 1;
  object-fit: cover;
  background: var(--border);
}

.card-body {
  display: flex;
  flex: 1;
  flex-direction: column;
  align-items: flex-start;
  gap: 8px;
  padding: 16px;
}

.card h3 { margin: 0; font-size: 1.2rem; line-height: 1.3; overflow-wrap: anywhere; }

.badge {
  display: inline-block;
  padding: 3px 12px;
  font-size: 0.875rem;
  font-weight: 700;
  border-radius: 999px;
}

.badge-worth-it { color: #ffffff; background: #146c37; }
.badge-skip     { color: #ffffff; background: #b42318; }
.badge-depends  { color: #2b1d00; background: #f7b731; }

.note { margin: 0; color: var(--muted); overflow-wrap: anywhere; }

.buy {
  display: flex;
  align-items: center;
  justify-content: center;
  align-self: stretch;
  min-height: 52px;
  margin-top: auto; /* lines buttons up across a row */
  padding: 12px 16px;
  font-size: 1.05rem;
  font-weight: 700;
  text-align: center;
  text-decoration: none;
  color: var(--on-accent);
  background: var(--accent);
  border-radius: 14px;
  touch-action: manipulation;
}

/* Makes the whole card open the product link */
.buy::after { content: ""; position: absolute; inset: 0; }

.buy:active { background: var(--accent-pressed); }

.video-number { align-self: center; margin: 0; font-size: 0.875rem; color: var(--muted); }

.message { text-align: center; padding: 32px 8px; color: var(--muted); }

.site-footer {
  padding: 28px 0 24px;
  text-align: center;
  font-size: 0.875rem;
  color: var(--muted);
}

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

[hidden] { display: none !important; }

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