/* FileConvert — the /tools directory.

   Layered over stylesheets/theme.css: this file uses the shared components
   (.vhero, .fxtrio, .liftcard, .band, .catchips, .extgrid, .pairlink,
   .minilabel) and only adds what the directory itself needs. It never
   redefines a theme token.

   Every selector is namespaced .tools-* so it cannot collide with form.css,
   pages.css or chrome.css. Colours come from --t-* / --primary-* only, so the
   page follows data-theme="dark|light" without a second ruleset. The one
   exception is inside .vhero, which is a permanently dark surface and where
   literal light-on-dark values are the correct answer.

   The page lists ~950 links: density, alignment and legible hover states
   matter more than decoration. */

/* ------------------------------------------------------------------ *
 * Hero — dark, with the live filter living inside it
 * ------------------------------------------------------------------ */

.tools-vhero {
    padding-bottom: 190px;
}

/* Inline example tokens in the lede. Inside .vhero, so light-on-dark. */
.tools-hint {
    padding: 1px 7px;
    font-family: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, monospace;
    font-size: 0.88em;
    color: var(--n-100);
    background: rgba(255, 255, 255, 0.09);
    border: 1px solid rgba(255, 255, 255, 0.14);
    border-radius: var(--radius-sm);
    white-space: nowrap;
}

.tools-filter {
    position: relative;
    display: flex;
    align-items: center;
    max-width: 520px;
    margin: 26px auto 0;
}

@media (min-width: 1024px) {
    .tools-filter {
        margin-left: 0;
    }
}

.tools-filter__icon {
    position: absolute;
    left: 18px;
    font-size: 15px;
    color: var(--n-400);
    pointer-events: none;
}

.tools-filter__input {
    width: 100%;
    min-width: 0;
    padding: 15px 18px 15px 46px;
    font: inherit;
    font-size: 16px;
    color: var(--n-50);
    background: rgba(255, 255, 255, 0.06);
    border: 1px solid rgba(255, 255, 255, 0.16);
    border-radius: 999px;
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.05);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    transition: border-color 0.15s ease, box-shadow 0.15s ease, background-color 0.15s ease;
    -webkit-appearance: none;
    appearance: none;
}

.tools-filter__input::placeholder {
    color: var(--n-500);
}

.tools-filter__input:hover {
    border-color: rgba(255, 255, 255, 0.26);
}

.tools-filter__input:focus,
.tools-filter__input:focus-visible {
    outline: none;
    background: rgba(255, 255, 255, 0.10);
    border-color: var(--primary-400);
    box-shadow: 0 0 0 4px rgba(229, 50, 45, 0.30);
}

.tools-filter__help {
    max-width: 52ch;
    margin: 12px auto 0;
    font-size: 13px;
    color: var(--n-500);
}

@media (min-width: 1024px) {
    .tools-filter__help {
        margin-left: 0;
    }
}

/* ------------------------------------------------------------------ *
 * Family chips, in a card lifted over the hero's bottom edge
 * ------------------------------------------------------------------ */

.tools-jumpcard {
    width: min(100% - 48px, 1240px);
    margin: -140px auto 0;
    padding: 22px 24px 20px;
    text-align: left;
}

.tools-jumpcard__label {
    margin-bottom: 14px;
}

.tools-jumpcard__chips {
    margin-top: 0;
    gap: 8px 20px;
}

/* .catchip is authored as a button in theme.css; here it is a link. */
.tools-jumpcard .catchip {
    text-decoration: none;
    scroll-margin-top: 90px;
}

.tools-jumpcard .catchip:focus-visible {
    outline: 2px solid var(--primary-500);
    outline-offset: 3px;
    border-radius: var(--radius-sm);
}

@media (max-width: 640px) {
    .tools-jumpcard {
        width: min(100% - 24px, 1240px);
        margin-top: -120px;
        padding: 18px 16px 16px;
    }

    .tools-jumpcard__chips {
        gap: 6px 14px;
    }
}

/* ------------------------------------------------------------------ *
 * Shared section rhythm
 * ------------------------------------------------------------------ */

.tools-popular,
.tools-all,
.tools-formats {
    padding-top: 56px;
}

.tools-popular {
    padding-top: 48px;
}

.tools-cta {
    padding-top: 8px;
}

/* The band rules that separate the three big blocks. */
.tools-all + .band__rule,
.tools-formats + .band__rule {
    margin: 56px auto;
}

/* ------------------------------------------------------------------ *
 * Most popular — copy on the left, pair links on the right
 * ------------------------------------------------------------------ */

.tools-popular__grid {
    align-items: start;
}

.tools-popular__list {
    padding-top: 2px;
}

.tools-popular .pairlink {
    text-decoration: none;
}

.tools-popular .pairlink:focus-visible {
    outline: 2px solid var(--primary-500);
    outline-offset: 3px;
    border-radius: var(--radius-sm);
}

/* Two columns of pair links once there is room, so twelve links do not
   turn into a very tall stack next to a short block of copy. */
@media (min-width: 560px) {
    .tools-popular__list .pairlink {
        display: inline-block;
        width: calc(50% - 8px);
        margin: 0 4px 14px;
        vertical-align: top;
    }

    .tools-popular__list .pairlink + .pairlink {
        margin-top: 0;
    }
}

@media (min-width: 1024px) {
    .tools-popular__list .pairlink {
        display: block;
        width: auto;
        margin: 0;
    }

    .tools-popular__list .pairlink + .pairlink {
        margin-top: 10px;
    }
}

/* ------------------------------------------------------------------ *
 * Family sections + the dense pair grid
 * ------------------------------------------------------------------ */

.tools-list {
    margin-top: 28px;
}

.tools-empty {
    padding: 22px 20px;
    margin: 0 0 24px;
    font-size: 15px;
    color: var(--t-muted);
    text-align: center;
    background: var(--t-elevated);
    border: 1px dashed var(--t-border-strong);
    border-radius: var(--radius-xl);
}

.tools-empty strong {
    color: var(--t-highlighted);
    font-weight: 600;
}

.tools-family {
    padding-top: 28px;
    margin-top: 28px;
    border-top: 1px solid var(--t-border);
    /* Room for the sticky site header when an anchor jump lands here. */
    scroll-margin-top: calc(var(--header-h, 64px) + 24px);
}

.tools-family:first-of-type {
    padding-top: 0;
    margin-top: 0;
    border-top: 0;
}

.tools-family__label {
    margin-bottom: 6px;
}

.tools-family__name {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    font-size: 12px;
    letter-spacing: 0.1em;
    color: var(--t-highlighted);
}

.tools-family__name i {
    font-size: 12px;
}

.tools-family__count {
    font-variant-numeric: tabular-nums;
}

.tools-family__blurb {
    max-width: 60ch;
    margin: 0 0 14px;
    font-size: 14px;
    line-height: 1.6;
    color: var(--t-muted);
}

.tools-pairgrid {
    margin: 0;
    padding: 0;
    list-style: none;
    gap: 6px;
}

.tools-pairgrid--more {
    margin-top: 8px;
}

.tools-pair {
    min-width: 0;
}

/* .extchip supplies the surface; the pair adds the arrow and the emphasis
   split between source and target. */
.tools-pair__link {
    gap: 6px;
    min-height: 30px;
    padding: 5px 10px;
    text-decoration: none;
    border: 1px solid var(--t-border);
    color: var(--t-default);
    transition: color 0.13s ease, background-color 0.13s ease, border-color 0.13s ease;
}

.tools-pair__to {
    color: var(--t-highlighted);
    font-weight: 600;
}

.tools-pair__arrow {
    flex: none;
    font-size: 9px;
    color: var(--t-dimmed);
    transition: color 0.13s ease;
}

.tools-pair__link:hover,
.tools-pair__link:focus-visible {
    background: var(--brand-tint);
    border-color: var(--brand-ring);
    color: var(--primary-600);
}

.tools-pair__link:hover .tools-pair__to,
.tools-pair__link:focus-visible .tools-pair__to,
.tools-pair__link:hover .tools-pair__arrow,
.tools-pair__link:focus-visible .tools-pair__arrow {
    color: var(--primary-600);
}

.tools-pair__link:focus-visible {
    outline: 2px solid var(--primary-500);
    outline-offset: 2px;
}

:root[data-theme="dark"] .tools-pair__link:hover,
:root[data-theme="dark"] .tools-pair__link:focus-visible,
:root[data-theme="dark"] .tools-pair__link:hover .tools-pair__to,
:root[data-theme="dark"] .tools-pair__link:hover .tools-pair__arrow {
    color: var(--primary-300);
}

@media (prefers-color-scheme: dark) {
    :root:not([data-theme="light"]) .tools-pair__link:hover,
    :root:not([data-theme="light"]) .tools-pair__link:focus-visible,
    :root:not([data-theme="light"]) .tools-pair__link:hover .tools-pair__to,
    :root:not([data-theme="light"]) .tools-pair__link:hover .tools-pair__arrow {
        color: var(--primary-300);
    }
}

/* The JS filter hides non-matching pairs and then whole empty families. */
.tools-pair[hidden],
.tools-family[hidden] {
    display: none !important;
}

/* ------------------------------------------------------------------ *
 * "Show the remaining N" disclosure — plain <details>, no JS
 * ------------------------------------------------------------------ */

.tools-more {
    margin-top: 12px;
}

.tools-more__summary {
    display: inline-flex;
    align-items: center;
    gap: 9px;
    padding: 7px 14px;
    font-size: 12.5px;
    font-weight: 600;
    color: var(--t-muted);
    list-style: none;
    cursor: pointer;
    background: var(--t-elevated);
    border: 1px solid var(--t-border);
    border-radius: 999px;
    transition: border-color 0.15s ease, color 0.15s ease, background-color 0.15s ease;
}

.tools-more__summary::-webkit-details-marker {
    display: none;
}

.tools-more__summary:hover {
    color: var(--t-highlighted);
    background: var(--t-accented);
    border-color: var(--t-border-strong);
}

.tools-more__summary:focus-visible {
    outline: 2px solid var(--primary-500);
    outline-offset: 2px;
}

.tools-more__chevron {
    font-size: 10px;
    color: var(--t-dimmed);
    transition: transform 0.15s ease;
}

.tools-more[open] .tools-more__chevron {
    transform: rotate(180deg);
}

.tools-more[open] .tools-more__summary {
    margin-bottom: 4px;
}

/* ------------------------------------------------------------------ *
 * Start from a format
 * ------------------------------------------------------------------ */

.tools-srcfamily {
    margin-top: 34px;
}

.tools-srcfamily:first-of-type {
    margin-top: 26px;
}

.tools-srcfamily__label span:first-child {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    color: var(--t-highlighted);
}

.tools-srcgrid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(min(100%, 250px), 1fr));
    gap: 12px;
    margin: 0;
    padding: 0;
    list-style: none;
}

.tools-src {
    min-width: 0;
    padding: 14px 16px;
    background: var(--t-surface);
    border: 1px solid var(--t-border);
    border-radius: var(--radius-xl);
    transition: border-color 0.15s ease;
}

.tools-src:hover {
    border-color: var(--t-border-strong);
}

.tools-src__title {
    display: flex;
    flex-wrap: wrap;
    align-items: baseline;
    gap: 7px;
    margin: 0 0 10px;
    font-size: 14px;
    font-weight: 700;
    color: var(--t-highlighted);
}

.tools-src__ext {
    font-family: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, monospace;
    font-size: 11.5px;
    font-weight: 400;
    color: var(--t-dimmed);
}

.tools-src__targets {
    margin: 0;
    padding: 0;
    list-style: none;
}

.tools-src__targets .extchip {
    text-decoration: none;
}

.tools-src__targets .extchip:focus-visible {
    outline: 2px solid var(--primary-500);
    outline-offset: 2px;
}

/* ------------------------------------------------------------------ *
 * Closing CTA
 * ------------------------------------------------------------------ */

.tools-cta__band {
    padding: 40px 30px;
    text-align: center;
    background: var(--t-elevated);
    border: 1px solid var(--t-border);
    border-radius: var(--radius-2xl);
}

.tools-cta__title {
    margin: 0;
    font-size: 26px;
    font-weight: 700;
    line-height: 1.25;
    letter-spacing: -0.01em;
    color: var(--t-highlighted);
}

.tools-cta__text {
    max-width: 52ch;
    margin: 12px auto 0;
    font-size: 15px;
    line-height: 1.65;
    color: var(--t-muted);
}

.tools-cta__actions {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    justify-content: center;
    margin: 22px 0 0;
}

/* ------------------------------------------------------------------ *
 * Responsive — nothing here may cause horizontal page scroll
 * ------------------------------------------------------------------ */

@media (max-width: 760px) {
    .tools-vhero {
        padding-bottom: 170px;
    }

    .tools-popular,
    .tools-all,
    .tools-formats {
        padding-top: 40px;
    }

    .tools-cta__title {
        font-size: 22px;
    }

    .tools-cta__band {
        padding: 30px 20px;
    }
}

@media (max-width: 480px) {
    .tools-filter__input {
        padding: 13px 16px 13px 42px;
        font-size: 16px;
    }

    .tools-pairgrid {
        gap: 5px;
    }

    .tools-pair__link {
        padding: 5px 8px;
        font-size: 10.5px;
    }

    .tools-family {
        padding-top: 22px;
        margin-top: 22px;
    }

    .tools-srcgrid {
        grid-template-columns: 1fr;
    }
}

@media (prefers-reduced-motion: reduce) {
    .tools-pair__link,
    .tools-more__chevron,
    .tools-src,
    .tools-filter__input {
        transition: none;
    }
}
