/*
 * The text family (TOOLS-PLAN 3.2 "Text", site/pages/free-tools/text.php, assets/js/ft/text.js), after ft-base.css and
 * ft-calc.css (fields, units, errors). Tokens only.
 *
 *   .ft-text > .ft-text__inputs (.ft-text__head, .ft-text__actions, .ft-text__note, .ft-text__grid > .ft-text__field
 *              (--wide), .ft-text__checks, .ft-text__save)
 *            + .ft-text__outputs (.ft-text__out > .ft-text__out-head, .ft-text__box, .ft-text__state, .ft-text__buttons;
 *              .ft-text__out--list > .ft-text__list > .ft-text__item, .ft-text__short, .ft-text__links; .ft-text__ai)
 *   .ft-text__sample, .ft-text__sample-list   the worked example's texts
 * Desktop (960 px and wider): the fields and the texts side by side, half and half. Phone: the texts follow the fields.
 * Every target is 44 px or more; fields and the text boxes are 16 px so a phone does not zoom in. Boxes keep their size
 * from the first paint (the server fills them), so nothing moves when the script starts.
 */
.ft-text {
    display: grid;
    gap: var(--sp-5);
    align-items: start;
}

@media (min-width: 960px) {
    .ft-text {
        grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
        gap: var(--sp-8);
    }
}

.ft-text__inputs,
.ft-text__outputs {
    display: grid;
    gap: var(--sp-4);
    min-width: 0;
    padding: var(--sp-4);
    border: 1px solid var(--c-line);
    border-radius: var(--r-lg);
}

@media (min-width: 640px) {
    .ft-text__inputs,
    .ft-text__outputs { padding: var(--sp-6); }
}

.ft-text__inputs { background: var(--c-surface); }
.ft-text__outputs { background: var(--c-surface-2); }

.ft-text__head {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: var(--sp-2) var(--sp-4);
}

.ft-text__title {
    margin: 0;
    font-size: var(--fs-lg);
    font-weight: var(--fw-bold);
    color: var(--c-ink);
}

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

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

.ft-text__note,
.ft-text__state,
.ft-text__ai-note {
    margin: 0;
    font-size: var(--fs-sm);
    color: var(--c-text-2);
}

.ft-text__state:empty { display: none; }

/* ---- fields: two to a row from 640 px; a long one, a text box or a list of ticks on its own row */
.ft-text__grid {
    display: grid;
    gap: var(--sp-4);
}

@media (min-width: 640px) {
    .ft-text__grid { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }
    .ft-text__field--wide { grid-column: 1 / -1; }
}

.ft-text__field[hidden] { display: none; }

.ft-text .textarea {
    font-size: 1rem;
    line-height: 1.5;
}

.ft-text__checks {
    display: grid;
    gap: var(--sp-1) var(--sp-4);
    margin: 0;
    padding: 0;
    border: 0;
    min-width: 0;
}

@media (min-width: 640px) {
    .ft-text__checks { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }
    .ft-text__checks legend { grid-column: 1 / -1; }
}

.ft-text__checks legend {
    padding: 0;
    margin-bottom: var(--sp-2);
}

.ft-text__checks .check,
.ft-text__save .check {
    min-height: 44px;
    display: flex;
    align-items: center;
    gap: var(--sp-2);
}

.ft-text__save {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: var(--sp-2) var(--sp-4);
    padding-top: var(--sp-3);
    border-top: 1px solid var(--c-line);
    font-size: var(--fs-sm);
}

.ft-text__saved { color: var(--c-text-2); }

.ft-text__save .ft-linkbtn { min-height: 44px; }

/* ---- the texts */
.ft-text__out {
    display: grid;
    gap: var(--sp-2);
    min-width: 0;
}

.ft-text__out[hidden] { display: none; }

.ft-text__out + .ft-text__out,
.ft-text__ai {
    padding-top: var(--sp-4);
    border-top: 1px solid var(--c-line);
}

.ft-text__out-head {
    display: flex;
    flex-wrap: wrap;
    align-items: baseline;
    justify-content: space-between;
    gap: var(--sp-1) var(--sp-3);
}

.ft-text__out-title {
    margin: 0;
    font-size: var(--fs-base);
    font-weight: var(--fw-bold);
    color: var(--c-ink);
}

.ft-text__count {
    font-size: var(--fs-sm);
    color: var(--c-text-2);
    font-variant-numeric: tabular-nums;
}

.ft-text__count.is-over {
    font-weight: var(--fw-medium);
    color: var(--c-danger-ink);
}

.ft-text__box {
    width: 100%;
    min-height: 6.5em;
    resize: vertical;
    white-space: pre-wrap;
    background: var(--c-surface);
}

/* ---- names and slogans */
.ft-text__list,
.ft-text__short-list {
    display: grid;
    gap: var(--sp-1);
    margin: 0;
    padding: 0;
    list-style: none;
}

.ft-text__list {
    min-height: 18rem;
    align-content: start;
}

.ft-text__item {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto auto;
    align-items: center;
    gap: 0 var(--sp-2);
    padding: var(--sp-1) 0;
    border-bottom: 1px solid var(--c-line);
}

.ft-text__name {
    font-weight: var(--fw-medium);
    color: var(--c-ink);
    overflow-wrap: anywhere;
}

.ft-text__domain {
    grid-column: 1;
    grid-row: 2;
    font-size: var(--fs-sm);
    color: var(--c-text-2);
    overflow-wrap: anywhere;
}

.ft-text__item .btn { grid-row: 1 / span 2; }

.ft-text__item .btn[aria-pressed="true"] {
    border-color: var(--c-brand);
    color: var(--c-brand);
}

.ft-text__short,
.ft-text__links {
    display: grid;
    gap: var(--sp-2);
    padding-top: var(--sp-4);
    border-top: 1px solid var(--c-line);
}

.ft-text__short[hidden] { display: none; }

.ft-text__links ul {
    margin: 0;
    padding-left: 1.2em;
    list-style: disc;
}

.ft-text__links li { padding: 0; }

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

/* ---- the AI box: Cloudflare's widget gets its room before it paints */
.ft-text__ai {
    display: grid;
    gap: var(--sp-3);
}

.ft-text__ai-title {
    margin: 0;
    font-size: var(--fs-base);
    font-weight: var(--fw-bold);
}

.ft-text__ai .btn { justify-self: start; }

.ft-text__turnstile { min-height: 65px; }
.ft-text__turnstile[hidden] { display: none; }

.ft-text__ai-status:empty { display: none; }

.ft-text__ai-status {
    margin: 0;
    font-weight: var(--fw-medium);
}

.ft-text__hp {
    position: absolute;
    left: -10000px;
    width: 1px;
    height: 1px;
    overflow: hidden;
}

/* ---- the worked example: its details are words, not numbers, so they wrap and read from the left (no page scroll at 320 px) */
.ft-data--text th {
    width: 40%;
}

.ft-data--text td {
    text-align: left;
    overflow-wrap: anywhere;
}

.ft-text__sample {
    margin: 0 0 var(--sp-4);
    padding: var(--sp-4);
    border: 1px solid var(--c-line);
    border-radius: var(--r-md);
    background: var(--c-surface);
    overflow-wrap: anywhere;
}

.ft-text__sample-list {
    margin: 0 0 var(--sp-4);
    padding-left: 1.2em;
    list-style: disc;
}

@media (prefers-reduced-motion: reduce) {
    .ft-text * { transition: none !important; }
}

@media print {
    .ft-text__inputs,
    .ft-text__buttons,
    .ft-text__ai,
    .ft-text__links,
    .ft-text__count {
        display: none !important;
    }

    .ft-text {
        display: block;
    }

    .ft-text__outputs {
        border: 0;
        padding: 0;
        background: none;
    }

    .ft-text__box {
        border: 0;
        padding: 0;
        resize: none;
        overflow: visible;
    }
}
