/* Interactive tools. Loaded only on sites that have a tools/ folder. */
.tools-home { border-top: 1px solid var(--line); }
.tool-card { box-shadow: inset 0 4px 0 var(--accent); }
.tool-card .btn { align-self: flex-start; margin-top: auto; }
.tool-card h3 a { color: var(--text); text-decoration: none; }
.tool-card h3 a:hover { color: var(--accent-hover); }

.tool-page .tool-intro { padding-bottom: 8px; }
.tool-page .tool-guide { padding-top: 40px; }
.tool-wrap { padding-top: 8px; padding-bottom: 8px; }

.tool { display: grid; grid-template-columns: minmax(0, 5fr) minmax(0, 7fr); gap: 0; background: var(--panel); border: 1.5px solid var(--line); border-radius: 18px; overflow: hidden; box-shadow: 6px 6px 0 var(--accent); }
.tool.stacked { grid-template-columns: minmax(0, 1fr); }
.tool-controls { padding: 32px; display: flex; flex-direction: column; gap: 22px; border-right: 1px solid var(--line); background: var(--ground); }
.tool.stacked .tool-controls { border-right: 0; border-bottom: 1px solid var(--line); }
.tool-out { padding: 32px; display: flex; flex-direction: column; gap: 24px; min-width: 0; }
.tool h2, .tool h3 { font-family: var(--geo, var(--sans)); font-weight: 500; }
.tool h3 { font-size: 22px; line-height: 1.2; }

.tool-field { display: flex; flex-direction: column; gap: 6px; }
.tool-field .row { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; }
.tool-field label, .tool-field .name { font-size: 15px; font-weight: 500; color: var(--text); }
.tool-field .val { font-family: var(--mono); font-size: 14px; color: var(--accent); white-space: nowrap; font-variant-numeric: tabular-nums; }
.tool-field .hint { font-size: 13.5px; color: var(--muted); line-height: 1.45; }
.tool input[type=range] { width: 100%; height: 36px; accent-color: var(--accent); margin: 0; }
.tool select { width: 100%; min-height: 44px; background: var(--panel); color: var(--text); border: 1px solid var(--line); border-radius: 10px; padding: 8px 12px; font: inherit; font-size: 15px; }
.tool select:focus-visible, .tool button:focus-visible, .tool input:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip { appearance: none; cursor: pointer; font: inherit; font-family: var(--geo, var(--sans)); font-weight: 500; font-size: 14px; letter-spacing: 0.02em; color: var(--text-soft); background: transparent; border: 1px solid var(--line); border-radius: 999px; padding: 8px 14px; min-height: 38px; }
.chip:hover { border-color: var(--accent); color: var(--text); }
.chip[aria-pressed="true"] { background: var(--accent); border-color: var(--accent); color: var(--ground); }

.tool-big { display: flex; flex-wrap: wrap; gap: 12px 40px; align-items: flex-end; }
.tool-big > div { display: flex; flex-direction: column; gap: 2px; }
.tool-big .num { font-family: var(--geo, var(--serif)); font-weight: 500; font-size: clamp(48px, 6vw, 76px); line-height: 1; color: var(--accent); font-variant-numeric: tabular-nums; letter-spacing: -0.02em; }
.tool-big .num.small { font-size: clamp(30px, 3.6vw, 44px); color: var(--text); }
.tool-big sup { font-size: 0.5em; }

.tool-stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(180px, 100%), 1fr)); gap: 1px; background: var(--line); border: 1px solid var(--line); border-radius: 12px; overflow: hidden; }
.tool-stats > div { background: var(--ground); padding: 16px 18px; display: flex; flex-direction: column; gap: 4px; }
.tool-stats .v { font-family: var(--geo, var(--serif)); font-size: 26px; line-height: 1.15; color: var(--text); font-variant-numeric: tabular-nums; }
.tool-stats .v sup { font-size: 0.55em; }
.tool-stats .s { font-size: 13.5px; color: var(--muted); line-height: 1.4; }

.tool-chart { background: var(--ground); border: 1px solid var(--line); border-radius: 12px; padding: 10px 8px 4px; }
.tool-chart svg { display: block; width: 100%; height: auto; }
.tool-chart text { font-family: var(--mono); font-size: 11px; fill: var(--muted); }
.tool-chart .axis { stroke: var(--line); stroke-width: 1; }
.tool-chart .grid { stroke: var(--line); stroke-width: 1; stroke-dasharray: 2 4; opacity: 0.7; }
.tool-chart .c1 { fill: none; stroke: var(--accent); stroke-width: 2.5; }
.tool-chart .c2 { fill: none; stroke: var(--text-soft); stroke-width: 1.6; stroke-dasharray: 6 5; }
.tool-chart .c3 { fill: none; stroke: var(--muted); stroke-width: 1.2; stroke-dasharray: 2 4; }
.tool-chart .dot { fill: var(--accent); stroke: var(--ground); stroke-width: 2; }
.tool-chart .lbl { fill: var(--text-soft); font-size: 12px; }
.tool-chart .lbl.acc { fill: var(--accent); }
.legend { display: flex; flex-wrap: wrap; gap: 6px 18px; font-size: 13.5px; color: var(--muted); padding: 2px 10px 8px; }
.legend i { display: inline-block; width: 22px; height: 0; vertical-align: middle; margin-right: 8px; border-top: 2.5px solid var(--accent); }
.legend i.d { border-top: 1.6px dashed var(--text-soft); }
.legend i.o { border-top: 1.6px dotted var(--muted); }

.tool-verdict { font-size: 16.5px; line-height: 1.55; color: var(--text-soft); border-left: 3px solid var(--accent); padding: 4px 0 4px 16px; min-height: 52px; }
.tool-verdict strong { color: var(--text); }
.tool-note { font-size: 13.5px; color: var(--muted); line-height: 1.5; }
.tool-note a { color: var(--accent-soft); }

.tool-table { width: 100%; border-collapse: collapse; font-size: 15px; }
.tool-table th, .tool-table td { text-align: left; padding: 10px 12px; border-bottom: 1px solid var(--line); vertical-align: top; }
.tool-table th { font-family: var(--geo, var(--mono)); font-weight: 600; font-size: 12px; letter-spacing: 0.14em; text-transform: uppercase; color: var(--muted); }
.tool-table td.n { font-family: var(--mono); font-size: 14px; color: var(--text); white-space: nowrap; font-variant-numeric: tabular-nums; }
.tool-table tr.on td { background: var(--panel-hi); }
.tool-table tr.on td:first-child { box-shadow: inset 3px 0 0 var(--accent); }
.tool-scroll { overflow-x: auto; -webkit-overflow-scrolling: touch; }

.bar { position: relative; height: 10px; background: var(--line); border-radius: 999px; overflow: hidden; }
.bar > span { position: absolute; left: 0; top: 0; bottom: 0; background: var(--accent); border-radius: 999px; transition: width .25s ease; }

/* CoLD ladder */
.ladder { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 8px; }
.ladder li { display: grid; grid-template-columns: 44px 1fr auto; gap: 14px; align-items: center; padding: 12px 14px; border: 1px solid var(--line); border-radius: 12px; background: var(--ground); }
.ladder .lv { font-family: var(--geo, var(--mono)); font-weight: 600; font-size: 20px; width: 36px; height: 36px; border-radius: 50%; display: grid; place-items: center; border: 1.5px solid var(--line); color: var(--muted); }
.ladder .tx { font-size: 15px; color: var(--text-soft); line-height: 1.4; }
.ladder .st { font-family: var(--mono); font-size: 12px; letter-spacing: 0.08em; text-transform: uppercase; color: var(--muted); white-space: nowrap; }
.ladder li.pass .lv { background: var(--accent); border-color: var(--accent); color: var(--ground); }
.ladder li.pass .st { color: var(--accent); }
.ladder li.open { border-color: var(--accent); box-shadow: inset 3px 0 0 var(--accent); }
.ladder li.open .st { color: var(--text); }
.ladder li.fail .lv { border-style: dashed; }
.case-text { display: flex; flex-direction: column; gap: 10px; }
.case-text p { font-size: 15.5px; color: var(--text-soft); line-height: 1.55; margin: 0; }
.case-text .src { font-size: 13.5px; color: var(--muted); }
.qa { display: flex; flex-direction: column; gap: 10px; }
.qa .q { font-size: 15.5px; color: var(--text); }
.qa .btns { display: flex; gap: 8px; flex-wrap: wrap; }

@media (max-width: 880px) {
  .tool { grid-template-columns: minmax(0, 1fr); box-shadow: 4px 4px 0 var(--accent); }
  .tool-controls { border-right: 0; border-bottom: 1px solid var(--line); padding: 24px; }
  .tool-out { padding: 24px; }
  .ladder li { grid-template-columns: 36px 1fr; }
  .ladder .st { grid-column: 2; }
}

/* Keep reading-column padding on tool pages (the shared .prose rule zeroes it). */
.tool-page .prose { max-width: 788px; padding-left: 24px; padding-right: 24px; }
.tool-page .prose.tool-intro { padding-top: 56px; }
.tool-page .explainer { margin-left: 0; margin-right: 0; }
