/* Безкоштовні інструменти (/ru/tools, /uk/tools). Усе під префіксом .tl-, спирається на токени style.css */

.tl-wrap { padding: 36px 0 72px; max-width: 880px; margin: 0 auto; }

.tl-crumbs { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; font-size: 13px; color: var(--text-tertiary); margin-bottom: 28px; }
.tl-crumbs a { color: var(--text-secondary); text-decoration: none; }
.tl-crumbs a:hover { color: var(--accent); }
.tl-crumbs b { color: var(--text-secondary); font-weight: 500; }

.tl-head h1 { font-size: clamp(30px, 4.4vw, 46px); line-height: 1.04; margin-bottom: 16px; }
.tl-head .subtitle { max-width: 640px; margin-bottom: 20px; }
.tl-badges { list-style: none; display: flex; flex-wrap: wrap; gap: 8px; margin: 0 0 34px; padding: 0; }
.tl-badges li {
    font-family: var(--font-mono); font-size: 12px; color: var(--text-secondary);
    border: 1px solid var(--border); border-radius: var(--radius-pill); padding: 5px 12px;
}
.tl-badges li::before { content: "✓ "; color: var(--accent); }

.tl-section { margin-top: 56px; }
.tl-section h2, .tl-cta h2 { font-family: var(--font-display); font-size: clamp(22px, 3vw, 28px); font-weight: 600; letter-spacing: -0.015em; margin: 0 0 16px; }

/* ---- форма інструмента ---- */
.tl-tool { padding: 26px; }
.tl-tool label, .tl-label {
    display: block; font-size: 12px; font-weight: 600; letter-spacing: 0.03em; text-transform: uppercase;
    color: var(--text-secondary); margin: 18px 0 7px;
}
.tl-tool label:first-child, .tl-label:first-child { margin-top: 0; }
.tl-tool input[type="number"], .tl-tool input[type="text"], .tl-tool select { width: 100%; }
.tl-tool select {
    background: var(--surface-2); color: var(--text); border: 1px solid var(--border); border-radius: var(--radius-sm);
    padding: 11px 14px; font-size: 14px; font-family: var(--font-body);
}
.tl-tool select:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }

.tl-row { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.tl-row-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; }

.tl-chips { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 4px; }
.tl-chip {
    background: transparent; color: var(--text-secondary); border: 1px solid var(--border); border-radius: var(--radius-pill);
    padding: 7px 14px; font-size: 13px; font-family: var(--font-body); cursor: pointer; transition: border-color .15s, color .15s, background .15s;
}
.tl-chip:hover { border-color: var(--accent); color: var(--accent); }
.tl-chip.on { background: var(--accent-soft); border-color: var(--accent); color: var(--accent); }

/* перемикач замість звичайної галочки */
/* label.tl-check, а не просто .tl-check: інакше правило ".tl-tool label" (display:block + відступи) перебиває flex і
   перемикач з'їжджає відносно тексту */
.tl-tool label.tl-check {
    display: flex; align-items: center; gap: 12px; margin: 20px 0 0; line-height: 1; color: var(--text-secondary); cursor: pointer; user-select: none;
}
.tl-tool label.tl-check:hover { color: var(--text); }
.tl-check-text { display: block; padding-top: 1px; }
.tl-tool .tl-check input[type="checkbox"] {
    -webkit-appearance: none; appearance: none; flex: none; width: 42px; height: 24px; padding: 0; margin: 0; position: relative; cursor: pointer;
    background: var(--surface-3); border: 1px solid var(--border-hover); border-radius: 24px; transition: background .18s, border-color .18s, box-shadow .18s;
}
.tl-tool .tl-check input[type="checkbox"]::after {
    content: ""; position: absolute; top: 3px; left: 3px; width: 16px; height: 16px; border-radius: 50%;
    background: var(--text-tertiary); transition: transform .18s cubic-bezier(.3, .8, .3, 1), background .18s;
}
.tl-tool .tl-check input[type="checkbox"]:checked { background: var(--accent-soft); border-color: var(--accent); }
.tl-tool .tl-check input[type="checkbox"]:checked::after { transform: translateX(18px); background: var(--accent); box-shadow: 0 0 10px var(--accent-glow); }
.tl-tool .tl-check input[type="checkbox"]:focus-visible { outline: none; box-shadow: 0 0 0 3px var(--accent-soft); border-color: var(--accent); }

/* числові поля без системних стрілочок */
.tl-tool input[type="number"] { -moz-appearance: textfield; appearance: textfield; }
.tl-tool input[type="number"]::-webkit-outer-spin-button,
.tl-tool input[type="number"]::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }

/* власний випадаючий список */
.tl-dd { position: relative; }
.tl-tool select.tl-dd-native { position: absolute; left: 0; top: 0; width: 1px; height: 1px; opacity: 0; pointer-events: none; padding: 0; border: 0; }
.tl-dd-btn {
    width: 100%; display: flex; align-items: center; justify-content: space-between; gap: 12px; text-align: left; cursor: pointer;
    background: var(--surface-2); color: var(--text); border: 1px solid var(--border); border-radius: var(--radius-sm);
    padding: 11px 14px; font-size: 14px; font-family: var(--font-body); transition: border-color .15s, box-shadow .15s;
}
.tl-dd-btn:hover { border-color: var(--border-hover); }
.tl-dd-btn:focus-visible, .tl-dd.open .tl-dd-btn { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.tl-dd-label { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tl-dd-chev { width: 16px; height: 16px; flex: none; color: var(--text-tertiary); transition: transform .18s ease, color .15s; }
.tl-dd.open .tl-dd-chev { transform: rotate(180deg); color: var(--accent); }
.tl-dd-list {
    position: absolute; left: 0; right: 0; top: calc(100% + 6px); z-index: 40; margin: 0; padding: 6px; list-style: none;
    max-height: 288px; overflow-y: auto; background: var(--surface); border: 1px solid var(--border-hover); border-radius: var(--radius-md);
    box-shadow: 0 18px 44px rgba(0, 0, 0, .6); animation: tl-dd-in .14s ease; scrollbar-width: thin; scrollbar-color: var(--surface-3) transparent;
}
.tl-dd.up .tl-dd-list { top: auto; bottom: calc(100% + 6px); }
.tl-dd-opt {
    display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 9px 12px; border-radius: var(--radius-sm);
    font-size: 14px; color: var(--text-secondary); cursor: pointer; transition: background .1s, color .1s;
}
.tl-dd-opt.is-active { background: var(--accent-soft); color: var(--text); }
.tl-dd-check { width: 15px; height: 15px; flex: none; color: var(--accent); opacity: 0; }
.tl-dd-opt[aria-selected="true"] { color: var(--accent); font-weight: 600; }
.tl-dd-opt[aria-selected="true"] .tl-dd-check { opacity: 1; }
@keyframes tl-dd-in { from { opacity: 0; transform: translateY(-4px); } to { opacity: 1; transform: translateY(0); } }
.tl-dd.up .tl-dd-list { animation-name: tl-dd-in-up; }
@keyframes tl-dd-in-up { from { opacity: 0; transform: translateY(4px); } to { opacity: 1; transform: translateY(0); } }

/* ---- калькулятор: дві панелі однакової висоти, верх і низ збігаються ---- */
.tl-calc { display: grid; grid-template-columns: 1.05fr 1fr; gap: 20px; align-items: stretch; }
.tl-form-panel, .tl-results {
    background: var(--surface-2); border: 1px solid var(--border); border-radius: var(--radius-md); padding: 22px;
}
.tl-form-panel { display: flex; flex-direction: column; justify-content: space-between; gap: 18px; }
.tl-form-panel .tl-field label { margin-top: 0; }
.tl-form-panel .tl-field .tl-label { margin-top: 14px; }
.tl-results { display: flex; flex-direction: column; }
.tl-results .tl-note { margin-top: auto; padding-top: 14px; }
.tl-mult-badge { color: var(--accent); font-family: var(--font-mono); margin-left: 6px; text-transform: none; letter-spacing: 0; }

/* повзунок: суцільна доріжка із заповненням до бігунка (--pct виставляє JS) і світний бігунок */
.tl-tool input.tl-range {
    -webkit-appearance: none; appearance: none; width: 100%; height: 28px; padding: 0; margin: 4px 0 0;
    background: transparent; border: 0; box-shadow: none; cursor: pointer; --pct: 25%;
}
.tl-range:focus { outline: none; }
.tl-range::-webkit-slider-runnable-track {
    height: 6px; border-radius: 6px; background: linear-gradient(to right, var(--accent) 0 var(--pct), var(--surface-3) var(--pct) 100%);
}
.tl-range::-moz-range-track { height: 6px; border-radius: 6px; background: var(--surface-3); }
.tl-range::-moz-range-progress { height: 6px; border-radius: 6px; background: var(--accent); }
.tl-range::-webkit-slider-thumb {
    -webkit-appearance: none; appearance: none; width: 22px; height: 22px; margin-top: -8px; border-radius: 50%;
    background: var(--accent); border: 4px solid var(--surface-2); box-shadow: 0 0 0 2px var(--accent), 0 0 14px var(--accent-glow);
    transition: transform .12s ease;
}
.tl-range::-moz-range-thumb {
    width: 14px; height: 14px; border-radius: 50%; background: var(--accent); border: 4px solid var(--surface-2);
    box-shadow: 0 0 0 2px var(--accent), 0 0 14px var(--accent-glow);
}
.tl-range:hover::-webkit-slider-thumb, .tl-range:active::-webkit-slider-thumb { transform: scale(1.12); }
.tl-range:focus-visible::-webkit-slider-thumb { box-shadow: 0 0 0 2px var(--accent), 0 0 0 6px var(--accent-soft), 0 0 14px var(--accent-glow); }
.tl-range-scale { display: flex; justify-content: space-between; margin-top: 2px; padding: 0 2px; font-family: var(--font-mono); font-size: 11.5px; color: var(--text-tertiary); }

.tl-big { font-family: var(--font-display); font-size: clamp(34px, 5vw, 46px); font-weight: 600; letter-spacing: -0.02em; color: var(--accent); line-height: 1.05; }
.tl-big small { font-size: 15px; font-weight: 500; color: var(--text-tertiary); margin-left: 6px; letter-spacing: 0; }
.tl-big-label { font-size: 12px; font-weight: 600; letter-spacing: 0.03em; text-transform: uppercase; color: var(--text-secondary); margin-bottom: 6px; }
.tl-stat-list { list-style: none; margin: 20px 0 0; padding: 0; display: grid; gap: 0; }
.tl-stat-list li { display: flex; justify-content: space-between; gap: 16px; padding: 10px 0; border-top: 1px solid var(--border); font-size: 14px; color: var(--text-secondary); }
.tl-stat-list li b { color: var(--text); font-weight: 600; text-align: right; font-variant-numeric: tabular-nums; }
.tl-stat-list li.neg b { color: var(--danger); }
.tl-hint { margin-top: 16px; padding: 12px 14px; border-radius: var(--radius-sm); background: var(--accent-soft); color: var(--text); font-size: 14px; }
.tl-hint.warn { background: var(--warn-soft); }
.tl-note { margin-top: 14px; font-size: 12.5px; color: var(--text-tertiary); }
.tl-actions { display: flex; gap: 10px; flex-wrap: wrap; margin-top: 16px; }
.tl-actions .btn { padding: 9px 18px; font-size: 13px; }

/* ---- генератор підписів ---- */
.tl-out { margin-top: 28px; display: grid; gap: 12px; }
.tl-out-title { font-family: var(--font-display); font-size: 18px; font-weight: 600; margin: 0 0 4px; }
.tl-cap {
    background: var(--surface-2); border: 1px solid var(--border); border-radius: var(--radius-md);
    padding: 16px 18px; display: grid; grid-template-columns: 1fr auto; gap: 14px; align-items: start;
}
.tl-cap pre { margin: 0; white-space: pre-wrap; word-break: break-word; font-family: var(--font-body); font-size: 15px; line-height: 1.5; color: var(--text); }
.tl-cap small { display: block; margin-top: 8px; font-family: var(--font-mono); font-size: 11.5px; color: var(--text-tertiary); }
.tl-cap small.warn { color: var(--warn); }
.tl-copy { padding: 7px 14px !important; font-size: 12.5px !important; white-space: nowrap; }
.tl-tags { background: var(--surface-2); border: 1px dashed var(--border-hover); border-radius: var(--radius-md); padding: 16px 18px; display: grid; grid-template-columns: 1fr auto; gap: 14px; align-items: center; }
.tl-tags span { font-family: var(--font-mono); font-size: 13.5px; color: var(--accent); word-break: break-word; }
.tl-empty { color: var(--text-tertiary); font-size: 14px; padding: 6px 0; }

/* ---- завантажувач ---- */
.tl-dl-form { display: flex; gap: 10px; flex-wrap: wrap; }
.tl-dl-form input { flex: 1 1 320px; min-width: 0; }
.tl-dl-form .btn { padding: 11px 24px; }
.tl-error { margin-top: 14px; padding: 12px 14px; border-radius: var(--radius-sm); background: var(--danger-soft); color: var(--text); font-size: 14px; }
.tl-status { margin-top: 14px; color: var(--text-secondary); font-size: 14px; }
.tl-result { margin-top: 22px; display: grid; grid-template-columns: 220px 1fr; gap: 20px; align-items: start; }
.tl-thumb { width: 100%; aspect-ratio: 16 / 9; object-fit: cover; border-radius: var(--radius-md); background: var(--surface-3); border: 1px solid var(--border); }
.tl-meta h3 { font-family: var(--font-display); font-size: 18px; margin: 0 0 6px; letter-spacing: -0.01em; word-break: break-word; }
.tl-meta p { margin: 0 0 14px; font-size: 13.5px; color: var(--text-secondary); }
.tl-quality { display: flex; flex-wrap: wrap; gap: 10px; }
.tl-quality a { padding: 10px 20px; font-size: 14px; }
.tl-quality a small { font-weight: 400; color: var(--text-tertiary); font-size: 12px; }
.tl-quality a:hover small { color: var(--bg); }
.tl-next { margin-top: 18px; padding: 16px 18px; border: 1px solid var(--accent); border-radius: var(--radius-md); background: var(--accent-soft); }
.tl-next h4 { margin: 0 0 6px; font-family: var(--font-display); font-size: 16px; }
.tl-next p { margin: 0 0 12px; font-size: 14px; color: var(--text-secondary); }

/* ---- текстові блоки ---- */
.tl-steps { counter-reset: step; list-style: none; margin: 0; padding: 0; display: grid; gap: 12px; }
.tl-steps li {
    counter-increment: step; position: relative; padding: 14px 16px 14px 56px; background: var(--surface);
    border: 1px solid var(--border); border-radius: var(--radius-md); color: var(--text-secondary); font-size: 15px;
}
.tl-steps li::before {
    content: counter(step); position: absolute; left: 16px; top: 50%; transform: translateY(-50%);
    width: 28px; height: 28px; border-radius: 50%; display: grid; place-items: center;
    font-family: var(--font-mono); font-size: 13px; color: var(--accent); border: 1px solid var(--accent); background: var(--accent-soft);
}
.tl-prose p { color: var(--text-secondary); font-size: 15.5px; line-height: 1.7; margin: 0 0 14px; max-width: 720px; }

.tl-faq { display: grid; gap: 8px; }
.tl-faq details { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-md); padding: 0 18px; }
.tl-faq summary { cursor: pointer; padding: 15px 0; font-weight: 600; font-size: 15px; list-style: none; display: flex; justify-content: space-between; gap: 12px; }
.tl-faq summary::-webkit-details-marker { display: none; }
.tl-faq summary::after { content: "+"; color: var(--accent); font-family: var(--font-mono); font-size: 18px; line-height: 1; }
.tl-faq details[open] summary::after { content: "−"; }
.tl-faq details p { margin: 0 0 16px; color: var(--text-secondary); font-size: 14.5px; line-height: 1.65; }

.tl-cta { margin-top: 56px; text-align: left; border-color: var(--border-hover); }
.tl-cta p { color: var(--text-secondary); max-width: 560px; margin: 0 0 20px; font-size: 15px; }
.tl-cta-sub { display: block; margin-top: 12px; font-family: var(--font-mono); font-size: 12px; color: var(--text-tertiary); }

.tl-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 14px; }
.tl-grid-hub { margin-top: 8px; }
.tl-card {
    display: flex; flex-direction: column; gap: 8px; padding: 22px; background: var(--surface); border: 1px solid var(--border);
    border-radius: var(--radius-md); text-decoration: none; color: inherit; transition: border-color .15s, transform .15s;
}
.tl-card:hover { border-color: var(--accent); transform: translateY(-2px); }
.tl-card h3 { margin: 0; font-family: var(--font-display); font-size: 18px; letter-spacing: -0.01em; }
.tl-card p { margin: 0; color: var(--text-secondary); font-size: 14px; flex: 1; }
.tl-open { font-family: var(--font-mono); font-size: 12.5px; color: var(--accent); }

/* пункт «Інструменти» в шапці на всіх сторінках і блок на головній */
.nav-links a.nav-text-link {
    font-size: 13.5px; font-weight: 500; color: var(--text-secondary); text-decoration: none; padding: 6px 10px;
    border-radius: var(--radius-pill); border: 1px solid transparent; transition: color .15s, border-color .15s, background .15s;
}
.nav-links a.nav-text-link:hover { color: var(--accent); border-color: var(--border-hover); background: transparent; }
.tl-home-tools { margin-bottom: 8px; }

@media (max-width: 520px) {
    .nav-links a.nav-text-link { font-size: 12.5px; padding: 5px 5px; border-color: transparent; }
}

@media (max-width: 760px) {
    .tl-calc { grid-template-columns: 1fr; }
    .tl-form-panel { gap: 20px; }
    .tl-row, .tl-row-3 { grid-template-columns: 1fr; }
    .tl-result { grid-template-columns: 1fr; }
    .tl-cap, .tl-tags { grid-template-columns: 1fr; }
    .tl-wrap { padding-top: 22px; }
}
