/* ═══════════════════════════════════════════════════════════
   RateAtlas Tools – Shared Design System
   tools.rateatlas.org  •  shared/style.css
   ═══════════════════════════════════════════════════════════ */

/* ── Design tokens ── */
:root {
  --ra-accent: #0b5ed7;
  --ra-green: #059669;
  --ra-bg: #f8fafc;
  --ra-panel: #ffffff;
  --ra-border: #dbe4f0;
  --ra-text: #0f172a;
  --ra-muted: #475569;
  --ra-light: #f1f5f9;
  --ra-danger: #dc2626;
  --ra-warn: #b45309;
}

@font-face {
  font-family: "Manrope";
  font-style: normal;
  font-weight: 200 800;
  font-display: fallback;
  src: url("https://rateatlas.org/wp-content/themes/twentytwentyfive/assets/fonts/manrope/Manrope-VariableFont_wght.woff2") format("woff2");
}

/* ── Reset ── */
*, *::before, *::after { box-sizing: border-box; }
body {
  margin: 0;
  background: var(--ra-bg);
  color: var(--ra-text);
  font-family: "Manrope", system-ui, -apple-system, "Segoe UI", sans-serif;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

/* ═══ Hub-style header ═══ */
.ra-site-header {
  position: sticky;
  top: 0;
  z-index: 1000;
  background: #eef3fb;
  border-bottom: 1px solid rgba(15, 23, 42, 0.06);
}
.ra-site-header__inner {
  width: min(1200px, calc(100% - 32px));
  margin: 0 auto;
  min-height: 74px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}
.ra-site-title {
  margin: 0;
  font-size: 1.28rem;
  font-weight: 700;
  letter-spacing: -0.5px;
  line-height: 1.15;
  white-space: nowrap;
}
.ra-site-title a {
  color: #111827;
  text-decoration: none;
}
.ra-site-title a:hover { text-decoration: underline; }

.ra-site-nav {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 1rem;
}
.ra-nav-link {
  color: #1f2937;
  text-decoration: none;
  padding: 8px 12px;
  border-radius: 10px;
  border: 1px solid transparent;
  font-weight: 500;
  background: transparent;
  cursor: pointer;
  font: inherit;
}
.ra-nav-link:hover,
.ra-nav-link:focus-visible {
  background: rgba(64, 89, 173, 0.08);
  border-color: rgba(64, 89, 173, 0.22);
  outline: none;
}
.ra-nav-item { position: relative; }
.ra-nav-button {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}
.ra-nav-caret {
  font-size: 0.78rem;
  line-height: 1;
  transform: translateY(1px);
}
.ra-nav-submenu {
  list-style: none;
  margin: 0;
  padding: 6px;
  position: absolute;
  top: calc(100% + 6px);
  left: 0;
  min-width: 186px;
  border: 1px solid rgba(15, 23, 42, 0.1);
  border-radius: 12px;
  background: #fff;
  box-shadow: 0 16px 28px rgba(2, 6, 23, 0.08);
  display: none;
  z-index: 1002;
}
.ra-nav-submenu a {
  display: block;
  color: #1f2937;
  text-decoration: none;
  padding: 8px 10px;
  border-radius: 8px;
  font-size: 0.95rem;
}
.ra-nav-submenu a:hover {
  background: #f8fafc;
  text-decoration: underline;
}
.ra-nav-item:hover > .ra-nav-submenu,
.ra-nav-item:focus-within > .ra-nav-submenu,
.ra-nav-item.is-open > .ra-nav-submenu {
  display: block;
}

.ra-nav-toggle {
  display: none;
  border: 1px solid rgba(15, 23, 42, 0.1);
  border-radius: 10px;
  background: #fff;
  color: #111827;
  font: inherit;
  font-weight: 600;
  padding: 7px 11px;
  cursor: pointer;
}
.ra-nav-toggle:hover { background: #f8fafc; }

/* ═══ Top navbar (legacy) ═══ */
.ra-topbar {
  background: #0f172a;
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 20px;
  height: 52px;
  position: sticky;
  top: 0;
  z-index: 100;
}
.ra-topbar__brand {
  display: flex;
  align-items: center;
  gap: 10px;
  text-decoration: none;
  color: #fff;
  font-weight: 800;
  font-size: 1.05rem;
  letter-spacing: -0.01em;
}
.ra-topbar__brand svg { flex-shrink: 0; }
.ra-topbar__nav {
  display: flex;
  gap: 6px;
  align-items: center;
}
.ra-topbar__link {
  color: rgba(255,255,255,0.78);
  text-decoration: none;
  font-size: 0.88rem;
  font-weight: 600;
  padding: 6px 12px;
  border-radius: 8px;
  transition: background .15s, color .15s;
}
.ra-topbar__link:hover,
.ra-topbar__link[aria-current="page"] {
  background: rgba(255,255,255,0.12);
  color: #fff;
}
.ra-topbar__link[aria-current="page"] {
  background: rgba(11,94,215,0.35);
}

/* ── Mobile hamburger ── */
.ra-topbar__toggle {
  display: none;
  background: none;
  border: none;
  color: #fff;
  font-size: 1.5rem;
  cursor: pointer;
  padding: 4px;
}
@media (max-width: 640px) {
  .ra-topbar__toggle { display: block; }
  .ra-topbar__nav {
    display: none;
    position: absolute;
    top: 52px;
    left: 0;
    right: 0;
    background: #0f172a;
    flex-direction: column;
    padding: 8px 16px 14px;
    gap: 2px;
  }
  .ra-topbar__nav.open { display: flex; }
  .ra-topbar__link { padding: 10px 12px; width: 100%; }
}

@media (max-width: 900px) {
  .ra-site-header__inner {
    min-height: 64px;
  }
  .ra-nav-toggle {
    display: inline-flex;
  }
  .ra-site-nav {
    display: none;
    position: absolute;
    top: calc(100% + 1px);
    left: 0;
    right: 0;
    background: #fff;
    border-bottom: 1px solid rgba(15, 23, 42, 0.1);
    padding: 12px 16px 14px;
    flex-direction: column;
    align-items: stretch;
    gap: 6px;
  }
  .ra-site-nav.is-open { display: flex; }
  .ra-nav-link {
    width: 100%;
    text-align: left;
  }
  .ra-nav-submenu {
    position: static;
    border: 0;
    border-radius: 0;
    box-shadow: none;
    padding: 2px 0 6px 10px;
  }
}

/* ═══ Main content wrapper ═══ */
.ra-main {
  flex: 1;
  max-width: 960px;
  width: 100%;
  margin: 0 auto;
  padding: 16px 14px 48px;
}

/* ═══ Hub back-banner ═══ */
.ra-hub-banner {
  max-width: 960px;
  margin: 0 auto 6px;
  padding: 0 2px;
}
.ra-hub-banner__link {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 0.85rem;
  font-weight: 700;
  color: #4059AD;
  text-decoration: none;
  padding: 8px 16px;
  border-radius: 10px;
  background: #eff6ff;
  border: 1px solid #dbeafe;
  transition: background .15s, box-shadow .15s;
}
.ra-hub-banner__link:hover {
  background: #dbeafe;
  box-shadow: 0 2px 6px rgba(64,89,173,0.12);
}

/* ═══ Active nav link ═══ */
.ra-topbar__link--active {
  background: rgba(11,94,215,0.35) !important;
  color: #fff !important;
}
.ra-topbar__hub-link {
  background: rgba(5,150,105,0.18);
  color: #6ee7b7 !important;
  border: 1px solid rgba(5,150,105,0.3);
  margin-left: 4px;
}
.ra-topbar__hub-link:hover {
  background: rgba(5,150,105,0.3);
  color: #fff !important;
}

/* ═══ Footer (matches hub style) ═══ */
.ra-site-footer {
  margin-top: auto;
  background: #c8ced9;
}
.ra-site-footer__inner {
  width: min(960px, calc(100% - 32px));
  margin: 0 auto;
  padding: 56px 0 68px;
  text-align: center;
}
.ra-site-footer__brand {
  margin: 0;
  color: #1f2b40;
  font-size: clamp(1.35rem, 1.45vw, 1.7rem);
  font-weight: 700;
  letter-spacing: -0.01em;
  line-height: 1.2;
}
.ra-site-footer__tagline {
  margin: 14px 0 0;
  color: #8290a6;
  font-size: clamp(0.86rem, 1vw, 1rem);
  line-height: 1.5;
  font-weight: 500;
}
.ra-site-footer__copy {
  margin: 14px 0 0;
  color: #a7b1bf;
  font-size: clamp(0.75rem, 0.85vw, 0.88rem);
  line-height: 1.5;
  font-weight: 500;
}

.ra-footer {
  background: #0f172a;
  color: rgba(255,255,255,0.6);
  text-align: center;
  padding: 32px 14px 24px;
  margin-top: auto;
}
.ra-footer__inner {
  max-width: 960px;
  margin: 0 auto;
}
.ra-footer__brand {
  font-size: 1.15rem;
  font-weight: 800;
  color: #fff;
  letter-spacing: -0.02em;
}
.ra-footer__tagline {
  margin: 6px 0 0;
  font-size: 0.88rem;
  color: rgba(255,255,255,0.55);
}
.ra-footer__copy {
  margin: 12px 0 0;
  font-size: 0.78rem;
  color: rgba(255,255,255,0.4);
}
.ra-footer__nav {
  display: flex;
  justify-content: center;
  gap: 16px;
  margin-top: 14px;
}
.ra-footer__nav a {
  color: rgba(255,255,255,0.65);
  text-decoration: none;
  font-size: 0.82rem;
  font-weight: 600;
  transition: color .15s;
}
.ra-footer__nav a:hover { color: #fff; }
.ra-footer a { color: rgba(255,255,255,0.8); text-decoration: none; }
.ra-footer a:hover { color: #fff; }

@media (max-width: 900px) {
  .ra-site-footer__inner {
    padding: 44px 0 54px;
  }
}

/* ═══ Hero ═══ */
.ra-hero {
  background: linear-gradient(135deg, var(--ra-green) 0%, var(--ra-accent) 100%);
  border-radius: 16px;
  padding: 28px 24px 24px;
  color: #fff;
  position: relative;
  overflow: hidden;
}
.ra-hero::after {
  content: "";
  position: absolute;
  right: -40px;
  top: -40px;
  width: 200px;
  height: 200px;
  background: rgba(255,255,255,0.06);
  border-radius: 50%;
}
.ra-hero h1 {
  font-size: clamp(1.5rem, 4vw, 2.2rem);
  line-height: 1.15;
  letter-spacing: -0.01em;
  margin: 0;
}
.ra-hero .sub {
  margin-top: 10px;
  opacity: 0.92;
  line-height: 1.55;
  font-size: 1rem;
  max-width: 60ch;
}
.ra-hero-nav {
  margin-top: 14px;
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}
.ra-hero-nav a {
  text-decoration: none;
  border-radius: 999px;
  padding: 7px 14px;
  font-weight: 700;
  font-size: 0.88rem;
  background: rgba(255,255,255,0.14);
  color: #fff;
  border: 1px solid rgba(255,255,255,0.22);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  transition: background .15s;
}
.ra-hero-nav a:hover { background: rgba(255,255,255,0.28); }

/* ═══ Cards ═══ */
.ra-card {
  border: 1px solid var(--ra-border);
  border-radius: 14px;
  background: var(--ra-panel);
  padding: 18px 16px;
  margin-top: 14px;
}
.ra-card-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 12px;
}
.ra-card h2 { font-size: 1.1rem; margin: 0; }

/* ═══ Forms ═══ */
.ra-field { display: block; margin-bottom: 0; }
.ra-field span {
  display: block;
  font-size: 0.82rem;
  font-weight: 700;
  margin-bottom: 5px;
  color: var(--ra-muted);
  letter-spacing: 0.01em;
}
.ra-input, .ra-select {
  font: inherit;
  width: 100%;
  border: 1px solid #cbd5e1;
  border-radius: 10px;
  padding: 9px 11px;
  background: #fff;
  font-size: 0.92rem;
  min-height: 42px;
  transition: border-color .15s, box-shadow .15s;
}
.ra-input:focus, .ra-select:focus {
  outline: none;
  border-color: var(--ra-accent);
  box-shadow: 0 0 0 3px rgba(11,94,215,0.1);
}

/* ═══ Grid layouts ═══ */
.ra-g2 { display: grid; gap: 12px; grid-template-columns: 1fr 1fr; }
.ra-g3 { display: grid; gap: 12px; grid-template-columns: 1fr 1fr 1fr; }
.ra-g4 { display: grid; gap: 10px; grid-template-columns: repeat(4, 1fr); }
@media (max-width: 640px) {
  .ra-g2, .ra-g3, .ra-g4 { grid-template-columns: 1fr; }
}

/* ═══ Buttons ═══ */
.ra-btn {
  border: 0;
  border-radius: 999px;
  padding: 10px 16px;
  font: inherit;
  font-weight: 700;
  cursor: pointer;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 0.9rem;
  transition: transform .1s, background .15s, box-shadow .15s;
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
}
.ra-btn:active { transform: scale(0.97); }
.ra-btn-primary {
  background: rgba(11,94,215,0.16);
  color: var(--ra-accent);
  border: 1px solid rgba(11,94,215,0.26);
}
.ra-btn-primary:hover {
  background: rgba(11,94,215,0.28);
  box-shadow: 0 2px 8px rgba(11,94,215,0.15);
}
.ra-btn-green {
  background: rgba(5,150,105,0.16);
  color: var(--ra-green);
  border: 1px solid rgba(5,150,105,0.26);
}
.ra-btn-green:hover { background: rgba(5,150,105,0.28); }
.ra-btn-ghost {
  background: rgba(241,245,249,0.5);
  color: var(--ra-text);
  border: 1px solid rgba(203,213,225,0.5);
}
.ra-btn-ghost:hover { background: rgba(241,245,249,0.85); }

/* ═══ Badges ═══ */
.ra-badge {
  font-size: 0.78rem;
  font-weight: 700;
  padding: 4px 10px;
  border-radius: 999px;
  background: #eff6ff;
  color: #1d4ed8;
  white-space: nowrap;
}

/* ═══ Chips ═══ */
.ra-chip {
  border: 1px solid #cbd5e1;
  background: #fff;
  color: var(--ra-text);
  border-radius: 999px;
  padding: 5px 12px;
  font: inherit;
  font-size: 0.82rem;
  font-weight: 600;
  cursor: pointer;
  transition: all .15s;
}
.ra-chip:hover { border-color: var(--ra-accent); }
.ra-chip.is-active,
.ra-chip.on {
  background: var(--ra-accent);
  border-color: var(--ra-accent);
  color: #fff;
}

/* ═══ Hints ═══ */
.ra-hint {
  color: var(--ra-muted);
  font-size: 0.84rem;
  line-height: 1.4;
  margin-top: 6px;
}
.ra-hint.error { color: var(--ra-danger); }
.ra-hint.warn { color: var(--ra-warn); }

/* ═══ Big result number ═══ */
.ra-result-box {
  text-align: center;
  padding: 18px 10px;
  background: linear-gradient(135deg, #eff6ff, #f0fdf4);
  border-radius: 14px;
  border: 1px solid #dbeafe;
}
.ra-result-box .v {
  font-size: clamp(1.8rem, 5vw, 2.6rem);
  font-weight: 900;
  color: var(--ra-accent);
  line-height: 1.1;
}
.ra-result-box .k {
  font-size: 0.84rem;
  color: var(--ra-muted);
  margin-top: 4px;
}

/* ═══ Metric cards ═══ */
.ra-metric {
  border: 1px solid #e2e8f0;
  border-radius: 10px;
  padding: 10px;
  background: var(--ra-bg);
}
.ra-metric .k { color: var(--ra-muted); font-size: 0.8rem; }
.ra-metric .v { margin-top: 3px; font-weight: 800; font-size: 1.05rem; }

/* ═══ Flash animation ═══ */
@keyframes ra-flash {
  0% { box-shadow: 0 0 0 0 rgba(11,94,215,0.4); }
  70% { box-shadow: 0 0 0 14px rgba(11,94,215,0); }
  100% { box-shadow: 0 0 0 0 rgba(11,94,215,0); }
}
.ra-flash { animation: ra-flash 0.55s ease-out; }

/* ═══ Source line ═══ */
.ra-source {
  margin-top: 10px;
  font-size: 0.82rem;
  color: #94a3b8;
  line-height: 1.4;
}
.ra-source a { color: var(--ra-accent); }

/* ═══ Tool directory cards (homepage) ═══ */
.ra-tool-grid {
  display: grid;
  gap: 16px;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  margin-top: 20px;
}
.ra-tool-card {
  border: 1px solid var(--ra-border);
  border-radius: 14px;
  background: var(--ra-panel);
  padding: 22px 20px;
  transition: box-shadow .2s, transform .1s;
  text-decoration: none;
  color: var(--ra-text);
  display: block;
}
.ra-tool-card:hover {
  box-shadow: 0 4px 20px rgba(0,0,0,0.08);
  transform: translateY(-2px);
}
.ra-tool-card h3 {
  margin: 0 0 8px;
  font-size: 1.1rem;
  color: var(--ra-accent);
}
.ra-tool-card p {
  margin: 0;
  font-size: 0.9rem;
  color: var(--ra-muted);
  line-height: 1.5;
}
.ra-tool-card .tool-states {
  margin-top: 10px;
  font-size: 0.8rem;
  font-weight: 700;
  color: var(--ra-green);
}
