.home-page {
    --home-gutter: 22px;
}

.home-page .home-discovery {
    --home-new-bg: #e2f3e9;
    --home-new-text: #1b6948;
    --home-gap: 14px;
    --home-columns: 3;
    background: var(--shell-bg);
    color: var(--shell-text);
    color-scheme: light;
}

html.dark-mode .home-page .home-discovery {
    --home-new-bg: #214036;
    --home-new-text: #95e5b9;
    color-scheme: dark;
}

.home-page .home-width {
    inline-size: min(1112px, calc(100% - 2 * var(--home-gutter)));
    margin-inline: auto;
}

.home-page .home-discovery :is(a, button, select):focus-visible {
    outline: 2px solid var(--shell-focus);
    outline-offset: 2px;
}

.home-page .home-hero {
    padding-block: 59px 40px;
    text-align: center;
}

.home-page .home-hero__title {
    margin: 0;
    color: var(--shell-text);
    font-size: clamp(2.125rem, 4.5vw, 3rem);
    font-weight: 720;
    line-height: 1.12;
    text-wrap: balance;
    overflow-wrap: anywhere;
}

.home-page .home-hero__title:dir(ltr) {
    letter-spacing: -0.034em;
}

.home-page .home-hero__intro {
    max-inline-size: 670px;
    margin: 16px auto 28px;
    color: var(--shell-muted);
    font-size: 0.9375rem;
    line-height: 1.7;
    text-wrap: pretty;
}

.home-page .home-hero__stats {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 0.375rem 1.25rem;
    margin: 19px 0 0;
    color: var(--shell-muted);
    font-size: 0.75rem;
}

.home-page .home-hero__stat,
.home-page .home-hero__stat dt {
    display: inline-flex;
    align-items: center;
    gap: 0.375rem;
}

.home-page .home-hero__stat svg {
    flex: none;
    color: var(--shell-accent);
}

.home-page .home-hero__stat dd {
    margin: 0;
    color: var(--shell-text);
    font-variant-numeric: tabular-nums;
    font-weight: 690;
}

.home-page .home-tool-search {
    position: relative;
    z-index: 2;
    inline-size: min(100%, 790px);
    margin-inline: auto;
    text-align: start;
}

.home-page .home-tool-search__field {
    display: flex;
    align-items: center;
    gap: 13px;
    min-block-size: 60px;
    padding-inline: 17px;
    border: 1px solid var(--shell-control-border);
    border-radius: 13px;
    background: var(--shell-surface);
}

.home-page .home-tool-search__field:focus-within {
    border-color: var(--shell-focus);
    box-shadow: 0 0 0 3px color-mix(in srgb, var(--shell-focus) 16%, transparent);
}

.home-page .home-tool-search__icon {
    flex: none;
    color: var(--shell-accent);
}

.home-page .home-tool-search__input {
    flex: 1;
    min-inline-size: 0;
    min-block-size: 56px;
    padding: 0;
    border: 0;
    outline: none;
    background: transparent;
    color: var(--shell-text);
    caret-color: var(--shell-focus);
    font: inherit;
    font-size: 0.9375rem;
}

.home-page .home-tool-search__input::placeholder {
    color: var(--shell-muted-dim);
    opacity: 1;
}

.home-page .home-tool-search__input:focus {
    box-shadow: none;
}

/* Discoverable desktop shortcut; decorative keycaps never intercept the search. */
.home-page .home-tool-search__shortcut {
    display: inline-flex;
    flex: none;
    align-items: center;
    gap: 6px;
    white-space: nowrap;
    user-select: none;
    pointer-events: none;
}

.home-page .home-tool-search__shortcut-key {
    display: inline-grid;
    place-items: center;
    min-inline-size: 27px;
    block-size: 26px;
    padding-inline: 7px;
    border: 1px solid var(--shell-border);
    border-radius: 6px;
    background: var(--shell-surface-soft);
    box-shadow: 0 1px 0 var(--shell-control-border);
    color: var(--shell-muted);
    font-family: inherit;
    font-size: 0.75rem;
    font-weight: 650;
    line-height: 1;
}

.home-page .home-tool-search__shortcut-plus {
    color: var(--shell-muted-dim);
    font-size: 0.8125rem;
    font-weight: 650;
    line-height: 1;
}

@media (max-width: 780px), (hover: none) and (pointer: coarse) {
    .home-page .home-tool-search__shortcut {
        display: none;
    }
}

.home-page .home-tool-search__dropdown {
    position: absolute;
    inset-block-start: calc(100% + 8px);
    inset-inline: 0;
    max-block-size: 370px;
    max-block-size: min(370px, 48dvh);
    overflow: auto;
    overscroll-behavior: contain;
    padding: 7px;
    border: 1px solid var(--shell-border);
    border-radius: 12px;
    background: var(--shell-surface);
    box-shadow: 0 16px 36px rgb(12 23 27 / 24%);
}

.home-page .home-tool-search__results {
    margin: 0;
    padding: 0;
    list-style: none;
}

.home-page .home-tool-search__result-link {
    display: grid;
    gap: 0.25rem;
    min-block-size: 48px;
    padding: 0.625rem 0.75rem;
    border-radius: 8px;
    color: var(--shell-text);
    text-align: start;
    text-decoration: none;
    overflow-wrap: anywhere;
}

.home-page .home-tool-search__result-link:is(:hover, :focus-visible) {
    background: var(--shell-hover);
    color: var(--shell-text);
    outline-offset: -2px;
}

.home-page .home-tool-search__result-heading {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.25rem 0.5rem;
}

.home-page .home-tool-search__result-title {
    font-size: 0.875rem;
    font-weight: 690;
}

.home-page :is(.home-tool-search__result-category, .home-tool-search__result-description, .home-tool-search__empty) {
    color: var(--shell-muted);
    font-size: 0.8125rem;
}

.home-page .home-tool-search__result-category {
    color: var(--shell-accent);
    font-size: 0.75rem;
}

.home-page .home-tool-search__empty {
    margin: 0;
    padding: 0.75rem;
    text-align: start;
}

.home-page .home-catalog {
    padding-block: 5px clamp(3rem, 6vw, 5rem);
    text-align: start;
}

.home-page .home-catalog__heading {
    display: flex;
    flex-wrap: wrap;
    align-items: baseline;
    justify-content: space-between;
    gap: 0.25rem 1rem;
    margin-block-end: 15px;
}

.home-page .home-catalog__heading h2 {
    margin: 0;
    color: var(--shell-text);
    font-size: 1.3125rem;
    font-weight: 760;
    line-height: 1.25;
    overflow-wrap: anywhere;
}

.home-page .home-catalog__summary {
    margin: 0;
    color: var(--shell-muted-dim);
    font-size: 0.75rem;
    font-variant-numeric: tabular-nums;
}

.home-page .tool-category-filter {
    margin-block-end: 22px;
}

.home-page .tool-category-filter__buttons {
    display: flex;
    flex-wrap: wrap;
    gap: 7px;
}

.home-page .tool-category-filter__button {
    display: inline-flex;
    align-items: center;
    gap: 0.375rem;
    max-inline-size: 100%;
    min-block-size: 38px;
    padding: 0.5rem 0.75rem;
    border: 1px solid var(--shell-border);
    border-radius: 999px;
    background: var(--shell-surface-soft);
    color: var(--shell-muted);
    font: inherit;
    font-size: 0.78125rem;
    font-weight: 650;
    line-height: 1.24;
    text-align: start;
    overflow-wrap: anywhere;
    cursor: pointer;
}

.home-page .tool-category-filter__button:hover {
    border-color: var(--shell-accent);
    color: var(--shell-text);
}

.home-page .tool-category-filter__button[aria-pressed="true"] {
    border-color: color-mix(in srgb, var(--shell-accent) 60%, var(--shell-border));
    background: var(--shell-accent-soft);
    color: var(--shell-accent);
}

.home-page .tool-category-filter__count {
    font-size: 0.6875rem;
    font-variant-numeric: tabular-nums;
}

.home-page .tool-category-filter__mobile {
    display: none;
    align-items: center;
    gap: 0.625rem;
}

.home-page .tool-category-filter__mobile label {
    flex: 0 1 auto;
    max-inline-size: 40%;
    color: var(--shell-muted);
    font-size: 0.75rem;
    font-weight: 650;
    overflow-wrap: anywhere;
}

.home-page .tool-category-filter__mobile select {
    flex: 1;
    min-inline-size: 0;
    min-block-size: 46px;
    padding: 0.5rem 0.625rem;
    border: 1px solid var(--shell-control-border);
    border-radius: 9px;
    background: var(--shell-surface);
    color: var(--shell-text);
    font: inherit;
    font-size: 1rem;
}

.home-page .tool-category-grid {
    display: grid;
    grid-template-columns: repeat(var(--home-columns), minmax(0, 1fr));
    align-items: start;
    gap: var(--home-gap);
    max-inline-size: none;
}

.home-page .home-catalog .tool-category-card {
    display: block;
    min-inline-size: 0;
    margin: 0;
    padding: 16px 15px 13px;
    border: 1px solid var(--shell-border);
    border-radius: 14px;
    background: var(--shell-surface);
    color: var(--shell-text);
    box-shadow: none;
}

.home-page .tool-category-card[hidden],
.home-page .tool-category-filter[hidden],
.home-page .home-tool-search [hidden] {
    display: none;
}

/* Balanced CSS columns flow in DOM order without moving focused links. */
@supports (column-count: 2) and (break-inside: avoid) {
    .home-page .tool-category-grid {
        display: block;
        column-count: var(--home-columns);
        column-gap: var(--home-gap);
    }

    .home-page .home-catalog .tool-category-card {
        break-inside: avoid;
        margin-block-end: var(--home-gap);
    }
}

.home-page .tool-category-grid.is-single-category {
    --home-columns: 1;
    max-inline-size: 860px;
    margin-inline: auto;
}

.home-page .tool-category-grid.is-single-category .tool-category-card__tool-list {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 3px 15px;
}

.home-page .tool-category-card__header {
    margin-block-end: 8px;
    padding-block-end: 10px;
    border-block-end: 1px solid var(--shell-border-soft);
}

.home-page .tool-category-card__title {
    color: var(--shell-text);
    font-size: 0.875rem;
    font-weight: 740;
    line-height: 1.3;
}

.home-page .tool-category-card__title-link {
    display: flex;
    gap: 8px;
    min-block-size: 32px;
    border-radius: 7px;
    text-align: start;
}

.home-page .tool-category-card__title-link:is(:hover, :focus-visible) {
    color: var(--shell-accent);
}

.home-page .home-catalog__category-icon {
    display: grid;
    flex: none;
    place-items: center;
    inline-size: 30px;
    block-size: 30px;
    border-radius: 9px;
    background: var(--shell-surface-raised);
    color: var(--shell-accent);
}

.home-page .home-catalog__category-name {
    flex: 1;
    min-inline-size: 0;
    overflow-wrap: anywhere;
}

.home-page .home-catalog__category-count {
    min-inline-size: 24px;
    padding: 3px 6px;
    border-radius: 5px;
    background: var(--shell-surface-raised);
    color: var(--shell-muted);
    font-size: 0.6875rem;
    font-variant-numeric: tabular-nums;
    font-weight: 650;
    text-align: center;
}

.home-page .tool-category-card__tool-list {
    display: flex;
    gap: 1px;
}

.home-page .tool-category-card .tool-link {
    gap: 8px;
    min-block-size: 40px;
    padding: 0.4rem 0.5rem;
    border: 0;
    border-radius: 7px;
    background: transparent;
    color: var(--shell-text);
}

.home-page .tool-category-card .tool-link:is(:hover, :focus-visible) {
    background: var(--shell-hover);
    color: var(--shell-text);
}

.home-page .tool-category-card .tool-link-label {
    font-size: 0.8375rem;
    font-weight: 570;
    line-height: 1.48;
}

.home-page :is(.tool-link-icon, .tool-category-card__title-icon) {
    flex: none;
    color: var(--shell-muted-dim);
}

.home-page .home-discovery .tool-badge {
    flex: 0 0 auto;
    max-inline-size: 45%;
    min-block-size: 0;
    padding: 3px 5px;
    border: 0;
    border-radius: 5px;
    background: var(--shell-accent-soft);
    color: var(--shell-accent);
    font-size: 0.625rem;
    line-height: 1.2;
    text-align: center;
    overflow-wrap: anywhere;
}

.home-page .home-discovery .tool-badge--new {
    background: var(--home-new-bg);
    color: var(--home-new-text);
}

.home-page .home-about {
    padding-block: clamp(2.5rem, 5vw, 3.875rem);
    border-block: 1px solid var(--shell-border-soft);
    background: var(--shell-surface-raised);
    color: var(--shell-text);
    scroll-margin-block-start: var(--site-nav-height);
}

.home-about__lead {
    display: grid;
    grid-template-columns: minmax(0, .88fr) minmax(0, 1.15fr);
    align-items: start;
    gap: 14px clamp(24px, 5vw, 70px);
    margin-block-end: 34px;
}

.home-about :is(h2, h3, p) {
    margin: 0;
    text-align: start;
    overflow-wrap: anywhere;
}

.home-about :is(h2, h3) {
    color: var(--shell-text);
}

.home-about__lead h2 {
    max-inline-size: 22ch;
    font-size: clamp(1.5rem, 2.6vw, 2rem);
    font-weight: 740;
    line-height: 1.25;
    text-wrap: balance;
}

.home-about p {
    color: var(--shell-muted);
    font-size: 0.875rem;
    font-weight: 400;
    line-height: 1.75;
}

.home-about__copy {
    max-inline-size: 65ch;
}

.home-about__copy p + p {
    margin-block-start: 12px;
}

.home-about__benefits {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: clamp(18px, 2.5vw, 28px);
}

.home-about__benefit,
.home-about__closing {
    padding-block-start: 18px;
    border-block-start: 1px solid var(--shell-border);
}

.home-about__benefit svg {
    margin-block-end: 8px;
    color: var(--shell-accent);
}

.home-about__benefit h3,
.home-about__closing h3 {
    margin-block-end: 6px;
    font-size: 0.9375rem;
    line-height: 1.35;
}

.home-about__benefit p {
    max-inline-size: 42ch;
    font-size: 0.8125rem;
}

.home-about__closing {
    display: grid;
    grid-template-columns: minmax(0, .27fr) minmax(0, 1fr);
    gap: 4px 24px;
    margin-block-start: 28px;
}

.home-about__closing p {
    max-inline-size: 75ch;
    font-size: 0.8125rem;
}

.home-about__closing a {
    color: var(--shell-accent);
    text-decoration: underline;
    text-underline-offset: 2px;
}

.home-about__closing a:focus-visible {
    outline: 2px solid var(--shell-focus);
    outline-offset: 2px;
}

@media (max-width: 1050px) {
    .home-page .home-discovery {
        --home-columns: 2;
    }
}

@media (max-width: 780px) {
    .home-page {
        --home-gutter: 17px;
    }

    .home-about__lead,
    .home-about__closing {
        grid-template-columns: minmax(0, 1fr);
    }

    .home-about__lead h2 {
        max-inline-size: 32ch;
    }

    .home-page .home-hero {
        padding-block: 45px 34px;
    }

    .home-page .home-hero__title {
        font-size: 2.3125rem;
    }

    .home-page .home-hero__intro {
        font-size: 0.875rem;
    }

    .home-page .home-catalog {
        padding-block-start: 0;
    }

    .home-page .tool-category-filter__buttons:not(:focus-within) {
        display: none;
    }

    .home-page .tool-category-filter__mobile {
        display: flex;
    }
}

/* Keep the old control focusable until the media query listener transfers focus. */
.home-page .tool-category-filter__mobile:focus-within {
    display: flex;
}

@media (max-width: 585px) {
    .home-page .home-discovery {
        --home-columns: 1;
        --home-gap: 12px;
    }

    .home-page .home-hero {
        padding-block: 38px 26px;
    }

    .home-page .home-hero__title {
        font-size: 1.875rem;
    }

    .home-page .home-hero__intro {
        margin-block: 11px 19px;
        font-size: 0.8125rem;
    }

    .home-page .home-tool-search__field {
        min-block-size: 56px;
        padding-inline: 14px;
        gap: 10px;
    }

    .home-page .home-tool-search__input {
        min-block-size: 52px;
        font-size: 1rem;
    }

    .home-page .home-hero__stats {
        margin-block-start: 14px;
    }

    .home-page .home-catalog__heading {
        margin-block-end: 12px;
    }

    .home-page .home-catalog__heading h2 {
        font-size: 1.1875rem;
    }

    .home-page .tool-category-filter {
        margin-block-end: 16px;
    }

    .home-page .home-catalog .tool-category-card {
        padding: 15px 14px 13px;
    }

    .home-page .tool-category-grid.is-single-category .tool-category-card__tool-list {
        display: flex;
    }

    .home-about__benefits {
        grid-template-columns: minmax(0, 1fr);
    }

    .home-about__lead {
        margin-block-end: 24px;
    }
}

@media (max-width: 360px) {
    .home-page {
        --home-gutter: 13px;
    }

    .home-page .home-hero__title {
        font-size: 1.8125rem;
    }
}

@media (any-pointer: coarse) {
    .home-page .tool-category-card :is(.tool-link, .tool-category-card__title-link),
    .home-page .tool-category-filter__button {
        min-block-size: 44px;
    }
}

@media (prefers-reduced-motion: reduce) {
    .home-page .home-discovery :is(h1, h2, h3, p, a, button, input, select) {
        transition: none;
    }
}

@media (forced-colors: active) {
    .home-page .home-tool-search__field:focus-within {
        outline: 2px solid Highlight;
        outline-offset: 2px;
    }
}

/* Category search and tool descriptions */
.home-page .home-catalog .tool-category-card__header {
    display: flex;
    align-items: center;
    gap: 6px;
}

.home-page .home-catalog .tool-category-card__title {
    flex: 1;
    min-inline-size: 0;
}

.home-page .home-catalog__icon-button {
    display: grid;
    flex: none;
    place-items: center;
    min-inline-size: 40px;
    min-block-size: 40px;
    padding: 0;
    border: 1px solid transparent;
    border-radius: 8px;
    background: transparent;
    color: var(--shell-muted);
    cursor: pointer;
    touch-action: manipulation;
}

.home-page .home-catalog__icon-button:is(:hover, :focus-visible) {
    background: var(--shell-hover);
    color: var(--shell-accent);
}

.home-page .home-catalog__icon-button[aria-expanded="true"] {
    border-color: color-mix(in srgb, var(--shell-accent) 60%, var(--shell-border));
    background: var(--shell-accent-soft);
    color: var(--shell-accent);
}

.home-page .home-catalog__icon-button[aria-expanded="false"] .home-catalog__close-icon,
.home-page .home-catalog__icon-button[aria-expanded="true"] .home-catalog__open-icon,
.home-page .home-catalog [hidden],
.home-page .home-catalog .tool-category-card__tool-list[hidden],
.home-page .home-tool-tooltip[hidden] {
    display: none;
}

/* Reserve control geometry until the deferred homepage scripts initialize. */
.js-enabled.no-transition .home-page :is(.home-tool-search, .tool-category-filter)[hidden] {
    display: block;
    visibility: hidden;
}

.js-enabled.no-transition .home-page [data-local-search-toggle][hidden] {
    display: grid;
    visibility: hidden;
}

@media (any-pointer: coarse), (hover: none) {
    .js-enabled.no-transition .home-page [data-tool-preview-toggle][hidden] {
        display: grid;
        visibility: hidden;
    }
}

/* Breaks from the previous layout stop applying as soon as the viewport changes. */
@media (width > 1050px) {
    .home-page .tool-category-grid[data-pinned-columns="3"] .home-column-start {
        break-before: column;
    }
}

@media (585px < width <= 1050px) {
    .home-page .tool-category-grid[data-pinned-columns="2"] .home-column-start {
        break-before: column;
    }
}

.home-page .home-category-search {
    margin-block-end: 8px;
}

.home-page .home-category-search__field {
    display: flex;
    align-items: center;
    gap: 8px;
    padding-inline: 10px;
    border: 1px solid var(--shell-control-border);
    border-radius: 9px;
    background: var(--shell-surface-soft);
    color: var(--shell-accent);
}

.home-page .home-category-search__field:focus-within {
    outline: 2px solid var(--shell-focus);
    outline-offset: 1px;
}

.home-page .home-category-search__field svg {
    flex: none;
}

.home-page .home-category-search__field input {
    flex: 1;
    min-inline-size: 0;
    min-block-size: 42px;
    padding: 0;
    border: 0;
    outline: none;
    background: transparent;
    box-shadow: none;
    color: var(--shell-text);
    font: inherit;
    font-size: 0.875rem;
}

.home-page .home-category-search__field input::placeholder {
    color: var(--shell-muted-dim);
}

.home-page .home-category-search__status {
    margin: 6px 2px 0;
    color: var(--shell-muted);
    font-size: 0.75rem;
    text-align: start;
}

.home-page .home-category-search__empty {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 6px 12px;
    margin-block-start: 8px;
    padding: 8px 10px;
    border-radius: 9px;
    background: var(--shell-surface-soft);
}

.home-page .home-category-search__empty p {
    margin: 0;
    color: var(--shell-muted);
    font-size: 0.8125rem;
    text-align: start;
}

.home-page .home-category-search__reset {
    min-block-size: 44px;
    padding: 4px 6px;
    border: 0;
    border-radius: 6px;
    background: transparent;
    color: var(--shell-accent);
    font: inherit;
    font-size: 0.8125rem;
    font-weight: 650;
    text-align: start;
    text-decoration: underline;
    cursor: pointer;
}

.home-page .home-tool-row {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    align-items: start;
}

.home-page .home-tool-row .tool-link {
    min-inline-size: 0;
}

.home-page .home-tool-info {
    margin-inline-start: 3px;
}

.home-page .home-tool-context {
    display: block;
    margin-block-start: 3px;
    color: var(--shell-muted);
    font-size: 0.75rem;
    font-weight: 400;
    overflow-wrap: anywhere;
}

.home-page .home-tool-row mark {
    padding-inline: 1px;
    border-radius: 3px;
    background: var(--shell-accent-soft);
    color: var(--shell-accent);
    box-decoration-break: clone;
    font-weight: 680;
}

.home-page .home-tool-tooltip,
.home-page .home-tool-description {
    border: 1px solid var(--shell-border);
    border-radius: 9px;
    background: var(--shell-surface-raised);
    color: var(--shell-text);
    font-size: 0.8125rem;
    line-height: 1.55;
    text-align: start;
    overflow-wrap: anywhere;
}

.home-page .home-tool-description {
    grid-column: 1 / -1;
    margin: 3px 0 6px;
    padding: 8px 10px;
    color: var(--shell-muted);
}

.home-page .home-tool-tooltip {
    position: fixed;
    z-index: 5;
    inline-size: min(340px, calc(100vw - 28px));
    max-block-size: calc(100vh - 16px);
    max-block-size: calc(100dvh - 16px);
    overflow: auto;
    padding: 10px 12px;
    box-shadow: 0 8px 22px rgb(12 23 27 / 22%);
}

.home-page .home-tool-tooltip p {
    margin: 4px 0 0;
    color: var(--shell-muted);
    font-size: inherit;
    text-align: start;
}

@media (max-width: 585px), (any-pointer: coarse), (hover: none) {
    .home-page .home-catalog__icon-button {
        min-inline-size: 44px;
        min-block-size: 44px;
    }

    .home-page .home-category-search__field input {
        min-block-size: 44px;
        font-size: 1rem;
    }
}

@media (prefers-reduced-motion: reduce) {
    .home-page :is(.home-catalog__icon-button, .home-category-search__reset) {
        transition: none;
    }
}
