/* =============================================================
   1. Tokens
   ============================================================= */
:root {
  --bg: #f0ece3;
  --surface: #ffffff;
  --surface-2: #f7f3ea;
  --text: #221b22;
  --text-muted: #6e646f;
  --primary: #7a2e3b;
  --primary-dark: #5c2029;
  --secondary: #5f7d5b;
  --gold: #b4842a;
  --border: #ddd3c4;
  --radius: 14px;
  --shadow: 0 2px 10px rgba(34, 27, 34, 0.08);
  --ease-out: cubic-bezier(0.16, 1, 0.3, 1);
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #1b1620;
    --surface: #241d28;
    --surface-2: #2c232f;
    --text: #f1eae4;
    --text-muted: #b8adb6;
    --primary: #e08a99;
    --primary-dark: #f0a7b3;
    --secondary: #8fb089;
    --gold: #e0b65c;
    --border: #3c3140;
    --shadow: 0 2px 14px rgba(0, 0, 0, 0.35);
  }
}

/* =============================================================
   2. Reset & base
   ============================================================= */
*, *::before, *::after { box-sizing: border-box; margin: 0; }
html { -webkit-text-size-adjust: 100%; tab-size: 2; }
body {
  background: var(--bg);
  color: var(--text);
  font-family: "Work Sans", system-ui, -apple-system, sans-serif;
  font-size: 16px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  overflow-x: clip;
}
h1, h2, h3 { font-family: "Fraunces", Georgia, serif; text-wrap: balance; line-height: 1.08; margin: 0 0 0.4em; }
p { text-wrap: pretty; }
a { color: var(--primary); }
img, svg, video { display: block; max-width: 100%; }
button { font: inherit; color: inherit; cursor: pointer; border: 0; background: none; }
:focus-visible { outline: 2px solid var(--primary); outline-offset: 3px; border-radius: 4px; }

/* =============================================================
   3. Utilities
   ============================================================= */
.visually-hidden { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.wrap { max-width: 1080px; margin: 0 auto; padding: 0 20px; }
.skip-link { position: fixed; top: -100px; left: 1rem; padding: .6rem 1rem; background: var(--surface); color: var(--text); z-index: 9999; border-radius: 8px; font-weight: 600; }
.skip-link:focus { top: 1rem; }

/* =============================================================
   4. Typography
   ============================================================= */
.tagline { color: var(--text-muted); font-size: 0.98rem; margin: 0; }

/* =============================================================
   5. Components
   ============================================================= */
.btn { border: none; border-radius: 999px; padding: 11px 20px; font-weight: 600; font-size: 0.95rem; cursor: pointer; transition: transform .12s var(--ease-out), background .12s var(--ease-out); text-decoration: none; display: inline-flex; align-items: center; gap: 6px; }
.btn:hover { transform: translateY(-1px); }
.btn-primary { background: var(--primary); color: #fff; }
.btn-primary:hover { background: var(--primary-dark); }
.btn-ghost { background: var(--surface-2); color: var(--text); }
.chip { border: 1px solid var(--border); background: var(--surface); color: var(--text); border-radius: 999px; padding: 7px 14px; font-size: 0.86rem; cursor: pointer; }
.chip-row { display: flex; flex-wrap: wrap; gap: 8px; }

.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 16px; box-shadow: var(--shadow); display: flex; flex-direction: column; gap: 6px; }
.card-name { font-size: 1.08rem; margin: 0; }
.card-meta { margin: 0; color: var(--secondary); font-size: 0.82rem; font-weight: 600; text-transform: uppercase; letter-spacing: .03em; }
.card-address { margin: 0; color: var(--text-muted); font-size: 0.9rem; }
.card-rating { display: flex; align-items: center; gap: 6px; font-family: "IBM Plex Mono", monospace; font-size: 0.86rem; flex-wrap: wrap; }
.stars { color: var(--gold); letter-spacing: 1px; }
.rating-num { font-weight: 700; }
.rating-count { color: var(--text-muted); }
.card-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 6px; }
.card-map { margin-top: 8px; border-radius: 10px; overflow: hidden; border: 1px solid var(--border); }
.card-map iframe { width: 100%; height: 220px; border: 0; display: block; }
.empty-state { color: var(--text-muted); padding: 20px 0; }

/* =============================================================
   6. Sections
   ============================================================= */
.site-header { padding: 22px 0 10px; }
.header-inner { display: flex; flex-direction: column; gap: 2px; }
.brand { display: flex; align-items: center; gap: 10px; }
.brand-mark { font-size: 1.6rem; }
.brand-name { font-family: "Fraunces", serif; font-weight: 700; font-size: 1.5rem; }

.tool { padding: 18px 20px 28px; }
.tool-h1 { font-size: clamp(1.6rem, 3.4vw, 2.3rem); }
.tool-sub { color: var(--text-muted); margin: 0 0 18px; max-width: 60ch; }

.tool-card { background: var(--surface); border: 1px solid var(--border); border-radius: 18px; padding: 18px; box-shadow: var(--shadow); }
.search-row { display: flex; gap: 10px; flex-wrap: wrap; margin-bottom: 10px; }
#search-input { flex: 1 1 260px; padding: 13px 16px; font-size: 1rem; border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface-2); color: var(--text); font-family: inherit; }
#search-input:focus { outline: 2px solid var(--primary); outline-offset: 1px; }

.privacy-badge { display: flex; align-items: center; gap: 8px; color: var(--text-muted); font-size: 0.86rem; margin: 12px 0 0; }
.results-area { margin-top: 18px; min-height: 60px; }
.results-count { color: var(--text-muted); font-size: 0.88rem; margin: 0 0 12px; }
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 16px; }

.tool-card[data-state="empty"] .results-loading,
.tool-card[data-state="empty"] .results-error,
.tool-card[data-state="loading"] .results-empty-hint,
.tool-card[data-state="loading"] .results-error,
.tool-card[data-state="done"] .results-loading,
.tool-card[data-state="done"] .results-empty-hint,
.tool-card[data-state="done"] .results-error,
.tool-card[data-state="error"] .results-loading,
.tool-card[data-state="error"] .results-empty-hint { display: none; }
.tool-card:not([data-state="error"]) .results-error { display: none; }
.results-loading { color: var(--text-muted); padding: 10px 0; }
.results-empty-hint { color: var(--text-muted); padding: 6px 0 0; }
.results-error { background: var(--surface-2); border: 1px solid var(--border); border-radius: 10px; padding: 12px 14px; color: var(--primary-dark); }

.ad-slot { padding: 22px 20px; }
.ad-box { border: 2px dashed var(--border); border-radius: 12px; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px; color: var(--text-muted); font-weight: 700; letter-spacing: .08em; background: var(--surface-2); }
.ad-slot--banner .ad-box { height: 90px; }
.ad-slot--incontent .ad-box { height: 160px; }
.ad-box small { font-weight: 500; letter-spacing: 0; font-size: 0.72rem; }

.steps { padding: 26px 20px; }
.steps-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 20px; margin-top: 14px; }
.step { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 18px; }
.step-num { display: inline-flex; align-items: center; justify-content: center; width: 30px; height: 30px; border-radius: 50%; background: var(--primary); color: #fff; font-weight: 700; font-family: "IBM Plex Mono", monospace; margin-bottom: 8px; }

.seo-text { padding: 6px 20px 10px; max-width: 72ch; color: var(--text-muted); }
.seo-text h2 { color: var(--text); }
.popular { padding: 6px 20px 26px; }
.faq { padding: 6px 20px 34px; }
.faq details { border-bottom: 1px solid var(--border); padding: 12px 0; }
.faq summary { cursor: pointer; font-weight: 600; }
.faq p { color: var(--text-muted); margin: 10px 0 0; }

.site-footer { padding: 20px 20px 34px; color: var(--text-muted); font-size: 0.85rem; border-top: 1px solid var(--border); }

.corner-ad { position: fixed; left: 14px; bottom: 14px; z-index: 40; }
.ad-box--corner { width: 150px; height: 70px; font-size: 0.78rem; }
.corner-ad-close { position: absolute; top: -8px; right: -8px; width: 22px; height: 22px; border-radius: 50%; border: 1px solid var(--border); background: var(--surface); cursor: pointer; font-size: 0.9rem; line-height: 1; }

.modal-overlay { position: fixed; inset: 0; background: rgba(20, 16, 20, 0.55); display: flex; align-items: center; justify-content: center; z-index: 60; padding: 16px; }
.modal-overlay[hidden] { display: none; }
.modal { background: var(--surface); border-radius: 16px; padding: 20px; max-width: 340px; width: 100%; position: relative; box-shadow: 0 12px 40px rgba(0, 0, 0, 0.3); }
.modal-close { position: absolute; top: 10px; right: 10px; width: 30px; height: 30px; border-radius: 50%; border: 1px solid var(--border); background: var(--surface-2); cursor: pointer; font-size: 1.1rem; line-height: 1; }
.ad-box--popup { height: 250px; }

/* =============================================================
   7. Effects
   ============================================================= */
.chip:hover { background: var(--surface-2); }

/* =============================================================
   8. Responsive
   ============================================================= */
@media (max-width: 720px) {
  .steps-grid { grid-template-columns: 1fr; }
  .search-row { flex-direction: column; }
  #search-input { flex: none; width: 100%; }
  #near-me-btn { width: 100%; justify-content: center; }
}

/* =============================================================
   9. Reduced motion (only intrusive effects)
   ============================================================= */
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
}
@media (prefers-reduced-motion: no-preference) {
  html { scroll-behavior: smooth; }
}
