/* ==========================================================================
   TOOL DIRECTORY — 100% Solid Surfaces, Crisp High-Contrast Tokens
   ========================================================================== */

/* --------------------------------------------------------------------------
   1. COLOR TOKENS (Solid Surfaces)
   -------------------------------------------------------------------------- */
:root {
  --dir-card-bg: #ffffff;
  --dir-card-subbg: #f8fafc;
  --dir-border: #e2e8f0;
  --dir-border-hover: #cbd5e1;
  --dir-card-shadow: 0 4px 20px rgba(0, 0, 0, 0.03);

  --badge-swap-bg: #f8fafc;
  --badge-swap-text: #09090b;
  --badge-swap-border: #e2e8f0;

  --badge-tag-bg: #f1f5f9;
  --badge-tag-text: #334155;
  --badge-tag-border: #e2e8f0;

  --btn-action-bg: #09090b;
  --btn-action-text: #ffffff;
  --btn-action-hover: #18181b;

  --compare-good: #16a34a;
  --compare-neutral: #475569;
}

html.dark-mode,
body.dark-mode {
  --dir-card-bg: #0e1017;
  --dir-card-subbg: #141724;
  --dir-border: #222634;
  --dir-border-hover: #33394d;
  --dir-card-shadow: 0 6px 28px rgba(0, 0, 0, 0.5);

  --badge-swap-bg: #141724;
  --badge-swap-text: #ffffff;
  --badge-swap-border: #222634;

  --badge-tag-bg: #181c2b;
  --badge-tag-text: #cbd5e1;
  --badge-tag-border: #282e44;

  --btn-action-bg: #ffffff;
  --btn-action-text: #09090b;
  --btn-action-hover: #f1f5f9;

  --compare-good: #4ade80;
  --compare-neutral: #94a3b8;
}

/* --------------------------------------------------------------------------
   2. PAGE WRAPPER & BASE CARD
   -------------------------------------------------------------------------- */
.dir-page-wrapper {
  position: relative;
  z-index: 5;
  max-width: 1080px;
  width: 100%;
  margin: 0 auto;
  padding: clamp(24px, 4vw, 48px) clamp(12px, 2vw, 20px) clamp(48px, 6vw, 84px);
  box-sizing: border-box;
  display: flex;
  flex-direction: column;
  gap: clamp(36px, 5vw, 56px);
}

.dir-solid-card {
  background: var(--dir-card-bg);
  border: 1px solid var(--dir-border);
  border-radius: clamp(16px, 2.2vw, 22px);
  box-shadow: var(--dir-card-shadow);
  box-sizing: border-box;
  transition: border-color 0.25s ease, transform 0.25s ease;
}

.dir-solid-card:hover {
  border-color: var(--dir-border-hover);
  transform: translateY(-2px);
}

/* --------------------------------------------------------------------------
   3. HEADER
   -------------------------------------------------------------------------- */
.dir-header-section {
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  padding-top: clamp(8px, 1.5vw, 16px);
}

.dir-badge-pill {
  display: inline-block;
  font-size: clamp(10px, 0.9vw, 11px);
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: #2563eb;
  background: #eff6ff;
  border: 1px solid #dbeafe;
  padding: 5px 14px;
  border-radius: 9999px;
  margin-bottom: clamp(12px, 1.8vw, 16px);
}

html.dark-mode .dir-badge-pill {
  color: #60a5fa;
  background: #14203d;
  border-color: #1e2e57;
}

.dir-headline {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: clamp(2px, 0.6vw, 6px);
  margin-bottom: clamp(10px, 1.5vw, 14px);
  line-height: 1.15;
}

.dir-headline .font-sans-bold {
  font-family: var(--font-display);
  font-size: clamp(28px, 4.4vw, 48px);
  font-weight: 700;
  letter-spacing: -0.03em;
  color: var(--text-main);
}

.dir-headline .font-serif-italic {
  font-family: var(--font-serif);
  font-size: clamp(28px, 4.6vw, 50px);
  font-style: italic;
  font-weight: 500;
  color: var(--text-main);
}

.dir-subtext {
  font-size: clamp(13px, 1.15vw, 15px);
  color: var(--text-muted);
  line-height: 1.6;
  max-width: 600px;
  margin: 0 auto;
}

/* --------------------------------------------------------------------------
   4. BENTO HERO SHOWCASE (Left Card + Right Stacked)
   -------------------------------------------------------------------------- */
.dir-bento-hero {
  display: grid;
  grid-template-columns: 1.35fr 1fr;
  gap: clamp(14px, 2vw, 22px);
  align-items: stretch;
  width: 100%;
}

/* ─── Left Card ─── */
.bento-hero-left {
  padding: clamp(22px, 3.2vw, 36px);
  display: flex;
  flex-direction: column;
  gap: clamp(14px, 1.8vw, 22px);
  flex: 1;
}

.bento-badge-row {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  margin-bottom: 0;
}

.badge-replaces {
  font-size: clamp(10.5px, 0.9vw, 11.5px);
  font-weight: 600;
  color: var(--text-main);
  background: var(--dir-card-subbg);
  border: 1px solid var(--dir-border);
  padding: 4px 10px;
  border-radius: 6px;
  white-space: nowrap;
}

.badge-spotlight {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-main);
  background: var(--badge-tag-bg);
  border: 1px solid var(--badge-tag-border);
  padding: 4px 9px;
  border-radius: 6px;
}

.bento-title-group {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.bento-hero-title {
  font-family: var(--font-display);
  font-size: clamp(24px, 2.8vw, 32px);
  font-weight: 700;
  color: var(--text-main);
  letter-spacing: -0.02em;
  margin: 0;
}

.bento-hero-summary {
  font-size: clamp(13px, 1.1vw, 14.5px);
  color: var(--text-muted);
  line-height: 1.6;
  margin: 0;
}

/* ─── Pros & Cons (Standard) ─── */
.pros-cons-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: clamp(16px, 2vw, 24px);
  margin: 0;
}

.pros-cons-col {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.pros-cons-head {
  display: flex;
  align-items: center;
  margin-bottom: 4px;
}

.pro-tag,
.con-tag {
  font-size: clamp(11px, 0.95vw, 12px);
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.pro-tag {
  color: #16a34a;
}
.con-tag {
  color: #e11d48;
}

html.dark-mode .pro-tag {
  color: #4ade80;
}
html.dark-mode .con-tag {
  color: #fb7185;
}

.matrix-list {
  list-style: none;
  padding: 0;
  margin: 0;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.matrix-list li {
  font-size: clamp(12px, 1.05vw, 13px);
  font-weight: 500;
  color: var(--text-main);
  line-height: 1.5;
  padding: 2px 0;
}

/* ─── Actions ─── */
.bento-card-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  margin-top: auto;
  padding-top: clamp(10px, 1.2vw, 16px);
  border-top: 1px solid var(--dir-border);
}

.btn-solid-primary {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: var(--btn-action-bg);
  color: var(--btn-action-text);
  padding: 9px 20px;
  border-radius: 9999px;
  font-size: 13px;
  font-weight: 600;
  text-decoration: none;
  transition: all 0.2s ease;
}

.btn-solid-primary svg {
  width: 14px;
  height: 14px;
  fill: currentColor;
}

.btn-solid-primary:hover {
  background: var(--btn-action-hover);
  transform: translateY(-1px);
}

.link-secondary {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-muted);
  text-decoration: none;
  transition: color 0.2s ease;
}

.link-secondary:hover {
  color: var(--text-main);
}

/* ─── Right Stacked Column ─── */
.bento-hero-right {
  display: flex;
  flex-direction: column;
  gap: clamp(14px, 2vw, 22px);
}

.bento-mini-card {
  padding: clamp(18px, 2.4vw, 26px);
  flex: 1;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
}

.bento-mini-title {
  font-family: var(--font-display);
  font-size: clamp(18px, 2vw, 22px);
  font-weight: 700;
  color: var(--text-main);
  letter-spacing: -0.015em;
  margin-bottom: 6px;
}

.bento-mini-desc {
  font-size: clamp(12.5px, 1.05vw, 13.5px);
  color: var(--text-muted);
  line-height: 1.58;
  margin-bottom: 14px;
}

.btn-solid-mini {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  background: var(--btn-action-bg);
  color: var(--btn-action-text);
  padding: 6px 14px;
  border-radius: 9999px;
  font-size: 11.5px;
  font-weight: 600;
  text-decoration: none;
  transition: all 0.2s ease;
  white-space: nowrap;
}

.btn-solid-mini svg {
  width: 12px;
  height: 12px;
  fill: currentColor;
}

.btn-solid-mini:hover {
  background: var(--btn-action-hover);
  transform: translateY(-1px);
}

/* ==========================================================================
   5. FEATURED CARD (AppFlowy) – Enhanced with pros/cons container
   ========================================================================== */

/* ─── Card Glow ─── */
.bento-hero-left.featured-card {
  position: relative;
  overflow: visible;
}

.bento-hero-left.featured-card::before {
  content: '';
  position: absolute;
  inset: -2px;
  border-radius: inherit;
  padding: 2px;
  background: linear-gradient(135deg, rgba(59, 130, 246, 0.25), rgba(168, 85, 247, 0.15));
  -webkit-mask: linear-gradient(#fff 0 0) content-box, linear-gradient(#fff 0 0);
  -webkit-mask-composite: xor;
  mask-composite: exclude;
  pointer-events: none;
  z-index: 0;
}

.bento-hero-left.featured-card > * {
  position: relative;
  z-index: 1;
}

/* ─── Badge Alignment ─── */
.bento-hero-left.featured-card .bento-badge-row {
  justify-content: flex-start;
}

.bento-hero-left.featured-card .badge-spotlight.featured-badge {
  background: #3b82f6;
  color: #ffffff;
  border: none;
  padding: 5px 14px;
  border-radius: 9999px;
  font-size: clamp(10px, 0.9vw, 11px);
  font-weight: 700;
  letter-spacing: 0.06em;
  box-shadow: 0 2px 10px rgba(59, 130, 246, 0.25);
  margin-left: auto;
}

html.dark-mode .bento-hero-left.featured-card .badge-spotlight.featured-badge {
  background: #2563eb;
}

.bento-hero-left.featured-card .badge-replaces {
  font-size: clamp(10px, 0.85vw, 11px);
  font-weight: 500;
  color: var(--text-muted);
  background: var(--dir-card-subbg);
  border: 1px solid var(--dir-border);
  padding: 4px 10px;
  border-radius: 9999px;
}

/* ─── Tighter Spacing ─── */
.bento-hero-left.featured-card {
  padding: clamp(18px, 2.6vw, 28px);
  gap: clamp(12px, 1.6vw, 20px);
}

.bento-hero-left.featured-card .bento-title-group {
  gap: 4px;
}

.bento-hero-left.featured-card .bento-hero-title {
  font-size: clamp(22px, 2.6vw, 30px);
  margin-bottom: 0;
}

.bento-hero-left.featured-card .bento-hero-summary {
  font-size: clamp(12.5px, 1.05vw, 14px);
  line-height: 1.55;
}

/* ─── Pros & Cons Container ─── */
.featured-pros-cons {
  background: var(--dir-card-subbg);
  border: 1px solid var(--dir-border);
  border-radius: 12px;
  padding: clamp(14px, 1.8vw, 22px) clamp(16px, 2vw, 26px);
  margin: 0;
  transition: border-color 0.2s ease;
}

.featured-pros-cons .pros-cons-grid {
  gap: clamp(20px, 2.5vw, 32px);
  margin: 0;
}

.featured-pros-cons .pros-cons-col {
  gap: 4px;
}

.featured-pros-cons .pros-cons-head {
  margin-bottom: 6px;
}

.featured-pros-cons .pro-tag,
.featured-pros-cons .con-tag {
  font-size: clamp(11px, 0.95vw, 12px);
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.featured-pros-cons .pro-tag {
  color: #16a34a;
}
.featured-pros-cons .con-tag {
  color: #e11d48;
}

html.dark-mode .featured-pros-cons .pro-tag {
  color: #4ade80;
}
html.dark-mode .featured-pros-cons .con-tag {
  color: #fb7185;
}

.featured-pros-cons .matrix-list {
  gap: 6px;
}

.featured-pros-cons .matrix-list li {
  font-size: clamp(13px, 1.1vw, 15px);
  font-weight: 450;
  padding: 2px 0;
  line-height: 1.5;
  color: var(--text-main);
}

/* ─── Actions ─── */
.bento-hero-left.featured-card .bento-card-actions {
  padding-top: clamp(10px, 1.2vw, 14px);
  margin-top: auto;
  border-top: 1px solid var(--dir-border);
}

/* --------------------------------------------------------------------------
   6. CONTROLS BAR & FILTER ENGINE
   -------------------------------------------------------------------------- */
.dir-explorer-section {
  width: 100%;
  display: flex;
  flex-direction: column;
  gap: clamp(18px, 2.5vw, 28px);
}

.dir-controls-shell {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  flex-wrap: wrap;
}

.dir-category-bar {
  display: flex;
  align-items: center;
  gap: 6px;
  background: var(--dir-card-bg);
  border: 1px solid var(--dir-border);
  padding: 5px;
  border-radius: 9999px;
  flex-wrap: wrap;
}

.cat-pill {
  background: transparent;
  border: none;
  padding: 6px 15px;
  border-radius: 9999px;
  font-size: clamp(12px, 1.05vw, 13px);
  font-weight: 500;
  color: var(--text-muted);
  cursor: pointer;
  font-family: inherit;
  transition: all 0.2s ease;
}

.cat-pill:hover {
  color: var(--text-main);
}

.cat-pill.active {
  background: var(--btn-action-bg);
  color: var(--btn-action-text);
  font-weight: 600;
}

.dir-search-box {
  position: relative;
  display: flex;
  align-items: center;
  width: clamp(210px, 24vw, 270px);
}

.search-icon-svg {
  position: absolute;
  left: 14px;
  width: 15px;
  height: 15px;
  color: var(--text-muted);
  pointer-events: none;
}

.dir-search-box input {
  width: 100%;
  background: var(--dir-card-bg);
  border: 1px solid var(--dir-border);
  border-radius: 9999px;
  padding: 9px 14px 9px 36px;
  font-family: inherit;
  font-size: 13px;
  color: var(--text-main);
  outline: none;
  transition: border-color 0.2s ease;
  box-sizing: border-box;
}

.dir-search-box input:focus {
  border-color: var(--border-focus);
}

/* --------------------------------------------------------------------------
   7. TOOL CATALOG GRID (3 Columns)
   -------------------------------------------------------------------------- */
.dir-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: clamp(14px, 2vw, 20px);
}

.tool-item-card {
  padding: clamp(18px, 2.2vw, 24px);
  display: flex;
  flex-direction: column;
  justify-content: space-between;
}

.tool-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 12px;
}

.tool-title {
  font-family: var(--font-display);
  font-size: clamp(17px, 1.6vw, 20px);
  font-weight: 700;
  color: var(--text-main);
  letter-spacing: -0.015em;
  margin-bottom: 6px;
}

.tool-desc {
  font-size: clamp(12.5px, 1.05vw, 13.5px);
  color: var(--text-muted);
  line-height: 1.58;
  margin-bottom: 18px;
}

.tool-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding-top: 14px;
  border-top: 1px solid var(--dir-border);
  margin-top: auto;
}

.tool-guide-link {
  font-size: 12.5px;
  font-weight: 600;
  color: var(--text-muted);
  text-decoration: none;
  transition: color 0.2s ease;
}

.tool-guide-link:hover {
  color: var(--text-main);
}

.btn-icon-link {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: var(--dir-card-subbg);
  border: 1px solid var(--dir-border);
  color: var(--text-main);
  display: flex;
  align-items: center;
  justify-content: center;
  text-decoration: none;
  flex-shrink: 0;
  transition: all 0.2s ease;
}

.btn-icon-link svg {
  width: 13px;
  height: 13px;
  transition: transform 0.2s ease;
}

.btn-icon-link:hover {
  background: var(--btn-action-bg);
  color: var(--btn-action-text);
  border-color: var(--btn-action-bg);
}

.btn-icon-link:hover svg {
  transform: translate(1px, -1px);
}

/* Empty State */
.dir-empty-state {
  display: none;
  text-align: center;
  padding: clamp(36px, 5vw, 54px) 16px;
  background: var(--dir-card-bg);
  border: 1px solid var(--dir-border);
  border-radius: 16px;
}

.empty-title {
  font-family: var(--font-display);
  font-size: 18px;
  font-weight: 700;
  color: var(--text-main);
  margin-bottom: 4px;
}

.empty-sub {
  font-size: 13px;
  color: var(--text-muted);
  margin-bottom: 14px;
}

.btn-reset-filters {
  background: var(--dir-card-subbg);
  border: 1px solid var(--dir-border);
  color: var(--text-main);
  padding: 8px 18px;
  border-radius: 9999px;
  font-size: 12.5px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
}

.btn-reset-filters:hover {
  background: var(--btn-action-bg);
  color: var(--btn-action-text);
}

/* --------------------------------------------------------------------------
   8. NEWSLETTER SECTION
   -------------------------------------------------------------------------- */
.dir-newsletter-wrap {
  width: 100%;
}

/* ==========================================================================
   9. RESPONSIVE BREAKPOINTS (consolidated at the end)
   ========================================================================== */

@media (max-width: 860px) {
  .dir-bento-hero {
    grid-template-columns: 1fr;
  }

  .dir-grid {
    grid-template-columns: repeat(2, 1fr);
  }

  .dir-controls-shell {
    flex-direction: column;
    align-items: stretch;
  }

  .dir-search-box {
    width: 100%;
  }
}

@media (max-width: 580px) {
  .dir-grid {
    grid-template-columns: 1fr;
  }

  .dir-category-bar {
    border-radius: 14px;
  }

  .bento-card-actions {
    flex-direction: column;
    align-items: stretch;
  }

  .btn-solid-primary {
    justify-content: center;
  }

  .link-secondary {
    text-align: center;
  }

  /* Standard pros/cons grid */
  .pros-cons-grid {
    grid-template-columns: 1fr;
    gap: 16px;
  }

  /* Featured card pros/cons container */
  .featured-pros-cons .pros-cons-grid {
    grid-template-columns: 1fr;
    gap: 14px;
  }
}

@media (max-width: 480px) {
  .bento-hero-left {
    padding: clamp(16px, 4vw, 22px);
    gap: 12px;
  }

  .matrix-list li {
    font-size: 12.5px;
  }

  .bento-hero-left.featured-card {
    padding: clamp(14px, 4vw, 18px);
    gap: 10px;
  }

  .featured-pros-cons {
    padding: 12px 14px;
  }

  .featured-pros-cons .matrix-list li {
    font-size: 12.5px;
  }
}