/* ============================================================
   ToolSignal — global.css
   Shared across all pages: theme variables, nav, search,
   smooth transitions, card hovers, utility components.
   ============================================================ */

/* ── Reset ─────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

/* ── Design Tokens — Dark (default) ────────────────────────── */
:root {
  --bg:       #0a0a0f;
  --surface:  #111118;
  --surface2: #18181f;
  --border:   #22222e;
  --accent:   #00e5a0;
  --accent2:  #7c6aff;
  --text:     #e8e8f0;
  --muted:    #6b6b80;
  --danger:   #ff4d6d;
  --amber:    #f5a623;
}

/* ── Design Tokens — Light ──────────────────────────────────── */
[data-theme="light"] {
  --bg:       #f5f5f7;
  --surface:  #ffffff;
  --surface2: #ebebf0;
  --border:   #d1d1db;
  --text:     #2e2e4e;
  --muted:    #5a5a72;
}

/* ── Base ───────────────────────────────────────────────────── */
html {
  scroll-behavior: smooth;
}

/* Smooth theme crossfade — apply to every element that uses a CSS var color */
body,
nav.site-nav,
header,
.card,
.cat-card,
.related-card,
section,
footer,
input,
button,
a,
.search-dropdown,
.search-result-item,
.verdict-box,
.nl-bar {
  transition:
    background-color 0.25s ease,
    color            0.25s ease,
    border-color     0.25s ease,
    box-shadow       0.25s ease;
}

/* ── Fonts (loaded here so all pages share one request) ─────── */
/* Fonts are linked via <link> in sharedHeadAssets() in build-site.js */

/* ── NAV ────────────────────────────────────────────────────── */
nav.site-nav {
  position: fixed;
  top: 0; left: 0; right: 0;
  z-index: 100;
  display: flex;
  align-items: center;
  gap: 1rem;
  padding: 0.9rem 2rem;
  background: rgba(10, 10, 15, 0.88);
  backdrop-filter: blur(14px);
  border-bottom: 1px solid var(--border);
}

[data-theme="light"] nav.site-nav {
  background: rgba(245, 245, 247, 0.92);
}

.logo {
  font-family: 'Space Grotesk', sans-serif;
  font-weight: 800;
  font-size: 1.25rem;
  letter-spacing: -0.03em;
  color: var(--text);
  text-decoration: none;
  flex-shrink: 0;
  transition: color 0.2s ease;
}

.logo span { color: var(--accent); }

.nav-links {
  display: flex;
  gap: 2rem;
  list-style: none;
  margin-right: auto;
}

.nav-links a {
  color: var(--muted);
  text-decoration: none;
  font-size: 0.78rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  transition: color 0.15s ease;
}

.nav-links a:hover { color: var(--accent); }

.nav-links .nav-cta {
  background: var(--accent);
  color: #000 !important;
  padding: 0.4rem 1rem;
  border-radius: 4px;
  font-weight: 600;
  transition: opacity 0.2s ease !important;
}

.nav-links .nav-cta:hover { opacity: 0.82; }

/* ── SEARCH BAR ─────────────────────────────────────────────── */
.search-wrap {
  position: relative;
  display: flex;
  align-items: center;
  flex-shrink: 0;
}

#site-search {
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: 20px;
  color: var(--text);
  font-family: 'DM Mono', monospace;
  font-size: 0.78rem;
  padding: 0.38rem 1rem;
  width: 200px;
  outline: none;
  transition: border-color 0.2s ease, width 0.25s ease, background-color 0.25s ease;
}

#site-search::placeholder { color: var(--muted); }

#site-search:focus {
  border-color: var(--accent);
  width: 240px;
}

#site-search::-webkit-search-cancel-button { display: none; }

.search-dropdown {
  position: absolute;
  top: calc(100% + 8px);
  left: 0;
  width: 320px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.35);
  z-index: 200;
  overflow: hidden;
  animation: dropIn 0.14s ease;
}

@keyframes dropIn {
  from { opacity: 0; transform: translateY(-6px); }
  to   { opacity: 1; transform: translateY(0); }
}

.search-result-item {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  padding: 0.6rem 0.85rem;
  text-decoration: none;
  border-bottom: 1px solid var(--border);
}

.search-result-item:last-child { border-bottom: none; }

.search-result-item:hover { background: var(--surface2); }

.sr-logo {
  width: 24px;
  height: 24px;
  border-radius: 5px;
  object-fit: contain;
  flex-shrink: 0;
  background: var(--surface2);
}

.sr-logo-fallback {
  width: 24px;
  height: 24px;
  border-radius: 5px;
  background: var(--surface2);
  color: var(--accent);
  font-size: 0.75rem;
  font-weight: 700;
  display: none;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.sr-text { display: flex; flex-direction: column; gap: 0.1rem; min-width: 0; }

.sr-name {
  color: var(--text);
  font-size: 0.85rem;
  font-weight: 600;
}

.sr-tag {
  color: var(--muted);
  font-size: 0.74rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* ── THEME TOGGLE ───────────────────────────────────────────── */
.theme-btn {
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: 50%;
  width: 34px;
  height: 34px;
  cursor: pointer;
  font-size: 1rem;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  line-height: 1;
  transition: background-color 0.2s ease, border-color 0.2s ease;
}

.theme-btn:hover { background: var(--border); }

.theme-icon {
  color: var(--accent);     /* green sun icon — visible on dark bg */
}

[data-theme="light"] .theme-icon {
  color: var(--accent2);    /* purple moon icon — visible on light bg */
}

/* ── BREADCRUMB ─────────────────────────────────────────────── */
.breadcrumb-bar {
  font-size: 0.8rem;
  color: var(--muted);
  padding: 0.55rem 2rem;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  margin-top: 58px;        /* offset for fixed nav */
}

.breadcrumb-bar a {
  color: var(--muted);
  text-decoration: none;
  transition: color 0.15s ease;
}

.breadcrumb-bar a:hover { color: var(--accent); }

/* ── TOOL LOGO (cards + hero) ───────────────────────────────── */
.tool-logo {
  border-radius: 8px;
  object-fit: contain;
  background: var(--surface2);
  flex-shrink: 0;
}

.tool-logo-fallback {
  border-radius: 8px;
  background: var(--surface2);
  color: var(--accent);
  font-weight: 800;
  display: none;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  font-family: 'Space Grotesk', sans-serif;
}

/* ── PRICING BADGE ──────────────────────────────────────────── */
.price-badge {
  display: inline-flex;
  align-items: center;
  padding: 0.18rem 0.55rem;
  border-radius: 999px;
  font-size: 0.7rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  border: 1px solid transparent;
}

.price-badge.free     { color: var(--accent);  border-color: var(--accent);  background: rgba(0, 229, 160, 0.08); }
.price-badge.freemium { color: var(--amber);   border-color: var(--amber);   background: rgba(245, 166, 35, 0.08); }
.price-badge.paid     { color: var(--accent2); border-color: var(--accent2); background: rgba(124, 106, 255, 0.08); }
.price-badge.unknown  { color: var(--muted);   border-color: var(--border);  background: transparent; }

/* ── FRESHNESS BADGE ────────────────────────────────────────── */
.freshness {
  font-size: 0.72rem;
  color: var(--muted);
  background: var(--surface2);
  padding: 0.15rem 0.5rem;
  border-radius: 999px;
  border: 1px solid var(--border);
}

.freshness.fresh { color: var(--accent); border-color: rgba(0, 229, 160, 0.3); }

/* ── VERDICT CALLOUT ────────────────────────────────────────── */
.verdict-box {
  border-left: 3px solid var(--accent);
  background: rgba(0, 229, 160, 0.06);
  border-radius: 0 8px 8px 0;
  padding: 1rem 1.2rem;
  margin-bottom: 1.5rem;
  font-size: 0.97rem;
  line-height: 1.7;
  color: var(--text);
}

[data-theme="light"] .verdict-box {
  background: rgba(0, 229, 160, 0.08);
}

.verdict-box .verdict-label {
  display: block;
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--accent);
  margin-bottom: 0.4rem;
}

/* ── SOCIAL SHARE ───────────────────────────────────────────── */
.share-row {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  margin-top: 1rem;
}

.share-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.3rem 0.75rem;
  border-radius: 6px;
  font-size: 0.75rem;
  font-weight: 600;
  text-decoration: none;
  border: 1px solid var(--border);
  background: var(--surface2);
  color: var(--text);
  cursor: pointer;
  transition: border-color 0.15s ease, background-color 0.15s ease;
}

.share-btn:hover { border-color: var(--accent); background: var(--surface); }

/* ── READING PROGRESS BAR ───────────────────────────────────── */
#read-progress {
  position: fixed;
  top: 0;
  left: 0;
  height: 3px;
  width: 0%;
  background: var(--accent);
  z-index: 200;
  transition: width 0.1s linear;
  pointer-events: none;
}

/* ── BACK TO TOP ────────────────────────────────────────────── */
#back-to-top {
  position: fixed;
  bottom: 2rem;
  right: 1.5rem;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: var(--accent);
  color: #000;
  border: none;
  cursor: pointer;
  font-size: 1.1rem;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  transform: translateY(12px);
  transition: opacity 0.25s ease, transform 0.25s ease;
  z-index: 150;
  pointer-events: none;
}

#back-to-top.visible {
  opacity: 1;
  transform: translateY(0);
  pointer-events: auto;
}

/* ── STICKY NEWSLETTER BAR ──────────────────────────────────── */
#nl-bar {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  background: var(--surface);
  border-top: 1px solid var(--border);
  padding: 0.75rem 2rem;
  display: flex;
  align-items: center;
  gap: 1rem;
  z-index: 140;
  transform: translateY(100%);
  transition: transform 0.3s ease;
  flex-wrap: wrap;
}

#nl-bar.visible { transform: translateY(0); }

#nl-bar .nl-bar-text {
  font-size: 0.88rem;
  color: var(--text);
  flex: 1;
  min-width: 180px;
}

#nl-bar .nl-bar-text span { color: var(--accent); font-weight: 700; }

#nl-bar .nl-bar-form {
  display: flex;
  gap: 0.5rem;
  align-items: center;
  flex-shrink: 0;
}

#nl-bar input[type="email"] {
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: 6px;
  color: var(--text);
  font-size: 0.82rem;
  padding: 0.38rem 0.8rem;
  width: 200px;
  outline: none;
}

#nl-bar input[type="email"]:focus { border-color: var(--accent); }

#nl-bar .nl-bar-btn {
  background: var(--accent);
  color: #000;
  border: none;
  border-radius: 6px;
  padding: 0.38rem 1rem;
  font-weight: 700;
  font-size: 0.82rem;
  cursor: pointer;
  transition: opacity 0.2s ease;
}

#nl-bar .nl-bar-btn:hover { opacity: 0.85; }

#nl-bar .nl-bar-close {
  background: none;
  border: none;
  color: var(--muted);
  cursor: pointer;
  font-size: 1.1rem;
  padding: 0.2rem 0.4rem;
  flex-shrink: 0;
  transition: color 0.15s ease;
}

#nl-bar .nl-bar-close:hover { color: var(--text); }

/* ── CARD HOVER (override generated page styles) ────────────── */
.card:hover,
.cat-card:hover,
.related-card:hover {
  transform: translateY(-3px);
  box-shadow: 0 8px 28px rgba(0, 0, 0, 0.2);
  border-color: var(--accent) !important;
}

[data-theme="light"] .card:hover,
[data-theme="light"] .cat-card:hover,
[data-theme="light"] .related-card:hover {
  box-shadow: 0 8px 28px rgba(0, 0, 0, 0.08);
}

/* ── TOP RATED BADGE ────────────────────────────────────────── */
.badge-top {
  color: #c89a00;
  border-color: #c89a00;
  background: rgba(200, 154, 0, 0.08);
}

/* ── MOBILE ─────────────────────────────────────────────────── */
@media (max-width: 700px) {
  nav.site-nav { padding: 0.8rem 1.2rem; gap: 0.6rem; }
  .nav-links { display: none; }
  #site-search { width: 130px; }
  #site-search:focus { width: 160px; }
  .search-dropdown { width: 260px; }
  .breadcrumb-bar { margin-top: 54px; }
  #nl-bar { padding: 0.75rem 1rem; }
  #nl-bar input[type="email"] { width: 140px; }
}


/* ── Skip Link (Accessibility) ──────────────────────────────── */
.skip-link {
  position: absolute;
  left: -9999px;
  top: auto;
  width: 1px;
  height: 1px;
  overflow: hidden;
  z-index: 9999;
  padding: 0.5rem 1rem;
  background: var(--accent);
  color: #0a0a0f;
  font-weight: 700;
  text-decoration: none;
  border-radius: 0 0 8px 0;
}
.skip-link:focus {
  position: fixed;
  left: 0;
  top: 0;
  width: auto;
  height: auto;
  overflow: visible;
}

/* ── Focus Visible (Accessibility) ──────────────────────────── */
a:focus-visible,
button:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}
