/* ==========================================================
   Learn & Respond: base styles and design tokens
   ========================================================== */

/* Self-hosted fonts (SIL Open Font License 1.1, see fonts/LICENSE-*.txt) */
@font-face {
  font-family: 'Inter';
  src: url('../fonts/inter-latin-wght-normal.woff2') format('woff2');
  font-weight: 100 900;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: 'JetBrains Mono';
  src: url('../fonts/jetbrains-mono-latin-wght-normal.woff2') format('woff2');
  font-weight: 100 800;
  font-style: normal;
  font-display: swap;
}

:root {
  --font: 'Inter', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
  --mono: 'JetBrains Mono', ui-monospace, Consolas, monospace;

  --radius-sm: 8px;
  --radius: 14px;
  --radius-lg: 22px;

  --c-ems: #3b9eff;
  --c-fire: #ff5d3b;
  --c-ref: #a78bfa;
  --c-ok: #30c47a;
  --c-warn: #ffb224;
  --c-bad: #ff5a5f;
  --brand: #e5484d;
  --brand-2: #ff8a3d;
}

:root[data-theme="dark"] {
  --bg: #0a0d14;
  --bg-2: #0f141e;
  --surface: #131a26;
  --surface-2: #1a2232;
  --surface-3: #222c3f;
  --border: #253047;
  --border-strong: #34425f;
  --text: #e8edf6;
  --text-2: #a3b0c6;
  --text-3: #6d7a92;
  --shadow: 0 10px 30px -12px rgba(0, 0, 0, .6);
  --glow: rgba(229, 72, 77, .22);
  color-scheme: dark;
}

:root[data-theme="light"] {
  --bg: #f4f6fa;
  --bg-2: #eef1f6;
  --surface: #ffffff;
  --surface-2: #f5f7fb;
  --surface-3: #e9edf4;
  --border: #dde3ec;
  --border-strong: #c5cedc;
  --text: #121826;
  --text-2: #4a5568;
  --text-3: #7a8699;
  --shadow: 0 10px 30px -14px rgba(20, 30, 50, .25);
  --glow: rgba(229, 72, 77, .12);
  color-scheme: light;
}

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

html { -webkit-text-size-adjust: 100%; }
[hidden] { display: none !important; }

body {
  margin: 0;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  font-size: 16px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
}

a { color: inherit; text-decoration: none; }
button { font: inherit; color: inherit; }
svg { display: block; }
h1, h2, h3 { line-height: 1.15; letter-spacing: -0.02em; margin: 0; }

:focus-visible { outline: 2px solid var(--c-ems); outline-offset: 2px; border-radius: 6px; }

/* ---------- Top bar ---------- */
.topbar {
  position: sticky; top: 0; z-index: 50;
  display: flex; align-items: center; justify-content: space-between;
  gap: 16px;
  padding: 12px max(16px, calc((100vw - 1180px) / 2));
  background: color-mix(in srgb, var(--bg) 82%, transparent);
  backdrop-filter: saturate(160%) blur(14px);
  -webkit-backdrop-filter: saturate(160%) blur(14px);
  border-bottom: 1px solid var(--border);
}
.brand { display: flex; align-items: center; gap: 10px; font-weight: 600; letter-spacing: -0.01em; }
.brand-mark svg { width: 30px; height: 30px; }
.brand-mark rect { fill: var(--brand); }
.brand-mark .flame { fill: #fff; }
.brand-mark .pulse { fill: none; stroke: var(--brand); stroke-width: 2.2; stroke-linecap: round; stroke-linejoin: round; }
.brand-name b { font-weight: 800; }

.topnav { display: flex; align-items: center; gap: 4px; }
.topnav a {
  padding: 8px 12px; border-radius: 10px;
  color: var(--text-2); font-weight: 500; font-size: 15px;
}
.topnav a:hover { color: var(--text); background: var(--surface-2); }
.topnav a.active { color: var(--text); }

.icon-btn {
  width: 38px; height: 38px; border-radius: 10px;
  display: grid; place-items: center;
  background: transparent; border: 1px solid var(--border); cursor: pointer;
  color: var(--text-2);
}
.icon-btn:hover { color: var(--text); background: var(--surface-2); }
.icon-btn svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
[data-theme="dark"] .i-sun, [data-theme="light"] .i-moon { display: none; }

/* ---------- Layout ---------- */
main { flex: 1; width: 100%; max-width: 1180px; margin: 0 auto; padding: 0 16px 64px; outline: none; }

.section { margin-top: 40px; }
.section-head {
  display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap;
  gap: 12px; margin-bottom: 18px;
}
.section-head h2 { font-size: 22px; }

/* ---------- Hero ---------- */
.hero {
  position: relative;
  margin-top: 28px;
  padding: 56px 40px 44px;
  border-radius: var(--radius-lg);
  background:
    linear-gradient(180deg, color-mix(in srgb, var(--surface) 70%, transparent), var(--surface)),
    repeating-linear-gradient(90deg, transparent 0 46px, color-mix(in srgb, var(--border) 50%, transparent) 46px 47px);
  border: 1px solid var(--border);
  overflow: hidden;
  isolation: isolate;
}
.hero-glow {
  position: absolute; inset: -40% -10% auto auto; width: 70%; height: 160%; z-index: -1;
  background: radial-gradient(closest-side, var(--glow), transparent 70%);
  pointer-events: none;
}
.eyebrow {
  margin: 0 0 14px;
  font-size: 13px; font-weight: 700; letter-spacing: .12em; text-transform: uppercase;
  color: var(--brand-2);
}
.hero h1 { font-size: clamp(32px, 5.4vw, 58px); font-weight: 800; max-width: 15ch; }
.grad {
  background: linear-gradient(90deg, var(--brand), var(--brand-2));
  -webkit-background-clip: text; background-clip: text; color: transparent;
}
.lead { font-size: clamp(16px, 2vw, 19px); color: var(--text-2); max-width: 54ch; margin: 18px 0 0; }

.hero-stats { display: flex; flex-wrap: wrap; gap: 12px 36px; margin-top: 34px; }
.hero-stats div { display: flex; flex-direction: column; }
.hero-stats b { font-size: 24px; font-weight: 800; letter-spacing: -0.02em; }
.hero-stats span { font-size: 13px; color: var(--text-3); }

/* ---------- Chips ---------- */
.chips { display: flex; gap: 6px; padding: 4px; border-radius: 12px; background: var(--surface); border: 1px solid var(--border); }
.chip {
  padding: 6px 14px; border-radius: 9px; border: 0; cursor: pointer;
  background: transparent; color: var(--text-2); font-size: 14px; font-weight: 600;
}
.chip:hover { color: var(--text); }
.chip.active { background: var(--surface-3); color: var(--text); }

/* ---------- Tool cards ---------- */
.tool-grid {
  display: grid; gap: 16px;
  grid-template-columns: repeat(auto-fill, minmax(min(100%, 300px), 1fr));
}
.tool-card {
  position: relative;
  display: flex; flex-direction: column; gap: 8px;
  padding: 22px;
  border-radius: var(--radius);
  background: var(--surface);
  border: 1px solid var(--border);
  transition: transform .18s ease, border-color .18s ease, box-shadow .18s ease;
}
a.tool-card:hover {
  transform: translateY(-3px);
  border-color: color-mix(in srgb, var(--accent) 55%, var(--border));
  box-shadow: var(--shadow), 0 0 0 1px color-mix(in srgb, var(--accent) 30%, transparent);
}
.tool-card.soon { opacity: .62; }
.tool-card h3 { font-size: 18px; margin-top: 10px; }
.tool-card p { margin: 0; color: var(--text-2); font-size: 14.5px; }
.tool-card-top { display: flex; align-items: center; justify-content: space-between; }

.tool-icon {
  width: 44px; height: 44px; border-radius: 12px;
  display: grid; place-items: center;
  color: var(--accent, var(--c-ems));
  background: color-mix(in srgb, var(--accent, var(--c-ems)) 14%, transparent);
}
.tool-icon svg { width: 24px; height: 24px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.tool-icon.lg { width: 60px; height: 60px; border-radius: 16px; flex: none; }
.tool-icon.lg svg { width: 32px; height: 32px; }

.tool-go {
  margin-top: auto; padding-top: 12px;
  display: inline-flex; align-items: center; gap: 6px;
  font-size: 14px; font-weight: 600; color: var(--accent);
}
.tool-go svg { width: 16px; height: 16px; fill: none; stroke: currentColor; stroke-width: 2.2; stroke-linecap: round; stroke-linejoin: round; transition: transform .18s; }
a.tool-card:hover .tool-go svg { transform: translateX(3px); }

.tags { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 4px; }
.tags span { font-size: 12px; color: var(--text-3); background: var(--surface-2); padding: 2px 8px; border-radius: 6px; }

.badge {
  display: inline-flex; align-items: center;
  padding: 3px 9px; border-radius: 999px;
  font-size: 12px; font-weight: 700; letter-spacing: .02em;
  color: var(--badge, var(--text-2));
  background: color-mix(in srgb, var(--badge, var(--text-3)) 15%, transparent);
}
.badge-muted { --badge: var(--text-3); color: var(--text-2); }

/* ---------- Tool page ---------- */
.tool-page { margin-top: 24px; }
.back-link {
  display: inline-flex; align-items: center; gap: 6px;
  color: var(--text-2); font-size: 14px; font-weight: 500;
}
.back-link:hover { color: var(--text); }
.back-link svg { width: 16px; height: 16px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.tool-header { display: flex; gap: 18px; align-items: center; margin: 18px 0 26px; }
.tool-header h1 { font-size: clamp(26px, 4vw, 36px); font-weight: 800; margin-top: 6px; }
.tool-header p { margin: 4px 0 0; color: var(--text-2); }
.tool-header-meta { display: flex; gap: 6px; flex-wrap: wrap; }

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  padding: 10px 16px; border-radius: 11px;
  border: 1px solid var(--border-strong);
  background: var(--surface-2); color: var(--text);
  font-weight: 600; font-size: 15px; cursor: pointer;
  transition: background .15s, border-color .15s, transform .08s;
}
.btn:hover:not(:disabled) { background: var(--surface-3); }
.btn:active:not(:disabled) { transform: translateY(1px); }
.btn:disabled { opacity: .45; cursor: not-allowed; }
.btn-primary {
  background: linear-gradient(180deg, #f0565b, var(--brand));
  border-color: transparent; color: #fff;
  box-shadow: 0 6px 18px -8px var(--brand);
}
.btn-primary:hover:not(:disabled) { background: linear-gradient(180deg, #f5686c, #ea5257); }
.btn-ghost { background: transparent; border-color: var(--border); color: var(--text-2); }
.btn svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
}

/* ---------- Prose ---------- */
.prose { max-width: 70ch; }
.prose h1 { font-size: 36px; margin-bottom: 12px; }
.prose h2 { font-size: 20px; margin-top: 28px; }
.prose p { color: var(--text-2); }

/* ---------- Footer ---------- */
.footer {
  border-top: 1px solid var(--border);
  padding: 22px 16px;
  text-align: center;
  color: var(--text-3);
  font-size: 13px;
}
.footer p { margin: 0 auto; max-width: 70ch; }
.footer .copyright { margin-top: 8px; }

@media (max-width: 640px) {
  .hero { padding: 36px 22px 30px; }
  .brand-name { font-size: 15px; }
  .topnav a { padding: 8px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition-duration: .01ms !important; animation-duration: .01ms !important; }
}
