/* EdgeLab — calculator pages (/tools/). Loaded after style.css. */

/* tabs and method switches use the hidden attribute; keep it stronger than display:grid/block below */
.tool [hidden] { display: none !important; }

.tool-head { padding: 2.6rem 0 0.4rem; max-width: 760px; }
.tool-head .crumbs { font-size: 0.86rem; color: var(--text-3); margin-bottom: 0.8rem; }
.tool-head .crumbs a { color: inherit; }
.tool-head h1 { margin-bottom: 0.45em; }
.tool-head .lead { font-size: 1.15rem; color: var(--text-2); margin-bottom: 0.4rem; }

.tool { margin: 1.6rem 0 0.5rem; }
.tool-grid {
  display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.08fr);
  gap: 1.6rem; align-items: start;
}
@media (max-width: 860px) { .tool-grid { grid-template-columns: minmax(0, 1fr); } }

.tool-inputs {
  background: var(--bg-2); border: 1px solid var(--border); border-radius: 10px;
  padding: 1.2rem 1.25rem 0.6rem;
}
.tool-inputs fieldset { border: 0; margin: 0 0 1.1rem; min-width: 0; }
.tool-inputs legend {
  font-size: 0.78rem; font-weight: 700; letter-spacing: 0.07em; text-transform: uppercase;
  color: var(--text-3); margin-bottom: 0.65rem; padding: 0;
}
.field-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0.75rem 0.9rem; }
@media (max-width: 420px) { .field-grid { grid-template-columns: minmax(0, 1fr); } }
.field { display: block; min-width: 0; }
.field.wide { grid-column: 1 / -1; }
.field > span { display: block; font-size: 0.86rem; font-weight: 600; color: var(--text); margin-bottom: 0.25rem; line-height: 1.35; }
.field small { display: block; font-size: 0.78rem; color: var(--text-3); margin-top: 0.25rem; line-height: 1.4; }
.input-unit {
  display: flex; align-items: stretch; background: #fff;
  border: 1px solid var(--border); border-radius: 6px; overflow: hidden;
}
.input-unit:focus-within { border-color: var(--blue); outline: 2px solid var(--blue-bg); }
.input-unit .unit {
  display: flex; align-items: center; padding: 0 0.6rem; font-size: 0.88rem;
  color: var(--text-3); background: var(--bg-2); white-space: nowrap;
}
.input-unit .unit.after { border-left: 1px solid var(--border); }
.input-unit .unit.before { border-right: 1px solid var(--border); }
.tool input[type="number"], .tool select {
  width: 100%; min-width: 0; font: inherit; font-size: 0.98rem; color: var(--text);
  padding: 0.48em 0.65em; border: 0; background: #fff;
}
.tool input[type="number"]:focus, .tool select:focus { outline: none; }
.tool select {
  border: 1px solid var(--border); border-radius: 6px; cursor: pointer;
}
.tool select:focus { border-color: var(--blue); outline: 2px solid var(--blue-bg); }
.check { display: flex; gap: 0.5rem; align-items: flex-start; font-size: 0.88rem; color: var(--text-2); cursor: pointer; }
.check input { margin-top: 0.3rem; }

.presets { display: flex; flex-wrap: wrap; gap: 0.45rem; margin-bottom: 1rem; }
.presets .label { width: 100%; font-size: 0.78rem; font-weight: 700; letter-spacing: 0.07em; text-transform: uppercase; color: var(--text-3); }
.preset-chip {
  font: inherit; font-size: 0.84rem; color: var(--text-2); background: #fff;
  border: 1px solid var(--border); border-radius: 999px; padding: 0.3em 0.85em; cursor: pointer;
}
.preset-chip:hover { border-color: var(--blue); color: var(--text); }
.preset-chip[aria-pressed="true"] { background: var(--blue-bg); border-color: var(--blue); color: var(--blue-dk); font-weight: 600; }

.tabs { display: flex; gap: 0.35rem; border-bottom: 1px solid var(--border); margin-bottom: 1.1rem; overflow-x: auto; }
.tab {
  font: inherit; font-size: 0.94rem; font-weight: 600; color: var(--text-2); background: none;
  border: 0; border-bottom: 2px solid transparent; padding: 0.55em 0.8em; cursor: pointer; white-space: nowrap;
}
.tab:hover { color: var(--text); }
.tab[aria-selected="true"] { color: var(--blue-dk); border-bottom-color: var(--blue); }
@media (max-width: 480px) { .tabs { gap: 0; } .tab { font-size: 0.86rem; padding: 0.55em 0.5em; } }

.tool-results {
  border: 1px solid var(--border); border-radius: 10px; padding: 1.2rem 1.25rem; background: #fff;
}
.big-stat .label { display: block; font-size: 0.8rem; font-weight: 700; letter-spacing: 0.07em; text-transform: uppercase; color: var(--text-3); }
.big-stat .value { display: block; font-size: clamp(2.3rem, 6vw, 3rem); font-weight: 800; line-height: 1.1; color: var(--text); letter-spacing: -0.02em; margin: 0.15rem 0; }
.big-stat .sub { display: block; font-size: 0.86rem; color: var(--text-3); }
.big-stat .value.good { color: #1a7f37; }
.big-stat .value.bad { color: var(--red); }

.stat-row { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0.7rem; margin: 1rem 0; }
.stat { border-top: 2px solid var(--blue); padding-top: 0.45rem; min-width: 0; }
.stat .k { display: block; font-size: 0.8rem; color: var(--text-3); line-height: 1.35; }
.stat .v { display: block; font-size: 1.3rem; font-weight: 700; line-height: 1.25; overflow-wrap: anywhere; }
.stat .v small { font-size: 0.8rem; font-weight: 500; color: var(--text-3); }
@media (max-width: 480px) { .stat .v small { display: block; line-height: 1.35; } }

.fates { margin: 1rem 0 0.4rem; }
.fate-bar { display: flex; height: 26px; border-radius: 5px; overflow: hidden; background: var(--bg-2); border: 1px solid var(--border); }
.fate-bar span { display: block; height: 100%; transition: width 0.25s; }
.legend { display: flex; flex-wrap: wrap; gap: 0.35rem 1rem; font-size: 0.84rem; color: var(--text-2); margin-top: 0.5rem; }
.legend i { display: inline-block; width: 11px; height: 11px; border-radius: 2px; margin-right: 0.35rem; vertical-align: -1px; }
.c-pass { background: #2ca02c; }
.c-daily { background: #d62728; }
.c-dd { background: #ff7f0e; }
.c-timeout { background: #7f7f7f; }
.c-blue { background: #1f77b4; }

.result-note {
  background: var(--blue-bg); border-left: 3px solid var(--blue); border-radius: 0 8px 8px 0;
  padding: 0.7rem 0.95rem; margin: 1rem 0; font-size: 0.95rem;
}
.result-note p { margin: 0; }
.result-note p + p { margin-top: 0.45em; }
.result-note.warn { background: #fdf3f3; border-left-color: var(--red); }
.result-error { display: none; color: var(--red); font-size: 0.9rem; margin: 0.6rem 0 0; }

.chart-wrap { margin-top: 1rem; }
.chart-wrap .chart-title { font-size: 0.88rem; font-weight: 700; margin-bottom: 0.35rem; }
.chart-wrap canvas { display: block; width: 100%; height: 260px; }
.chart-wrap .chart-cap { font-size: 0.8rem; color: var(--text-3); margin-top: 0.35rem; }

table.mini { width: 100%; border-collapse: collapse; font-size: 0.9rem; margin: 0.8rem 0; }
table.mini th, table.mini td { padding: 0.4em 0.55em; border-bottom: 1px solid var(--border); text-align: right; white-space: nowrap; }
table.mini th:first-child, table.mini td:first-child { text-align: left; }
table.mini td small { color: var(--text-3); font-weight: 400; }
table.mini th { font-size: 0.74rem; color: var(--text-3); font-weight: 650; text-transform: uppercase; letter-spacing: 0.03em; white-space: normal; vertical-align: bottom; line-height: 1.3; }
table.mini tr.hl td { background: var(--blue-bg); font-weight: 650; }
@media (max-width: 480px) { table.mini { font-size: 0.82rem; } table.mini th, table.mini td { padding: 0.4em 0.3em; } }
.table-scroll { overflow-x: auto; }

.status { font-size: 0.82rem; color: var(--text-3); min-height: 1.2em; }

/* phone: a slim bar keeps the headline result in view while the inputs are edited */
.peek {
  display: none; position: fixed; left: 0; right: 0; bottom: 0; z-index: 40;
  background: rgba(255, 255, 255, 0.97); border-top: 1px solid var(--border);
  box-shadow: 0 -4px 16px rgba(15, 17, 20, 0.08);
  padding: 0.55rem 1rem; font-size: 0.92rem;
  align-items: center; justify-content: space-between; gap: 0.8rem;
}
.peek strong { font-size: 1.1rem; }
.peek a { font-weight: 600; text-decoration: none; white-space: nowrap; }
@media (max-width: 860px) { .peek.on { display: flex; } }

.tool-cards { list-style: none; display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 1.2rem; margin: 1.8rem 0; }
@media (max-width: 860px) { .tool-cards { grid-template-columns: minmax(0, 1fr); } }
.tool-card { border: 1px solid var(--border); border-radius: 10px; padding: 1.2rem 1.25rem; display: flex; flex-direction: column; }
.tool-card h2 { font-size: 1.15rem; margin: 0 0 0.45rem; }
.tool-card h2 a { color: var(--text); text-decoration: none; }
.tool-card h2 a:hover { color: var(--blue); }
.tool-card p { color: var(--text-2); font-size: 0.95rem; }
.tool-card .answers { font-size: 0.86rem; color: var(--text-3); margin-bottom: 1rem; }
.tool-card .btn { align-self: flex-start; margin-top: auto; }

.tool-body h2 { margin-top: 2.2em; }

.link-row { margin: 0.9rem 0 0; }
.copy-link { font-size: 0.86rem; padding: 0.45em 0.95em; }
