/* =============================================
   TOOLSITE — Main Stylesheet
   Pure CSS, no frameworks, no CDN
   ============================================= */

/* ── Custom Properties ─────────────────────── */
:root {
  /* Spacing scale */
  --space-xs:   0.25rem;
  --space-sm:   0.5rem;
  --space-md:   1rem;
  --space-lg:   1.5rem;
  --space-xl:   2.5rem;
  --space-2xl:  4rem;

  /* Typography */
  --font-sans: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto,
               Helvetica, Arial, sans-serif;
  --font-mono: ui-monospace, "Cascadia Code", "Source Code Pro", monospace;
  --text-sm:   0.875rem;
  --text-base: 1rem;
  --text-lg:   1.125rem;
  --text-xl:   1.375rem;
  --text-2xl:  1.75rem;
  --text-3xl:  2.25rem;

  /* Radius */
  --radius-sm:  0.375rem;
  --radius-md:  0.625rem;
  --radius-lg:  1rem;
  --radius-full: 9999px;

  /* Transitions */
  --transition: 200ms ease;

  /* Layout */
  --max-width: 1200px;
  --header-h:  60px;
}

/* ── Light Theme (default) ─────────────────── */
:root,
[data-theme="light"] {
  --bg:           #ffffff;
  --bg-subtle:    #f5f5f7;
  --bg-card:      #ffffff;
  --border:       #e5e5ea;
  --border-focus: #0071e3;

  --text-primary:   #1d1d1f;
  --text-secondary: #6e6e73;
  --text-tertiary:  #aeaeb2;

  --accent:       #0071e3;
  --accent-hover: #0077ed;
  --accent-text:  #ffffff;

  --tag-bg:       #e5e5ea;
  --tag-text:     #1d1d1f;
  --tag-active-bg: #0071e3;
  --tag-active-text: #ffffff;

  --shadow-sm: 0 1px 3px rgba(0,0,0,.08), 0 1px 2px rgba(0,0,0,.05);
  --shadow-md: 0 4px 12px rgba(0,0,0,.08), 0 2px 4px rgba(0,0,0,.05);
  --shadow-lg: 0 12px 32px rgba(0,0,0,.10);

  --cookie-bg: #1d1d1f;
  --cookie-text: #f5f5f7;
}

/* ── Dark Theme ────────────────────────────── */
[data-theme="dark"] {
  --bg:           #000000;
  --bg-subtle:    #111111;
  --bg-card:      #1c1c1e;
  --border:       #2c2c2e;
  --border-focus: #0a84ff;

  --text-primary:   #f5f5f7;
  --text-secondary: #98989d;
  --text-tertiary:  #636366;

  --accent:       #0a84ff;
  --accent-hover: #409cff;
  --accent-text:  #ffffff;

  --tag-bg:       #2c2c2e;
  --tag-text:     #f5f5f7;
  --tag-active-bg: #0a84ff;
  --tag-active-text: #ffffff;

  --shadow-sm: 0 1px 3px rgba(0,0,0,.4);
  --shadow-md: 0 4px 12px rgba(0,0,0,.4);
  --shadow-lg: 0 12px 32px rgba(0,0,0,.5);

  --cookie-bg: #1c1c1e;
  --cookie-text: #f5f5f7;
}

/* ── System preference fallback ────────────── */
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg:           #000000;
    --bg-subtle:    #111111;
    --bg-card:      #1c1c1e;
    --border:       #2c2c2e;
    --border-focus: #0a84ff;
    --text-primary:   #f5f5f7;
    --text-secondary: #98989d;
    --text-tertiary:  #636366;
    --accent:       #0a84ff;
    --accent-hover: #409cff;
    --accent-text:  #ffffff;
    --tag-bg:       #2c2c2e;
    --tag-text:     #f5f5f7;
    --tag-active-bg: #0a84ff;
    --tag-active-text: #ffffff;
    --shadow-sm: 0 1px 3px rgba(0,0,0,.4);
    --shadow-md: 0 4px 12px rgba(0,0,0,.4);
    --shadow-lg: 0 12px 32px rgba(0,0,0,.5);
  }
}

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

html {
  font-size: 16px;
  scroll-behavior: smooth;
  -webkit-text-size-adjust: 100%;
}

body {
  font-family: var(--font-sans);
  font-size: var(--text-base);
  line-height: 1.6;
  background: var(--bg);
  color: var(--text-primary);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  transition: background var(--transition), color var(--transition);
}

img, svg { display: block; max-width: 100%; }
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
button { cursor: pointer; font-family: inherit; }
ul, ol { list-style: none; }

/* ── Layout helpers ────────────────────────── */
.container {
  width: 100%;
  max-width: var(--max-width);
  margin-inline: auto;
  padding-inline: var(--space-lg);
}

.sr-only {
  position: absolute; width: 1px; height: 1px;
  padding: 0; margin: -1px; overflow: hidden;
  clip: rect(0,0,0,0); white-space: nowrap; border: 0;
}

/* ── Header ────────────────────────────────── */
.site-header {
  position: sticky;
  top: 0;
  z-index: 100;
  height: var(--header-h);
  background: var(--bg);
  border-bottom: 1px solid var(--border);
  backdrop-filter: saturate(180%) blur(20px);
  -webkit-backdrop-filter: saturate(180%) blur(20px);
  background: color-mix(in srgb, var(--bg) 85%, transparent);
  transition: background var(--transition);
}

.site-header .container {
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-md);
}

.site-logo {
  font-size: var(--text-lg);
  font-weight: 700;
  color: var(--text-primary);
  letter-spacing: -0.02em;
  text-decoration: none;
  flex-shrink: 0;
}
.site-logo:hover { text-decoration: none; }
.site-logo span { color: var(--accent); }

.header-nav {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
}

.header-nav a {
  font-size: var(--text-sm);
  color: var(--text-secondary);
  padding: var(--space-xs) var(--space-sm);
  border-radius: var(--radius-sm);
  transition: color var(--transition), background var(--transition);
}
.header-nav a:hover {
  color: var(--text-primary);
  background: var(--bg-subtle);
  text-decoration: none;
}

/* Theme toggle button */
.btn-theme {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  border: 1px solid var(--border);
  border-radius: var(--radius-full);
  background: var(--bg-subtle);
  color: var(--text-secondary);
  transition: all var(--transition);
  padding: 0;
}
.btn-theme:hover {
  background: var(--border);
  color: var(--text-primary);
}
.btn-theme svg { width: 18px; height: 18px; pointer-events: none; }
.icon-sun  { display: none; }
.icon-moon { display: block; }
[data-theme="dark"] .icon-sun  { display: block; }
[data-theme="dark"] .icon-moon { display: none; }

/* ── Admin gear menu ───────────────────────── */
.admin-menu { position: relative; }
.admin-menu-btn {
  width: 36px; height: 36px;
  display: flex; align-items: center; justify-content: center;
  background: none;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  cursor: pointer;
  color: var(--text-secondary);
  transition: all 150ms;
}
.admin-menu-btn:hover,
.admin-menu-btn.open { background: var(--bg-subtle); color: var(--text-primary); border-color: var(--border-focus); }
.admin-dropdown {
  display: none;
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  min-width: 200px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: 0 8px 24px rgba(0,0,0,.12);
  z-index: 200;
  overflow: hidden;
  padding: var(--space-xs) 0;
}
.admin-dropdown.open { display: block; }
.admin-dropdown-label {
  font-size: 0.65rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .07em;
  color: var(--text-tertiary);
  padding: var(--space-sm) var(--space-md) var(--space-xs);
}
.admin-dropdown-item {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  padding: var(--space-sm) var(--space-md);
  font-size: var(--text-sm);
  color: var(--text-primary);
  text-decoration: none;
  transition: background 150ms;
  width: 100%;
  text-align: left;
  background: none;
  border: none;
  cursor: pointer;
  font-family: inherit;
}
.admin-dropdown-item:hover { background: var(--bg-subtle); text-decoration: none; }
.admin-dropdown-sep { height: 1px; background: var(--border); margin: var(--space-xs) 0; }
.admin-logout { color: var(--text-secondary); font-size: var(--text-sm); }
.admin-logout:hover { color: #ff3b30; background: color-mix(in srgb,#ff3b30 8%,transparent); }

/* ── Hero ──────────────────────────────────── */
.hero {
  padding: var(--space-2xl) 0 var(--space-xl);
  text-align: center;
}

.hero-inner {
  display: flex;
  align-items: center;
  gap: var(--space-2xl);
  text-align: left;
}

.hero-content {
  flex: 1;
  min-width: 0;
}

.hero-image {
  flex-shrink: 0;
  width: 520px;
  max-width: 45%;
}

.hero-image img {
  width: 100%;
  height: auto;
  display: block;
  border-radius: var(--radius-lg);
  content: url('/images/hero.png');
}

[data-theme="dark"] .hero-image img {
  content: url('/images/hero-dark.png');
}

@media (prefers-color-scheme: dark) {
  html:not([data-theme="light"]) .hero-image img {
    content: url('/images/hero-dark.png');
  }
}

.hero-title {
  font-size: clamp(var(--text-2xl), 5vw, var(--text-3xl));
  font-weight: 700;
  letter-spacing: -0.03em;
  line-height: 1.15;
  margin-bottom: var(--space-sm);
  color: var(--text-primary);
}
.hero-title span { color: var(--accent); }

.hero-sub {
  font-size: var(--text-lg);
  color: var(--text-secondary);
  margin-bottom: var(--space-xl);
  max-width: 540px;
  margin-inline: auto;
}

/* Without image — keep centred layout */
.hero-inner:not(:has(.hero-image)) {
  flex-direction: column;
  text-align: center;
}
.hero-inner:not(:has(.hero-image)) .hero-sub {
  margin-inline: auto;
}
.hero-inner:not(:has(.hero-image)) .search-wrap {
  margin-inline: auto;
}

/* Tablet — stack vertically, image goes below */
@media (max-width: 860px) {
  .hero-inner {
    flex-direction: column;
    text-align: center;
  }
  .hero-image {
    width: 100%;
    max-width: 480px;
    margin-inline: auto;
    order: -1;
  }
  .hero-sub { margin-inline: auto; }
  .search-wrap { margin-inline: auto; }
}

/* Mobile — hide image to save space */
@media (max-width: 540px) {
  .hero-image { display: none; }
  .hero-inner { text-align: center; }
}

/* ── Search ────────────────────────────────── */
.search-wrap {
  position: relative;
  max-width: 520px;
  margin-inline: auto;
}

.search-wrap svg {
  position: absolute;
  left: var(--space-md);
  top: 50%;
  transform: translateY(-50%);
  width: 18px;
  height: 18px;
  color: var(--text-tertiary);
  pointer-events: none;
}

#tool-search {
  width: 100%;
  padding: 0.75rem var(--space-md) 0.75rem 2.75rem;
  font-size: var(--text-base);
  font-family: inherit;
  background: var(--bg-subtle);
  border: 1px solid var(--border);
  border-radius: var(--radius-full);
  color: var(--text-primary);
  outline: none;
  transition: border-color var(--transition), box-shadow var(--transition);
}
#tool-search::placeholder { color: var(--text-tertiary); }
#tool-search:focus {
  border-color: var(--border-focus);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 20%, transparent);
  background: var(--bg-card);
}

/* ── Category tabs ─────────────────────────── */
.categories {
  padding-block: var(--space-lg);
}

.category-list {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-sm);
  justify-content: center;
}

.category-btn {
  padding: 0.375rem 0.875rem;
  font-size: var(--text-sm);
  font-weight: 500;
  border-radius: var(--radius-full);
  border: 1px solid var(--border);
  background: var(--tag-bg);
  color: var(--tag-text);
  transition: all var(--transition);
  white-space: nowrap;
}
.category-btn:hover {
  background: var(--border);
}
.category-btn.active,
.category-btn[aria-pressed="true"] {
  background: var(--tag-active-bg);
  color: var(--tag-active-text);
  border-color: var(--tag-active-bg);
}

/* ── Tools section ─────────────────────────── */
.tools-section {
  padding-bottom: var(--space-2xl);
  flex: 1;
}

.section-header {
  display: flex;
  align-items: baseline;
  gap: var(--space-sm);
  margin-bottom: var(--space-lg);
}

.section-title {
  font-size: var(--text-xl);
  font-weight: 600;
  letter-spacing: -0.02em;
}

.tool-count {
  font-size: var(--text-sm);
  color: var(--text-tertiary);
}

/* Grid */
.tools-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: var(--space-md);
}

/* Tool card */
.tool-card {
  display: flex;
  flex-direction: column;
  gap: var(--space-sm);
  padding: var(--space-lg);
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  text-decoration: none;
  color: inherit;
  box-shadow: var(--shadow-sm);
  transition: transform var(--transition), box-shadow var(--transition),
              border-color var(--transition);
  cursor: pointer;
}
.tool-card:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
  border-color: var(--accent);
  text-decoration: none;
}

.tool-icon {
  width: 40px;
  height: 40px;
  border-radius: var(--radius-md);
  background: var(--bg-subtle);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.25rem;
  flex-shrink: 0;
}

.tool-name {
  font-size: var(--text-base);
  font-weight: 600;
  color: var(--text-primary);
  line-height: 1.3;
}

.tool-desc {
  font-size: var(--text-sm);
  color: var(--text-secondary);
  line-height: 1.5;
  flex: 1;
}

.tool-tag {
  display: inline-block;
  font-size: 0.75rem;
  font-weight: 500;
  padding: 0.1875rem 0.5rem;
  border-radius: var(--radius-full);
  background: var(--tag-bg);
  color: var(--text-secondary);
  align-self: flex-start;
}

/* Empty state */
.tools-empty {
  grid-column: 1 / -1;
  text-align: center;
  padding: var(--space-2xl);
  color: var(--text-secondary);
}
.tools-empty p { margin-bottom: var(--space-sm); }
.tools-empty strong { color: var(--text-primary); }

/* Hidden card (search/filter) */
.tool-card[hidden] { display: none; }

/* ── Partner links ──────────────────────────── */
.partners-section {
  border-top: 1px solid var(--border);
  padding: var(--space-md) 0;
}
.partners-label {
  font-size: var(--text-xs);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-tertiary);
  margin-bottom: var(--space-sm);
}
.partners-list {
  list-style: none;
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-sm) var(--space-lg);
}
.partners-item a {
  font-size: var(--text-sm);
  color: var(--text-secondary);
  text-decoration: none;
}
.partners-item a:hover { color: var(--accent); text-decoration: underline; }

/* ── Footer ────────────────────────────────── */
.site-footer {
  background: var(--bg-subtle);
  border-top: 1px solid var(--border);
  padding-block: var(--space-xl);
  font-size: var(--text-sm);
  color: var(--text-secondary);
}

.footer-inner {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-lg);
  justify-content: space-between;
  align-items: center;
}

.footer-links {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-md);
}
.footer-links a { color: var(--text-secondary); }
.footer-links a:hover { color: var(--text-primary); }

/* ── Cookie Banner ─────────────────────────── */
#cookie-banner {
  position: fixed;
  bottom: var(--space-md);
  left: 50%;
  transform: translateX(-50%);
  width: calc(100% - 2 * var(--space-lg));
  max-width: 680px;
  background: var(--cookie-bg);
  color: var(--cookie-text);
  padding: var(--space-lg);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  z-index: 9999;
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-md);
  align-items: center;
  justify-content: space-between;
  font-size: var(--text-sm);
}
#cookie-banner[hidden] { display: none; }

#cookie-banner p { flex: 1; min-width: 200px; line-height: 1.5; }
#cookie-banner a { color: #6c9ef8; }

.cookie-actions {
  display: flex;
  gap: var(--space-sm);
  flex-shrink: 0;
  flex-wrap: wrap;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0.5rem 1rem;
  border-radius: var(--radius-sm);
  font-size: var(--text-sm);
  font-weight: 500;
  border: 1px solid transparent;
  transition: all var(--transition);
  white-space: nowrap;
}

.btn-primary {
  background: var(--accent);
  color: var(--accent-text);
  border-color: var(--accent);
}
.btn-primary:hover { background: var(--accent-hover); border-color: var(--accent-hover); }

.btn-secondary {
  background: transparent;
  color: var(--cookie-text);
  border-color: rgba(255,255,255,.25);
}
.btn-secondary:hover { background: rgba(255,255,255,.1); }

.btn-outline {
  background: transparent;
  color: var(--text-secondary);
  border-color: var(--border);
}
.btn-outline:hover { background: var(--bg-subtle); color: var(--text-primary); }

.btn-sm { padding: 0.25rem 0.65rem; font-size: var(--text-xs, 0.75rem); }

/* ── Tool sub-bar ──────────────────────────── */
:root { --tool-bar-h: 52px; }

.tool-bar {
  position: sticky;
  top: var(--header-h);
  z-index: 99;
  height: var(--tool-bar-h);
  background: color-mix(in srgb, var(--bg) 88%, transparent);
  border-bottom: 1px solid var(--border);
  backdrop-filter: saturate(180%) blur(20px);
  -webkit-backdrop-filter: saturate(180%) blur(20px);
  transition: background var(--transition);
}

.tool-bar .container {
  height: 100%;
  display: flex;
  align-items: center;
  gap: var(--space-md);
}

.tool-bar-icon {
  font-size: 1.25rem;
  flex-shrink: 0;
  line-height: 1;
}

.tool-bar-text {
  display: flex;
  align-items: baseline;
  gap: var(--space-sm);
  min-width: 0;
  flex: 1;
}

.tool-bar-name {
  font-weight: 600;
  font-size: var(--text-base);
  letter-spacing: -0.01em;
  white-space: nowrap;
  flex-shrink: 0;
  display: inline;
  margin: 0;
}

.tool-bar-sep {
  color: var(--text-tertiary);
  flex-shrink: 0;
}

.tool-bar-desc {
  font-size: var(--text-sm);
  color: var(--text-secondary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.tool-bar-actions {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  margin-left: auto;
  flex-shrink: 0;
}

/* ── Site message bar ──────────────────────────────────────────── */
.site-message-bar {
  background: color-mix(in srgb, var(--accent) 6%, transparent);
  border-bottom: 1px solid color-mix(in srgb, var(--accent) 15%, transparent);
  padding: var(--space-xs) 0;
}
.site-message-bar .container {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
}
.site-message-icon { font-size: 0.9rem; flex-shrink: 0; }
.site-message-text {
  font-size: var(--text-sm);
  color: var(--text-secondary);
  font-style: italic;
  line-height: 1.5;
}

/* ── Tool page partner bar ─────────────────────────────────────── */
.tool-partner-bar {
  border-bottom: 1px solid var(--border);
  background: var(--bg-subtle);
  padding: var(--space-xs) 0;
}
.tool-partner-bar .container {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  flex-wrap: wrap;
}
.tpb-label {
  font-size: 0.65rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .06em;
  color: var(--text-tertiary);
  flex-shrink: 0;
  padding-right: var(--space-xs);
  border-right: 1px solid var(--border);
}
.tpb-card {
  display: flex;
  flex-direction: column;
  padding: 3px 10px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  text-decoration: none;
  transition: border-color 150ms, background 150ms;
  min-width: 0;
}
.tpb-card:hover { border-color: var(--accent); background: var(--bg-subtle); text-decoration: none; }
.tpb-name {
  font-size: 0.72rem;
  font-weight: 600;
  color: var(--text-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 120px;
}
.tpb-domain {
  font-size: 0.62rem;
  color: var(--text-tertiary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 120px;
}

/* ── Articles section (homepage) ──────────────────────────────── */
.articles-section {
  padding: var(--space-2xl) 0;
  border-top: 1px solid var(--border);
}
.section-link {
  font-size: var(--text-sm);
  color: var(--accent);
  text-decoration: none;
  white-space: nowrap;
}
.section-link:hover { text-decoration: underline; }
.articles-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: var(--space-lg);
}
.art-hp-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  overflow: hidden;
  text-decoration: none;
  display: flex;
  flex-direction: column;
  transition: box-shadow 200ms, transform 200ms;
  box-shadow: var(--shadow-sm);
}
.art-hp-card:hover { box-shadow: var(--shadow-md); transform: translateY(-2px); text-decoration: none; }
.art-hp-img { width: 100%; aspect-ratio: 16/7; object-fit: cover; display: block; }
.art-hp-placeholder { background: var(--bg-subtle); display: flex; align-items: center; justify-content: center; font-size: 1.5rem; color: var(--text-tertiary); }
.art-hp-body { padding: var(--space-md); flex: 1; }
.art-hp-cat { font-size: 0.65rem; font-weight: 700; text-transform: uppercase; letter-spacing: .06em; color: var(--accent); margin-bottom: 4px; }
.art-hp-title { font-size: var(--text-sm); font-weight: 600; color: var(--text-primary); line-height: 1.35; margin-bottom: 6px; }
.art-hp-date { font-size: 0.7rem; color: var(--text-tertiary); }

/* ── Partner banner cards (homepage) ─────────────────────────── */
.partner-banners-section {
  padding-block: var(--space-lg);
  border-bottom: 1px solid var(--border);
}

.partner-banners-grid {
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  gap: var(--space-sm);
}

.partner-banner-card {
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 2px;
  padding: var(--space-sm) var(--space-md);
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  text-decoration: none;
  color: inherit;
  box-shadow: var(--shadow-sm);
  min-height: 52px;
  transition: transform var(--transition), box-shadow var(--transition),
              border-color var(--transition);
  overflow: hidden;
}
.partner-banner-card:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
  border-color: var(--accent);
  text-decoration: none;
}

.pbc-name {
  font-size: var(--text-sm);
  font-weight: 600;
  color: var(--text-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.pbc-domain {
  font-size: var(--text-xs, 0.72rem);
  color: var(--text-tertiary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

@media (max-width: 900px) {
  .partner-banners-grid { grid-template-columns: repeat(3, 1fr); }
}
@media (max-width: 540px) {
  .partner-banners-grid { grid-template-columns: repeat(2, 1fr); }
}

/* ── Partner text link (tool pages) ──────────────────────────── */
.partner-link {
  display: flex;
  align-items: center;
  gap: 0.35rem;
  font-size: var(--text-sm);
  color: var(--text-tertiary);
  padding: var(--space-xs) var(--space-md);
  background: var(--bg-subtle);
  border-top: 1px solid var(--border);
}
.partner-link-label { font-weight: 500; }
.partner-link a { color: var(--accent); }
.partner-link a:hover { text-decoration: underline; }
  flex-shrink: 0;
}

.tool-bar-desc {
  font-size: var(--text-sm);
  color: var(--text-secondary);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.tool-bar-actions {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  flex-shrink: 0;
  margin-left: auto;
}

@media (max-width: 600px) {
  .tool-bar-sep,
  .tool-bar-desc { display: none; }
}

/* ── Sticky bottom ad bar ──────────────────── */
.ad-bar-sticky {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  z-index: 200;
  background: var(--bg);
  border-top: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 60px;
  padding: var(--space-xs) var(--space-md);
  box-shadow: 0 -2px 12px rgba(0,0,0,.06);
}

.ad-bar-sticky .ad-label {
  font-size: 0.625rem;
  color: var(--text-tertiary);
  text-transform: uppercase;
  letter-spacing: .08em;
  position: absolute;
  top: 4px;
  left: 50%;
  transform: translateX(-50%);
  white-space: nowrap;
}

.ad-bar-sticky .ad-slot {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  max-width: 728px;
  min-height: 50px;
  color: var(--text-tertiary);
  font-size: var(--text-sm);
  font-style: italic;
}

/* ── Responsive ────────────────────────────── */
@media (max-width: 768px) {
  .tools-grid {
    grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
  }
  .footer-inner { flex-direction: column; align-items: flex-start; }
}

@media (max-width: 480px) {
  :root { --space-lg: 1rem; }
  .tools-grid { grid-template-columns: 1fr 1fr; }
  .tool-card { padding: var(--space-md); }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition-duration: 0.01ms !important; }
  html { scroll-behavior: auto; }
}


/* ── Partner banners (homepage) ───────────────────────────────── */
.partner-banners {
  padding-block: var(--space-md);
  border-bottom: 1px solid var(--border);
}
.partner-banners-inner {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-sm);
  align-items: center;
  justify-content: center;
}
.partner-banner-item {
  display: block;
  border-radius: var(--radius-sm);
  overflow: hidden;
  opacity: .85;
  transition: opacity var(--transition), transform var(--transition);
  flex-shrink: 0;
}
.partner-banner-item:hover { opacity: 1; transform: translateY(-1px); }
.partner-banner-item img { display: block; }

/* ── Partner text link (tool pages) ──────────────────────────── */
.partner-link {
  display: flex;
  align-items: center;
  gap: 0.35rem;
  font-size: var(--text-sm);
  color: var(--text-tertiary);
  padding: var(--space-xs) var(--space-md);
  background: var(--bg-subtle);
  border-top: 1px solid var(--border);
}
.partner-link-label { font-weight: 500; }
.partner-link a { color: var(--accent); }
.partner-link a:hover { text-decoration: underline; }
