/* bigtechcalc.com — PEFG brand system
 *
 * Navy #0D1F3C anchor. Mid-navy #1A3A5C on light grounds, steel blue
 * #7FA8CC on dark. Gold is paired and never cross-used: #F0D080 on dark
 * grounds only, #8A6410 on light grounds only. Burgundy #8B2D40 is
 * functional only (errors and warnings), on light ground, never on navy.
 * Off-white #F0EDE6 neutral.
 *
 * Type: IBM Plex Serif (display), Sans (body), Mono (technical labels).
 */

:root {
  --navy:        #0D1F3C;
  --navy-mid:    #1A3A5C;
  --steel:       #7FA8CC;
  --gold-dark:   #F0D080;  /* dark grounds ONLY */
  --gold-light:  #8A6410;  /* light grounds ONLY */
  --burgundy:    #8B2D40;  /* functional only */
  --offwhite:    #F0EDE6;
  --white:       #FFFFFF;

  --ink:         #0D1F3C;
  --ink-2:       #40506A;
  --ink-3:       #6B7A90;
  --rule:        rgba(13, 31, 60, 0.14);
  --rule-strong: rgba(13, 31, 60, 0.26);
  --surface:     #FFFFFF;
  --surface-2:   #F7F5F0;

  --sans:  'IBM Plex Sans', ui-sans-serif, system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
  --serif: 'IBM Plex Serif', Georgia, 'Times New Roman', serif;
  --mono:  'IBM Plex Mono', ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;

  --maxw: 1240px;
  --radius: 6px;
}

*, *::before, *::after { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }

body {
  margin: 0;
  font-family: var(--sans);
  font-size: 16px;
  line-height: 1.6;
  color: var(--ink);
  background: var(--offwhite);
}

h1, h2, h3, h4 { font-family: var(--serif); font-weight: 600; line-height: 1.22; margin: 0 0 .5em; color: var(--navy); }
h1 { font-size: clamp(1.75rem, 3.6vw, 2.6rem); letter-spacing: -0.015em; }
h2 { font-size: clamp(1.3rem, 2.4vw, 1.75rem); }
h3 { font-size: 1.1rem; }
h4 { font-size: .98rem; }
p  { margin: 0 0 1em; }
a  { color: var(--navy-mid); text-decoration-thickness: 1px; text-underline-offset: 2px; }
a:hover { color: var(--gold-light); }

.sr-only {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}

.wrap { max-width: var(--maxw); margin: 0 auto; padding: 0 20px; }
.narrow { max-width: 760px; }

/* ---------------------------------------------------------------- Header */

.site-header {
  background: var(--navy);
  color: var(--offwhite);
  border-bottom: 3px solid var(--gold-dark);
}
.site-header .wrap {
  display: flex; align-items: center; justify-content: space-between;
  gap: 20px; min-height: 62px;
}
.brand { display: flex; align-items: center; gap: 10px; text-decoration: none; }
.brand svg { display: block; height: 34px; width: auto; }
.site-nav { display: flex; gap: 22px; }
.site-nav a {
  color: var(--offwhite); text-decoration: none; font-size: .9rem;
  font-weight: 500; padding: 6px 0; border-bottom: 2px solid transparent;
}
.site-nav a:hover { color: var(--gold-dark); border-bottom-color: var(--gold-dark); }
@media (max-width: 720px) { .site-nav { display: none; } }

/* ------------------------------------------------------------------ Hero */

.hero { background: var(--navy); color: var(--offwhite); padding: 34px 0 40px; }
.hero h1 { color: var(--offwhite); max-width: 22ch; }
.hero h1 em { font-style: normal; color: var(--gold-dark); }
.hero .lede { font-size: 1.05rem; color: #C9D6E4; max-width: 62ch; margin-bottom: 0; }
.hero .kicker {
  font-family: var(--mono); font-size: .72rem; letter-spacing: .14em;
  text-transform: uppercase; color: var(--steel); margin-bottom: 10px;
}

/* --------------------------------------------------------------- Layout */

.main-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 300px;
  gap: 28px;
  align-items: start;
  padding: 28px 0 40px;
}
@media (max-width: 1080px) { .main-grid { grid-template-columns: 1fr; } }

.rail { position: sticky; top: 18px; }
@media (max-width: 1080px) { .rail { position: static; } }

/* ---------------------------------------------------------------- Panels */

.panel {
  background: var(--surface);
  border: 1px solid var(--rule);
  border-radius: var(--radius);
  margin-bottom: 20px;
}
.panel > header {
  display: flex; align-items: center; gap: 12px; flex-wrap: wrap;
  padding: 12px 16px; border-bottom: 1px solid var(--rule);
  background: var(--surface-2); border-radius: var(--radius) var(--radius) 0 0;
}
.panel > header h2, .panel > header h3 { margin: 0; font-size: 1rem; }
.panel .body { padding: 16px; }
.panel .body.tight { padding: 0; }

.panel-note {
  font-size: .82rem; color: var(--ink-3); margin: 0;
}

/* ---------------------------------------------------------------- Forms */

.field { display: flex; flex-direction: column; gap: 4px; margin-bottom: 12px; }
.field label {
  font-family: var(--mono); font-size: .7rem; letter-spacing: .07em;
  text-transform: uppercase; color: var(--ink-2); font-weight: 500;
}
.field .hint { font-size: .74rem; color: var(--ink-3); line-height: 1.4; }

input[type="text"], input[type="number"], select {
  font-family: var(--sans); font-size: .92rem; color: var(--ink);
  padding: 7px 9px; border: 1px solid var(--rule-strong);
  border-radius: 4px; background: var(--white); width: 100%;
  min-height: 36px;
}
input:focus, select:focus, button:focus-visible {
  outline: 2px solid var(--navy-mid); outline-offset: 1px;
}
input[type="checkbox"] { width: 16px; height: 16px; accent-color: var(--navy-mid); }

.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 0 14px; }
.grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 0 14px; }
.grid-4 { display: grid; grid-template-columns: repeat(4, 1fr); gap: 0 14px; }
@media (max-width: 640px) {
  .grid-2, .grid-3, .grid-4 { grid-template-columns: 1fr; }
}

fieldset { border: 0; padding: 0; margin: 0 0 6px; }
legend {
  font-family: var(--mono); font-size: .68rem; letter-spacing: .11em;
  text-transform: uppercase; color: var(--navy-mid); font-weight: 600;
  padding: 0 0 8px; border-bottom: 1px solid var(--rule);
  width: 100%; margin-bottom: 12px;
}

.inline { display: flex; align-items: center; gap: 8px; }
.inline label { text-transform: none; font-family: var(--sans); font-size: .88rem; letter-spacing: 0; }

/* --------------------------------------------------------------- Buttons */

button {
  font-family: var(--sans); font-size: .88rem; font-weight: 500;
  padding: 8px 14px; border-radius: 4px; cursor: pointer;
  border: 1px solid var(--rule-strong); background: var(--white); color: var(--navy);
  min-height: 36px;
}
button:hover { background: var(--surface-2); }
button.primary { background: var(--navy); color: var(--offwhite); border-color: var(--navy); }
button.primary:hover { background: var(--navy-mid); }
button.ghost { border-color: transparent; background: transparent; }
button.ghost:hover { background: var(--surface-2); }
button.danger { color: var(--burgundy); border-color: rgba(139,45,64,.4); }
button.danger:hover { background: rgba(139,45,64,.06); }
button:disabled { opacity: .45; cursor: not-allowed; }
.btn-row { display: flex; gap: 8px; flex-wrap: wrap; }

/* ----------------------------------------------------------------- Tabs */

.tabs { display: flex; gap: 2px; flex-wrap: wrap; align-items: center; }
.tab {
  padding: 7px 13px; border: 1px solid var(--rule); border-bottom: none;
  background: var(--surface-2); border-radius: 4px 4px 0 0;
  font-size: .87rem; cursor: pointer; color: var(--ink-2); min-height: 34px;
}
.tab[aria-selected="true"] {
  background: var(--white); color: var(--navy); font-weight: 600;
  border-color: var(--rule-strong); box-shadow: inset 0 3px 0 var(--gold-light);
}
.tab.baseline::after {
  content: 'baseline'; font-family: var(--mono); font-size: .58rem;
  letter-spacing: .08em; text-transform: uppercase; color: var(--gold-light);
  margin-left: 7px; vertical-align: middle;
}

/* ---------------------------------------------------------- Scenario pills */

.scen-pills { display: flex; gap: 6px; }
.scen-pill {
  font-family: var(--mono); font-size: .72rem; letter-spacing: .06em;
  text-transform: uppercase; padding: 6px 11px; border-radius: 999px;
  border: 1px solid var(--rule-strong); background: var(--white);
  cursor: pointer; color: var(--ink-2); min-height: 32px;
}
.scen-pill[aria-pressed="true"] {
  background: var(--navy); color: var(--offwhite); border-color: var(--navy);
}

/* ---------------------------------------------------------------- Tables */

.table-scroll { overflow-x: auto; -webkit-overflow-scrolling: touch; }
table { border-collapse: collapse; width: 100%; font-size: .85rem; }
caption {
  text-align: left; font-family: var(--mono); font-size: .7rem;
  letter-spacing: .08em; text-transform: uppercase; color: var(--ink-3);
  padding: 10px 16px 8px;
}
th, td { padding: 7px 12px; text-align: right; border-bottom: 1px solid var(--rule); white-space: nowrap; }
th:first-child, td:first-child { text-align: left; }
thead th {
  font-family: var(--mono); font-size: .68rem; letter-spacing: .06em;
  text-transform: uppercase; color: var(--ink-2); font-weight: 600;
  background: var(--surface-2); border-bottom: 1px solid var(--rule-strong);
  position: sticky; top: 0; z-index: 1;
}
tbody tr:hover { background: rgba(127,168,204,.09); }
tfoot td { font-weight: 600; border-top: 2px solid var(--navy); border-bottom: none; background: var(--surface-2); }
td.num, th.num { font-family: var(--mono); font-variant-numeric: tabular-nums; font-size: .82rem; }
td.dim { color: var(--ink-3); }

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

.stat-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 12px; }
.stat {
  border: 1px solid var(--rule); border-radius: var(--radius);
  padding: 13px 15px; background: var(--surface);
}
.stat .co {
  font-family: var(--mono); font-size: .68rem; letter-spacing: .09em;
  text-transform: uppercase; color: var(--ink-3); margin-bottom: 6px;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.stat .big {
  font-family: var(--serif); font-size: 1.5rem; font-weight: 600;
  color: var(--navy); font-variant-numeric: tabular-nums; line-height: 1.1;
}
.stat .band {
  font-family: var(--mono); font-size: .72rem; color: var(--ink-3);
  margin-top: 5px; font-variant-numeric: tabular-nums;
}
.stat.lead { border-color: var(--gold-light); border-width: 1px; box-shadow: inset 3px 0 0 var(--gold-light); }

/* ---------------------------------------------------------------- Charts */

.chart-box { padding: 8px 4px 4px; }
.chart-box svg { display: block; width: 100%; height: auto; }
.legend { display: flex; gap: 16px; flex-wrap: wrap; padding: 6px 16px 14px; font-size: .8rem; }
.legend span { display: inline-flex; align-items: center; gap: 6px; color: var(--ink-2); }
.legend i { width: 14px; height: 3px; border-radius: 2px; display: inline-block; }
.legend i.sw { height: 11px; width: 11px; border-radius: 2px; }

/* ---------------------------------------------------------------- Notices */

.notice {
  border-left: 3px solid var(--gold-light); background: rgba(240,208,128,.13);
  padding: 11px 14px; font-size: .85rem; border-radius: 0 4px 4px 0;
  margin: 0 0 14px; color: var(--ink-2);
}
.notice strong { color: var(--navy); }
.notice.warn {
  border-left-color: var(--burgundy); background: rgba(139,45,64,.07); color: var(--burgundy);
}
.notice.warn strong { color: var(--burgundy); }
.notice.flat { border-left-color: var(--steel); background: rgba(127,168,204,.12); }

.errors { margin: 0; padding-left: 18px; font-size: .85rem; color: var(--burgundy); }

/* ------------------------------------------------------------ Vest editor */

.vest-editor { border: 1px solid var(--rule); border-radius: 4px; padding: 12px; background: var(--surface-2); }
.vest-row { display: flex; gap: 6px; flex-wrap: wrap; align-items: flex-end; }
.vest-cell { width: 74px; }
.vest-cell label {
  font-family: var(--mono); font-size: .62rem; color: var(--ink-3);
  display: block; text-align: center; margin-bottom: 2px;
}
.vest-cell input { padding: 5px 4px; text-align: center; font-size: .82rem; min-height: 32px; }
.vest-total {
  font-family: var(--mono); font-size: .78rem; padding: 6px 10px;
  border-radius: 4px; white-space: nowrap;
}
.vest-total.ok  { color: #1d5b34; background: rgba(29,91,52,.09); }
.vest-total.bad { color: var(--burgundy); background: rgba(139,45,64,.09); font-weight: 600; }

/* ------------------------------------------------------------------- Ads */

.ad {
  display: block; margin: 0 auto 20px; text-align: center;
  background: repeating-linear-gradient(45deg, #EFECE4, #EFECE4 10px, #EAE6DC 10px, #EAE6DC 20px);
  border: 1px dashed var(--rule-strong); border-radius: 4px;
  color: var(--ink-3); font-family: var(--mono); font-size: .68rem;
  letter-spacing: .1em; text-transform: uppercase;
  display: flex; align-items: center; justify-content: center;
  overflow: hidden;
}
/* Heights are reserved to hold Cumulative Layout Shift at ~0 when the
   AdSense script fills the slot. Do not remove these. */
.ad-rail       { min-height: 600px; width: 300px; max-width: 100%; }
.ad-inline     { min-height: 280px; width: 100%; }
.ad-footer     { min-height: 250px; width: 100%; }
@media (max-width: 1080px) { .ad-rail { min-height: 280px; width: 100%; } }

/* -------------------------------------------------------------- Content */

.content { background: var(--white); border-top: 1px solid var(--rule); padding: 40px 0; }
.content h2 { margin-top: 1.6em; }
.content h2:first-child { margin-top: 0; }
.content h3 { margin-top: 1.4em; }
.content ul, .content ol { margin: 0 0 1em; padding-left: 22px; }
.content li { margin-bottom: .45em; }
.content .narrow > p, .content .narrow > ul, .content .narrow > ol { font-size: 1rem; }

details.faq {
  border-bottom: 1px solid var(--rule); padding: 12px 0;
}
details.faq summary {
  cursor: pointer; font-weight: 600; color: var(--navy);
  font-family: var(--serif); font-size: 1.02rem; list-style: none;
  display: flex; justify-content: space-between; gap: 12px;
}
details.faq summary::-webkit-details-marker { display: none; }
details.faq summary::after { content: '+'; color: var(--gold-light); font-family: var(--mono); }
details[open].faq summary::after { content: '\2212'; }
details.faq .a { padding-top: 10px; color: var(--ink-2); font-size: .95rem; }

dl.glossary dt {
  font-family: var(--mono); font-size: .8rem; color: var(--navy);
  font-weight: 600; margin-top: 14px; letter-spacing: .02em;
}
dl.glossary dd { margin: 3px 0 0; color: var(--ink-2); font-size: .93rem; }

/* -------------------------------------------------------------- Footer */

.site-footer {
  background: var(--navy); color: #A9BCD0; padding: 30px 0 34px; font-size: .84rem;
}
.site-footer h4 { color: var(--offwhite); font-size: .82rem; font-family: var(--mono);
  letter-spacing: .1em; text-transform: uppercase; margin-bottom: 10px; }
.site-footer a { color: var(--steel); }
.site-footer a:hover { color: var(--gold-dark); }
.footer-grid { display: grid; grid-template-columns: 2fr 1fr 1fr; gap: 30px; }
@media (max-width: 720px) { .footer-grid { grid-template-columns: 1fr; } }
.footer-legal {
  margin-top: 24px; padding-top: 16px; border-top: 1px solid rgba(240,237,230,.16);
  font-size: .78rem; color: #8FA3BA;
}

/* ------------------------------------------------------------- Utilities */

.mono { font-family: var(--mono); }
.tnum { font-variant-numeric: tabular-nums; }
.mb0 { margin-bottom: 0; }
.mt16 { margin-top: 16px; }
.spacer { flex: 1; }
.small { font-size: .82rem; color: var(--ink-3); }
.hidden { display: none !important; }

@media print {
  .site-header, .site-footer, .rail, .ad, .btn-row, .content, .no-print { display: none !important; }
  body { background: #fff; }
  .panel { break-inside: avoid; border-color: #999; }
  .main-grid { grid-template-columns: 1fr; }
}
