/* /tools/data-types - page-specific rules ONLY. Shared primitives (tokens,
   headings, buttons, cards, notices, form controls) come from tokens.css /
   site.css / tools.css. No new colors: every value here is a site token. Mono
   is for type names only. Everything is scoped under .dt-page so the shared
   tools.css rules stay untouched for the other tools. */

/* ---------- Full-bleed tool areas ----------
   The converter and the reference table use the whole viewport; the prose
   sections stay in the readable .wrap column. */
.dt-page .dt-bleed { padding: 0 clamp(16px, 2vw, 32px); }

.dt-page .dt-tool { padding: 32px 0 clamp(48px, 6vw, 72px); }

/* ---------- Converter: input pane + result pane ---------- */
.dt-page .dt-converter {
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    background: var(--card);
    border: 1px solid var(--line);
    border-radius: 14px;
    overflow: hidden;
}
.dt-page .dt-pane { padding: 22px; min-width: 0; }
.dt-page .dt-pane-out { border-top: 1px solid var(--line); background: var(--cream); }
.dt-page .dt-pane-h { font-size: 1.3rem; margin: 0 0 16px; }

@media (min-width: 1024px) {
    .dt-page .dt-converter { grid-template-columns: minmax(320px, 380px) minmax(0, 1fr); min-height: 320px; }
    .dt-page .dt-pane { padding: 26px 28px; }
    .dt-page .dt-pane-out { border-top: none; border-left: 1px solid var(--line); }
}

.dt-page .dt-controls { display: flex; flex-direction: column; gap: 16px; }
.dt-page .dt-field { display: flex; flex-direction: column; gap: 6px; font-size: .86rem; font-weight: 600; color: var(--heading); }
.dt-page .dt-field select,
.dt-page .dt-field input { padding: 10px 12px; font-size: .95rem; min-width: 0; width: 100%; min-height: 44px; }
/* The site default border (--line) is about 1.2:1 on the card; controls need 3:1. */
.dt-page .dt-field select,
.dt-page .dt-field input[type="text"] { border-color: var(--muted); }
.dt-page .dt-field select:focus-visible,
.dt-page .dt-field input[type="text"]:focus-visible { outline: 2px solid var(--blue-bright); outline-offset: 2px; }
.dt-page .dt-field input {
    font-family: "JetBrains Mono", "Fira Code", ui-monospace, monospace;
    font-variant-ligatures: none;
}
.dt-page .dt-field input::placeholder { color: var(--muted); opacity: 1; }
.dt-page .dt-type-row { display: flex; gap: 8px; align-items: stretch; }
.dt-page .dt-type-row input { flex: 1 1 auto; }

/* Small secondary buttons on this page (clear, examples, copy) share one look. */
.dt-page .dt-clear,
.dt-page .dt-examples button,
.dt-page .dt-copy {
    font: inherit;
    font-size: .84rem;
    font-weight: 600;
    color: var(--heading);
    background: var(--card);
    border: 1.5px solid var(--line);
    border-radius: 999px;
    padding: 6px 14px;
    min-height: 44px;
    cursor: pointer;
    transition: border-color .15s ease, color .15s ease;
}
.dt-page .dt-clear:hover,
.dt-page .dt-examples button:hover,
.dt-page .dt-copy:hover { border-color: var(--blue-bright); color: var(--link); }

.dt-page .dt-examples { margin: 18px 0 0; display: flex; flex-wrap: wrap; align-items: center; gap: 8px 10px; }
.dt-page .dt-examples-label { font-size: .84rem; color: var(--muted); }
.dt-page .dt-examples ul { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: 8px; }
.dt-page .dt-examples button { font-family: "JetBrains Mono", "Fira Code", ui-monospace, monospace; font-variant-ligatures: none; font-weight: 500; }

.dt-page .dt-noscript { margin: 16px 0 0; font-size: .92rem; color: var(--amber-ink); }
.dt-page .dt-hint { margin: 18px 0 0; font-size: .88rem; line-height: 1.55; color: var(--muted); max-width: 60ch; }

.dt-page .dt-status { margin: 0; font-size: .95rem; line-height: 1.5; color: var(--muted); max-width: 70ch; }
.dt-page .dt-status.is-match { color: var(--heading); }
.dt-page .dt-status.is-miss { color: var(--amber-ink); }
.dt-page .dt-status code { font-family: "JetBrains Mono", "Fira Code", ui-monospace, monospace; font-variant-ligatures: none; font-size: .92em; }
.dt-page .dt-suggest { display: inline-flex; flex-wrap: wrap; gap: 6px; margin-left: 4px; vertical-align: middle; }
.dt-page .dt-suggest button {
    font-family: "JetBrains Mono", "Fira Code", ui-monospace, monospace; font-variant-ligatures: none;
    font-size: .84rem; color: var(--link); background: none; border: none; padding: 4px 2px; min-height: 32px;
    text-decoration: underline; text-underline-offset: 3px; cursor: pointer;
}

/* ---------- Result cards ---------- */
.dt-page .dt-results {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(min(100%, 168px), 1fr));
    gap: 12px;
    margin: 16px 0 0;
}
.dt-page .dt-card {
    background: var(--card);
    border: 1px solid var(--line);
    border-radius: 10px;
    padding: 14px 16px;
    display: flex;
    flex-direction: column;
    gap: 8px;
    min-width: 0;
}
.dt-page .dt-card.is-source { border-color: var(--blue-bright); }
.dt-page .dt-card-title { margin: 0; font-size: .86rem; font-weight: 600; color: var(--heading); display: flex; align-items: center; justify-content: space-between; gap: 8px; flex-wrap: wrap; }
.dt-page .dt-badge {
    font-size: .72rem; font-weight: 600; border-radius: 999px; padding: 2px 9px; white-space: nowrap;
    background: var(--blue-soft); color: var(--blue-on-soft);
}
.dt-page .dt-badge.is-caveat { background: var(--amber-soft); color: var(--amber-ink); }
.dt-page .dt-badge.is-clean { background: var(--green-soft); color: var(--green-on-soft); }
.dt-page .dt-badge.is-none { background: var(--cream); color: var(--muted); border: 1px solid var(--line); }
.dt-page .dt-card-type { font-family: "JetBrains Mono", "Fira Code", ui-monospace, monospace; font-size: 1rem; color: var(--ink); font-variant-ligatures: none; overflow-wrap: break-word; }
.dt-page .dt-card-type.is-none { font-family: inherit; font-style: italic; color: var(--muted); }
.dt-page .dt-card-typed { margin: 0; font-size: .8rem; color: var(--muted); }
.dt-page .dt-card-typed code { font-family: "JetBrains Mono", "Fira Code", ui-monospace, monospace; font-variant-ligatures: none; }
.dt-page .dt-card-note { margin: 0; font-size: .84rem; line-height: 1.45; color: var(--ink); }
.dt-page .dt-card.has-caveat .dt-card-note { color: var(--amber-ink); }
.dt-page .dt-copy { align-self: flex-start; margin-top: auto; min-height: 36px; padding: 4px 12px; }

.dt-page .dt-jump { margin: 16px 0 0; font-size: .92rem; }
.dt-page .dt-jump a { text-underline-offset: 3px; }
.dt-page .dt-copied {
    position: absolute; width: 1px; height: 1px; overflow: hidden;
    clip: rect(0 0 0 0); clip-path: inset(50%); white-space: nowrap; margin: 0;
}

/* ---------- Reference table ---------- */
.dt-page .dt-ref .tools-intro { max-width: 65ch; }

.dt-page .dt-cols {
    display: flex; flex-wrap: wrap; align-items: center; gap: 6px 10px;
    margin: 0 0 14px; padding: 0; border: none;
}
.dt-page .dt-cols legend { float: left; margin-right: 6px; font-size: .86rem; font-weight: 600; color: var(--heading); padding: 0; }
.dt-page .dt-col-toggle {
    display: inline-flex; align-items: center; gap: 8px; min-height: 44px; padding: 0 14px;
    border: 1.5px solid var(--line); border-radius: 999px; font-size: .88rem; color: var(--ink); cursor: pointer;
    background: var(--card);
}
.dt-page .dt-col-toggle:has(input:checked) { border-color: var(--blue-bright); }
.dt-page .dt-col-toggle:has(input:focus-visible) { outline: 2px solid var(--blue-bright); outline-offset: 2px; }
.dt-page .dt-col-toggle input { width: 18px; height: 18px; margin: 0; accent-color: var(--blue-bright); }

/* The wrapper is the scroll container in both directions, so the header row
   and the type column can both stay pinned while the table scrolls. */
.dt-page .dt-table-wrap {
    overflow: auto;
    max-height: min(78vh, 900px);
    border: 1px solid var(--line);
    border-radius: 12px;
    background: var(--card);
    overscroll-behavior: contain;
}
.dt-page .dt-table-wrap:focus-visible { outline: 2px solid var(--blue-bright); outline-offset: 2px; }
.dt-page .dt-table { width: 100%; border-collapse: separate; border-spacing: 0; font-size: .9rem; }
.dt-page .dt-table th,
.dt-page .dt-table td {
    border-right: 1px solid var(--line); border-bottom: 1px solid var(--line);
    padding: 10px 12px; vertical-align: top; text-align: left; background: var(--card);
}
.dt-page .dt-table tr > :last-child { border-right: none; }
.dt-page .dt-table thead th {
    color: var(--heading); position: sticky; top: 0; z-index: 2;
    box-shadow: 0 1px 0 var(--line);
}
.dt-page .dt-table thead th:first-child { left: 0; z-index: 3; }
.dt-page .dt-table tr[data-logical] th {
    position: sticky; left: 0; z-index: 1;
    font-weight: 600; color: var(--heading); min-width: 9ch; max-width: 16ch;
}
.dt-page .dt-table .dt-family th {
    background: var(--cream); color: var(--heading); font-size: .82rem; text-transform: uppercase;
    letter-spacing: .06em; font-family: "JetBrains Mono", monospace; font-weight: 600;
}
/* The family label stays in view while the table scrolls sideways. */
.dt-page .dt-table .dt-family th span { position: sticky; left: 12px; }
.dt-page .dt-table td code {font-family: "JetBrains Mono", "Fira Code", ui-monospace, monospace; font-size: .86em; font-variant-ligatures: none; overflow-wrap: break-word; }
.dt-page .dt-table td code.dt-none { font-family: inherit; font-style: italic; color: var(--muted); }
.dt-page .dt-table td small { display: block; margin-top: 4px; color: var(--muted); font-size: .8rem; line-height: 1.4; }
.dt-page .dt-table .dt-notes { color: var(--muted); font-size: .84rem; line-height: 1.45; min-width: 24ch; }
.dt-page .dt-table td { min-width: 14ch; }

/* The row the converter matched. */
.dt-page .dt-table tr.is-current > * { background: var(--blue-soft); }
.dt-page .dt-table tr.is-current > th { box-shadow: inset 3px 0 0 var(--blue-bright); }

/* Engine column toggles (nth-child: 1 is the type, 2-6 the engines). */
.dt-page .dt-table.dt-hide-2 tr > :nth-child(2):not([colspan]),
.dt-page .dt-table.dt-hide-3 tr > :nth-child(3),
.dt-page .dt-table.dt-hide-4 tr > :nth-child(4),
.dt-page .dt-table.dt-hide-5 tr > :nth-child(5),
.dt-page .dt-table.dt-hide-6 tr > :nth-child(6) { display: none; }

/* ---------- Readable prose below the tool ---------- */
.dt-page .tools-points li,
.dt-page .tools-faq .card p { max-width: 60ch; }
.dt-page .tools-faq { max-width: 70ch; }
.dt-page .dt-hint,
.dt-page .tools-intro,
.dt-page .tools-points li,
.dt-page .tools-faq .card p { text-wrap: pretty; }


@media (max-width: 820px) {
    .dt-page .dt-table { font-size: .86rem; }
    .dt-page .dt-table tr[data-logical] th { max-width: 11ch; }
    .dt-page .dt-table .dt-notes { min-width: 20ch; }
}

@media (prefers-reduced-motion: reduce) {
    .dt-page .dt-clear,
    .dt-page .dt-examples button,
    .dt-page .dt-copy { transition: none; }
}
