/* =========================================================
   ToolTopia — style.css
   Dark, premium AI tools directory
   ========================================================= */

/* ---------- Design tokens ---------- */
:root {
    --bg: #0B0D12;
    --bg-secondary: #11141B;
    --card: #161A23;
    --card-hover: #1A1F2B;
    --border: #252A35;
    --border-soft: #1E232F;
    --primary: #7C5CFF;
    --primary-soft: rgba(124, 92, 255, 0.14);
    --accent: #00D4FF;
    --accent-soft: rgba(0, 212, 255, 0.12);
    --text: #FFFFFF;
    --muted: #9CA3AF;
    --muted-2: #6B7280;
    --success: #22C55E;
    --warning: #F59E0B;
    --danger: #EF4444;

    --grad: linear-gradient(135deg, #7C5CFF 0%, #00D4FF 100%);
    --grad-soft: linear-gradient(135deg, rgba(124, 92, 255, 0.16), rgba(0, 212, 255, 0.12));

    --radius-sm: 10px;
    --radius: 16px;
    --radius-lg: 22px;
    --radius-xl: 28px;

    --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.25);
    --shadow: 0 12px 30px rgba(0, 0, 0, 0.35);
    --shadow-lg: 0 24px 60px rgba(0, 0, 0, 0.5);
    --glow: 0 0 0 1px rgba(124, 92, 255, 0.35), 0 10px 40px rgba(124, 92, 255, 0.18);

    --header-h: 68px;
    --font: 'Inter', 'SF Pro Display', ui-sans-serif, system-ui, -apple-system, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    --font-mono: 'SF Mono', 'JetBrains Mono', ui-monospace, 'Cascadia Code', Menlo, Consolas, monospace;
}

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

html { scroll-behavior: smooth; scroll-padding-top: calc(var(--header-h) + 16px); }

body {
    font-family: var(--font);
    background: var(--bg);
    color: var(--text);
    font-size: 16px;
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
    text-rendering: optimizeLegibility;
    overflow-x: hidden;
}

img { max-width: 100%; display: block; }
a { color: inherit; text-decoration: none; }
button { font-family: inherit; cursor: pointer; background: none; border: none; color: inherit; }
input, select, textarea { font-family: inherit; color: inherit; }
ul { list-style: none; }
h1, h2, h3, h4 { line-height: 1.2; font-weight: 700; letter-spacing: -0.02em; }

::selection { background: rgba(124, 92, 255, 0.45); color: #fff; }

:focus-visible {
    outline: 2px solid var(--primary);
    outline-offset: 3px;
    border-radius: 4px;
}

/* ---------- Scrollbar ---------- */
::-webkit-scrollbar { width: 11px; height: 11px; }
::-webkit-scrollbar-track { background: var(--bg); }
::-webkit-scrollbar-thumb { background: var(--border); border-radius: 8px; border: 2px solid var(--bg); }
::-webkit-scrollbar-thumb:hover { background: #343B4B; }

/* ---------- Utilities ---------- */
.container { width: min(1200px, 100% - 2rem); margin-inline: auto; }
.container.narrow { width: min(760px, 100% - 2rem); }

.gradient-text {
    background: var(--grad);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
    color: transparent;
}

.muted { color: var(--muted); }
.visually-hidden {
    position: absolute; width: 1px; height: 1px; margin: -1px; padding: 0;
    overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}

.skip-link {
    position: absolute; top: -100px; left: 16px; z-index: 200;
    background: var(--primary); color: #fff; padding: 10px 16px; border-radius: var(--radius-sm);
    transition: top 0.2s ease;
}
.skip-link:focus { top: 12px; }

.noscript-notice {
    padding: 12px 16px; text-align: center; background: #3b2a00; color: #ffd479;
    font-size: 0.9rem;
}

/* ---------- Buttons ---------- */
.btn {
    display: inline-flex; align-items: center; justify-content: center; gap: 8px;
    padding: 10px 18px; border-radius: var(--radius-sm); font-weight: 600; font-size: 0.92rem;
    transition: transform 0.18s ease, box-shadow 0.18s ease, background 0.18s ease, border-color 0.18s ease, color 0.18s ease;
    white-space: nowrap; border: 1px solid transparent;
}
.btn:active { transform: translateY(1px) scale(0.99); }

.btn-primary {
    background: var(--grad); color: #fff;
    box-shadow: 0 8px 24px rgba(124, 92, 255, 0.32);
    border: 1px solid rgba(124, 92, 255, 0.4);
}
.btn-primary:hover { transform: translateY(-1px); box-shadow: 0 12px 30px rgba(124, 92, 255, 0.45); filter: brightness(1.08); }

.btn-ghost {
    background: rgba(255, 255, 255, 0.03); color: var(--text);
    border: 1px solid var(--border);
}
.btn-ghost:hover { border-color: rgba(124, 92, 255, 0.55); background: var(--primary-soft); color: #fff; }

.btn-sm { padding: 8px 14px; font-size: 0.85rem; }
.btn-block { width: 100%; }
.link-btn { padding-inline: 8px; }

.btn-icon {
    display: inline-flex; align-items: center; justify-content: center;
    width: 40px; height: 40px; border-radius: var(--radius-sm);
    border: 1px solid var(--border); background: rgba(255, 255, 255, 0.03); color: var(--muted);
    transition: color 0.18s, border-color 0.18s, background 0.18s;
}
.btn-icon:hover { color: #fff; border-color: var(--primary); background: var(--primary-soft); }

/* ---------- Header ---------- */
.site-header {
    position: sticky; top: 0; z-index: 100;
    height: var(--header-h);
    background: rgba(11, 13, 18, 0.78);
    -webkit-backdrop-filter: blur(16px) saturate(1.4);
    backdrop-filter: blur(16px) saturate(1.4);
    border-bottom: 1px solid rgba(37, 42, 53, 0.7);
    transition: background 0.3s ease, box-shadow 0.3s ease;
}
.site-header.scrolled {
    background: rgba(11, 13, 18, 0.92);
    box-shadow: 0 8px 30px rgba(0, 0, 0, 0.45);
}
.header-inner { display: flex; align-items: center; gap: 20px; height: var(--header-h); }

.brand { display: inline-flex; align-items: center; gap: 10px; }
.brand-mark {
    display: inline-flex; align-items: center; justify-content: center;
    width: 38px; height: 38px; border-radius: 12px;
    background: var(--grad-soft); border: 1px solid rgba(124, 92, 255, 0.35);
    box-shadow: 0 4px 16px rgba(124, 92, 255, 0.25);
}
.brand-name { font-size: 1.22rem; font-weight: 800; letter-spacing: -0.03em; }
.brand-name span { background: var(--grad); -webkit-background-clip: text; background-clip: text; -webkit-text-fill-color: transparent; }

.main-nav { margin-left: 18px; }
.main-nav ul { display: flex; align-items: center; gap: 4px; }
.main-nav a {
    display: block; padding: 8px 13px; border-radius: var(--radius-sm);
    font-size: 0.92rem; font-weight: 500; color: var(--muted);
    transition: color 0.18s, background 0.18s;
}
.main-nav a:hover { color: #fff; background: rgba(255, 255, 255, 0.04); }
.nav-mobile-extra { display: none; }

.header-actions { display: flex; align-items: center; gap: 10px; margin-left: auto; }
.hide-sm { display: none; }
.hide-mobile { display: inline-flex; }
.menu-toggle { display: none; }

/* ---------- Hero ---------- */
.hero { position: relative; padding: 88px 0 70px; overflow: hidden; }

.hero-bg { position: absolute; inset: 0; pointer-events: none; }
.orb { position: absolute; border-radius: 50%; filter: blur(90px); opacity: 0.55; }
.orb-1 { width: 560px; height: 560px; background: rgba(124, 92, 255, 0.4); top: -220px; left: -120px; animation: drift 18s ease-in-out infinite alternate; }
.orb-2 { width: 480px; height: 480px; background: rgba(0, 212, 255, 0.28); top: 40px; right: -160px; animation: drift 22s ease-in-out infinite alternate-reverse; }
.orb-3 { width: 320px; height: 320px; background: rgba(124, 92, 255, 0.22); bottom: -140px; left: 45%; animation: drift 26s ease-in-out infinite alternate; }

.grid-overlay {
    position: absolute; inset: 0;
    background-image:
        linear-gradient(rgba(255, 255, 255, 0.03) 1px, transparent 1px),
        linear-gradient(90deg, rgba(255, 255, 255, 0.03) 1px, transparent 1px);
    background-size: 56px 56px;
    -webkit-mask-image: radial-gradient(ellipse 70% 60% at 50% 20%, #000 0%, transparent 75%);
    mask-image: radial-gradient(ellipse 70% 60% at 50% 20%, #000 0%, transparent 75%);
}

@keyframes drift {
    0% { transform: translate3d(0, 0, 0) scale(1); }
    100% { transform: translate3d(40px, -30px, 0) scale(1.12); }
}

.hero-inner { position: relative; text-align: center; max-width: 860px; }

.hero-eyebrow {
    display: inline-flex; align-items: center; gap: 9px;
    font-size: 0.82rem; font-weight: 600; letter-spacing: 0.04em;
    color: var(--muted); background: rgba(255, 255, 255, 0.04);
    border: 1px solid var(--border); border-radius: 100px; padding: 7px 16px; margin-bottom: 26px;
}
.pulse-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--success); box-shadow: 0 0 0 rgba(34, 197, 94, 0.5); animation: pulse 2s infinite; }
@keyframes pulse {
    0% { box-shadow: 0 0 0 0 rgba(34, 197, 94, 0.5); }
    70% { box-shadow: 0 0 0 8px rgba(34, 197, 94, 0); }
    100% { box-shadow: 0 0 0 0 rgba(34, 197, 94, 0); }
}

.hero-title {
    font-size: clamp(2rem, 5vw, 3.5rem);
    font-weight: 800; letter-spacing: -0.03em; line-height: 1.12;
    text-wrap: balance;
}
.hero-subtitle {
    margin: 18px auto 0; max-width: 560px;
    font-size: clamp(1rem, 1.6vw, 1.15rem); color: var(--muted);
    text-wrap: balance;
}

.hero-search {
    position: relative; display: flex; align-items: center; gap: 10px;
    margin: 34px auto 0; max-width: 640px;
    background: rgba(22, 26, 35, 0.82);
    border: 1px solid var(--border); border-radius: 999px;
    padding: 8px 8px 8px 20px;
    -webkit-backdrop-filter: blur(12px); backdrop-filter: blur(12px);
    box-shadow: var(--shadow);
    transition: border-color 0.25s ease, box-shadow 0.25s ease;
    animation: rise 0.6s ease 0.15s both;
}
.hero-search:focus-within {
    border-color: var(--primary);
    box-shadow: var(--glow);
}
.hero-search-icon { color: var(--muted); flex-shrink: 0; }
.hero-search input {
    flex: 1; background: none; border: none; outline: none;
    font-size: 1rem; color: var(--text); min-width: 0;
}
.hero-search input::placeholder { color: var(--muted-2); }
.kbd-hint {
    font-family: var(--font-mono); font-size: 0.78rem; font-weight: 600;
    color: var(--muted); background: rgba(255, 255, 255, 0.06);
    border: 1px solid var(--border); border-bottom-width: 2px;
    border-radius: 7px; padding: 2px 9px; pointer-events: none;
}

.popular-searches {
    display: flex; flex-wrap: wrap; align-items: center; justify-content: center; gap: 8px;
    margin-top: 20px; font-size: 0.85rem;
}
.popular-searches .label { color: var(--muted-2); font-weight: 600; }
.chip {
    display: inline-flex; align-items: center;
    padding: 6px 14px; border-radius: 999px;
    border: 1px solid var(--border); background: rgba(255, 255, 255, 0.03);
    color: var(--muted); font-size: 0.85rem; font-weight: 500;
    transition: all 0.18s ease;
}
.chip:hover { color: #fff; border-color: var(--accent); background: var(--accent-soft); transform: translateY(-1px); }

.hero-stats {
    display: flex; justify-content: center; gap: clamp(28px, 6vw, 64px);
    margin-top: 48px;
}
.stat { display: flex; flex-direction: column; gap: 2px; }
.stat strong { font-size: 1.5rem; font-weight: 800; background: var(--grad); -webkit-background-clip: text; background-clip: text; -webkit-text-fill-color: transparent; }
.stat span { font-size: 0.8rem; color: var(--muted-2); font-weight: 500; }

@keyframes rise {
    from { opacity: 0; transform: translateY(14px); }
    to { opacity: 1; transform: translateY(0); }
}

/* ---------- Sections ---------- */
.section { padding: 76px 0; }
.section-alt { background: linear-gradient(180deg, rgba(17, 20, 27, 0.55), var(--bg) 120%); border-top: 1px solid var(--border-soft); border-bottom: 1px solid var(--border-soft); }

.section-head {
    display: flex; align-items: flex-end; justify-content: space-between; gap: 20px;
    margin-bottom: 34px;
}
.section-head.center { flex-direction: column; align-items: center; text-align: center; }
.section-head h2 { font-size: clamp(1.6rem, 3vw, 2.2rem); font-weight: 800; letter-spacing: -0.025em; margin-bottom: 8px; }
.section-head p { color: var(--muted); font-size: 1rem; }

/* ---------- Advertisement containers ---------- */
.ad-slot-wrap { padding: 8px 0; }

.ad-container {
    position: relative;
    display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 10px;
    background: rgba(17, 20, 27, 0.7);
    border: 1px dashed var(--border);
    border-radius: var(--radius);
    overflow: hidden;
}
.ad-container > span:first-child {
    font-size: 0.62rem; font-weight: 700; letter-spacing: 0.16em;
    color: var(--muted-2); text-transform: uppercase;
}
.ad-placeholder {
    display: flex; align-items: center; justify-content: center;
    width: 100%; color: var(--muted-2); font-size: 0.9rem; font-weight: 500;
}

.ad-banner { min-height: 110px; margin: 30px auto; }
.ad-responsive { min-height: 110px; margin: 12px auto; }
.ad-square { min-height: 250px; max-width: 480px; margin-inline: auto; }

/* Inline ad inserted inside the directory grid */
.ad-cell { grid-column: 1 / -1; }
.ad-cell .ad-inline { min-height: 120px; margin: 4px 0; }

/* ---------- Tool grid & cards ---------- */
.tool-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 20px;
}

.tool-card {
    position: relative;
    display: flex; flex-direction: column;
    background: linear-gradient(180deg, var(--card), #141824);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 22px;
    overflow: hidden;
    cursor: pointer;
    transition: transform 0.22s ease, border-color 0.22s ease, box-shadow 0.22s ease, background 0.22s ease;
    animation: rise 0.45s ease both;
}
.tool-card::before {
    content: ""; position: absolute; inset: 0; opacity: 0;
    background: radial-gradient(420px circle at var(--mx, 50%) var(--my, 0%), rgba(124, 92, 255, 0.1), transparent 60%);
    transition: opacity 0.3s ease; pointer-events: none;
}
.tool-card:hover {
    transform: translateY(-4px);
    border-color: rgba(124, 92, 255, 0.5);
    box-shadow: 0 18px 40px rgba(0, 0, 0, 0.45), 0 0 0 1px rgba(124, 92, 255, 0.12);
    background: var(--card-hover);
}
.tool-card:hover::before { opacity: 1; }

.tool-card-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 10px; margin-bottom: 14px; }
.tool-card-head-left { display: flex; align-items: center; gap: 10px; min-width: 0; }
.tool-card-head-left .badge-new { align-self: flex-start; margin-top: 2px; }

.tool-logo {
    display: inline-flex; align-items: center; justify-content: center;
    width: 48px; height: 48px; border-radius: 14px;
    font-size: 1.5rem; line-height: 1;
    background: var(--grad-soft); border: 1px solid rgba(255, 255, 255, 0.08);
    flex-shrink: 0;
}
.tool-logo-lg { width: 62px; height: 62px; font-size: 1.9rem; border-radius: 18px; }

.tool-logo-img {
    width: 70%;
    height: 70%;
    object-fit: contain;
    border-radius: 8px;
}

/* Category-tinted logo tiles */
.tool-logo.writing       { background: linear-gradient(135deg, rgba(124, 92, 255, 0.28), rgba(124, 92, 255, 0.08)); border-color: rgba(124, 92, 255, 0.3); }
.tool-logo.image         { background: linear-gradient(135deg, rgba(249, 115, 22, 0.28), rgba(249, 115, 22, 0.08)); border-color: rgba(249, 115, 22, 0.3); }
.tool-logo.video         { background: linear-gradient(135deg, rgba(239, 68, 68, 0.28), rgba(239, 68, 68, 0.08)); border-color: rgba(239, 68, 68, 0.3); }
.tool-logo.audio         { background: linear-gradient(135deg, rgba(34, 197, 94, 0.28), rgba(34, 197, 94, 0.08)); border-color: rgba(34, 197, 94, 0.3); }
.tool-logo.documents     { background: linear-gradient(135deg, rgba(59, 130, 246, 0.28), rgba(59, 130, 246, 0.08)); border-color: rgba(59, 130, 246, 0.3); }
.tool-logo.coding        { background: linear-gradient(135deg, rgba(0, 212, 255, 0.28), rgba(0, 212, 255, 0.08)); border-color: rgba(0, 212, 255, 0.3); }
.tool-logo.marketing     { background: linear-gradient(135deg, rgba(168, 85, 247, 0.28), rgba(168, 85, 247, 0.08)); border-color: rgba(168, 85, 247, 0.3); }
.tool-logo.education     { background: linear-gradient(135deg, rgba(245, 158, 11, 0.28), rgba(245, 158, 11, 0.08)); border-color: rgba(245, 158, 11, 0.3); }
.tool-logo.productivity  { background: linear-gradient(135deg, rgba(16, 185, 129, 0.28), rgba(16, 185, 129, 0.08)); border-color: rgba(16, 185, 129, 0.3); }
.tool-logo.business      { background: linear-gradient(135deg, rgba(236, 72, 153, 0.28), rgba(236, 72, 153, 0.08)); border-color: rgba(236, 72, 153, 0.3); }
.tool-logo.logo-real     { background: rgba(255, 255, 255, 0.96); border-color: rgba(255, 255, 255, 0.22); }

.fav-btn {
    display: inline-flex; align-items: center; justify-content: center;
    width: 34px; height: 34px; border-radius: 10px;
    border: 1px solid var(--border); background: rgba(255, 255, 255, 0.03);
    color: var(--muted); transition: all 0.18s ease; flex-shrink: 0;
}
.fav-btn:hover { color: var(--danger); border-color: rgba(239, 68, 68, 0.4); }
.fav-btn.is-fav { color: var(--danger); border-color: rgba(239, 68, 68, 0.5); background: rgba(239, 68, 68, 0.1); fill: currentColor; }

.tool-card h3  { font-size: 1.12rem; font-weight: 700; margin-bottom: 6px; }
.tool-card .tool-desc { font-size: 0.9rem; color: var(--muted); line-height: 1.55; margin-bottom: 18px; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; min-height: 3.1em; }

.tool-card-meta { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-bottom: 4px; }

.cat-chip {
    display: inline-flex; align-items: center;
    padding: 4px 11px; border-radius: 999px;
    font-size: 0.72rem; font-weight: 700; letter-spacing: 0.04em;
    background: var(--primary-soft); color: #b9a7ff;
    border: 1px solid rgba(124, 92, 255, 0.25);
}

.rating {
    display: inline-flex; align-items: center; gap: 5px;
    font-size: 0.82rem; font-weight: 600; color: var(--text);
}
.rating svg { color: var(--warning); }
.rating .rating-count { color: var(--muted-2); font-weight: 500; font-size: 0.78rem; }

.badge-new {
    display: inline-flex; align-items: center; justify-content: center;
    background: var(--grad); color: #fff;
    font-size: 0.62rem; font-weight: 800; letter-spacing: 0.12em;
    padding: 3px 9px; border-radius: 999px; text-transform: uppercase;
    box-shadow: 0 0 14px rgba(124, 92, 255, 0.55);
}
.badge-new-large { padding: 5px 13px; font-size: 0.75rem; }

.tool-card-foot {
    display: flex; align-items: center; justify-content: space-between; gap: 12px;
    margin-top: auto; padding-top: 16px;
}
.price-badge {
    font-size: 0.78rem; font-weight: 700;
    color: var(--success); background: rgba(34, 197, 94, 0.1);
    border: 1px solid rgba(34, 197, 94, 0.25);
    padding: 5px 12px; border-radius: 999px;
}
.price-badge.freemium { color: var(--accent); background: var(--accent-soft); border-color: rgba(0, 212, 255, 0.3); }
.price-badge.trial { color: var(--warning); background: rgba(245, 158, 11, 0.1); border-color: rgba(245, 158, 11, 0.3); }
.price-badge.paid { color: var(--text); background: rgba(255, 255, 255, 0.05); border-color: var(--border); }

.card-cta {
    display: inline-flex; align-items: center; gap: 7px;
    font-size: 0.85rem; font-weight: 700; color: #c9bcff;
    transition: color 0.18s ease;
}
.tool-card:hover .card-cta { color: #fff; }
.card-cta svg { transition: transform 0.18s ease; }
.tool-card:hover .card-cta svg { transform: translateX(3px); }

/* ---------- Category grid ---------- */
.category-grid {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    gap: 16px;
}
.category-card {
    position: relative;
    display: flex; flex-direction: column; align-items: flex-start; gap: 6px;
    padding: 20px; border-radius: var(--radius);
    background: linear-gradient(180deg, var(--card), #141824);
    border: 1px solid var(--border);
    text-align: left;
    transition: transform 0.2s ease, border-color 0.2s ease, box-shadow 0.2s ease;
}
.category-card:hover {
    transform: translateY(-4px);
    border-color: rgba(0, 212, 255, 0.45);
    box-shadow: 0 14px 34px rgba(0, 0, 0, 0.4), 0 0 0 1px rgba(0, 212, 255, 0.08);
}
.category-icon {
    display: inline-flex; align-items: center; justify-content: center;
    width: 44px; height: 44px; border-radius: 13px; font-size: 1.3rem;
    background: rgba(255, 255, 255, 0.04); border: 1px solid rgba(255, 255, 255, 0.07);
    margin-bottom: 8px;
}
.category-name { font-weight: 700; font-size: 0.98rem; }
.category-count { font-size: 0.78rem; color: var(--muted-2); font-weight: 500; }

/* ---------- Directory toolbar ---------- */
.directory-toolbar {
    display: grid; grid-template-columns: 1fr auto; gap: 14px;
    margin-bottom: 18px;
}
.directory-search {
    display: flex; align-items: center; gap: 10px;
    background: var(--card); border: 1px solid var(--border);
    border-radius: var(--radius-sm); padding: 0 16px; min-width: 0;
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
}
.directory-search:focus-within { border-color: var(--primary); box-shadow: 0 0 0 3px rgba(124, 92, 255, 0.15); }
.directory-search svg { color: var(--muted); flex-shrink: 0; }
.directory-search input {
    flex: 1; background: none; border: none; outline: none;
    padding: 13px 0; font-size: 0.95rem; min-width: 0;
}
.directory-search input::placeholder { color: var(--muted-2); }

.directory-sort { position: relative; display: flex; align-items: center; gap: 8px; background: var(--card); border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 0 14px; }
.directory-sort svg:first-child { color: var(--muted); flex-shrink: 0; }
.directory-sort select {
    appearance: none; -webkit-appearance: none;
    background: none; border: none; outline: none;
    padding: 13px 24px 13px 0; font-size: 0.9rem; font-weight: 600;
    cursor: pointer; color: var(--text); min-width: 150px;
}
.directory-sort svg:last-child {
    position: absolute; right: 12px; pointer-events: none; color: var(--muted);
}

.directory-filters {
    display: flex; gap: 8px; flex-wrap: wrap;
    margin-bottom: 22px;
}
.filter-chip {
    padding: 8px 16px; border-radius: 999px;
    border: 1px solid var(--border); background: var(--card);
    color: var(--muted); font-size: 0.85rem; font-weight: 600;
    transition: all 0.18s ease;
}
.filter-chip:hover { color: #fff; border-color: var(--primary); transform: translateY(-1px); }
.filter-chip.is-active {
    background: var(--grad); color: #fff; border-color: transparent;
    box-shadow: 0 6px 18px rgba(124, 92, 255, 0.35);
}

.result-count { font-size: 0.85rem; color: var(--muted); margin-bottom: 16px; }

.empty-state {
    text-align: center; padding: 60px 20px;
    border: 1px dashed var(--border); border-radius: var(--radius-lg);
    background: rgba(17, 20, 27, 0.5);
}
.empty-icon {
    display: inline-flex; align-items: center; justify-content: center;
    width: 72px; height: 72px; border-radius: 20px; color: var(--muted);
    background: rgba(255, 255, 255, 0.03); border: 1px solid var(--border); margin-bottom: 18px;
}
.empty-state h3 { font-size: 1.25rem; margin-bottom: 6px; }
.empty-state p { color: var(--muted); margin-bottom: 20px; }

/* ---------- Newsletter ---------- */
.newsletter { position: relative; padding: 72px 0; overflow: hidden; }
.newsletter-inner { position: relative; text-align: center; max-width: 620px; }
.newsletter-glow {
    position: absolute; inset: -80px -40%; z-index: -1; pointer-events: none;
    background:
        radial-gradient(400px circle at 30% 50%, rgba(124, 92, 255, 0.18), transparent 65%),
        radial-gradient(400px circle at 70% 50%, rgba(0, 212, 255, 0.14), transparent 65%);
    filter: blur(30px);
}
.newsletter h2 { font-size: clamp(1.7rem, 3.2vw, 2.3rem); font-weight: 800; letter-spacing: -0.025em; margin-bottom: 10px; }
.newsletter p { color: var(--muted); margin-bottom: 28px; }
.newsletter-form {
    display: flex; gap: 10px;
    padding: 8px; border-radius: 999px;
    background: rgba(22, 26, 35, 0.9); border: 1px solid var(--border);
    transition: border-color 0.22s ease, box-shadow 0.22s ease;
}
.newsletter-form:focus-within { border-color: var(--accent); box-shadow: 0 0 0 3px rgba(0, 212, 255, 0.14); }
.newsletter-form input {
    flex: 1; background: none; border: none; outline: none;
    padding: 10px 18px; font-size: 0.95rem; min-width: 0;
}
.newsletter-form input::placeholder { color: var(--muted-2); }
.newsletter-note { font-size: 0.8rem; color: var(--muted-2); margin-bottom: 0; margin-top: 16px; }

/* ---------- Footer ---------- */
.site-footer { border-top: 1px solid var(--border); background: var(--bg-secondary); padding-top: 60px; }
.footer-grid {
    display: grid; grid-template-columns: 2fr 1fr 1fr 1fr; gap: 40px;
    padding-bottom: 44px;
}
.footer-brand p { color: var(--muted); font-size: 0.9rem; margin-top: 16px; max-width: 280px; }
.footer-col h3 { font-size: 0.82rem; font-weight: 700; letter-spacing: 0.09em; text-transform: uppercase; color: var(--text); margin-bottom: 18px; }
.footer-col li { margin-bottom: 11px; }
.footer-col a { color: var(--muted); font-size: 0.9rem; transition: color 0.18s ease; }
.footer-col a:hover { color: #fff; }

.footer-bottom {
    display: flex; flex-direction: column; gap: 10px;
    border-top: 1px solid var(--border-soft);
    padding: 24px 0; font-size: 0.85rem; color: var(--muted-2);
}
.footer-disclosure { max-width: 640px; line-height: 1.6; }

/* ---------- Modal ---------- */
.modal-overlay {
    position: fixed; inset: 0; z-index: 300;
    display: flex; align-items: center; justify-content: center;
    padding: 20px;
    background: rgba(5, 6, 10, 0.72);
    -webkit-backdrop-filter: blur(8px); backdrop-filter: blur(8px);
    animation: fadeIn 0.2s ease both;
}
.modal-overlay[hidden] { display: none; }

@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }

.modal {
    position: relative;
    width: min(640px, 100%);
    max-height: min(86vh, 720px);
    overflow-y: auto;
    background: linear-gradient(180deg, #1A1F2B, #141824);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 30px;
    box-shadow: var(--shadow-lg);
    animation: modalIn 0.28s cubic-bezier(0.2, 0.9, 0.3, 1.2) both;
}
@keyframes modalIn {
    from { opacity: 0; transform: translateY(18px) scale(0.97); }
    to { opacity: 1; transform: translateY(0) scale(1); }
}
.modal-close {
    position: absolute; top: 16px; right: 16px; z-index: 2;
    display: inline-flex; align-items: center; justify-content: center;
    width: 36px; height: 36px; border-radius: 10px;
    color: var(--muted); background: rgba(255, 255, 255, 0.04);
    border: 1px solid var(--border); transition: all 0.18s ease;
}
.modal-close:hover { color: #fff; border-color: var(--danger); }

.tool-modal-head { display: flex; align-items: center; gap: 16px; margin-bottom: 18px; padding-right: 40px; }
.tool-modal-head h2 { font-size: 1.5rem; font-weight: 800; }
.tool-modal-head .rating { margin-top: 6px; }

.tool-modal-desc { color: var(--muted); line-height: 1.7; margin-bottom: 22px; }

.modal-block {
    background: rgba(11, 13, 18, 0.6); border: 1px solid var(--border-soft);
    border-radius: var(--radius); padding: 18px 20px; margin-bottom: 16px;
}
.modal-block h3 { font-size: 0.8rem; font-weight: 700; letter-spacing: 0.09em; text-transform: uppercase; color: var(--muted); margin-bottom: 12px; }

.feature-list { display: grid; gap: 9px; }
.feature-list li { display: flex; align-items: flex-start; gap: 10px; font-size: 0.92rem; color: var(--text); }
.feature-list li svg { color: var(--success); flex-shrink: 0; margin-top: 3px; }

.tool-modal-meta { display: grid; grid-template-columns: repeat(2, 1fr); gap: 14px; }
.meta-item { display: flex; flex-direction: column; gap: 3px; }
.meta-item .meta-label { font-size: 0.72rem; font-weight: 700; letter-spacing: 0.08em; text-transform: uppercase; color: var(--muted-2); }
.meta-item .meta-value { font-size: 0.93rem; font-weight: 600; }
.meta-item .meta-value a { color: var(--accent); word-break: break-all; }
.meta-item .meta-value a:hover { text-decoration: underline; }

.tool-modal-actions { display: flex; align-items: center; gap: 12px; margin-top: 8px; }
.tool-modal-actions .btn-primary { flex: 1; padding: 14px; font-size: 0.98rem; }
.tool-modal-actions .fav-btn { width: 48px; height: 48px; }

.about-text { color: var(--muted); line-height: 1.75; font-size: 0.95rem; }
.about-text p { margin-bottom: 14px; }
.about-text strong { color: var(--text); }
.about-text .btn { margin-top: 8px; }

/* ---------- Toast ---------- */
.toast {
    position: fixed; bottom: 26px; left: 50%; z-index: 400;
    transform: translateX(-50%) translateY(20px);
    opacity: 0; pointer-events: none;
    background: #1E2430; border: 1px solid var(--border);
    color: var(--text); font-size: 0.9rem; font-weight: 500;
    padding: 12px 20px; border-radius: var(--radius);
    box-shadow: var(--shadow-lg);
    transition: transform 0.25s ease, opacity 0.25s ease;
    max-width: calc(100vw - 32px); text-align: center;
}
.toast.show { transform: translateX(-50%) translateY(0); opacity: 1; }
.toast.success { border-color: rgba(34, 197, 94, 0.45); }
.toast.error { border-color: rgba(239, 68, 68, 0.45); }

/* ---------- Responsive ---------- */
@media (max-width: 1080px) {
    .category-grid { grid-template-columns: repeat(3, 1fr); }
    .tool-grid { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 900px) {
    .hide-sm { display: none; }

    .main-nav {
        position: fixed; top: var(--header-h); left: 0; right: 0; z-index: 90;
        transform: translateY(-16px); opacity: 0; visibility: hidden;
        background: rgba(11, 13, 18, 0.98);
        border-bottom: 1px solid var(--border);
        -webkit-backdrop-filter: blur(16px); backdrop-filter: blur(16px);
        padding: 16px 20px 24px;
        transition: transform 0.25s ease, opacity 0.25s ease, visibility 0.25s;
        box-shadow: var(--shadow-lg);
    }
    .main-nav.open { transform: translateY(0); opacity: 1; visibility: visible; }
    .main-nav ul { flex-direction: column; align-items: stretch; gap: 2px; }
    .main-nav a { padding: 12px 14px; font-size: 1rem; }
    .nav-mobile-extra { display: block; margin-top: 12px; padding-top: 12px; border-top: 1px solid var(--border-soft); }
    .nav-mobile-extra .btn { width: 100%; }
    .menu-toggle { display: inline-flex; }

    .footer-grid { grid-template-columns: 1fr 1fr; }
    .footer-brand { grid-column: 1 / -1; }
}

@media (max-width: 640px) {
    .section { padding: 56px 0; }
    .hide-mobile { display: none; }
    .category-grid { grid-template-columns: repeat(2, 1fr); }
    .tool-grid { grid-template-columns: 1fr; }
    .form-row { grid-template-columns: 1fr; }
    .tool-modal-meta { grid-template-columns: 1fr; }
    .hero { padding: 64px 0 54px; }
    .hero-stats { gap: 24px; }
    .hero-search { flex-wrap: wrap; border-radius: 20px; padding: 12px; }
    .hero-search input { width: 100%; padding: 6px 4px; order: -1; }
    .hero-search .btn { flex: 1; }
    .kbd-hint { display: none; }
    .newsletter-form { border-radius: 18px; flex-direction: column; }
    .newsletter-form .btn { width: 100%; }
    .directory-toolbar { grid-template-columns: 1fr; }
    .directory-sort select { min-width: 100%; }
    .section-head { flex-direction: column; align-items: flex-start; gap: 14px; }
    .modal { padding: 24px; }
    .footer-grid { grid-template-columns: 1fr; gap: 28px; }
}

@media (max-width: 400px) {
    .header-actions .btn-primary { font-size: 0; gap: 0; padding: 10px 12px; }
    .header-actions .btn-primary svg { width: 18px; height: 18px; }
}

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