/* Electronics Calculators: app-specific styles (shared styles: /assets/css/site.css) */

:root {
  --accent: #1f6fb2;
  --accent-dark: #17578d;
  --ok: #2e7d32;
  --warn: #9a6400;
  --bad: #b3261e;
  --mono: ui-monospace, "Cascadia Mono", "SF Mono", Menlo, Consolas, "Liberation Mono", monospace;
}

.app { max-width: 1240px; margin: 0 auto; padding: 1.5rem 1.25rem 0; display: flex; flex-direction: column; gap: 1rem; }
.app-head { max-width: 82ch; }
.app-head h1 { margin: 0 0 0.35rem; font-size: 2rem; color: var(--brand); }
.app-head p { margin: 0; color: var(--ink-soft); }
code { font-family: var(--mono); font-size: 0.9em; background: #eceef4; padding: 0.05rem 0.3rem; border-radius: 3px; }

/* ---------- tabs ---------- */

.tabs { display: flex; flex-wrap: wrap; gap: 0.35rem; border-bottom: 2px solid var(--line); }
.tabs button {
  font: inherit; font-weight: 700; font-size: 0.9375rem; color: var(--ink-soft); background: none; border: 0;
  padding: 0.55rem 0.9rem; margin-bottom: -2px; border-bottom: 3px solid transparent; cursor: pointer;
}
.tabs button:hover { color: var(--ink); }
.tabs button[aria-selected="true"] { color: var(--accent); border-bottom-color: var(--accent); }

.tabpanel { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 360px), 1fr)); gap: 1rem; align-items: start; }
.tabpanel[hidden] { display: none; }

/* ---------- cards ---------- */

.panel { background: var(--surface); border-radius: var(--radius); box-shadow: var(--shadow); padding: 1rem 1.1rem 1.1rem; min-width: 0; }
.panel h2 { margin: 0 0 0.3rem; font-size: 1.125rem; color: var(--brand); }
.panel h3 { margin: 1rem 0 0.4rem; font-size: 0.875rem; }
.calc.wide { grid-column: 1 / -1; }
@media (min-width: 800px) { .calc.span2c { grid-column: span 2; } }
.calc:target { box-shadow: 0 0 0 2px var(--accent), var(--shadow); }
.lead { margin: 0 0 0.8rem; color: var(--ink-soft); font-size: 0.9rem; }
.hint { font-weight: 400; color: var(--ink-soft); }
.split { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 0.5rem 1.6rem; }
.split h3:first-child { margin-top: 0; }

.fields { display: grid; grid-template-columns: repeat(auto-fill, minmax(9.5rem, 1fr)); gap: 0.55rem 0.75rem; }
.field { display: flex; flex-direction: column; gap: 0.2rem; min-width: 0; }
.field.span2 { grid-column: span 2; }
.field > span:first-child { font-weight: 700; font-size: 0.8125rem; }
input, select {
  font: inherit; font-size: 0.9375rem; padding: 0.35rem 0.5rem; border: 1px solid #c5c8d4; border-radius: 5px;
  background: var(--surface); color: var(--ink); min-width: 0; width: 100%;
}
input:focus, select:focus { border-color: var(--accent); }
input.bad { border-color: var(--bad); background: #fdf0ef; }
.unit { display: flex; align-items: stretch; }
.unit input { border-radius: 5px 0 0 5px; font-variant-numeric: tabular-nums; }
.unit i { font-style: normal; font-size: 0.8125rem; color: var(--ink-soft); background: #f0f1f5; border: 1px solid #c5c8d4; border-left: 0; border-radius: 0 5px 5px 0; padding: 0 0.5rem; display: flex; align-items: center; min-width: 2.2rem; justify-content: center; }
:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; }

.result { margin: 0.8rem 0 0; font-size: 0.95rem; line-height: 1.55; font-variant-numeric: tabular-nums; }
.result:empty { display: none; }
.result + .fields { margin-top: 0.9rem; }
.result b.big { font-size: 1.35rem; color: var(--ink); }
.note { margin: 0.6rem 0 0; font-size: 0.8125rem; color: var(--ink-soft); }
.note:empty { display: none; }
.ok { color: var(--ok); font-weight: 700; }
.warn { color: var(--warn); font-weight: 700; }
.bad { color: var(--bad); font-weight: 700; }

/* ---------- tables ---------- */

.tbl { overflow-x: auto; }
.pairs { width: 100%; border-collapse: collapse; font-size: 0.875rem; font-variant-numeric: tabular-nums; }
.pairs th { text-align: left; font-size: 0.75rem; color: var(--ink-soft); font-weight: 700; padding: 0.25rem 0.45rem; border-bottom: 1px solid var(--line); }
.pairs td { padding: 0.28rem 0.45rem; border-bottom: 1px solid #f0f1f5; }
.pairs td.n, .pairs th.n { text-align: right; white-space: nowrap; }
.pairs tr[data-pick] { cursor: pointer; }
.pairs tr[data-pick]:hover td { background: #edf4fb; }
.pairs tr.best td { background: #f2f8ee; }
.pairs.results td:first-child { color: var(--ink-soft); }
.pairs.results td:nth-child(2) { font-weight: 700; }

/* ---------- colour code ---------- */

.resistor { display: block; width: 100%; max-width: 320px; height: auto; margin: 0.8rem auto 0.4rem; }
.bands { display: grid; grid-template-columns: repeat(auto-fill, minmax(6.5rem, 1fr)); gap: 0.4rem 0.6rem; }
.bands label { display: flex; flex-direction: column; gap: 0.15rem; font-size: 0.75rem; font-weight: 700; }
.bands select { font-size: 0.875rem; padding: 0.25rem 0.35rem; }

.help { margin-bottom: 1.5rem; }
.help ul { margin: 0; padding-left: 1.2rem; font-size: 0.9375rem; }
.help li { margin: 0.35rem 0; }

@media (max-width: 760px) {
  .split { grid-template-columns: minmax(0, 1fr); }
}
@media (max-width: 560px) {
  .app { padding: 1rem 0.75rem 0; }
  .app-head h1 { font-size: 1.6rem; }
  .tabs button { padding: 0.5rem 0.6rem; font-size: 0.875rem; }
  .field.span2 { grid-column: 1 / -1; }
  .fields { grid-template-columns: repeat(auto-fill, minmax(8.5rem, 1fr)); }
}
