/* findcanada — styles
   Palette: Canadian red on warm off-white. Keep it clean and trustworthy.
   Spacing follows an 8px grid. Colours are chosen to meet WCAG AA contrast
   (4.5:1 for text, 3:1 for large text/UI). See docs/design-notes.md. */

:root {
  --red: #d52b1e;
  --red-dark: #b02318;
  --ink: #1f2328;
  --ink-soft: #57606a;
  --paper: #faf8f5;
  --card: #ffffff;
  --line: #e8e2da;
  --line-strong: #d3c9ba;
  --gold: #7a5a06;       /* darkened from #b8860b — 2.8:1 failed AA, now 5.5:1 */
  --gold-bg: #f5efdc;
  --green: #146b40;      /* used for the "link checked" note; 5.7:1 on white */
  --focus: #1a56db;
  --radius: 14px;
  --radius-sm: 8px;
  --shadow: 0 1px 2px rgba(31, 35, 40, 0.06), 0 4px 14px rgba(31, 35, 40, 0.06);
  --touch-min: 44px;
  --nav-h: 56px;
}

* { box-sizing: border-box; }

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  background: var(--paper);
  color: var(--ink);
  line-height: 1.55;
  font-size: 16px;
}

.container {
  max-width: 1040px;
  margin: 0 auto;
  padding: 0 20px;
}

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

/* Skip link — hidden until focused, first stop for keyboard users */
.skip-link {
  position: absolute;
  top: -48px;
  left: 12px;
  z-index: 100;
  background: var(--ink);
  color: #fff;
  padding: 12px 18px;
  border-radius: var(--radius-sm);
  text-decoration: none;
  font-weight: 600;
  transition: top 0.15s ease;
}

.skip-link:focus {
  top: 12px;
}

/* Focus visibility — one consistent ring across every interactive element */
a:focus-visible,
button:focus-visible,
input:focus-visible {
  outline: 3px solid var(--focus);
  outline-offset: 2px;
  border-radius: var(--radius-sm);
}

/* Hero */
.hero {
  background: linear-gradient(180deg, #fff 0%, var(--paper) 100%);
  border-bottom: 1px solid var(--line);
  text-align: center;
  padding: 48px 0 32px;
}

.hero-flag { font-size: 44px; margin: 0 0 8px; }

.hero h1 {
  font-size: clamp(1.9rem, 5vw, 3rem);
  margin: 0 0 12px;
  letter-spacing: -0.02em;
}

.hero-sub {
  font-size: clamp(1.05rem, 2.5vw, 1.3rem);
  color: var(--ink-soft);
  max-width: 620px;
  margin: 0 auto 10px;
}

.hero-why {
  color: var(--ink-soft);
  font-size: 0.95rem;
  max-width: 560px;
  margin: 0 auto 24px;
}

.hero-cta {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: var(--touch-min);
  background: var(--red);
  color: #fff;
  text-decoration: none;
  font-weight: 600;
  font-size: 1rem;
  padding: 12px 28px;
  border-radius: 999px;
  transition: background 0.15s ease, transform 0.15s ease;
}

.hero-cta:hover { background: var(--red-dark); }

/* Trust strip — short, honest, factual claims only (no fabricated logos/press) */
.trust-strip {
  list-style: none;
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 8px 24px;
  margin: 20px 0 0;
  padding: 0;
  font-size: 0.85rem;
  color: var(--ink-soft);
}

.trust-strip li { display: flex; align-items: center; gap: 6px; }

/* Category filters */
.filters {
  position: sticky;
  top: 0;
  z-index: 20;
  background: var(--paper);
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: center;
  align-items: center;
  padding: 12px 20px;
  border-bottom: 1px solid transparent;
}

.filters.is-stuck {
  border-bottom-color: var(--line-strong);
  box-shadow: 0 2px 10px rgba(31, 35, 40, 0.06);
}

.filter-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: var(--touch-min);
  border: 1px solid var(--line-strong);
  background: var(--card);
  color: var(--ink);
  padding: 8px 18px;
  border-radius: 999px;
  font-size: 0.95rem;
  cursor: pointer;
  transition: background-color 0.15s ease, border-color 0.15s ease, color 0.15s ease;
}

.filter-btn:hover { border-color: var(--red); color: var(--red); }

.filter-btn.is-active {
  background: var(--red);
  border-color: var(--red);
  color: #fff;
}

.product-count {
  text-align: center;
  color: var(--ink-soft);
  font-size: 0.9rem;
  margin: 18px 0 0;
}

.mini-disclosure {
  text-align: center;
  color: var(--ink-soft);
  font-size: 0.78rem;
  margin: 4px 0 18px;
}

.mini-disclosure a { color: var(--ink-soft); }

/* Product grid */
.grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 20px;
  padding-bottom: 48px;
  scroll-margin-top: calc(var(--nav-h) + 12px);
}

.loading, .empty-state, .error-state {
  color: var(--ink-soft);
  text-align: center;
  grid-column: 1 / -1;
  padding: 32px 16px;
}

.loading {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
}

.spinner {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  border: 3px solid var(--line);
  border-top-color: var(--red);
  animation: spin 0.8s linear infinite;
}

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

.error-state {
  background: #fdeae8;
  color: var(--red-dark);
  border-radius: var(--radius);
  border: 1px solid #f6c9c3;
}

.card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}

.card:hover {
  transform: translateY(-2px);
  box-shadow: 0 2px 4px rgba(31, 35, 40, 0.08), 0 10px 24px rgba(31, 35, 40, 0.1);
}

.card-emoji {
  width: 56px;
  height: 56px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 28px;
  line-height: 1;
  background: linear-gradient(160deg, #fdeae8, #fff);
  border-radius: 50%;
}

.card h3 { margin: 0; font-size: 1.1rem; }

.card-brand { color: var(--ink-soft); font-size: 0.85rem; margin: -6px 0 0; }

.card-desc { font-size: 0.92rem; color: var(--ink-soft); margin: 0; flex-grow: 1; }

.card-badges { display: flex; flex-wrap: wrap; gap: 6px; }

.badge {
  display: inline-block;
  font-size: 0.78rem;
  font-weight: 600;
  padding: 4px 10px;
  border-radius: 999px;
  white-space: nowrap;
}

.badge-made { background: #fdeae8; color: var(--red-dark); }
.badge-grown { background: var(--gold-bg); color: var(--gold); }
.badge-owned { background: #e9eef4; color: #2c4a68; }

.card-provenance {
  font-size: 0.8rem;
  color: var(--ink-soft);
  margin: 0;
  border-left: 3px solid var(--line);
  padding-left: 10px;
}

.card-footer {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 12px;
  margin-top: 4px;
  padding-top: 12px;
  border-top: 1px solid var(--line);
}

.card-price-wrap { display: flex; flex-direction: column; gap: 2px; min-width: 0; }

.card-price { font-weight: 700; font-size: 1.05rem; }
.card-price .approx { font-weight: 400; font-size: 0.75rem; color: var(--ink-soft); }

.card-retailer {
  font-size: 0.78rem;
  color: var(--ink-soft);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.card-retailer .verified { color: var(--green); font-weight: 600; }

.buy-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: var(--touch-min);
  flex-shrink: 0;
  background: var(--red);
  color: #fff;
  text-decoration: none;
  font-weight: 600;
  padding: 10px 22px;
  border-radius: 999px;
  font-size: 0.95rem;
  transition: background 0.15s ease;
}

.buy-btn:hover { background: var(--red-dark); }

/* Badges explainer */
.badges-explainer {
  border-top: 1px solid var(--line);
  padding-top: 36px;
  padding-bottom: 36px;
}

.badges-explainer h2 { margin-top: 0; }

.badge-list { list-style: none; padding: 0; margin: 0; display: grid; gap: 12px; }

.badge-list li { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; color: var(--ink-soft); }

/* Signup */
.signup {
  background: var(--ink);
  color: #fff;
  text-align: center;
  padding: 44px 0;
}

.signup h2 { margin: 0 0 8px; }
.signup p { color: #c8cdd3; margin: 0 0 20px; }
.signup .signup-note { font-size: 0.78rem; margin-top: 12px; color: #9aa2ab; }

.signup-form {
  display: flex;
  gap: 10px;
  justify-content: center;
  flex-wrap: wrap;
}

.signup-form input {
  min-height: var(--touch-min);
  padding: 11px 16px;
  border-radius: 999px;
  border: 2px solid transparent;
  font-size: 1rem;
  min-width: 260px;
}

.signup-form button {
  min-height: var(--touch-min);
  background: var(--red);
  color: #fff;
  border: none;
  padding: 11px 24px;
  border-radius: 999px;
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
}

.signup-form button:hover { background: var(--red-dark); }

.signup-message { min-height: 1.4em; font-size: 0.9rem; }

/* Footer */
.site-footer {
  padding: 32px 0 40px;
  text-align: center;
  color: var(--ink-soft);
  font-size: 0.9rem;
}

.disclosure {
  font-size: 0.8rem;
  max-width: 640px;
  margin: 8px auto;
  scroll-margin-top: calc(var(--nav-h) + 12px);
}

.site-version {
  font-size: 0.72rem;
  color: var(--ink-soft);
  opacity: 0.7;
  margin: 16px 0 0;
}

@media (max-width: 480px) {
  .signup-form input { min-width: 0; width: 100%; }
  .signup-form button { width: 100%; }

  .card { padding: 16px; }

  .card-footer { flex-wrap: wrap; }

  .buy-btn { width: 100%; }

  .card-retailer { white-space: normal; }
}

/* Reduced motion — disable transforms/animation, keep the change itself instant */
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }

  * {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }

  .card:hover { transform: none; }
}
