/* ============================================================
 * Utilities Bunker — Antenna Gain Calculator (v2.1)
 * File: /assets/css/modules/electronics/antenna-gain.v2.1.css
 * Purpose:
 * - Tool-only layout + panels + focus styling + small UX polish
 * - Mobile-first, UB breakpoints, clamp(), container queries (opt-in)
 * - No changes to ub-toolkit.v2.1.css
 * ============================================================ */

/* ============================== Tool-scoped tokens ============================== */
:root{
  --ag-radius: 16px;
  --ag-gap: 14px;
  --ag-ring: rgba(249,58,19,.14);
  --ag-ring-dark: rgba(249,58,19,.20);
  --ag-row: rgba(0,0,0,.06);
  --ag-row-dark: rgba(255,255,255,.10);
}

/* ============================== Header row ============================== */
.ub-headrow{
  display:flex;
  align-items:flex-start;
  justify-content:space-between;
  gap:12px;
  flex-wrap:wrap;
}
.ub-title-tight{ margin:0; font-size: var(--ub-fs-5); letter-spacing:-0.02em; }
.ub-sub-tight{ margin:6px 0 0; }

/* ============================== How-to list ============================== */
.ub-steps{
  margin:0;
  padding-left:18px;
}
.ub-steps li{ margin: 6px 0; }

/* ============================== Tool grid (panels) ============================== */
/* Desktop / Laptops: 1025–1440  |  Tablets stack <=1024 */
.ub-toolgrid{
  display:grid;
  grid-template-columns: 1.05fr 0.95fr;
  gap: var(--ag-gap);
}
@media (max-width: 1024px){
  .ub-toolgrid{ grid-template-columns: 1fr; }
}

/* ============================== Panel component (tool-only) ============================== */
.ub-panel{
  border: 1px solid var(--ub-border);
  border-radius: var(--ag-radius);
  background: var(--ub-surface-2);
  padding: 12px;
  box-shadow: none;
}

/* Dark-mode panel tuning */
html.ub-theme-dark .ub-panel{
  border-color: rgba(255,255,255,.12);
  background: rgba(255,255,255,.03);
}

.ub-panel-head{
  padding: 2px 2px 10px;
  border-bottom: 1px solid var(--ub-border);
  margin-bottom: 12px;
}
html.ub-theme-dark .ub-panel-head{
  border-bottom-color: rgba(255,255,255,.12);
}

.ub-panel-title{
  margin:0;
  font-size: var(--ub-fs-3);
  font-weight: 950;
  letter-spacing: -0.01em;
}
.ub-panel-sub{
  margin: 6px 0 0;
  font-size: var(--ub-fs-1);
  color: var(--ub-muted);
}

/* ============================== Container query (optional enhancement) ============================== */
/* Add container behavior without touching shared toolkit */
.ub-panel{ container-type: inline-size; }

/* Inside narrow panels, tighten grid spacing */
@container (max-width: 520px){
  .ub-panel{ padding: 10px; }
  .ub-panel-head{ margin-bottom: 10px; }
}

/* ============================== Forms + actions ============================== */
.ub-form{ margin:0; }

/* Ensure strong tap targets even if future toolkit tweaks happen */
.ub-field input,
.ub-field select{
  min-height: var(--ub-hit);
}

/* Action row buttons: keep them readable & wrap nicely */
.ub-actions .ub-btn{
  min-height: var(--ub-hit);
  padding: 10px 14px;
}

/* On small screens, make action buttons full width for easy tapping */
@media (max-width: 480px){
  .ub-actions .ub-btn{
    width: 100%;
    justify-content: center;
  }
}

/* ============================== Output blocks ============================== */
#gainOut,
#eirpOut{ position: relative; }

/* Subtle output background (non-invasive) */
.ub-out{
  background: linear-gradient(180deg, var(--ub-surface-2), var(--ub-surface-3));
}

/* Slightly tighter output tiles on tiny screens */
@media (max-width: 480px){
  .ub-out-grid{ gap: 10px; }
}

/* ============================== Focus mode (gain outputs) ============================== */
/* Output tiles are the 4 children of .ub-out-grid in order:
   1) dBi  2) dBd  3) Linear  4) Ratio
*/
#gainOut[data-focus="dbi"] .ub-out-grid > :not(:nth-child(1)),
#gainOut[data-focus="dbd"] .ub-out-grid > :not(:nth-child(2)),
#gainOut[data-focus="lin"] .ub-out-grid > :not(:nth-child(3)){
  opacity: .45;
  filter: saturate(.75);
}

/* Highlight the focused tile */
#gainOut[data-focus="dbi"] .ub-out-grid > :nth-child(1),
#gainOut[data-focus="dbd"] .ub-out-grid > :nth-child(2),
#gainOut[data-focus="lin"] .ub-out-grid > :nth-child(3){
  opacity: 1;
  filter: none;
  border-radius: 12px;
  box-shadow: 0 0 0 4px var(--ag-ring);
}

/* Dark ring tuning */
html.ub-theme-dark #gainOut[data-focus="dbi"] .ub-out-grid > :nth-child(1),
html.ub-theme-dark #gainOut[data-focus="dbd"] .ub-out-grid > :nth-child(2),
html.ub-theme-dark #gainOut[data-focus="lin"] .ub-out-grid > :nth-child(3){
  box-shadow: 0 0 0 4px var(--ag-ring-dark);
}

/* ============================== Work box ============================== */
.ub-work{
  font-family: var(--ub-mono);
  font-size: 13px;
  line-height: 1.55;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

/* Easier-to-hit summary row */
.ub-collapsible summary{
  min-height: var(--ub-hit);
}

/* ============================== Reference / FAQ ============================== */
.ub-ref-list{
  margin: 0;
  padding-left: 18px;
}
.ub-ref-list li{ margin: 8px 0; }

.ub-faq-q{
  margin: 12px 0 6px;
  font-size: var(--ub-fs-2);
  font-weight: 950;
}
.ub-faq-a{
  margin: 0 0 10px;
  font-size: var(--ub-fs-2);
}

/* ============================== Tiny polish: code blocks ============================== */
code{
  font-family: var(--ub-mono);
  font-size: .95em;
  padding: 0 .35em;
  border-radius: 8px;
  background: rgba(0,0,0,.05);
  border: 1px solid var(--ub-border);
}
html.ub-theme-dark code{
  background: rgba(255,255,255,.06);
  border-color: rgba(255,255,255,.12);
}
