/* ============================================================
   WAF Tools Directory — Global Styles
   Typography: Space Grotesk (display + logo), Overpass (body),
   JetBrains Mono (metadata).
   WAF brand purple #443fde as the only strong accent.
   Light by default, dark via [data-prefers-color-scheme="dark"].
   ============================================================ */

:root {
  /* Brand */
  --waf-accent: #443fde;
  --waf-accent-hover: #3530c4;
  --waf-accent-soft: #ece9ff;

  /* Surface */
  --bg: #fafaf7;
  --bg-elevated: #ffffff;
  --bg-subtle: #f3f2ed;
  --border: #e7e5dd;
  --border-strong: #d4d2c8;

  /* Text */
  --text: #1a1a1a;
  --text-muted: #5a5a55;
  --text-faint: #8a8a83;

  /* Type */
  --font-display: 'Space Grotesk', 'Helvetica Neue', system-ui, sans-serif;
  --font-body: 'Overpass', 'Helvetica Neue', system-ui, sans-serif;
  --font-mono: 'JetBrains Mono', 'SF Mono', Menlo, monospace;

  /* Layout */
  --container: 1240px;
  --gutter: clamp(1rem, 4vw, 2.5rem);
  --radius-sm: 4px;
  --radius: 8px;
  --radius-lg: 16px;
}

html[data-prefers-color-scheme="dark"] {
  --bg: #0e0e0c;
  --bg-elevated: #1a1a17;
  --bg-subtle: #16161300;
  --border: #2a2a26;
  --border-strong: #3a3a34;
  --text: #f5f4ee;
  --text-muted: #a8a7a0;
  --text-faint: #6f6e68;
  --waf-accent-soft: #1f1c4a;
}

* { box-sizing: border-box; margin: 0; padding: 0; }

html {
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-body);
  font-size: 16px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

body { min-height: 100vh; }

h1, h2, h3, h4 {
  font-family: var(--font-display);
  font-weight: 500;
  line-height: 1.05;
  letter-spacing: -0.02em;
  color: var(--text);
}

h1 { font-size: clamp(2rem, 4.5vw, 3.25rem); font-weight: 500; }
h2 { font-size: clamp(1.5rem, 3vw, 2.25rem); }
h3 { font-size: 1.375rem; letter-spacing: -0.01em; }
h4 { font-size: 1.125rem; letter-spacing: -0.01em; font-weight: 600; }

a {
  color: var(--text);
  text-decoration: underline;
  text-decoration-color: var(--border-strong);
  text-underline-offset: 3px;
  transition: text-decoration-color 0.15s ease;
}
a:hover { text-decoration-color: var(--waf-accent); }

.container {
  max-width: var(--container);
  margin: 0 auto;
  padding: 0 var(--gutter);
}

.mono-label {
  font-family: var(--font-mono);
  font-size: 0.6875rem;
  font-weight: 500;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-faint);
}

/* ============================================================
   Header
   ============================================================ */
.site-header {
  border-bottom: 1px solid var(--border);
  background: var(--bg);
  position: sticky;
  top: 0;
  z-index: 50;
  backdrop-filter: blur(12px);
  background: color-mix(in srgb, var(--bg) 85%, transparent);
}
.site-header__inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1.25rem 0;
}
.site-header__brand-group {
  display: flex;
  align-items: baseline;
  gap: 0.625rem;
}
.site-header__brand {
  font-family: var(--font-display);
  font-size: 1.125rem;
  font-weight: 600;
  text-decoration: none;
  letter-spacing: -0.02em;
  color: var(--text);
}
.site-header__brand:hover { color: var(--waf-accent); }
.site-header__divider {
  font-family: var(--font-display);
  font-size: 1.125rem;
  color: var(--text-muted);
  font-weight: 400;
}
.site-header__tools {
  font-family: var(--font-display);
  font-size: 1.125rem;
  font-weight: 600;
  text-decoration: none;
  letter-spacing: -0.02em;
  color: var(--waf-accent);
}
.site-header__tools:hover { opacity: 0.85; }
.site-header__nav {
  display: flex;
  gap: 1rem;
  font-size: 0.875rem;
  align-items: center;
}

/* Submit your tool — solid CTA matching WAF's Subscribe button */
.site-header__submit {
  display: inline-flex;
  align-items: center;
  padding: 0.5rem 1.125rem;
  background: var(--waf-accent);
  border: 1px solid var(--waf-accent);
  border-radius: 999px;
  color: white !important;
  font-weight: 600;
  font-size: 0.8125rem;
  text-decoration: none;
  transition: opacity 120ms ease;
  white-space: nowrap;
}
.site-header__submit:hover {
  opacity: 0.9;
  color: white !important;
}

/* Theme toggle */
.theme-toggle {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  background: transparent;
  border: 1px solid var(--border);
  border-radius: 999px;
  color: var(--text-muted);
  cursor: pointer;
  transition: color 0.15s ease, border-color 0.15s ease, background 0.15s ease;
}
.theme-toggle:hover {
  color: var(--text);
  border-color: var(--text);
  background: var(--bg-subtle);
}
.theme-toggle__icon { display: none; }
html[data-prefers-color-scheme="dark"] .theme-toggle__icon--sun { display: block; }
html:not([data-prefers-color-scheme="dark"]) .theme-toggle__icon--moon { display: block; }

/* ============================================================
   Footer
   ============================================================ */
.site-footer {
  border-top: 1px solid var(--border);
  margin-top: 6rem;
  padding: 3rem 0 4rem;
  font-size: 0.875rem;
  color: var(--text-muted);
}
.site-footer p { max-width: 60ch; }
.site-footer a { color: var(--text); }

/* ============================================================
   Buttons & pills
   ============================================================ */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.75rem 1.25rem;
  font-family: var(--font-body);
  font-size: 0.9375rem;
  font-weight: 500;
  text-decoration: none;
  border-radius: var(--radius);
  border: 1px solid transparent;
  cursor: pointer;
  transition: all 0.15s ease;
  line-height: 1;
}
.btn--primary { background: var(--waf-accent); color: #fff; }
.btn--primary:hover { background: var(--waf-accent-hover); }
.btn--ghost {
  background: transparent;
  color: var(--text);
  border-color: var(--border-strong);
}
.btn--ghost:hover { border-color: var(--text); }

.pill {
  display: inline-flex;
  align-items: center;
  gap: 0.375rem;
  padding: 0.5rem 1rem;
  font-family: var(--font-body);
  font-size: 0.8125rem;
  font-weight: 500;
  letter-spacing: 0;
  color: var(--text-muted);
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: 999px;
  text-decoration: none;
  cursor: pointer;
  transition: all 0.15s ease;
  white-space: nowrap;
  flex-shrink: 0;
}
.pill:hover, .pill[aria-pressed="true"] {
  color: var(--waf-accent);
  border-color: var(--waf-accent);
  background: var(--waf-accent-soft);
}

/* ============================================================
   Tool card
   ============================================================ */
.tool-card {
  display: block;
  padding: 1.5rem;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  text-decoration: none;
  color: inherit;
  transition: border-color 0.2s ease, transform 0.2s ease;
}
.tool-card:hover {
  border-color: var(--text);
  transform: translateY(-2px);
}
.tool-card__head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  margin-bottom: 1rem;
  gap: 1rem;
}
.tool-card__head-left {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  min-width: 0;
}
.tool-card__logo {
  width: 32px;
  height: 32px;
  border-radius: 6px;
  flex-shrink: 0;
  background: var(--bg-subtle);
  object-fit: contain;
}
.tool-card__name {
  font-family: var(--font-display);
  font-size: 1.5rem;
  font-weight: 600;
  letter-spacing: -0.02em;
}
.tool-card__price {
  font-family: var(--font-mono);
  font-size: 0.8125rem;
  color: var(--text-muted);
  white-space: nowrap;
  padding-top: 0.4rem;
  text-align: right;
}
.tool-card__price strong { color: var(--text); font-weight: 500; }
.tool-card__tagline {
  color: var(--text-muted);
  font-size: 0.9375rem;
  margin-bottom: 1.25rem;
  line-height: 1.5;
}
.tool-card__meta {
  display: flex;
  flex-wrap: wrap;
  gap: 0.375rem;
  padding-top: 1rem;
  border-top: 1px solid var(--border);
}
.tool-card__meta .pill {
  cursor: default;
  pointer-events: none;
  font-family: var(--font-mono);
  font-size: 0.6875rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  padding: 0.4rem 0.75rem;
}

.tools-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: 1.25rem;
}

/* ============================================================
   Compact intro
   ============================================================ */
.directory-intro {
  padding: 2.5rem 0 1.75rem;
}
.directory-intro__eyebrow {
  font-family: var(--font-mono);
  font-size: 0.75rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--waf-accent);
  margin-bottom: 0.75rem;
}
.directory-intro__heading {
  font-size: clamp(1.75rem, 3.5vw, 2.5rem);
  line-height: 1.1;
  max-width: 22ch;
  font-weight: 500;
}
.directory-intro__heading em {
  font-style: italic;
  color: var(--text-muted);
  font-weight: 400;
}

.page-hero { padding: 3rem 0 2rem; }
.page-hero__eyebrow {
  font-family: var(--font-mono);
  font-size: 0.75rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--waf-accent);
  margin-bottom: 1rem;
}
.page-hero__lede {
  font-family: var(--font-body);
  font-size: clamp(1.0625rem, 1.75vw, 1.25rem);
  color: var(--text-muted);
  margin-top: 1rem;
  max-width: 60ch;
  line-height: 1.4;
  font-weight: 400;
  font-style: italic;
}

/* ============================================================
   Category strip — full-width scroll, but pills aligned to container
   ============================================================ */
.category-strip {
  position: relative;
  width: 100%;
  margin-bottom: 0.5rem;
}
.category-strip__scroll-wrap {
  position: relative;
  width: 100%;
}
.category-strip__pills {
  display: flex;
  gap: 0.625rem;
  flex-wrap: nowrap;
  overflow-x: auto;
  scroll-snap-type: x proximity;
  scrollbar-width: none;
  -ms-overflow-style: none;
  padding: 1rem var(--gutter);
  /* Center the row within the container so first pill aligns
     with the page heading above it */
  max-width: var(--container);
  margin: 0 auto;
}
.category-strip__pills::-webkit-scrollbar { display: none; }
.category-strip__pills .pill { scroll-snap-align: start; }

.category-strip__fade {
  position: absolute;
  top: 0;
  right: 0;
  bottom: 0;
  width: clamp(3rem, 6vw, 4.5rem);
  background: linear-gradient(to right, transparent, var(--bg) 60%);
  pointer-events: none;
}

/* ============================================================
   Filter bar
   ============================================================ */
.filter-bar {
  border-bottom: 1px solid var(--border);
  padding: 0.875rem 0;
  margin-bottom: 2.5rem;
}
.filter-bar__inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}
.filter-bar__left, .filter-bar__right {
  display: flex;
  align-items: center;
}
.filter-bar__count {
  font-family: var(--font-mono);
  font-size: 0.8125rem;
  color: var(--text-muted);
}

/* Toggle switch */
.toggle {
  display: inline-flex;
  align-items: center;
  gap: 0.75rem;
  cursor: pointer;
  user-select: none;
}
.toggle__label {
  font-size: 0.875rem;
  color: var(--text-muted);
  font-weight: 500;
}
.toggle__input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
  width: 0;
  height: 0;
}
.toggle__track {
  position: relative;
  display: inline-block;
  width: 36px;
  height: 20px;
  background: var(--border-strong);
  border-radius: 999px;
  transition: background 0.18s ease;
  flex-shrink: 0;
}
.toggle__thumb {
  position: absolute;
  top: 2px;
  left: 2px;
  width: 16px;
  height: 16px;
  background: var(--bg-elevated);
  border-radius: 50%;
  transition: transform 0.18s ease;
  box-shadow: 0 1px 2px rgba(0,0,0,0.15);
}
.toggle__input:checked ~ .toggle__track {
  background: var(--waf-accent);
}
.toggle__input:checked ~ .toggle__track .toggle__thumb {
  transform: translateX(16px);
}
.toggle:hover .toggle__label { color: var(--text); }
.toggle__input:focus-visible ~ .toggle__track {
  outline: 2px solid var(--waf-accent);
  outline-offset: 2px;
}

[data-hidden="true"] { display: none !important; }

/* ============================================================
   Section heading + lede
   ============================================================ */
.section-heading {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  margin: 4rem 0 0.5rem;
  padding-bottom: 1rem;
  border-bottom: 1px solid var(--border);
}
.section-heading h2 { font-size: 1.75rem; font-weight: 500; }
.section-heading a { font-size: 0.875rem; color: var(--text-muted); }

.section-lede {
  font-family: var(--font-body);
  font-style: italic;
  font-size: 1.0625rem;
  color: var(--text-muted);
  max-width: 60ch;
  line-height: 1.45;
  margin: 0 0 2rem;
}

.empty-state {
  text-align: center;
  padding: 4rem 1rem;
  color: var(--text-muted);
}

/* ============================================================
   Tool detail page (kept for [slug].astro)
   ============================================================ */
.tool-detail__tagline {
  font-family: var(--font-display);
  font-weight: 500;
}

/* ============================================================
   Responsive
   ============================================================ */
@media (max-width: 760px) {
  .site-header__inner { padding: 1rem 0; gap: 0.75rem; }
  .site-header__nav { gap: 0.625rem; font-size: 0.75rem; }
  .site-header__brand,
  .site-header__divider,
  .site-header__tools { font-size: 0.9375rem; }
  .site-header__submit {
    padding: 0.4375rem 0.875rem;
    font-size: 0.75rem;
  }

  .category-strip__fade {
    width: 3rem;
  }
}
