/* =========================================================
   ToolZen Hub
   Text Diff / Compare

   Only what the shared tool styles do not already provide: the
   two input boxes, the options row, and the unified result list.
   Buttons, focus and headings come from the shared layer. Loaded
   after calculator-responsive.css.

   Added, removed, changed and unchanged lines are told by a
   symbol (+ and the minus sign), by hidden labels for a screen
   reader, by strike-through on removed words and underline on
   added words, AND by colour: never colour alone. Nothing animates.

   Narrow screens stack the boxes and wrap the result. From 900px
   the boxes sit side by side. The page itself never scrolls
   sideways: a no-wrap result scrolls inside its own box.
========================================================= */

.td-workspace [hidden],
.calculator-page [hidden] {

    display: none !important;

}

.td-sr {

    position: absolute;

    width: 1px;
    height: 1px;

    margin: -1px;
    padding: 0;

    overflow: hidden;

    clip: rect(0, 0, 0, 0);

    white-space: nowrap;

    border: 0;

}

.td-workspace {

    display: grid;
    grid-template-columns: minmax(0, 1fr);
    gap: 14px;

}

.td-inputs {

    display: grid;
    grid-template-columns: minmax(0, 1fr);
    gap: 16px;

}

.td-pane {

    display: flex;
    flex-direction: column;

    min-width: 0;

}

.td-pane__head {

    display: flex;
    flex-wrap: wrap;
    align-items: baseline;
    justify-content: space-between;
    gap: 4px 12px;

    margin-bottom: 8px;

}

.td-label {

    color: var(--color-ink);

    font-size: 15px;
    font-weight: 700;

}

.td-meta {

    color: #475467;

    font-size: 13px;
    font-variant-numeric: tabular-nums;

}

.td-meta[data-over="true"] {

    color: #912018;

    font-weight: 700;

}

.td-text {

    display: block;

    width: 100%;
    min-height: 220px;

    padding: 12px 14px;

    border: 1px solid #d0d5dd;
    border-radius: 12px;

    background: #ffffff;

    color: var(--color-ink);

    font-family:
        ui-monospace, SFMono-Regular, Menlo, Consolas,
        "Liberation Mono", monospace;
    font-size: 14px;
    line-height: 1.55;
    tab-size: 4;

    resize: vertical;

}

.td-text:focus-visible {

    outline: 3px solid var(--color-action-green);
    outline-offset: 2px;

}

.td-text[aria-invalid="true"] {

    border-color: #b42318;
    border-width: 2px;
    padding: 11px 13px;

}

.td-limit {

    margin: 0;

    color: #475467;

    font-size: 14px;
    line-height: 1.6;

}

.td-link {

    padding: 10px 0;

    border: 0;
    background: none;

    color: var(--color-action-green);

    font: inherit;
    font-weight: 600;
    text-decoration: underline;

    cursor: pointer;

}

.td-link:focus-visible {

    outline: 3px solid var(--color-action-green);
    outline-offset: 2px;

}

/* options and buttons */

.td-controls {

    display: grid;
    gap: 12px;

}

.td-options {

    display: flex;
    flex-wrap: wrap;
    gap: 4px 22px;

}

.td-check {

    display: inline-flex;
    align-items: center;
    gap: 10px;

    min-height: 44px;

    color: var(--color-ink);

    font-size: 15px;

    cursor: pointer;

}

.td-check input {

    flex: none;

    width: 20px;
    height: 20px;

    accent-color: var(--color-action-green);

}

.td-check input:focus-visible {

    outline: 3px solid var(--color-action-green);
    outline-offset: 2px;

}

.td-actions {

    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 10px;

}

.td-button {

    min-width: 0;
    min-height: 48px;

    font-size: 16px;

}

#td-compare {

    grid-column: 1 / -1;

}

.td-keys {

    margin: 0;

    color: #475467;

    font-size: 13px;
    text-align: center;

}

.td-keys kbd {

    padding: 1px 6px;

    border: 1px solid #d0d5dd;
    border-radius: 6px;

    background: #f9fafb;

    color: var(--color-ink);

    font: inherit;
    font-size: 12px;
    font-weight: 600;

}

/* the result */

.td-result {

    min-width: 0;

}

.td-result__title {

    margin: 6px 0 10px;

    color: var(--color-ink);

    font-size: 19px;
    font-weight: 700;

}

.td-status {

    margin: 0;
    padding: 10px 14px;

    border: 1px solid var(--color-slate-200);
    border-left-width: 6px;
    border-radius: 10px;

    background: #f9fafb;

    color: #344054;

    font-size: 15px;
    font-weight: 600;
    line-height: 1.5;

    overflow-wrap: anywhere;

}

.td-workspace[data-state="identical"] .td-status {

    border-color: #067647;

    background: #ecfdf3;

    color: #05603a;

}

.td-workspace[data-state="refused"] .td-status {

    border-color: #b42318;

    background: #fef3f2;

    color: #912018;

}

.td-workspace[data-state="busy"] .td-status {

    border-color: #b54708;

    background: #fffaeb;

    color: #7a2e0e;

}

.td-summary {

    display: flex;
    flex-wrap: wrap;
    gap: 8px;

    margin: 12px 0 0;
    padding: 0;

    list-style: none;

}

.td-chip {

    display: inline-flex;
    align-items: center;
    gap: 6px;

    padding: 4px 12px;

    border: 1px solid var(--color-slate-200);
    border-radius: 999px;

    background: #ffffff;

    color: var(--color-ink);

    font-size: 14px;
    font-weight: 600;
    font-variant-numeric: tabular-nums;

}

.td-chip__mark {

    font-weight: 800;

}

.td-chip--add {

    border-color: #067647;

    background: #ecfdf3;

}

.td-chip--del {

    border-color: #b42318;

    background: #fef3f2;

}

.td-chip--mod {

    border-color: #b54708;

    background: #fffaeb;

}

.td-note {

    margin: 10px 0 0;

    color: #475467;

    font-size: 14px;
    line-height: 1.55;

}

/* the list of lines */

.td-scroll {

    margin-top: 14px;

    border: 1px solid var(--color-slate-200);
    border-radius: 12px;

    background: #ffffff;

    overflow-x: auto;
    overflow-y: hidden;

}

.td-scroll:focus-visible {

    outline: 3px solid var(--color-action-green);
    outline-offset: 2px;

}

.td-lines {

    --td-digits: 3;

    margin: 0;
    padding: 0;

    list-style: none;

    font-family:
        ui-monospace, SFMono-Regular, Menlo, Consolas,
        "Liberation Mono", monospace;
    font-size: 13.5px;
    line-height: 1.55;

}

/* with wrapping off the rows keep their natural width and the box scrolls */
.td-scroll[data-wrap="false"] .td-lines {

    width: max-content;
    min-width: 100%;

}

.td-row {

    margin: 0;
    padding: 0;

}

.td-row[tabindex="-1"]:focus {

    outline: 3px solid var(--color-action-green);
    outline-offset: -3px;

}

.td-line {

    display: flex;
    align-items: baseline;

    border-left: 4px solid transparent;

}

.td-no {

    flex: none;

    box-sizing: content-box;
    width: calc(var(--td-digits) * 1ch);
    padding: 0 6px;

    color: #475467;

    font-size: 12px;
    text-align: right;
    font-variant-numeric: tabular-nums;

    user-select: none;

}

.td-mark {

    flex: none;

    width: 1.6ch;

    font-weight: 800;
    text-align: center;

    user-select: none;

}

.td-body {

    flex: 1;

    min-width: 0;
    padding: 1px 10px 1px 4px;

}

.td-text-line {

    display: block;

    color: #344054;

    white-space: pre-wrap;
    overflow-wrap: anywhere;
    tab-size: 4;

}

.td-scroll[data-wrap="false"] .td-text-line {

    white-space: pre;
    overflow-wrap: normal;

}

.td-blank {

    color: #475467;

    font-style: italic;

}

.td-line--add {

    border-left-color: #067647;

    background: #ecfdf3;

}

.td-line--add .td-mark {

    color: #05603a;

}

.td-line--del {

    border-left-color: #b42318;

    background: #fef3f2;

}

.td-line--del .td-mark {

    color: #912018;

}

.td-line--add .td-text-line,
.td-line--del .td-text-line {

    color: var(--color-ink);

}

/* changed words: struck through (old) and underlined (new), plus a tint */

.td-w {

    padding: 0 1px;

    border-radius: 3px;

    color: var(--color-ink);

    font-weight: 700;

}

del.td-w {

    background: #fecdca;

    text-decoration: line-through;
    text-decoration-thickness: 2px;

}

ins.td-w {

    background: #a6f4c5;

    text-decoration: underline;
    text-decoration-thickness: 2px;
    text-underline-offset: 3px;

}

.td-gap {

    margin: 0;
    padding: 0;

    border-top: 1px dashed var(--color-slate-200);
    border-bottom: 1px dashed var(--color-slate-200);

    background: #f9fafb;

}

.td-gap__button {

    display: block;

    width: 100%;
    min-height: 44px;
    padding: 8px 14px;

    border: 0;
    background: none;

    color: var(--color-ink);

    font-family: inherit;
    font-size: 14px;
    font-weight: 600;
    text-align: left;

    cursor: pointer;

}

.td-gap__button:focus-visible {

    outline: 3px solid var(--color-action-green);
    outline-offset: -3px;

}

.td-more {

    width: 100%;
    margin-top: 12px;

}

@media (min-width: 640px) {

    .td-actions {

        grid-template-columns: 2fr repeat(3, 1fr);

    }

    #td-compare {

        grid-column: auto;

    }

}

@media (min-width: 900px) {

    .td-inputs {

        grid-template-columns: repeat(2, minmax(0, 1fr));

    }

    .td-text {

        min-height: 300px;

    }

}

@media (max-width: 640px) {

    /* 16px so the browser does not zoom the page when a box is focused */

    .td-text {

        font-size: 16px;

    }

    .td-lines {

        font-size: 13px;

    }

    .td-no {

        padding: 0 4px;

    }

}

/* with a result the chips say it; the status line stays for a screen reader */

.td-workspace[data-state="result"] .td-status {

    position: absolute;

    width: 1px;
    height: 1px;

    margin: -1px;
    padding: 0;

    overflow: hidden;

    clip: rect(0, 0, 0, 0);

    white-space: nowrap;

    border: 0;

}
