/* ==========================================================================
   JUST TOOL IT — Privacy-First Utility Hub
   Shared stylesheet (Vanilla CSS, no frameworks)
   ========================================================================== */

/* ----- 1. Design Tokens ----- */
:root {
    --bg: #ffffff;
    --bg-soft: #fafafa;
    --surface: #ffffff;
    --surface-elevated: #ffffff;
    --border: #ebebeb;
    --border-strong: #d4d4d4;
    --text: #0a0a0a;
    --text-muted: #6b6b6b;
    --text-soft: #8a8a8a;

    --accent: #0070f3;
    --accent-hover: #0060d0;
    --accent-soft: #e6f0ff;

    --success: #16a34a;
    --success-soft: #e7f7ed;
    --warning: #d97706;
    --warning-soft: #fff4e0;
    --danger: #dc2626;
    --danger-soft: #fde8e8;

    --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.04);
    --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.06);
    --shadow-lg: 0 12px 32px rgba(0, 0, 0, 0.08);

    --radius-sm: 6px;
    --radius-md: 10px;
    --radius-lg: 16px;
    --radius-xl: 24px;

    --font-sans:
        'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
    --font-mono: 'JetBrains Mono', ui-monospace, SFMono-Regular, Menlo, monospace;

    --max-width: 1280px;
    --header-h: 64px;
    --transition: 180ms cubic-bezier(0.4, 0, 0.2, 1);

    /* Spacing scale */
    --space-1: 4px;
    --space-2: 8px;
    --space-3: 12px;
    --space-4: 16px;
    --space-5: 24px;
    --space-6: 32px;
    --space-7: 48px;
    --space-8: 64px;
}

body.dark {
    --bg: #0a0a0a;
    --bg-soft: #111111;
    --surface: #141414;
    --surface-elevated: #1a1a1a;
    --border: #262626;
    --border-strong: #404040;
    --text: #f5f5f5;
    --text-muted: #a3a3a3;
    --text-soft: #737373;

    --accent: #3291ff;
    --accent-hover: #59a5ff;
    --accent-soft: rgba(50, 145, 255, 0.12);

    --success-soft: rgba(22, 163, 74, 0.15);
    --warning-soft: rgba(217, 119, 6, 0.15);
    --danger-soft: rgba(220, 38, 38, 0.15);

    --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.3);
    --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.4);
    --shadow-lg: 0 12px 32px rgba(0, 0, 0, 0.5);
}

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

[hidden] {
    display: none !important;
}

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

body {
    font-family: var(--font-sans);
    font-size: 15px;
    line-height: 1.6;
    color: var(--text);
    background: var(--bg);
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    transition:
        opacity 100ms ease-in-out,
        background var(--transition),
        color var(--transition);
}

/* Prevent Flash of Untranslated Content (FOUT) */
html.lang-loading body {
    opacity: 0 !important;
}

/* Loading overlay shown while translations load */
#loading-overlay {
    position: fixed;
    inset: 0;
    z-index: 9999;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: var(--space-5);
    background: var(--bg);
    color: var(--text);
    transition:
        opacity 300ms ease,
        visibility 300ms ease;
}

html:not(.lang-loading) #loading-overlay {
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
}

.loading-spinner {
    width: 48px;
    height: 48px;
    border: 3px solid var(--border);
    border-top-color: var(--accent);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

.loading-text {
    font-size: 14px;
    color: var(--text-muted);
    letter-spacing: 0.02em;
}

a {
    color: var(--accent);
    text-decoration: none;
    transition: color var(--transition);
}
a:hover {
    color: var(--accent-hover);
}

img,
svg {
    max-width: 100%;
    display: block;
}

button {
    font-family: inherit;
    font-size: inherit;
    border: none;
    background: none;
    cursor: pointer;
    color: inherit;
}

button:disabled {
    cursor: not-allowed;
    opacity: 0.5;
}

input,
textarea,
select {
    font-family: inherit;
    font-size: inherit;
    color: var(--text);
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 8px 12px;
    transition:
        border-color var(--transition),
        box-shadow var(--transition);
}

input:focus,
textarea:focus,
select:focus {
    outline: none;
    border-color: var(--accent);
    box-shadow: 0 0 0 3px var(--accent-soft);
}

h1,
h2,
h3,
h4 {
    font-weight: 600;
    line-height: 1.25;
    letter-spacing: -0.02em;
    color: var(--text);
}

h1 {
    font-size: clamp(2rem, 4vw, 3rem);
    letter-spacing: -0.03em;
}
h2 {
    font-size: clamp(1.5rem, 3vw, 2rem);
}
h3 {
    font-size: 1.25rem;
}
h4 {
    font-size: 1rem;
}

p {
    color: var(--text-muted);
}

::selection {
    background: var(--accent);
    color: #fff;
}

/* ----- 3. Layout ----- */
.container {
    width: 100%;
    max-width: var(--max-width);
    margin: 0 auto;
    padding: 0 24px;
}

.container-narrow {
    max-width: 800px;
    margin: 0 auto;
    padding: 0 24px;
}

/* ----- 4. Header ----- */
.site-header {
    position: sticky;
    top: 0;
    z-index: 50;
    height: var(--header-h);
    background: rgba(255, 255, 255, 0.8);
    -webkit-backdrop-filter: saturate(180%) blur(12px);
    backdrop-filter: saturate(180%) blur(12px);
    border-bottom: 1px solid var(--border);
}

body.dark .site-header {
    background: rgba(10, 10, 10, 0.8);
}

.site-header .container {
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 24px;
}

/* Three-column header layout: brand | nav | lang+theme */
.site-header .container > .brand {
    flex-shrink: 0;
}
.site-header .container > .nav {
    flex: 0 1 auto;
    display: flex;
    justify-content: center;
    min-width: 0;
}
.site-header .container > .header-actions {
    flex-shrink: 0;
    display: flex;
    align-items: center;
    gap: 8px;
}

.brand {
    display: flex;
    align-items: center;
    gap: 10px;
    font-weight: 700;
    font-size: 17px;
    color: var(--text);
    letter-spacing: -0.02em;
    white-space: nowrap;
    flex-shrink: 0;
    overflow: visible;
}

.brand:hover {
    color: var(--text);
}

.brand-logo {
    width: 28px;
    height: 28px;
    border-radius: 8px;
    background: linear-gradient(135deg, var(--accent) 0%, #6366f1 100%);
    display: grid;
    place-items: center;
    color: #fff;
    font-weight: 800;
    font-size: 14px;
}

.nav {
    display: flex;
    align-items: center;
    gap: 4px;
}

.nav a {
    color: var(--text-muted);
    padding: 8px 12px;
    border-radius: var(--radius-sm);
    font-size: 14px;
    font-weight: 500;
    transition:
        color var(--transition),
        background var(--transition);
}

.nav a:hover {
    color: var(--text);
    background: var(--bg-soft);
}
.nav a.active {
    color: var(--text);
    background: var(--bg-soft);
}

.icon-btn {
    width: 36px;
    height: 36px;
    border-radius: var(--radius-sm);
    display: grid;
    place-items: center;
    color: var(--text-muted);
    transition:
        color var(--transition),
        background var(--transition);
}

.icon-btn:hover {
    color: var(--text);
    background: var(--bg-soft);
}

.icon-btn svg {
    width: 18px;
    height: 18px;
}

/* Show/hide based on theme */
.theme-icon-light {
    display: none;
}
body.dark .theme-icon-light {
    display: block;
}
body.dark .theme-icon-dark {
    display: none;
}

/* Language selector */
.lang-selector-wrapper {
    position: relative;
    display: inline-flex;
    align-items: center;
}

.lang-select {
    font-size: 13px;
    padding: 6px 28px 6px 12px;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    background: var(--surface);
    color: var(--text-muted);
    cursor: pointer;
    -webkit-appearance: none;
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%236b6b6b' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 8px center;
    background-size: 14px;
    transition:
        border-color var(--transition),
        color var(--transition),
        background var(--transition);
}

body.dark .lang-select {
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23a3a3a3' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'/%3E%3C/svg%3E");
}

.lang-select:hover {
    color: var(--text);
    border-color: var(--border-strong);
}

.lang-select:focus {
    box-shadow: 0 0 0 3px var(--accent-soft);
    border-color: var(--accent);
}

/* ----- 5. Hero (Dashboard) ----- */
.hero {
    padding: 80px 0 48px;
    text-align: center;
}

.hero .badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    background: var(--bg-soft);
    border: 1px solid var(--border);
    color: var(--text-muted);
    padding: 6px 12px;
    border-radius: 999px;
    font-size: 13px;
    font-weight: 500;
    margin-bottom: 20px;
}

.hero .badge .dot {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: var(--success);
    box-shadow: 0 0 0 3px var(--success-soft);
}

.hero h1 {
    max-width: 720px;
    margin: 0 auto 18px;
}

.hero h1 .accent {
    background: linear-gradient(135deg, var(--accent), #8b5cf6);
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
}

.hero .lead {
    max-width: 580px;
    margin: 0 auto 32px;
    font-size: 17px;
    color: var(--text-muted);
}

.hero-meta {
    display: flex;
    gap: 24px;
    justify-content: center;
    flex-wrap: wrap;
    color: var(--text-soft);
    font-size: 13px;
}

.hero-meta span {
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

.hero-meta svg {
    width: 14px;
    height: 14px;
    color: var(--success);
}

/* ----- 6. Tool Cards Grid ----- */
.tools-section {
    padding: 48px 0 96px;
}

.tools-catalog {
    padding: 24px 0 96px;
}

.section-head {
    margin-bottom: 32px;
    text-align: center;
}

.section-head h2 {
    margin-bottom: 8px;
}
.section-head p {
    font-size: 15px;
}

.tools-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 16px;
}

.tools-grid.compact {
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    gap: 12px;
}

.hero-sub {
    color: var(--text-muted);
    font-size: 16px;
    max-width: 640px;
    margin: 14px auto 22px;
    text-align: center;
}

.hero-search {
    max-width: 560px;
    margin: 0 auto;
}

.hero-search input {
    width: 100%;
    padding: 14px 18px;
    border-radius: 999px;
    border: 1px solid var(--border);
    background: var(--surface);
    font-size: 15px;
    box-shadow: var(--shadow-sm);
    transition:
        border-color var(--transition),
        box-shadow var(--transition);
}

.hero-search input:focus {
    outline: none;
    border-color: var(--accent);
    box-shadow: 0 0 0 4px var(--accent-soft);
}

.category-section {
    margin-bottom: 48px;
}

.category-head {
    display: flex;
    flex-direction: column;
    gap: 4px;
    margin-bottom: 16px;
    padding-bottom: 10px;
    border-bottom: 1px solid var(--border);
}

.category-head h2 {
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--text);
}

.category-head p {
    font-size: 13.5px;
    color: var(--text-muted);
}

.category-section.empty {
    display: none;
}

.search-empty {
    margin: 24px auto;
    padding: 28px 24px;
    max-width: 560px;
    text-align: center;
    border: 1px dashed var(--border);
    border-radius: var(--radius-lg);
    color: var(--text-muted);
    background: var(--surface);
}
.search-empty p {
    margin: 0;
    font-size: 14px;
    line-height: 1.5;
}

.tool-card {
    display: flex;
    flex-direction: column;
    gap: 14px;
    padding: 24px;
    border: 1px solid var(--border);
    background: var(--surface);
    border-radius: var(--radius-lg);
    color: var(--text);
    transition:
        border-color var(--transition),
        transform var(--transition),
        box-shadow var(--transition);
    position: relative;
}

.tool-card:hover {
    color: var(--text);
    border-color: var(--border-strong);
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
}

.tool-card-icon {
    width: 44px;
    height: 44px;
    border-radius: var(--radius-md);
    display: grid;
    place-items: center;
    background: var(--accent-soft);
    color: var(--accent);
}

.tool-card-icon svg {
    width: 22px;
    height: 22px;
}

/* Variant icon colors */
.tool-card-icon.violet {
    background: rgba(139, 92, 246, 0.12);
    color: #8b5cf6;
}
.tool-card-icon.green {
    background: rgba(22, 163, 74, 0.12);
    color: #16a34a;
}
.tool-card-icon.orange {
    background: rgba(217, 119, 6, 0.12);
    color: #d97706;
}
.tool-card-icon.pink {
    background: rgba(236, 72, 153, 0.12);
    color: #ec4899;
}
.tool-card-icon.teal {
    background: rgba(13, 148, 136, 0.12);
    color: #0d9488;
}

.tool-card h3 {
    font-size: 1.0625rem;
    font-weight: 600;
    color: var(--text);
}

.tool-card p {
    font-size: 14px;
    color: var(--text-muted);
    line-height: 1.55;
}

.tool-card-arrow {
    margin-top: auto;
    color: var(--text-soft);
    font-size: 13px;
    font-weight: 500;
    display: inline-flex;
    align-items: center;
    gap: 4px;
    transition:
        color var(--transition),
        gap var(--transition);
}

.tool-card:hover .tool-card-arrow {
    color: var(--accent);
    gap: 8px;
}

.tool-card.sm {
    display: grid;
    grid-template-columns: 36px 1fr;
    grid-template-rows: auto auto;
    column-gap: 12px;
    row-gap: 4px;
    align-items: start;
    padding: 14px;
    border-radius: var(--radius-md);
}

.tool-card.sm .tool-card-icon {
    width: 36px;
    height: 36px;
    grid-row: 1 / 3;
    grid-column: 1;
    align-self: start;
    margin-top: 1px;
}

.tool-card.sm .tool-card-icon svg {
    width: 18px;
    height: 18px;
}

.tool-card.sm h3 {
    grid-row: 1;
    grid-column: 2;
    font-size: 14px;
    font-weight: 600;
    margin: 0;
    line-height: 1.35;
    white-space: normal;
    word-break: break-word;
    overflow: visible;
    text-overflow: unset;
}

.tool-card.sm p {
    grid-row: 2;
    grid-column: 2;
    font-size: 12.5px;
    color: var(--text-muted);
    line-height: 1.45;
    margin: 0;
    white-space: normal;
    word-break: break-word;
    overflow: visible;
    text-overflow: unset;
}

/* For You section — larger, eye-catching cards */
.for-you-section .tool-card.sm {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 14px;
    padding: 24px;
    border-radius: var(--radius-xl);
    border: 1px solid var(--border);
    background: linear-gradient(180deg, var(--surface) 0%, var(--bg-soft) 100%);
    box-shadow: var(--shadow-sm);
    transition:
        transform var(--transition),
        box-shadow var(--transition),
        border-color var(--transition);
}

.for-you-section .tool-card.sm:hover {
    transform: translateY(-4px);
    box-shadow: var(--shadow-lg);
    border-color: var(--accent);
}

.for-you-section .tool-card.sm .tool-card-icon {
    width: 56px;
    height: 56px;
    border-radius: var(--radius-lg);
    display: grid;
    place-items: center;
    flex-shrink: 0;
}

.for-you-section .tool-card.sm .tool-card-icon svg {
    width: 26px;
    height: 26px;
}

.for-you-section .tool-card.sm h3 {
    font-size: 1.0625rem;
    font-weight: 700;
    color: var(--text);
    line-height: 1.3;
    white-space: normal;
    word-break: break-word;
    overflow: visible;
    text-overflow: unset;
    margin: 0;
}

.for-you-section .tool-card.sm p {
    font-size: 14.5px;
    color: var(--text-muted);
    line-height: 1.55;
    white-space: normal;
    word-break: break-word;
    overflow: visible;
    text-overflow: unset;
    margin: 0;
    display: block;
}

.for-you-section .tool-card.sm .pin-btn {
    top: 12px;
    inset-inline-end: 12px;
    opacity: 1;
    background: var(--surface-elevated);
    box-shadow: var(--shadow-sm);
}

.for-you-section .tool-card.sm .pin-btn:hover {
    background: var(--accent-soft);
    color: var(--accent);
    border-color: var(--accent);
}

.tool-card.coming-soon {
    opacity: 0.55;
    pointer-events: none;
}
.tool-card.coming-soon::after {
    content: 'Soon';
    position: absolute;
    top: 6px;
    inset-inline-end: 8px;
    font-size: 9.5px;
    font-weight: 700;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    color: var(--text-soft);
    background: var(--bg-soft);
    border: 1px solid var(--border);
    border-radius: 999px;
    padding: 2px 6px;
}

/* ----- Pin Button (Frequent Tools) ----- */
.pin-btn {
    position: absolute;
    top: 8px;
    inset-inline-end: 8px;
    width: 28px;
    height: 28px;
    border-radius: var(--radius-sm);
    background: var(--surface-elevated);
    border: 1px solid var(--border);
    color: var(--text-muted);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition:
        opacity var(--transition),
        background var(--transition),
        color var(--transition),
        border-color var(--transition);
    z-index: 1;
}
.tool-card:hover .pin-btn,
.tool-card:focus-within .pin-btn,
.pin-btn:focus {
    opacity: 1;
}
.pin-btn:hover {
    background: var(--accent-soft);
    color: var(--accent);
    border-color: var(--accent);
}
.pin-btn:focus {
    outline: none;
    box-shadow: 0 0 0 2px var(--accent-soft);
}
.pin-btn.pinned {
    opacity: 1;
    color: var(--warning);
}
.pin-btn.pinned:hover {
    background: var(--warning-soft);
    border-color: var(--warning);
}
.pin-btn svg {
    width: 16px;
    height: 16px;
}

/* ----- Homepage discovery sections ----- */
.section-head--left {
    text-align: left;
    margin-bottom: var(--space-5);
}
.section-head--left h2 {
    margin-bottom: 6px;
}
.section-head--left p {
    font-size: 14px;
    max-width: 640px;
}

.subsection-head {
    margin-bottom: var(--space-3);
}
.subsection-head h3 {
    font-size: 1rem;
    font-weight: 600;
    margin-bottom: 4px;
}
.subsection-head p {
    font-size: 13px;
    color: var(--text-muted);
}

.frequent-tools .subsection-head h3 {
    font-size: clamp(1.5rem, 3vw, 2rem);
    font-weight: 700;
    margin-bottom: var(--space-1);
}
.frequent-tools .subsection-head p {
    font-size: 0.9375rem;
}

.for-you-section {
    padding: var(--space-6) 0 var(--space-5);
}
.for-you-section .frequent-tools,
.for-you-section .recent-tools {
    margin-bottom: var(--space-6);
}
.for-you-section .tools-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 16px;
}

/* Responsive: fewer columns on smaller screens */
@media (max-width: 1100px) {
    .for-you-section .tools-grid {
        grid-template-columns: repeat(3, 1fr);
    }
}
@media (max-width: 820px) {
    .for-you-section .tools-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}
@media (max-width: 540px) {
    .for-you-section .tools-grid {
        grid-template-columns: 1fr;
    }
}

/* Hero search enhanced */
.hero-search {
    max-width: 640px;
    margin: 0 auto;
    position: relative;
    text-align: left;
}
.hero-search-wrap {
    position: relative;
    display: flex;
    align-items: center;
}
.hero-search-icon {
    position: absolute;
    left: 16px;
    width: 18px;
    height: 18px;
    color: var(--text-soft);
    pointer-events: none;
}
.hero-search input {
    width: 100%;
    padding: 14px 72px 14px 44px;
    border-radius: 999px;
    border: 1px solid var(--border);
    background: var(--surface);
    font-size: 15px;
    box-shadow: var(--shadow-sm);
    transition:
        border-color var(--transition),
        box-shadow var(--transition);
}
.hero-search input:focus {
    outline: none;
    border-color: var(--accent);
    box-shadow: 0 0 0 4px var(--accent-soft);
}
.hero-search-kbd {
    position: absolute;
    right: 12px;
    font-family: var(--font-sans);
    font-size: 11px;
    font-weight: 600;
    color: var(--text-soft);
    background: var(--bg-soft);
    border: 1px solid var(--border);
    border-radius: 6px;
    padding: 3px 7px;
    cursor: pointer;
    line-height: 1.2;
}
.hero-search-kbd:hover {
    color: var(--text);
    border-color: var(--border-strong);
}

.hero-suggestions {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    justify-content: center;
    margin-top: 16px;
    max-width: 720px;
    margin-left: auto;
    margin-right: auto;
}
.suggestion-chip,
.cat-chip {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 6px 12px;
    border-radius: 999px;
    border: 1px solid var(--border);
    background: var(--surface);
    color: var(--text-muted);
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    transition:
        color var(--transition),
        background var(--transition),
        border-color var(--transition);
    white-space: nowrap;
}
.suggestion-chip:hover,
.cat-chip:hover {
    color: var(--text);
    border-color: var(--border-strong);
    background: var(--bg-soft);
}
.cat-chip.is-active {
    color: var(--accent);
    border-color: var(--accent);
    background: var(--accent-soft);
}
.cat-chip__count {
    font-size: 11px;
    font-weight: 600;
    opacity: 0.7;
    background: var(--bg-soft);
    padding: 1px 6px;
    border-radius: 999px;
}
.cat-chip.is-active .cat-chip__count {
    background: rgba(255, 255, 255, 0.35);
}

/* Search dropdown */
.search-dropdown {
    position: absolute;
    left: 0;
    right: 0;
    top: calc(100% + 8px);
    z-index: 40;
    background: var(--surface-elevated);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-lg);
    overflow: hidden;
    max-height: 360px;
    overflow-y: auto;
}
.search-dropdown__item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 14px;
    color: var(--text);
    border-bottom: 1px solid var(--border);
    transition: background var(--transition);
}
.search-dropdown__item:last-of-type {
    border-bottom: none;
}
.search-dropdown__item:hover,
.search-dropdown__item.is-active {
    background: var(--bg-soft);
    color: var(--text);
}
.search-dropdown__icon {
    width: 36px;
    height: 36px;
    flex-shrink: 0;
    display: grid;
    place-items: center;
}
.search-dropdown__icon .tool-card-icon,
.search-dropdown__icon svg {
    width: 32px;
    height: 32px;
}
.search-dropdown__icon svg {
    width: 18px;
    height: 18px;
}
.search-dropdown__text {
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 2px;
}
.search-dropdown__title {
    font-size: 14px;
    font-weight: 600;
}
.search-dropdown__meta {
    font-size: 12px;
    color: var(--text-muted);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.search-dropdown__footer {
    width: 100%;
    padding: 10px 14px;
    text-align: center;
    font-size: 13px;
    font-weight: 600;
    color: var(--accent);
    background: var(--bg-soft);
    border-top: 1px solid var(--border);
    cursor: pointer;
}
.search-dropdown__footer:hover {
    background: var(--accent-soft);
}
.search-dropdown__empty {
    padding: 20px;
    text-align: center;
    color: var(--text-muted);
    font-size: 14px;
}

/* Category hubs */
.category-hubs-section {
    padding: var(--space-5) 0 var(--space-7);
}
.category-hubs-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    gap: 12px;
}
.category-hub {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 16px;
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    background: var(--surface);
    color: var(--text);
    transition:
        border-color var(--transition),
        transform var(--transition),
        box-shadow var(--transition);
}
.category-hub:hover {
    color: var(--text);
    border-color: var(--border-strong);
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
}
.category-hub__icon {
    width: 40px;
    height: 40px;
    border-radius: var(--radius-md);
    background: var(--accent-soft);
    color: var(--accent);
    display: grid;
    place-items: center;
    flex-shrink: 0;
}
.category-hub__icon svg {
    width: 20px;
    height: 20px;
}
.category-hub__body {
    min-width: 0;
    flex: 1;
}
.category-hub__body h3 {
    font-size: 14px;
    font-weight: 600;
    margin: 0 0 2px;
}
.category-hub__body p {
    font-size: 12px;
    color: var(--text-muted);
    margin: 0;
}
.category-hub__arrow {
    color: var(--text-soft);
    font-size: 16px;
}

/* How it works */
.how-it-works {
    padding: var(--space-7) 0;
    background: var(--bg-soft);
    border-top: 1px solid var(--border);
    border-bottom: 1px solid var(--border);
}
.how-it-works .section-head {
    text-align: center;
    margin-bottom: var(--space-6);
}
.how-steps {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 24px;
    max-width: 960px;
    margin: 0 auto;
}
.how-step {
    text-align: center;
    padding: 8px;
}
.how-step__num {
    width: 36px;
    height: 36px;
    margin: 0 auto 12px;
    border-radius: 50%;
    background: var(--accent);
    color: #fff;
    font-weight: 700;
    font-size: 15px;
    display: grid;
    place-items: center;
}
.how-step h3 {
    font-size: 15px;
    margin-bottom: 6px;
}
.how-step p {
    font-size: 13px;
    color: var(--text-muted);
}

/* Trust strip */
.trust-strip {
    padding: var(--space-7) 0;
}
.trust-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 16px;
}
.trust-item {
    padding: 20px;
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    background: var(--surface);
}
.trust-item__icon {
    width: 36px;
    height: 36px;
    border-radius: var(--radius-md);
    background: var(--success-soft);
    color: var(--success);
    display: grid;
    place-items: center;
    margin-bottom: 12px;
}
.trust-item__icon svg {
    width: 18px;
    height: 18px;
}
.trust-item h3 {
    font-size: 14px;
    margin-bottom: 6px;
}
.trust-item p {
    font-size: 13px;
    color: var(--text-muted);
    margin: 0;
}

/* Catalog chips + collapse */
.catalog-head {
    margin-bottom: var(--space-4);
}
.cat-chip-bar-wrap {
    margin-bottom: 20px;
}
.sticky-chips {
    position: sticky;
    top: var(--header-h);
    z-index: 30;
    background: var(--bg);
    padding: 10px 0 12px;
    margin-left: -4px;
    margin-right: -4px;
    padding-left: 4px;
    padding-right: 4px;
    transition: box-shadow var(--transition);
}
.sticky-chips.is-stuck {
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.06);
}
body.dark .sticky-chips.is-stuck {
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.35);
}
.sticky-chips-sentinel {
    height: 1px;
    margin: 0;
    pointer-events: none;
}
/* Wrap category filters onto multiple rows — no horizontal scrollbar */
.cat-chip-bar {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px;
    overflow: visible;
    padding: 0;
    width: 100%;
}

.category-head-row {
    display: flex;
    align-items: center;
    gap: 10px;
}
.category-count {
    font-size: 12px;
    font-weight: 600;
    color: var(--text-soft);
    background: var(--bg-soft);
    border: 1px solid var(--border);
    border-radius: 999px;
    padding: 2px 8px;
}

.tool-card.is-collapse-hidden {
    display: none !important;
}

.category-show-more,
.category-show-less {
    display: block;
    width: 100%;
    margin-top: 12px;
    padding: 10px 16px;
    border: 1px dashed var(--border);
    border-radius: var(--radius-md);
    background: var(--bg-soft);
    color: var(--accent);
    font-weight: 600;
    font-size: 13px;
    cursor: pointer;
    transition:
        background var(--transition),
        border-color var(--transition);
}
.category-show-more:hover,
.category-show-less:hover {
    background: var(--accent-soft);
    border-color: var(--accent);
}
.category-show-more[hidden],
.category-show-less[hidden] {
    display: none !important;
}

.search-empty-suggestions {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    justify-content: center;
    margin-top: 14px;
}

/* Command palette */
.command-palette {
    position: fixed;
    inset: 0;
    z-index: 200;
    display: flex;
    align-items: flex-start;
    justify-content: center;
    padding: 12vh 16px 16px;
}
.command-palette[hidden] {
    display: none !important;
}
.command-palette__backdrop {
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0.45);
    backdrop-filter: blur(4px);
}
body.dark .command-palette__backdrop {
    background: rgba(0, 0, 0, 0.65);
}
.command-palette__panel {
    position: relative;
    width: 100%;
    max-width: 560px;
    background: var(--surface-elevated);
    border: 1px solid var(--border);
    border-radius: var(--radius-xl);
    box-shadow: var(--shadow-lg);
    overflow: hidden;
}
.command-palette__search {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 14px 16px;
    border-bottom: 1px solid var(--border);
}
.command-palette__search svg {
    width: 18px;
    height: 18px;
    color: var(--text-soft);
    flex-shrink: 0;
}
.command-palette__search input {
    flex: 1;
    border: none;
    background: transparent;
    padding: 4px 0;
    font-size: 16px;
    box-shadow: none;
}
.command-palette__search input:focus {
    outline: none;
    box-shadow: none;
    border: none;
}
.command-palette__search kbd {
    font-size: 11px;
    font-family: var(--font-sans);
    color: var(--text-soft);
    border: 1px solid var(--border);
    border-radius: 6px;
    padding: 2px 6px;
    background: var(--bg-soft);
}
.command-palette__results {
    max-height: min(50vh, 400px);
    overflow-y: auto;
    padding: 8px;
}
.command-palette__group {
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: var(--text-soft);
    padding: 10px 10px 6px;
}
.command-palette__item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 10px 12px;
    border-radius: var(--radius-md);
    color: var(--text);
}
.command-palette__item:hover,
.command-palette__item.is-active {
    background: var(--accent-soft);
    color: var(--text);
}
.command-palette__title {
    font-size: 14px;
    font-weight: 500;
}
.command-palette__meta {
    font-size: 12px;
    color: var(--text-muted);
    flex-shrink: 0;
}
.command-palette__empty {
    padding: 24px;
    text-align: center;
    color: var(--text-muted);
    font-size: 14px;
}
body.palette-open {
    overflow: hidden;
}

/* Footer enhanced */
.site-footer .footer-main {
    display: flex;
    flex-wrap: wrap;
    gap: 32px;
    justify-content: space-between;
    width: 100%;
}
.site-footer .footer-brand {
    max-width: 360px;
}
.site-footer .footer-tagline {
    margin-top: 8px;
    font-size: 13px;
    color: var(--text-soft);
}
.site-footer .footer-cols {
    display: flex;
    gap: 40px;
    flex-wrap: wrap;
}
.site-footer .footer-col h4 {
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: var(--text-soft);
    margin-bottom: 10px;
}
.site-footer .footer-col .links {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 6px;
}
.site-footer .footer-cat-links {
    display: grid !important;
    grid-template-columns: 1fr 1fr;
    gap: 6px 16px;
}
.site-footer .footer-popular-links {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 6px;
    max-height: 220px;
    overflow: auto;
}
.site-footer .footer-seo-blurb {
    margin-top: 10px;
    font-size: 12px;
    line-height: 1.5;
    color: var(--text-soft);
    max-width: 320px;
}

/* Category hub pages */
.category-hub-page .category-hub-header {
    margin-bottom: var(--space-4);
}
.category-hub-page .category-hub-lead {
    font-size: 17px;
    color: var(--text-muted);
    max-width: 52rem;
    line-height: 1.6;
}
.category-hub-page .category-hub-intro {
    margin-bottom: var(--space-6);
    padding: var(--space-4) var(--space-5);
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    color: var(--text-muted);
    line-height: 1.65;
}
.category-hub-page .category-hub-intro p {
    margin-bottom: 10px;
}
.category-hub-page .category-hub-intro p:last-child {
    margin-bottom: 0;
}
.category-hub-page .category-hub-grid {
    margin-bottom: var(--space-8);
}

/* Related tools (flagship SEO) */
.related-tools-list {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
}
.related-tools-list li {
    margin: 0;
}
.related-tools-list a {
    display: inline-block;
    padding: 8px 14px;
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    background: var(--surface);
    color: var(--text);
    font-size: 14px;
    text-decoration: none;
    transition:
        border-color var(--transition),
        color var(--transition);
}
.related-tools-list a:hover {
    border-color: var(--accent);
    color: var(--accent);
}

/* Homepage FAQ */
.home-faq {
    padding: var(--space-8) 0 var(--space-10);
}
.home-faq .container-narrow {
    max-width: 720px;
    margin: 0 auto;
}
.home-faq .section-head {
    text-align: center;
    margin-bottom: var(--space-5);
}

/* Privacy page */
.privacy-page {
    padding: 48px 0 80px;
}
.privacy-page h1 {
    margin-bottom: 12px;
}
.privacy-page .lead {
    font-size: 17px;
    color: var(--text-muted);
    margin-bottom: 32px;
    max-width: 640px;
}
.privacy-page h2 {
    font-size: 1.25rem;
    margin: 28px 0 10px;
}
.privacy-page p,
.privacy-page li {
    color: var(--text-muted);
    font-size: 15px;
}
.privacy-page ul {
    margin: 8px 0 16px 1.25rem;
}
.privacy-page li {
    margin-bottom: 6px;
}

@media (max-width: 900px) {
    .how-steps {
        grid-template-columns: 1fr;
        gap: 20px;
    }
    .trust-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}
@media (max-width: 640px) {
    .trust-grid {
        grid-template-columns: 1fr;
    }
    .hero-search-kbd {
        display: none;
    }
    .hero-search input {
        padding-right: 16px;
    }
}

/* ----- 7. Tool Page Layout ----- */
.tool-page main {
    padding-top: 32px;
}

.tool-header {
    text-align: center;
    margin-bottom: 28px;
}

.tool-header .crumb {
    color: var(--text-soft);
    font-size: 13px;
    margin-bottom: 12px;
}

.tool-header .crumb a {
    color: var(--text-muted);
}

.tool-header h1 {
    font-size: clamp(1.75rem, 3vw, 2.25rem);
    margin-bottom: 10px;
}
.tool-header p {
    max-width: 560px;
    margin: 0 auto;
    font-size: 15px;
}

.privacy-pill {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    background: var(--success-soft);
    color: var(--success);
    padding: 4px 10px;
    border-radius: 999px;
    font-size: 12px;
    font-weight: 600;
    margin-bottom: 14px;
}

.privacy-pill svg {
    width: 12px;
    height: 12px;
}

.tool-card-main {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-xl);
    padding: 24px;
    margin-bottom: 24px;
    box-shadow: var(--shadow-sm);
}

@media (min-width: 640px) {
    .tool-card-main {
        padding: 32px;
    }
}

/* ----- 8. Drop Zone ----- */
.dropzone {
    border: 2px dashed var(--border-strong);
    border-radius: var(--radius-lg);
    padding: 48px 24px;
    text-align: center;
    cursor: pointer;
    transition:
        border-color var(--transition),
        background var(--transition);
    background: var(--bg-soft);
}

.dropzone:hover,
.dropzone.dragover {
    border-color: var(--accent);
    background: var(--accent-soft);
}

.dropzone-icon {
    width: 56px;
    height: 56px;
    margin: 0 auto 16px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    display: grid;
    place-items: center;
    color: var(--accent);
}

.dropzone-icon svg {
    width: 26px;
    height: 26px;
}

.dropzone h3 {
    font-size: 1rem;
    margin-bottom: 6px;
    font-weight: 600;
}

.dropzone p {
    font-size: 13px;
    color: var(--text-soft);
}

.dropzone .browse-link {
    color: var(--accent);
    font-weight: 500;
    text-decoration: underline;
}

/* ----- 9. Buttons ----- */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 10px 18px;
    border-radius: var(--radius-md);
    font-size: 14px;
    font-weight: 600;
    transition:
        background var(--transition),
        color var(--transition),
        transform var(--transition),
        border-color var(--transition);
    border: 1px solid transparent;
    white-space: nowrap;
}

.btn:active:not(:disabled) {
    transform: translateY(1px);
}

.btn-primary {
    background: var(--accent);
    color: #fff;
}

.btn-primary:hover:not(:disabled) {
    background: var(--accent-hover);
    color: #fff;
}

.btn-secondary {
    background: var(--surface);
    color: var(--text);
    border-color: var(--border);
}

.btn-secondary:hover:not(:disabled) {
    border-color: var(--border-strong);
    background: var(--bg-soft);
}

.btn-ghost {
    background: transparent;
    color: var(--text-muted);
}

.btn-ghost:hover:not(:disabled) {
    color: var(--danger);
    background: var(--danger-soft);
}

.btn-danger {
    background: var(--danger);
    color: #fff;
}

.btn-danger:hover:not(:disabled) {
    background: #b91c1c;
    color: #fff;
}

.btn svg {
    width: 16px;
    height: 16px;
}

.actions-row {
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
    justify-content: center;
    margin-top: 20px;
}

/* ----- 10. File List ----- */
.file-list {
    margin-top: 20px;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.file-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 14px;
    background: var(--bg-soft);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    transition:
        background var(--transition),
        border-color var(--transition),
        transform 120ms;
}

.file-item.dragging {
    opacity: 0.5;
}
.file-item.drag-over {
    border-color: var(--accent);
}

.file-item-handle {
    color: var(--text-soft);
    cursor: grab;
    display: grid;
    place-items: center;
    flex-shrink: 0;
}

.file-item-handle:active {
    cursor: grabbing;
}

.file-item-icon {
    width: 36px;
    height: 36px;
    border-radius: var(--radius-sm);
    background: var(--accent-soft);
    color: var(--accent);
    display: grid;
    place-items: center;
    flex-shrink: 0;
}

.file-item-icon svg {
    width: 18px;
    height: 18px;
}

.file-item-info {
    flex: 1;
    min-width: 0;
}
.file-item-name {
    font-size: 14px;
    font-weight: 500;
    color: var(--text);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.file-item-meta {
    font-size: 12px;
    color: var(--text-soft);
    margin-top: 2px;
}

.file-item-remove {
    width: 32px;
    height: 32px;
    border-radius: var(--radius-sm);
    color: var(--text-soft);
    display: grid;
    place-items: center;
    flex-shrink: 0;
}

.file-item-remove:hover {
    color: var(--danger);
    background: var(--danger-soft);
}
.file-item-remove svg {
    width: 16px;
    height: 16px;
}

/* ----- 11. Progress / Status ----- */
.progress-wrap {
    margin-top: 18px;
    padding: 16px;
    background: var(--bg-soft);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
}

.progress-label {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 13px;
    color: var(--text-muted);
    margin-bottom: 8px;
}

.progress-bar {
    height: 6px;
    background: var(--border);
    border-radius: 999px;
    overflow: hidden;
}

.progress-fill {
    height: 100%;
    background: var(--accent);
    width: 0%;
    transition: width 240ms cubic-bezier(0.4, 0, 0.2, 1);
}

.progress-fill.indeterminate {
    width: 40% !important;
    animation: indeterminate 1.4s infinite ease-in-out;
}

@keyframes indeterminate {
    0% {
        transform: translateX(-100%);
    }
    100% {
        transform: translateX(350%);
    }
}

.status-msg {
    margin-top: 14px;
    padding: 10px 14px;
    border-radius: var(--radius-sm);
    font-size: 13px;
    display: none;
}

.status-msg.show {
    display: block;
}
.status-msg.success {
    background: var(--success-soft);
    color: var(--success);
}
.status-msg.error {
    background: var(--danger-soft);
    color: var(--danger);
}
.status-msg.info {
    background: var(--accent-soft);
    color: var(--accent);
}

/* ----- 12. Controls (sliders, inputs) ----- */
.control-row {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-top: 18px;
}

@media (min-width: 640px) {
    .control-row.inline {
        flex-direction: row;
        align-items: center;
        gap: 16px;
    }
    .control-row.inline label {
        min-width: 140px;
    }
}

.control-row label {
    font-size: 14px;
    font-weight: 500;
    color: var(--text);
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
}

.control-row label .value {
    color: var(--accent);
    font-variant-numeric: tabular-nums;
    font-weight: 600;
}

.control-row input[type='range'] {
    flex: 1;
    -webkit-appearance: none;
    appearance: none;
    height: 6px;
    background: var(--border);
    border: none;
    border-radius: 999px;
    padding: 0;
    margin: 0;
}

.control-row input[type='range']:focus {
    box-shadow: none;
}

.control-row input[type='range']::-webkit-slider-thumb {
    -webkit-appearance: none;
    width: 18px;
    height: 18px;
    background: var(--accent);
    border-radius: 50%;
    cursor: pointer;
    border: 3px solid var(--surface);
    box-shadow: 0 0 0 1px var(--border-strong);
}

.control-row input[type='range']::-moz-range-thumb {
    width: 18px;
    height: 18px;
    background: var(--accent);
    border-radius: 50%;
    cursor: pointer;
    border: 3px solid var(--surface);
    box-shadow: 0 0 0 1px var(--border-strong);
}

.control-row input[type='text'],
.control-row input[type='number'] {
    flex: 1;
}

textarea.textfield {
    width: 100%;
    min-height: 200px;
    resize: vertical;
    font-family: var(--font-mono);
    font-size: 13.5px;
    line-height: 1.55;
    padding: 14px 16px;
}

/* ----- 13. Ad Placeholder ----- */
.ad-slot {
    margin: 28px auto 0;
    max-width: 728px;
    min-height: 90px;
    background: var(--bg-soft);
    border: 1px dashed var(--border-strong);
    border-radius: var(--radius-md);
    display: grid;
    place-items: center;
    color: var(--text-soft);
    font-size: 12px;
    letter-spacing: 0.08em;
    text-transform: uppercase;
}

.ad-slot::before {
    content: 'Advertisement';
}

/* ----- 14. SEO Section ----- */
.seo-section {
    padding: 56px 0 80px;
    border-top: 1px solid var(--border);
    margin-top: 48px;
}

.seo-section h2 {
    margin-bottom: 14px;
}

.seo-section p {
    margin-bottom: 16px;
    font-size: 15.5px;
    line-height: 1.7;
}

.seo-section ol,
.seo-section ul {
    margin: 0 0 24px 22px;
    color: var(--text-muted);
}

.seo-section ol li,
.seo-section ul li {
    margin-bottom: 10px;
    line-height: 1.65;
}

.seo-section ol li strong,
.seo-section ul li strong {
    color: var(--text);
}

.seo-block {
    margin-bottom: 40px;
}

.faq details {
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    margin-bottom: 10px;
    background: var(--surface);
    overflow: hidden;
    transition: border-color var(--transition);
}

.faq details[open] {
    border-color: var(--border-strong);
}

.faq summary {
    padding: 16px 20px;
    cursor: pointer;
    font-weight: 600;
    color: var(--text);
    list-style: none;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
}

.faq summary::-webkit-details-marker {
    display: none;
}

.faq summary::after {
    content: '+';
    font-size: 20px;
    font-weight: 400;
    color: var(--text-soft);
    transition: transform var(--transition);
    flex-shrink: 0;
}

.faq details[open] summary::after {
    content: '−';
}

.faq .faq-body {
    padding: 0 20px 18px;
    color: var(--text-muted);
    line-height: 1.65;
    font-size: 14.5px;
}

/* ----- 15. Footer ----- */
.site-footer {
    border-top: 1px solid var(--border);
    padding: 32px 0;
    color: var(--text-soft);
    font-size: 13px;
}

.site-footer .container {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    flex-wrap: wrap;
}

.site-footer .links {
    display: flex;
    gap: 18px;
    flex-wrap: wrap;
}

.site-footer .links a {
    color: var(--text-soft);
}
.site-footer .links a:hover {
    color: var(--text);
}

/* ----- 16. Canvas wrapper (image redact) ----- */
.canvas-wrap {
    margin-top: 18px;
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    background: var(--bg-soft);
    padding: 12px;
    text-align: center;
    overflow: auto;
}

.canvas-wrap canvas {
    max-width: 100%;
    height: auto;
    display: block;
    margin: 0 auto;
    cursor: crosshair;
    border-radius: var(--radius-sm);
    background: #fff;
}

.toolbar {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    padding: 12px 0;
    align-items: center;
    border-bottom: 1px solid var(--border);
    margin-bottom: 14px;
}

.toolbar-group {
    display: flex;
    gap: 6px;
    align-items: center;
    padding: 4px;
    background: var(--bg-soft);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
}

.tool-btn {
    padding: 6px 12px;
    border-radius: var(--radius-sm);
    font-size: 13px;
    font-weight: 500;
    color: var(--text-muted);
    transition:
        background var(--transition),
        color var(--transition);
}

.tool-btn:hover {
    color: var(--text);
    background: var(--surface);
}
.tool-btn.active {
    color: var(--accent);
    background: var(--surface);
    box-shadow: var(--shadow-sm);
}

/* ----- 17. Result Cards ----- */
.result-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
    margin-top: 20px;
}

@media (max-width: 640px) {
    .result-grid {
        grid-template-columns: 1fr;
    }
}

.result-card {
    padding: 16px;
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    background: var(--bg-soft);
}

.result-card .label {
    font-size: 12px;
    color: var(--text-soft);
    text-transform: uppercase;
    letter-spacing: 0.06em;
    margin-bottom: 6px;
}

.result-card .value {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--text);
    letter-spacing: -0.02em;
}

.result-card .delta {
    font-size: 13px;
    margin-top: 4px;
    font-weight: 500;
}

.result-card .delta.good {
    color: var(--success);
}
.result-card .delta.bad {
    color: var(--danger);
}

/* ----- 18. Stats Strip (Bento Grid Style) ----- */
.stats-strip {
    padding: var(--space-7) 0 var(--space-8);
    background: var(--bg);
    border-bottom: 1px solid var(--border);
}

.stats-strip .container {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: var(--space-4);
    max-width: var(--max-width);
    margin: 0 auto;
    padding: 0 var(--space-6);
}

@media (max-width: 1024px) {
    .stats-strip .container {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 640px) {
    .stats-strip .container {
        grid-template-columns: 1fr;
        gap: var(--space-3);
    }
}

.stat {
    display: grid;
    grid-template-columns: 48px 1fr;
    gap: var(--space-3);
    align-items: start;
    padding: var(--space-4) var(--space-5);
    border-radius: var(--radius-xl);
    background: var(--surface);
    border: 1px solid var(--border);
    transition:
        transform var(--transition),
        box-shadow var(--transition),
        border-color var(--transition),
        background var(--transition);
    position: relative;
    overflow: hidden;
}

.stat::before {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(135deg, var(--stat-color, var(--accent)) 0%, transparent 60%);
    opacity: 0;
    transition: opacity var(--transition);
    pointer-events: none;
}

.stat:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-lg);
    border-color: var(--stat-color, var(--accent));
    background: var(--surface-elevated);
}

.stat:hover::before {
    opacity: 0.04;
}

.stat:focus-within {
    outline: 2px solid var(--stat-color, var(--accent));
    outline-offset: 2px;
}

/* Per-stat theme colors */
.stat[data-stat='tools'] {
    --stat-color: var(--accent);
}
.stat[data-stat='categories'] {
    --stat-color: var(--success);
}
.stat[data-stat='languages'] {
    --stat-color: var(--warning);
}
.stat[data-stat='uploads'] {
    --stat-color: var(--danger);
}

/* Icon wrapper */
.stat__icon {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    border-radius: var(--radius-md);
    background: color-mix(in srgb, var(--stat-color, var(--accent)) 12%, transparent);
    color: var(--stat-color, var(--accent));
    flex-shrink: 0;
    transition:
        background var(--transition),
        transform var(--transition),
        color var(--transition);
}

.stat:hover .stat__icon {
    background: var(--stat-color, var(--accent));
    color: white;
    transform: scale(1.08);
}

.stat__icon svg {
    width: 20px;
    height: 20px;
    stroke-width: 2;
}

/* Content area */
.stat__content {
    display: flex;
    flex-direction: column;
    gap: 2px;
    min-width: 0;
}

.stat__value {
    display: flex;
    align-items: baseline;
    gap: var(--space-1);
    font-family: var(--font-mono);
    font-size: clamp(1.75rem, 4vw, 2.5rem);
    font-weight: 700;
    line-height: 1.1;
    letter-spacing: -0.03em;
    color: var(--text);
    white-space: nowrap;
}

.stat__value .accent {
    color: var(--stat-color, var(--accent));
    background: linear-gradient(135deg, var(--stat-color, var(--accent)), var(--accent-hover));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.stat__suffix {
    font-size: 0.7em;
    font-weight: 500;
    color: var(--text-soft);
    margin-inline-start: 2px;
}

.stat__label {
    font-size: 0.7rem;
    font-weight: 600;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--text-soft);
}

/* Reduced motion — respect user preference for ALL animations */
@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
        scroll-behavior: auto !important;
    }
    .spinner {
        animation: none;
    }
}

/* ----- 19. Utility ----- */
.hidden {
    display: none !important;
}
.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;
}

.spinner {
    width: 18px;
    height: 18px;
    border: 2px solid currentColor;
    border-bottom-color: transparent;
    border-radius: 50%;
    animation: spin 0.7s linear infinite;
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

/* Keyboard focus ring — visible only for keyboard navigation */
:focus-visible {
    outline: 2px solid var(--accent);
    outline-offset: 2px;
}

/* ----- 20. Responsive tweaks ----- */
@media (max-width: 768px) {
    .nav {
        display: none;
    }
    .hero {
        padding: 56px 0 32px;
    }
    .tools-section {
        padding: 32px 0 64px;
    }
    .site-header .container {
        gap: 12px;
    }
}
