/* Vibe Toolbox: dark, quiet, glassy.
   Minor-third type scale (1.2), with 0.75rem minimum.
   Spacing on an 8pt grid. No divider lines; hierarchy from type + space. */

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    color-scheme: dark;
    --bg: #08080a;
    --surface: rgba(255, 255, 255, 0.04);
    --surface-2: rgba(255, 255, 255, 0.07);
    --surface-solid: #101014;
    --border: rgba(255, 255, 255, 0.08);
    --border-strong: rgba(255, 255, 255, 0.16);
    --text: #f5f5f7;
    --text-2: #a5a5ad;
    --text-3: #7a7a84;
    --accent: #a78bfa;
    --accent-button: #8b5cf6;
    --accent-button-hover: #9d74f8;
    --accent-hover: #b9a3fc;
    --accent-dim: rgba(167, 139, 250, 0.14);
    --accent-soft: rgba(167, 139, 250, 0.1);
    --accent-surface: #221c33;
    --accent-border: rgba(167, 139, 250, 0.3);
    --accent-selected-border: rgba(167, 139, 250, 0.5);
    --accent-contrast: #14092b;
    --cta-green: #25ef79;
    --cta-green-hover: #4af38f;
    --cta-green-contrast: #05140b;
    --green: #4ade80;
    --green-subtle: rgba(74, 222, 128, 0.08);
    --green-soft: rgba(74, 222, 128, 0.15);
    --green-faint: rgba(74, 222, 128, 0.05);
    --green-border: rgba(74, 222, 128, 0.22);
    --green-glow: rgba(74, 222, 128, 0.25);
    --success-contrast: #04160b;
    --orange: #fb923c;
    --blue: #38bdf8;
    --nav-bg: rgba(10, 10, 14, 0.45);
    --panel-bg: rgba(16, 16, 20, 0.7);
    --code-bg: rgba(0, 0, 0, 0.45);
    --code-bg-hover: rgba(0, 0, 0, 0.6);
    --overlay: rgba(8, 8, 10, 0.6);
    --shadow: rgba(0, 0, 0, 0.5);
    --shadow-strong: rgba(0, 0, 0, 0.6);
    --card-inset: rgba(255, 255, 255, 0.05);
    --tooltip-text: #8b8b94;
    --heart: #f87171;
    --selection: rgba(167, 139, 250, 0.35);
    --ambient-1: rgba(139, 92, 246, 0.18);
    --ambient-2: rgba(96, 78, 176, 0.1);
    --cta-text: #ffffff;
    --icon-foreground: #f5f5f7;
    --icon-neutral: #86868b;
    --icon-orange: #fb923c;
    --icon-purple: #c084fc;
    --icon-pink: #f472b6;
    --icon-blue: #0ea5e9;
    --icon-yellow: #fbcc17;
    --icon-green: #4ade80;
    --type-xs: 0.75rem;
    --type-sm: 0.8333rem;
    --type-base: 1rem;
    --type-md: 1.2rem;
    --type-lg: 1.44rem;
    --type-xl: 1.728rem;
    --type-2xl: 2.0736rem;
    --type-3xl: 2.4883rem;
    --type-4xl: 2.986rem;
    --type-5xl: 3.5832rem;
    --type-6xl: 4.2998rem;
    --mono: ui-monospace, 'SF Mono', Menlo, 'Courier New', monospace;
    --noise: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='160' height='160'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='2' stitchTiles='stitch'/%3E%3CfeColorMatrix type='saturate' values='0'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
}

@media (prefers-color-scheme: light) {
    :root {
        color-scheme: light;
        --bg: #f8f7fb;
        --surface: rgba(45, 31, 63, 0.05);
        --surface-2: rgba(45, 31, 63, 0.09);
        --surface-solid: #ffffff;
        --border: rgba(45, 31, 63, 0.12);
        --border-strong: rgba(45, 31, 63, 0.22);
        --text: #1b1721;
        --text-2: #5f5868;
        --text-3: #6f687a;
        --accent: #6d28d9;
        --accent-button: #7c3aed;
        --accent-button-hover: #6d28d9;
        --accent-hover: #5b21b6;
        --accent-dim: rgba(109, 40, 217, 0.09);
        --accent-soft: rgba(109, 40, 217, 0.08);
        --accent-surface: #f0e8ff;
        --accent-border: rgba(109, 40, 217, 0.24);
        --accent-selected-border: rgba(109, 40, 217, 0.38);
        --accent-contrast: #ffffff;
        --cta-green: #10c968;
        --cta-green-hover: #0bb75b;
        --cta-green-contrast: #052012;
        --green: #16763f;
        --green-subtle: rgba(22, 118, 63, 0.07);
        --green-soft: rgba(22, 118, 63, 0.12);
        --green-faint: rgba(22, 118, 63, 0.04);
        --green-border: rgba(22, 118, 63, 0.2);
        --green-glow: rgba(22, 118, 63, 0.16);
        --success-contrast: #ffffff;
        --orange: #a84508;
        --blue: #0369a1;
        --nav-bg: rgba(255, 255, 255, 0.72);
        --panel-bg: rgba(255, 255, 255, 0.88);
        --code-bg: #f1eef6;
        --code-bg-hover: #ebe6f2;
        --overlay: rgba(38, 28, 50, 0.28);
        --shadow: rgba(43, 31, 62, 0.14);
        --shadow-strong: rgba(43, 31, 62, 0.22);
        --card-inset: rgba(255, 255, 255, 0.8);
        --tooltip-text: #5f5868;
        --heart: #dc2626;
        --selection: rgba(109, 40, 217, 0.2);
        --ambient-1: rgba(124, 58, 237, 0.1);
        --ambient-2: rgba(168, 85, 247, 0.06);
        --cta-text: #ffffff;
        --icon-foreground: #1b1721;
        --icon-neutral: #625a6d;
        --icon-orange: #c2410c;
        --icon-purple: #7e22ce;
        --icon-pink: #be185d;
        --icon-blue: #0369a1;
        --icon-yellow: #a16207;
        --icon-green: #16763f;
    }
}

[x-cloak] {
    display: none !important;
}

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

html {
    scroll-behavior: smooth;
}

body {
    font-family: system-ui, -apple-system, BlinkMacSystemFont, sans-serif;
    background: var(--bg);
    color: var(--text);
    font-size: var(--type-base);
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
    overflow-x: hidden;
    padding-bottom: 3rem;
}

h1,
h2,
h3 {
    line-height: 1.2;
}

/* Ambient: one soft violet field, no blur filter, no animation */
.ambient {
    position: fixed;
    inset: 0;
    z-index: 0;
    pointer-events: none;
    background:
        radial-gradient(68.75rem 32.5rem at 50% -8%, var(--ambient-1), transparent 70%),
        radial-gradient(56.25rem 30rem at 82% 4%, var(--ambient-2), transparent 65%);
}

.ambient::after {
    content: '';
    position: absolute;
    inset: 0;
    background-image: var(--noise);
    opacity: 0.05;
}

main,
.site-footer {
    position: relative;
    z-index: 1;
}

.container {
    max-width: 63rem;
    margin: 0 auto;
    padding: 0 1.5rem;
}

::selection {
    background: var(--selection);
}

/* Nav: one floating glass bar, cart included */
.site-header {
    position: fixed;
    top: 1rem;
    left: 50%;
    transform: translateX(-50%);
    z-index: 100;
    width: 100%;
    max-width: 63rem;
    padding: 0 1.5rem;
}

.nav-container {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    background: var(--nav-bg);
    backdrop-filter: blur(1rem);
    -webkit-backdrop-filter: blur(1rem);
    border-radius: 1rem;
    padding: 0.5rem 1rem;
}

.brand {
    display: flex;
    align-items: center;
    gap: 0.625rem;
    font-size: var(--type-md);
    font-weight: 700;
    letter-spacing: -0.02em;
    color: var(--text);
    text-decoration: none;
    padding: 0.5rem 0;
}

.brand-mark {
    width: 1.5rem;
    height: 1.5rem;
    color: var(--accent);
}

.brand-inline {
    color: var(--text);
    font-weight: 700;
}

.site-nav {
    position: relative;
    display: flex;
    align-items: center;
    gap: 0.25rem;
}

.site-nav a {
    display: inline-flex;
    align-items: center;
    gap: 0.375rem;
    padding: 0.5rem 0.75rem;
    font-size: var(--type-sm);
    font-weight: 500;
    color: var(--text-2);
    text-decoration: none;
    border-radius: 0.5rem;
    transition: color 0.15s ease, background-color 0.15s ease;
}

.site-nav a svg {
    width: 0.9375rem;
    height: 0.9375rem;
    flex-shrink: 0;
}

.site-nav a:hover {
    color: var(--text);
    background: var(--surface);
}

.site-nav a.active {
    color: var(--text);
}

.site-nav .nav-icon-link {
    padding: 0.5rem;
}

.site-nav .nav-icon-link svg {
    width: 1.0625rem;
    height: 1.0625rem;
}

.site-nav a:focus-visible,
.brand:focus-visible,
.mobile-menu-toggle:focus-visible,
.cart-btn:focus-visible {
    outline: 0.125rem solid var(--accent);
    outline-offset: 0.125rem;
}

/* Nav CTA */
.nav-cta {
    order: 0;
    max-width: 24rem;
    overflow: hidden;
    padding: 0.5rem 1rem;
    border-radius: 0.5rem;
    font-size: var(--type-sm);
    font-weight: 700;
    font-family: inherit;
    white-space: nowrap;
    cursor: pointer;
    transition:
        background-color 0.15s ease,
        color 0.15s ease,
        opacity 0.15s ease 0.72s,
        max-width 0.25s ease 0.65s,
        padding 0.25s ease 0.65s;
    background: var(--cta-green);
    border: none;
    color: var(--cta-green-contrast);
}

.nav-cta:hover:not(:disabled) {
    background: var(--cta-green-hover);
}

.nav-cta.menu-hidden {
    max-width: 0;
    padding-inline: 0;
    opacity: 0;
    pointer-events: none;
    transition:
        background-color 0.15s ease,
        color 0.15s ease,
        opacity 0.12s ease,
        max-width 0.25s ease 0.08s,
        padding 0.25s ease 0.08s;
}

.nav-cta:disabled {
    background: var(--surface-2);
    color: var(--text-3);
    cursor: not-allowed;
}

.nav-cta.copied {
    background: var(--green);
    color: var(--success-contrast);
}

.nav-cta:focus-visible {
    outline: 0.125rem solid var(--accent);
    outline-offset: 0.125rem;
}

.nav-cta-label-mobile {
    display: none;
}

.mobile-page-links {
    order: 2;
    display: flex;
    align-items: center;
    gap: 0.25rem;
    max-width: 0;
    overflow: hidden;
    opacity: 0;
    visibility: hidden;
    white-space: nowrap;
    pointer-events: none;
    transition:
        max-width 0.28s ease 0.18s,
        opacity 0.12s ease 0.18s,
        visibility 0s linear 0.46s;
}

.site-nav.mobile-pages-open .mobile-page-links {
    max-width: 28rem;
    opacity: 1;
    visibility: visible;
    pointer-events: auto;
    transition:
        max-width 0.35s ease 0.1s,
        opacity 0.12s ease 0.12s,
        visibility 0s;
}

.site-nav .mobile-page-links a {
    min-width: 2.5rem;
    min-height: 2.5rem;
    justify-content: center;
    padding: 0.5rem 0.75rem;
    opacity: 0;
    transform: translateX(0.75rem) scale(0.96);
    transition: opacity 0.12s ease, transform 0.18s ease;
}

.site-nav .mobile-page-links a:nth-child(1) { transition-delay: 0s; }
.site-nav .mobile-page-links a:nth-child(2) { transition-delay: 0.04s; }
.site-nav .mobile-page-links a:nth-child(3) { transition-delay: 0.08s; }
.site-nav .mobile-page-links a:nth-child(4) { transition-delay: 0.12s; }

.site-nav.mobile-pages-open .mobile-page-links a {
    opacity: 1;
    transform: translateX(0) scale(1);
}

.site-nav.mobile-pages-open .mobile-page-links a:nth-child(4) { transition-delay: 0.12s; }
.site-nav.mobile-pages-open .mobile-page-links a:nth-child(3) { transition-delay: 0.18s; }
.site-nav.mobile-pages-open .mobile-page-links a:nth-child(2) { transition-delay: 0.24s; }
.site-nav.mobile-pages-open .mobile-page-links a:nth-child(1) { transition-delay: 0.3s; }

.mobile-menu-toggle {
    order: 1;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 2.25rem;
    height: 2.25rem;
    flex-shrink: 0;
    padding: 0;
    color: var(--text-2);
    background: transparent;
    border: 0;
    border-radius: 0.5rem;
    cursor: pointer;
}

.mobile-menu-toggle:hover {
    color: var(--text);
    background: var(--surface);
}

.mobile-menu-toggle svg {
    width: 1rem;
    height: 1rem;
    transition: transform 0.2s ease 0.46s;
}

.mobile-menu-toggle svg.open {
    transform: rotate(180deg);
    transition-delay: 0s;
}

@media (max-width: 30rem) {
    .nav-cta {
        padding: 0.5rem 0.75rem;
    }
}

/* Cart button */
.cart-btn {
    position: relative;
    order: 3;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0.25rem;
    margin-left: 0.25rem;
    background: none;
    border: none;
    border-radius: 0.5rem;
    color: var(--text-2);
    cursor: pointer;
    transition: color 0.15s ease;
}

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

.cart-btn svg {
    width: 1.75rem;
    height: 1.75rem;
}

.cart-btn.bump svg {
    animation: cart-bump 0.5s ease;
}

@keyframes cart-bump {
    0% { transform: scale(1); }
    30% { transform: scale(1.3) rotate(-8deg); }
    55% { transform: scale(1.15) rotate(8deg); }
    100% { transform: scale(1) rotate(0); }
}

.cart-pending {
    font-family: var(--mono);
    font-size: var(--type-xs);
    color: var(--text-3);
    padding: 0.75rem 0.875rem;
    background: var(--code-bg);
    border: 0.0625rem solid var(--border);
    border-radius: 0.625rem;
}

.cart-badge {
    position: absolute;
    top: -0.25rem;
    right: -0.625rem;
    min-width: 1.125rem;
    height: 1.125rem;
    padding: 0 0.3125rem;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: var(--type-xs);
    font-weight: 600;
    font-variant-numeric: tabular-nums;
    background: var(--accent);
    color: var(--accent-contrast);
    border-radius: 62.4375rem;
}

/* Cart panel (sibling of .nav-container so backdrop-filter blurs the page) */
.cart-panel {
    position: absolute;
    top: calc(100% + 0.5rem);
    right: 1.5rem;
    width: min(26.25rem, calc(100vw - 2rem));
    background: var(--panel-bg);
    backdrop-filter: blur(1.25rem);
    -webkit-backdrop-filter: blur(1.25rem);
    border: 0.0625rem solid var(--border-strong);
    border-radius: 1rem;
    padding: 1.25rem;
    box-shadow: 0 1rem 3rem var(--shadow);
}

.cart-empty {
    font-size: var(--type-sm);
    color: var(--text-2);
    text-align: center;
    padding: 0.5rem 0;
}

.cart-title {
    font-size: var(--type-sm);
    font-weight: 600;
    margin-bottom: 0.75rem;
}

.cart-title span {
    color: var(--text-3);
    font-weight: 500;
}

.cart-items {
    display: flex;
    flex-wrap: wrap;
    gap: 0.375rem;
    margin-bottom: 1rem;
    max-height: 11.25rem;
    overflow-y: auto;
}

.cart-chip {
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
    font-size: var(--type-xs);
    font-weight: 500;
    color: var(--text-2);
    background: var(--surface);
    border: 0.0625rem solid var(--border);
    border-radius: 62.4375rem;
    padding: 0.1875rem 0.375rem 0.1875rem 0.625rem;
    cursor: default;
    user-select: none;
    transition: color 0.15s ease, background-color 0.15s ease, border-color 0.15s ease;
}

.cart-chip:hover {
    color: var(--text);
    background: var(--surface-2);
    border-color: var(--border-strong);
}

.cart-chip button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 1rem;
    height: 1rem;
    font-size: var(--type-xs);
    line-height: 1;
    background: none;
    border: none;
    border-radius: 50%;
    color: var(--text-3);
    cursor: pointer;
    transition: color 0.15s ease, background-color 0.15s ease;
}

.cart-chip button:hover {
    color: var(--text);
    background: var(--surface-2);
}

.cart-command {
    display: block;
    font-family: var(--mono);
    font-size: var(--type-xs);
    line-height: 1.6;
    color: var(--text);
    background: var(--code-bg);
    border: 0.0625rem solid var(--border);
    border-radius: 0.625rem;
    padding: 0.75rem 0.875rem;
    word-break: break-all;
    cursor: pointer;
    transition: border-color 0.15s ease, background-color 0.15s ease;
}

.cart-command:hover {
    border-color: var(--border-strong);
    background: var(--code-bg-hover);
}

.cart-command.copied {
    border-color: var(--green);
}

.cart-command:focus-visible {
    outline: 0.125rem solid var(--accent);
    outline-offset: 0.125rem;
}

.copy-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    padding: 0.625rem 1.25rem;
    border-radius: 0.625rem;
    font-size: var(--type-sm);
    font-weight: 600;
    font-family: inherit;
    cursor: pointer;
    transition: background-color 0.15s ease, color 0.15s ease;
    background: var(--accent);
    border: none;
    color: var(--accent-contrast);
}

.copy-btn:hover {
    background: var(--accent-hover);
}

.copy-btn.copied {
    background: var(--green);
    color: var(--success-contrast);
}

.copy-btn:focus-visible {
    outline: 0.125rem solid var(--accent);
    outline-offset: 0.125rem;
}

@media (max-width: 40rem) {
    .site-header {
        padding-inline: 0.75rem;
    }

    .brand-name,
    .site-nav a span,
    .nav-cta-label-full {
        display: none;
    }

    .nav-cta-label-mobile {
        display: inline;
    }

    .site-nav .cart-btn {
        max-width: 3rem;
        opacity: 1;
        visibility: visible;
        transition:
            color 0.15s ease,
            max-width 0.25s ease 0.65s,
            padding 0.25s ease 0.65s,
            margin 0.25s ease 0.65s,
            opacity 0.15s ease 0.72s,
            visibility 0s linear 0.65s;
    }

    .site-nav.mobile-pages-open .cart-btn {
        max-width: 0;
        overflow: hidden;
        padding-inline: 0;
        margin-left: 0;
        opacity: 0;
        visibility: hidden;
        transition:
            color 0.15s ease,
            max-width 0.18s ease,
            padding 0.18s ease,
            margin 0.18s ease,
            opacity 0.08s ease,
            visibility 0s linear 0.18s;
    }

    .site-nav a {
        padding: 0.5rem;
    }

    .site-nav a svg {
        width: 1.0625rem;
        height: 1.0625rem;
    }
}

@media (max-width: 22.5rem) {
    .nav-container {
        gap: 0.25rem;
        padding-inline: 0.5rem;
    }

    .brand-group {
        gap: 0.25rem;
    }

    .brand-version {
        padding-inline: 0.375rem;
    }

    .mobile-menu-toggle {
        width: 2rem;
    }

    .mobile-page-links {
        gap: 0.125rem;
    }

    .site-nav .mobile-page-links a {
        min-width: 2.25rem;
        padding-inline: 0.5rem;
    }
}

/* Hero */
.hero {
    padding: 9.5rem 0 4rem;
    text-align: center;
}

.hero-inner {
    position: relative;
}

.hero-logo {
    position: absolute;
    top: 1rem;
    left: 50%;
    transform: translateX(-50%);
    width: clamp(17.5rem, 42vw, 28.75rem);
    aspect-ratio: 1;
    pointer-events: none;
    -webkit-mask-image: linear-gradient(180deg, black 55%, transparent 92%);
    mask-image: linear-gradient(180deg, black 55%, transparent 92%);
}

.hero-logo svg {
    width: 100%;
    height: 100%;
}

.hero-pill,
h1,
.hero-sub,
.hero-presets,
.hero-hint {
    position: relative;
    z-index: 1;
}

.hero-pill {
    display: inline-flex;
    align-items: center;
    gap: 0.375rem;
    font-size: var(--type-xs);
    font-weight: 500;
    color: var(--green);
    background: var(--green-subtle);
    border: 0.0625rem solid var(--green-border);
    border-radius: 62.4375rem;
    padding: 0.3125rem 0.875rem;
    margin-bottom: 2rem;
}

.brand-group {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.brand-version {
    font-family: var(--mono);
    font-size: var(--type-xs);
    font-weight: 500;
    color: var(--accent);
    background: var(--accent-soft);
    border: 0.0625rem solid var(--accent-border);
    border-radius: 62.4375rem;
    padding: 0.125rem 0.5rem;
}

h1 {
    font-size: clamp(var(--type-3xl), 6vw, var(--type-6xl));
    font-weight: 700;
    letter-spacing: -0.03em;
    line-height: 1.08;
    margin-bottom: 1.5rem;
    text-wrap: balance;
}

h1 em {
    font-style: normal;
    color: var(--accent);
}

.hero-sub {
    font-size: var(--type-md);
    line-height: 1.6;
    color: var(--text-2);
    margin: 0 auto 2.5rem;
    text-wrap: pretty;
}

@media (max-width: 45rem) {
    .hero {
        padding: 7.5rem 0 3rem;
    }
}

/* Presets */
.hero-presets {
    display: flex;
    align-items: center;
    justify-content: center;
    flex-wrap: wrap;
    gap: 0.5rem;
}

.presets-label {
    position: relative;
    z-index: 1;
    font-size: var(--type-sm);
    color: var(--text-3);
    margin-bottom: 1rem;
}

.preset-btn {
    padding: 0.625rem 1.25rem;
    border-radius: 62.4375rem;
    font-size: var(--type-base);
    font-weight: 500;
    font-family: inherit;
    cursor: pointer;
    background: var(--surface);
    border: 0.0625rem solid var(--border);
    color: var(--text);
    transition: background-color 0.15s ease, border-color 0.15s ease;
}

.preset-btn:hover {
    background: var(--surface-2);
    border-color: var(--border-strong);
}

.preset-btn.active {
    background: var(--accent);
    border-color: var(--accent);
    color: var(--accent-contrast);
    font-weight: 600;
}

.preset-btn.preset-clear {
    background: transparent;
    color: var(--text-3);
}

.preset-btn.preset-clear:hover {
    color: var(--text-2);
}

.preset-btn:focus-visible {
    outline: 0.125rem solid var(--accent);
    outline-offset: 0.125rem;
}

.hero-hint {
    margin-top: 1rem;
    font-size: var(--type-sm);
    color: var(--text-3);
}

.hero-sub a {
    color: var(--text);
    text-decoration: underline;
    text-decoration-color: var(--text-3);
    text-underline-offset: 0.1875rem;
}

.hero-sub a:hover {
    text-decoration-color: var(--text);
}

/* Read-only tool cards (tools page) */
.tools-search {
    width: 100%;
    margin: 0 0 3rem;
}

.tools-search-field {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    min-height: 3.5rem;
    padding: 0 1rem;
    color: var(--text-3);
    background: var(--surface-solid);
    border: 0.0625rem solid var(--border-strong);
    border-radius: 1rem;
    box-shadow: 0 0.75rem 2rem var(--shadow);
    transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.tools-search-field:focus-within {
    border-color: var(--accent);
    box-shadow: 0 0 0 0.1875rem var(--accent-dim), 0 0.75rem 2rem var(--shadow);
}

.tools-search-field svg {
    width: 1.25rem;
    height: 1.25rem;
    flex-shrink: 0;
}

.tools-search-field input {
    min-width: 0;
    flex: 1;
    padding: 0.875rem 0;
    font: inherit;
    font-size: var(--type-base);
    color: var(--text);
    background: transparent;
    border: 0;
    outline: 0;
}

.tools-search-field input::placeholder {
    color: var(--text-3);
}

.tools-search-field input::-webkit-search-cancel-button {
    display: none;
}

.tools-search-field button {
    width: 1.75rem;
    height: 1.75rem;
    flex-shrink: 0;
    font: inherit;
    font-size: var(--type-md);
    line-height: 1;
    color: var(--text-3);
    background: var(--surface);
    border: 0;
    border-radius: 50%;
    cursor: pointer;
}

.tools-search-field button:hover {
    color: var(--text);
    background: var(--surface-2);
}

.tools-search-field button:focus-visible {
    outline: 0.125rem solid var(--accent);
    outline-offset: 0.125rem;
}

.tools-search-status {
    min-height: 1.25rem;
    margin-top: 0.625rem;
    padding-left: 0.25rem;
    font-family: var(--mono);
    font-size: var(--type-xs);
    color: var(--text-3);
}

.tools-empty {
    padding: 4rem 1.5rem;
    color: var(--text-2);
    text-align: center;
    background: var(--surface);
    border: 0.0625rem dashed var(--border-strong);
    border-radius: 1rem;
}

.tool-card-static {
    cursor: pointer;
}

.tool-actions {
    display: flex;
    gap: 0.5rem;
    margin-top: auto;
    padding-top: 1rem;
}

.tool-action {
    display: inline-flex;
    align-items: center;
    padding: 0.375rem 0.75rem;
    font-size: var(--type-xs);
    font-weight: 500;
    font-family: inherit;
    color: var(--text-2);
    background: var(--surface);
    border: 0.0625rem solid var(--border);
    border-radius: 62.4375rem;
    text-decoration: none;
    cursor: pointer;
    transition: color 0.15s ease, background-color 0.15s ease, border-color 0.15s ease;
}

.tool-action:hover {
    color: var(--text);
    background: var(--surface-2);
    border-color: var(--border-strong);
}

.tool-action:focus-visible {
    outline: 0.125rem solid var(--accent);
    outline-offset: 0.125rem;
}

/* Tool detail dialog */
.tool-modal-head {
    display: flex;
    gap: 0.75rem;
    margin-bottom: 1rem;
}

/* .modal h2 sets margin-bottom and wins on order; reset it here with a
   more specific selector so the icon and title align */
.modal .tool-modal-head h2 {
    font-size: var(--type-lg);
    font-weight: 700;
    letter-spacing: -0.02em;
    margin: 0;
    line-height: 1.75rem;
}

.tool-modal-head .tool-icon svg,
.tool-modal-head .tool-icon img {
    width: 1.75rem;
    height: 1.75rem;
}

.tool-modal-more {
    font-size: var(--type-base);
    line-height: 1.6;
    color: var(--text-2);
    margin-bottom: 1rem;
}

.tool-modal-why {
    position: relative;
    font-size: var(--type-sm);
    line-height: 1.6;
    color: var(--text-2);
    background: var(--accent-dim);
    border-radius: 0.625rem;
    padding: 1rem 0.875rem 0.75rem;
    margin: 1.25rem 0 1rem;
}

.why-pill {
    position: absolute;
    top: -0.625rem;
    right: 0.75rem;
    font-size: var(--type-xs);
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--accent);
    background: var(--accent-surface);
    border: 0.0625rem solid var(--accent-border);
    border-radius: 62.4375rem;
    padding: 0.0625rem 0.625rem;
}

.tool-modal-try {
    font-family: var(--mono);
    font-size: var(--type-sm);
    color: var(--text);
    background: var(--code-bg);
    border: 0.0625rem solid var(--border);
    border-radius: 0.625rem;
    padding: 0.75rem 0.875rem;
    margin-bottom: 1rem;
    overflow-x: auto;
}

.tool-modal-try::before {
    content: '❯ ';
    color: var(--text-3);
}

.tool-modal .tool-badge {
    margin-top: 0;
    margin-bottom: 1rem;
}

.tool-modal-actions {
    display: flex;
    gap: 0.5rem;
    margin-top: 0.5rem;
}

.tool-modal-actions .copy-btn {
    flex: 1;
    text-decoration: none;
}

/* Tooltip (fixed so scroll containers can't clip it) */
.tooltip {
    position: fixed;
    transform: translateX(-50%);
    z-index: 400;
    max-width: 16rem;
    background: var(--surface-solid);
    border: 0.0625rem solid var(--border-strong);
    border-radius: 0.5rem;
    padding: 0.375rem 0.625rem;
    font-size: var(--type-xs);
    line-height: 1.5;
    color: var(--tooltip-text);
    text-align: center;
    pointer-events: none;
    box-shadow: 0 0.5rem 1.5rem var(--shadow);
}

/* Post-copy guide dialog */
.modal-backdrop {
    position: fixed;
    inset: 0;
    z-index: 300;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1.5rem;
    background: var(--overlay);
    backdrop-filter: blur(0.5rem);
    -webkit-backdrop-filter: blur(0.5rem);
}

.modal {
    width: min(28rem, 100%);
    background: var(--surface-solid);
    border: 0.0625rem solid var(--border-strong);
    border-radius: 1rem;
    padding: 2rem;
    box-shadow: 0 1.5rem 4rem var(--shadow-strong);
}

.modal h2 {
    font-size: var(--type-lg);
    font-weight: 700;
    letter-spacing: -0.02em;
    line-height: 1.2;
    margin-bottom: 1.5rem;
    text-wrap: balance;
}

.guide-steps {
    list-style: none;
    counter-reset: guide;
    display: flex;
    flex-direction: column;
    gap: 1rem;
    margin-bottom: 1.5rem;
}

.guide-steps li {
    counter-increment: guide;
    position: relative;
    padding-left: 2.25rem;
    font-size: var(--type-sm);
    line-height: 1.6;
    color: var(--text-2);
}

.guide-steps li::before {
    content: counter(guide);
    position: absolute;
    left: 0;
    top: 0.125rem;
    width: 1.5rem;
    height: 1.5rem;
    display: flex;
    align-items: center;
    justify-content: center;
    font-family: var(--mono);
    font-size: var(--type-xs);
    font-weight: 500;
    color: var(--accent);
    background: var(--accent-dim);
    border-radius: 50%;
}

.guide-steps strong {
    display: block;
    color: var(--text);
    font-weight: 600;
}

.guide-steps em {
    font-style: normal;
    color: var(--text);
}

kbd {
    font-family: var(--mono);
    font-size: var(--type-xs);
    color: var(--text);
    background: var(--surface-2);
    border: 0.0625rem solid var(--border-strong);
    border-radius: 0.375rem;
    padding: 0.0625rem 0.375rem;
    margin: 0 0.0625rem;
}

.guide-dismiss {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: var(--type-sm);
    color: var(--text-3);
    margin-bottom: 1rem;
    cursor: pointer;
}

.guide-dismiss input {
    accent-color: var(--accent);
}

/* Dot rail: jump between sections */
.dot-nav {
    position: fixed;
    left: 1.5rem;
    top: 50%;
    transform: translateY(-50%);
    z-index: 50;
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.dot {
    position: relative;
    width: 1.25rem;
    height: 1.25rem;
    display: flex;
    align-items: center;
    justify-content: center;
}

.dot::before {
    content: '';
    width: 0.5rem;
    height: 0.5rem;
    border-radius: 50%;
    background: transparent;
    border: 0.09375rem solid var(--border-strong);
    transition: background-color 0.15s ease, border-color 0.15s ease, transform 0.15s ease;
}

.dot:hover::before {
    border-color: var(--accent);
    transform: scale(1.2);
}

.dot.active::before {
    background: var(--accent);
    border-color: var(--accent);
}

.dot:focus-visible {
    outline: 0.125rem solid var(--accent);
    outline-offset: 0.125rem;
    border-radius: 50%;
}

.dot-label {
    position: absolute;
    left: 1.75rem;
    top: 50%;
    transform: translateY(-50%);
    font-size: var(--type-xs);
    font-weight: 500;
    color: var(--text);
    background: var(--surface-solid);
    border: 0.0625rem solid var(--border);
    border-radius: 0.375rem;
    padding: 0.1875rem 0.625rem;
    white-space: nowrap;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.15s ease;
}

.dot:hover .dot-label,
.dot:focus-visible .dot-label {
    opacity: 1;
}

@media (max-width: 71.25rem) {
    .dot-nav {
        display: none;
    }
}

/* Picker */
.picker {
    padding: 1rem 1.5rem 2rem;
}

.hero,
.category,
.how {
    scroll-margin-top: 6rem;
}

.category {
    margin-bottom: 4rem;
}

.category-header {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 1rem;
    margin-bottom: 1.5rem;
}

.category-header h2 {
    font-size: var(--type-lg);
    font-weight: 600;
    letter-spacing: -0.02em;
}

.cat-count {
    font-family: var(--mono);
    font-size: var(--type-xs);
    color: var(--text-3);
}

.tool-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 1rem;
}

@media (max-width: 55rem) {
    .tool-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

@media (max-width: 35rem) {
    .tool-grid {
        grid-template-columns: 1fr;
    }
}

.tool-card {
    display: flex;
    flex-direction: column;
    position: relative;
    background: var(--surface);
    border: 0.0625rem solid var(--border);
    box-shadow: inset 0 0.0625rem var(--card-inset);
    border-radius: 1rem;
    padding: 1.5rem;
    cursor: pointer;
    transition: background-color 0.15s ease, border-color 0.15s ease;
}

.tool-card:hover {
    background: var(--surface-2);
    border-color: var(--border-strong);
}

.tool-card input {
    position: absolute;
    opacity: 0;
    pointer-events: none;
}

.tool-card:has(input:focus-visible) {
    outline: 0.125rem solid var(--accent);
    outline-offset: 0.125rem;
}

.tool-card.selected {
    background: var(--accent-dim);
    border-color: var(--accent-selected-border);
    overflow: hidden;
}

.tool-card.selected::after {
    content: '';
    position: absolute;
    inset: 0;
    border-radius: inherit;
    background-image: var(--noise);
    opacity: 0.06;
    pointer-events: none;
}

.tool-card-top {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    margin-bottom: 0.75rem;
}

.tool-icon {
    width: 1.75rem;
    height: 1.75rem;
    display: flex;
    align-items: center;
    justify-content: center;
}

.tool-icon svg,
.tool-icon img {
    width: 1.5rem;
    height: 1.5rem;
    object-fit: contain;
}

@media (prefers-color-scheme: light) {
    .tool-icon img.theme-invert {
        filter: invert(1);
    }
}

.tool-check {
    width: 1.25rem;
    height: 1.25rem;
    flex-shrink: 0;
    margin-left: auto;
    border-radius: 50%;
    border: 0.09375rem solid var(--border-strong);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: var(--type-xs);
    color: transparent;
    transition: background-color 0.15s ease, border-color 0.15s ease, color 0.15s ease;
}

.tool-check::after {
    content: '✓';
}

.tool-card.selected .tool-check {
    background: var(--accent);
    border-color: var(--accent);
    color: var(--accent-contrast);
}

.tool-name {
    font-size: var(--type-md);
    font-weight: 600;
    letter-spacing: -0.01em;
    min-width: 0;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.tool-desc {
    font-size: var(--type-sm);
    line-height: 1.6;
    color: var(--text-2);
}

.tool-card-meta {
    position: relative;
    z-index: 1;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-top: auto;
    padding-top: 1rem;
}

.tool-card-meta .tool-badge {
    margin-top: 0;
}

.tool-card-info {
    flex-shrink: 0;
    margin-left: auto;
}

.tool-badge {
    display: inline-block;
    margin-top: 1rem;
    font-family: var(--mono);
    font-size: var(--type-xs);
    color: var(--text-3);
    background: var(--surface);
    border: 0.0625rem solid var(--border);
    padding: 0.125rem 0.5rem;
    border-radius: 62.4375rem;
}

.noscript-note {
    background: var(--surface);
    border: 0.0625rem solid var(--border);
    border-radius: 1rem;
    padding: 1.5rem;
    font-size: var(--type-sm);
    color: var(--text-2);
}

.noscript-note code {
    font-family: var(--mono);
    font-size: var(--type-xs);
    color: var(--green);
}

/* How it works */
.how {
    padding: 4rem 0 2rem;
}

.section-header {
    max-width: 35rem;
    margin: 0 auto 3rem;
    text-align: center;
}

.section-title {
    font-size: var(--type-2xl);
    font-weight: 700;
    letter-spacing: -0.02em;
    line-height: 1.15;
    margin-bottom: 1rem;
}

.section-description {
    font-size: var(--type-base);
    line-height: 1.6;
    color: var(--text-2);
}

.how-steps {
    list-style: none;
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 2rem;
    max-width: 63rem;
    margin: 0 auto;
}

@media (max-width: 45rem) {
    .how-steps {
        grid-template-columns: 1fr;
    }
}

.step-card {
    display: flex;
    gap: 1rem;
    align-items: flex-start;
}

.how-num {
    font-family: var(--mono);
    font-size: var(--type-sm);
    font-weight: 500;
    color: var(--accent);
    flex-shrink: 0;
    width: 1.5rem;
    height: 1.5rem;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--accent-dim);
    border-radius: 50%;
    margin-top: 0.0625rem;
}

.step-card p {
    font-size: var(--type-sm);
    line-height: 1.6;
    color: var(--text-2);
}

.how-note {
    margin: 3rem auto 0;
    max-width: 35rem;
    text-align: center;
    font-size: var(--type-sm);
    line-height: 1.7;
    color: var(--text-3);
}

.how-note code,
.step-card code {
    font-family: var(--mono);
    font-size: var(--type-xs);
    background: var(--surface);
    border: 0.0625rem solid var(--border);
    padding: 0.0625rem 0.375rem;
    border-radius: 0.375rem;
    color: var(--text-2);
}

/* Footer */
.site-footer {
    padding: 4rem 0 3rem;
    text-align: center;
}

.footer-nav {
    display: flex;
    align-items: center;
    justify-content: center;
    flex-wrap: wrap;
    gap: 0.5rem;
    margin-bottom: 2rem;
}

.footer-nav a {
    font-size: var(--type-base);
    font-weight: 600;
    color: var(--text);
    text-decoration: none;
    padding: 0.625rem 1.25rem;
    border-radius: 62.4375rem;
    background: var(--surface);
    border: 0.0625rem solid var(--border);
    transition: background-color 0.15s ease, border-color 0.15s ease;
}

.footer-nav a:hover {
    background: var(--surface-2);
    border-color: var(--border-strong);
}

.footer-nav a:focus-visible {
    outline: 0.125rem solid var(--accent);
    outline-offset: 0.125rem;
}

@media (max-width: 35rem) {
    .footer-nav {
        display: block;
        max-width: 20rem;
        margin-left: auto;
        margin-right: auto;
    }

    .footer-nav a {
        display: block;
        margin-bottom: 0.5rem;
        text-align: center;
    }

    .footer-nav a:last-child {
        margin-bottom: 0;
    }
}

.site-footer p {
    display: flex;
    align-items: center;
    justify-content: center;
    flex-wrap: wrap;
    gap: 0.25rem;
    font-size: var(--type-sm);
    color: var(--text-3);
}

.footer-heart {
    width: 0.875rem;
    height: 0.875rem;
    color: var(--heart);
    opacity: 0.5;
    transition: opacity 0.15s ease;
}

.site-footer p:hover .footer-heart {
    opacity: 1;
    animation: heart-pulse 1s ease-in-out infinite;
}

@keyframes heart-pulse {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.3); }
}

.footer-github {
    display: inline-flex;
    align-items: center;
    margin-left: 0.5rem;
    color: var(--text-3);
}

.footer-github svg {
    width: 1rem;
    height: 1rem;
}

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

.site-footer a {
    color: var(--text-2);
    text-decoration: none;
    transition: color 0.15s ease;
}

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

.site-footer a:focus-visible {
    outline: 0.125rem solid var(--accent);
    outline-offset: 0.125rem;
    border-radius: 0.25rem;
}

/* Next steps page */
.steps-page {
    padding-bottom: 3rem;
}

.success-icon {
    position: relative;
    z-index: 1;
    width: 5rem;
    height: 5rem;
    margin: 0 auto 1.5rem;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--cta-green);
    background: linear-gradient(135deg, var(--green-soft), var(--green-faint));
    border: 0.0625rem solid var(--green-glow);
    border-radius: 50%;
}

.success-icon svg {
    width: 2rem;
    height: 2rem;
}

.success-icon::before {
    content: '';
    position: absolute;
    inset: -2.5rem;
    z-index: -1;
    border-radius: 50%;
    background: radial-gradient(circle, var(--green-glow) 0%, transparent 65%);
    filter: blur(0.75rem);
    animation: pulse-glow 3s ease-in-out infinite;
}

@keyframes pulse-glow {
    0%, 100% { transform: scale(1); opacity: 0.6; }
    50% { transform: scale(1.3); opacity: 1; }
}

.steps-page h1 {
    font-size: clamp(var(--type-2xl), 5vw, var(--type-5xl));
}

.next-steps-callout {
    width: calc(100% - 3rem);
    max-width: 42.5rem;
    display: flex;
    align-items: flex-start;
    gap: 0.75rem;
    margin: -1rem auto 3rem;
    padding: 1rem 1.25rem;
    color: var(--text-2);
    font-size: var(--type-base);
    line-height: 1.6;
    background: var(--accent-soft);
    border: 0.0625rem solid var(--accent-border);
    border-radius: 0.75rem;
}

.next-steps-callout svg {
    width: 1.25rem;
    height: 1.25rem;
    flex: 0 0 auto;
    margin-top: 0.1875rem;
    color: var(--accent);
}

.next-steps-callout strong {
    color: var(--text);
}

.steps {
    max-width: 42.5rem;
    margin: 0 auto;
    padding: 0 1.5rem;
    position: relative;
    z-index: 1;
    /* Sections hide per selection; hidden ones skip the counter */
    counter-reset: step;
}

.steps h2::before {
    counter-increment: step;
    content: counter(step) '. ';
}

.about-page .steps h2::before {
    content: none;
}

.steps > section {
    margin-bottom: 4rem;
}

.steps h2 {
    font-size: var(--type-lg);
    font-weight: 600;
    letter-spacing: -0.02em;
    margin-bottom: 1rem;
}

.steps p,
.steps li {
    color: var(--text-2);
    font-size: var(--type-base);
    line-height: 1.7;
}

.steps p {
    margin-bottom: 1rem;
}

.steps p:last-child {
    margin-bottom: 0;
}

.steps ul {
    list-style: none;
}

.steps li {
    margin-bottom: 0.5rem;
    padding-left: 1.5rem;
    position: relative;
}

.steps li::before {
    content: '❯';
    position: absolute;
    left: 0;
    color: var(--accent);
    font-family: var(--mono);
    font-size: var(--type-sm);
    top: 0.1875rem;
}

.steps li strong {
    color: var(--text);
    font-weight: 600;
}

.steps a {
    color: var(--text);
    text-decoration: underline;
    text-decoration-color: var(--text-3);
    text-underline-offset: 0.1875rem;
    transition: text-decoration-color 0.15s ease;
}

.steps a:hover {
    text-decoration-color: var(--text);
}

.steps pre {
    background: var(--surface);
    border: 0.0625rem solid var(--border);
    border-radius: 0.75rem;
    padding: 1rem 1.25rem;
    overflow-x: auto;
    margin: 1rem 0;
    scrollbar-color: transparent transparent;
    scrollbar-width: thin;
}

.steps pre:hover {
    scrollbar-color: var(--border-strong) transparent;
}

.steps pre::-webkit-scrollbar {
    width: 0.5rem;
    height: 0.5rem;
}

.steps pre::-webkit-scrollbar-thumb {
    background: transparent;
    border-radius: 999rem;
}

.steps pre:hover::-webkit-scrollbar-thumb {
    background: var(--border-strong);
}

.steps pre::-webkit-scrollbar-track {
    background: transparent;
}

.steps pre code {
    font-family: var(--mono);
    font-size: var(--type-sm);
    line-height: 1.7;
    color: var(--text);
    background: none;
    border: none;
    padding: 0;
}

.steps code {
    font-family: var(--mono);
    font-size: var(--type-sm);
    background: var(--surface);
    border: 0.0625rem solid var(--border);
    padding: 0.0625rem 0.375rem;
    border-radius: 0.375rem;
    color: var(--text);
}

.steps table {
    width: 100%;
    border-collapse: collapse;
    font-size: var(--type-sm);
    margin: 1rem 0;
}

.steps th,
.steps td {
    text-align: left;
    padding: 0.5rem 1rem 0.5rem 0;
}

.steps th {
    color: var(--text-3);
    font-family: var(--mono);
    font-size: var(--type-xs);
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.08em;
}

.steps td {
    color: var(--text-2);
}

/* Docs (docusaurus-style sidebar + prose) */
.docs-hero {
    padding-bottom: 2rem;
}

.docs-layout {
    display: grid;
    grid-template-columns: 13rem minmax(0, 1fr);
    gap: 4rem;
    align-items: start;
}

.docs-sidebar {
    position: sticky;
    top: 6rem;
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}

.docs-sidebar a {
    font-size: var(--type-sm);
    font-weight: 500;
    color: var(--text-2);
    text-decoration: none;
    padding: 0.375rem 0.75rem;
    border-radius: 0.5rem;
    transition: color 0.15s ease, background-color 0.15s ease;
}

.docs-sidebar a:hover {
    color: var(--text);
    background: var(--surface);
}

.docs-sidebar a:focus-visible {
    outline: 0.125rem solid var(--accent);
    outline-offset: 0.125rem;
}

.docs-content {
    max-width: none;
    margin: 0;
    padding: 0;
}

.docs-content section {
    scroll-margin-top: 6rem;
}

@media (max-width: 55rem) {
    .docs-layout {
        grid-template-columns: minmax(0, 1fr);
        gap: 2rem;
    }

    .docs-sidebar {
        position: static;
        flex-direction: row;
        flex-wrap: wrap;
        gap: 0.375rem;
    }

    .docs-sidebar a {
        background: var(--surface);
        border: 0.0625rem solid var(--border);
        border-radius: 62.4375rem;
        font-size: var(--type-sm);
    }
}

/* Shell syntax tokens (build.ts highlights static blocks, picker.js dynamic) */
.tok-cmd { color: var(--green); }
.tok-flag { color: var(--orange); }
.tok-url { color: var(--blue); }
.tok-pipe { color: var(--text-3); }
.tok-comment { color: var(--text-3); font-style: italic; }

/* 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;
    }

    .hero-logo {
        display: none;
    }
}
