/*
 * The free tools hubs, best-free lists and embeds (lane L10: site/pages/free-tools/index.php, hub-trade.php,
 * best-free.php, embed.php), after ft-base.css. Tokens only; every target 44 px or more; colour is never the only
 * signal (every cell says its words).
 *
 *   1. Hubs        .ft-hub-filter (+ __status), .ft-hub-group (+ __title), .ft-hub-list > .ft-hub-item (+ __links),
 *                  .ft-hub-names (a trade hub's tools for every trade, names only), .ft-hub__count, .ft-hub__empty
 *   2. Lists       .ft-best (the comparison table; rows stack on a phone), .ft-best__cell--pass/--fail/--unknown,
 *                  .ft-best-tool (+ __notes, __read)
 *   3. Embeds      .ft-embeds > .ft-embeds__item (the codes page); body.ft-embed (the framed page) + .ft-embed__credit
 *   4. Print
 */

/* =========================================================================
   1. Hubs
   ========================================================================= */
.ft-hub-filter {
    display: grid;
    gap: var(--sp-2);
    max-width: 30rem;
    margin-bottom: var(--sp-6);
}

.ft-hub-filter .input {
    min-height: 44px;
    font-size: var(--fs-base);
}

.ft-hub-filter__status {
    min-height: 1.5em;
    margin: 0;
    font-size: var(--fs-sm);
    color: var(--c-text-2);
}

/* the jumps to each job: plain links, two columns on a phone, one wrapping row where it fits */
.ft-hub-jump ul {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 0 var(--sp-4);
    margin: calc(-1 * var(--sp-3)) 0 var(--sp-6);
    padding: 0;
    list-style: none;
}

.ft-hub-jump a {
    display: flex;
    align-items: center;
    min-height: 44px;
    font-size: var(--fs-sm);
    font-weight: var(--fw-medium);
    color: var(--c-brand);
}

@media (min-width: 640px) {
    .ft-hub-jump ul {
        display: flex;
        flex-wrap: wrap;
        gap: 0 var(--sp-6);
    }
}

.ft-hub-list a.rel:focus-visible,
.ft-hub-names a:focus-visible,
.ft-hub-jump a:focus-visible {
    outline: none;
    border-radius: var(--r-sm);
    box-shadow: var(--focus-ring);
}

.ft-hub-group + .ft-hub-group {
    margin-top: var(--sp-8);
}

.ft-hub-group__title {
    margin: 0 0 var(--sp-3);
    font-size: var(--fs-lg);
    font-weight: var(--fw-semibold);
    color: var(--c-ink);
}

.ft-hub-list .rel {
    border-bottom: 0;
    height: auto;
}

.ft-hub-list > .ft-hub-item {
    border-bottom: 1px solid var(--c-line);
}

.ft-hub-list a.rel {
    min-height: 44px;
}

.ft-hub-item__links {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0 var(--sp-4);
    margin: calc(-1 * var(--sp-2)) 0 var(--sp-2);
    font-size: var(--fs-sm);
    color: var(--c-muted);
}

.ft-hub-item__links a {
    display: inline-flex;
    align-items: center;
    min-height: 44px;
    color: var(--c-brand);
}

.ft-hub-names {
    display: grid;
    gap: 0 var(--sp-6);
    margin: 0;
    padding: 0;
    list-style: none;
    border-top: 1px solid var(--c-line-strong);
}

.ft-hub-names a {
    display: flex;
    align-items: center;
    min-height: 44px;
    border-bottom: 1px solid var(--c-line);
    color: var(--c-ink);
}

.ft-hub-names a:hover {
    color: var(--c-brand);
}

@media (min-width: 640px) {
    .ft-hub-names { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (min-width: 1024px) {
    .ft-hub-names { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}

.ft-hub__count {
    font-weight: var(--fw-regular);
    color: var(--c-muted);
}

.ft-hub__shared-title {
    margin-top: var(--sp-12);
}

.ft-hub__empty {
    margin: var(--sp-4) 0 0;
    color: var(--c-text);
}

/* =========================================================================
   2. Lists
   ========================================================================= */
.ft-best-wrap {
    overflow-x: auto;
}

.ft-best {
    width: 100%;
    border-collapse: collapse;
    font-size: var(--fs-sm);
}

.ft-best caption {
    margin-bottom: var(--sp-3);
    text-align: left;
    color: var(--c-text-2);
}

.ft-best th,
.ft-best td {
    padding: var(--sp-3);
    text-align: left;
    vertical-align: top;
    border-bottom: 1px solid var(--c-line);
}

.ft-best thead th {
    font-weight: var(--fw-semibold);
    color: var(--c-ink);
    border-bottom-color: var(--c-line-strong);
}

.ft-best tbody th a {
    display: inline-flex;
    align-items: center;
    min-height: 44px;
    margin-block: calc(-1 * var(--sp-3));
    font-weight: var(--fw-semibold);
}

.ft-best__cell--pass {
    color: var(--c-success-ink);
}

.ft-best__cell--fail {
    color: var(--c-danger-ink);
}

.ft-best__cell--unknown {
    color: var(--c-muted);
}

/* a phone: one card per tool, each cell with its column's name */
@media (max-width: 767px) {
    .ft-best thead {
        position: absolute;
        width: 1px;
        height: 1px;
        overflow: hidden;
        clip: rect(0 0 0 0);
    }

    .ft-best tr {
        display: block;
        padding-block: var(--sp-2);
        border-bottom: 1px solid var(--c-line);
    }

    .ft-best th,
    .ft-best td {
        display: grid;
        grid-template-columns: minmax(0, 9rem) minmax(0, 1fr);
        gap: var(--sp-3);
        padding: var(--sp-1) 0;
        border: 0;
    }

    .ft-best tbody th {
        display: block;
    }

    .ft-best td::before {
        content: attr(data-label);
        color: var(--c-text-2);
    }
}

.ft-best-tool + .ft-best-tool {
    margin-top: var(--sp-8);
}

.ft-best-tool .ft-h3 a {
    display: inline-flex;
    align-items: center;
    min-height: 44px;
}

.ft-best-tool__notes {
    margin: var(--sp-2) 0;
    padding-left: 1.25em;
    list-style: disc;
}

.ft-best-tool__read {
    font-size: var(--fs-sm);
    color: var(--c-text-2);
}

/* =========================================================================
   3. Embeds
   ========================================================================= */
.ft-embeds {
    display: grid;
    gap: var(--sp-8);
    margin: 0;
    padding: 0;
    list-style: none;
}

@media (min-width: 960px) {
    .ft-embeds { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

.ft-embeds__item {
    display: grid;
    gap: var(--sp-2);
    align-content: start;
}

.ft-embeds__name {
    margin: 0;
    font-size: var(--fs-lg);
}

.ft-embeds__name a {
    display: inline-flex;
    align-items: center;
    min-height: 44px;
}

.ft-embeds__line {
    margin: 0;
    color: var(--c-text-2);
}

.ft-embeds__code {
    width: 100%;
    min-height: 6rem;
    font-family: var(--font-mono);
    font-size: var(--fs-sm);
    resize: vertical;
}

.ft-embeds__actions {
    display: flex;
    flex-wrap: wrap;
    gap: var(--sp-2);
}

.ft-embeds__actions .btn {
    min-height: 44px;
}

/* the framed page: the tool alone, no first-screen band, no bottom bar, no link to the framed address */
.ft-embed {
    background: var(--c-bg);
}

.ft-embed .ft-tool {
    padding-block: var(--sp-4);
}

.ft-embed .ft-bar,
.ft-embed .ft-calc__share,
.ft-embed [data-ft-link] {
    display: none !important;
}

.ft-embed__credit {
    margin: 0;
    padding: 0 var(--sp-4) var(--sp-4);
    font-size: var(--fs-sm);
    color: var(--c-text-2);
}

/* =========================================================================
   4. Print: the lists only
   ========================================================================= */
@media print {
    .ft-hub-filter,
    .ft-hub-jump,
    .ft-hub__empty,
    .ft-embeds__actions {
        display: none !important;
    }

    .ft-best td::before {
        content: none;
    }
}
