/* U.S. Materials Atlas -- DefMetrix palette (light only). */
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700&family=IBM+Plex+Mono:wght@400;500&display=swap');

:root {
  --bg: #f4f6f9;
  --panel: #ffffff;
  --border: #dfe5ec;
  --border-strong: #cfd8e3;
  --text: #1e293b;
  --text-dim: #475569;
  --text-muted: #64748b;
  --accent: #1a5dad;
  --accent-soft: #e8f0fa;
  --row-alt: #f8fafc;
  --row-hover: #f1f5f9;
  --header-bg: #f8fafc;
  --shadow: rgba(22, 40, 60, 0.06);
  --chip-border: rgba(22, 40, 60, 0.10);
  --good: #15803d;
  --good-soft: #e3f2e9;
  --warn: #b45309;
  --warn-soft: #fdf3e0;
  --bad: #dc2626;
  --bad-soft: #fdeaea;
  --node-product: #e8f0fa;
  --node-service: #eef1f5;
  --node-input: #f7ece3;
}

* { box-sizing: border-box; }

html, body {
  margin: 0; padding: 0;
  background: var(--bg);
  color: var(--text);
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  font-size: 16px;
  line-height: 1.55;
  -webkit-text-size-adjust: 100%;
}

a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }

.wrap { max-width: 1180px; margin: 0 auto; padding: 0 24px; }

.skip {
  position: absolute; left: -9999px;
  background: var(--accent); color: #fff; padding: 10px 16px; z-index: 100;
}
.skip:focus { left: 12px; top: 12px; }

/* ---- Top bar ---- */

.topbar {
  border-bottom: 1px solid var(--border);
  background: var(--panel);
  position: sticky; top: 0; z-index: 20;
}
.topbar__inner {
  display: flex; align-items: center; justify-content: space-between;
  gap: 20px; padding-top: 12px; padding-bottom: 12px; flex-wrap: wrap;
}
.brand { display: flex; flex-direction: column; line-height: 1.2; }
.brand:hover { text-decoration: none; }
.brand__mark { font-weight: 700; font-size: 1.02rem; color: var(--text); letter-spacing: -0.01em; }
.brand__sub { font-size: 0.72rem; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.09em; }
.topnav { display: flex; gap: 22px; font-size: 0.9rem; font-weight: 600; }
.topnav a { color: var(--text-dim); }

/* ---- Breadcrumbs ---- */

.crumbs { margin: 18px 0 4px; font-size: 0.83rem; }
.crumbs ol { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: 6px; }
.crumbs li + li::before { content: "/"; color: var(--text-muted); margin-right: 6px; }
.crumbs li[aria-current] { color: var(--text-muted); }

/* ---- Page head ---- */

.hero, .pagehead { padding: 30px 0 6px; }
.eyebrow {
  font-size: 0.74rem; text-transform: uppercase; letter-spacing: 0.1em;
  color: var(--text-muted); margin: 0 0 8px; font-weight: 700;
}
h1 { font-size: 2rem; line-height: 1.2; margin: 0 0 12px; letter-spacing: -0.02em; }
.sym {
  font-size: 1.1rem; color: var(--text-muted); font-weight: 500;
  border: 1px solid var(--border-strong); border-radius: 4px; padding: 2px 8px; vertical-align: middle;
}
.lede { font-size: 1.06rem; color: var(--text-dim); margin: 0; max-width: 74ch; }

/* ---- Sections ---- */

.sec { margin: 40px 0; }
.sec h2 {
  font-size: 1.18rem; margin: 0 0 6px; letter-spacing: -0.01em;
  padding-bottom: 8px; border-bottom: 1px solid var(--border);
}
.sec h3 { font-size: 0.98rem; margin: 22px 0 8px; }
.sec h4 { font-size: 0.86rem; margin: 14px 0 6px; color: var(--text-dim); }
.sec__sub { color: var(--text-muted); font-size: 0.88rem; margin: 8px 0 16px; max-width: 74ch; }
.prose p { max-width: 74ch; margin: 0 0 12px; }

.cols { display: grid; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); gap: 28px; }

.bullets { margin: 0; padding-left: 20px; max-width: 74ch; }
.bullets li { margin-bottom: 7px; }

/* ---- Callout ---- */

.callout {
  border: 1px solid var(--border-strong); border-left: 3px solid var(--accent);
  background: var(--panel); border-radius: 6px; padding: 16px 20px; margin: 26px 0;
}
.callout h3 { margin: 0 0 8px; font-size: 0.95rem; }
.callout p { margin: 0 0 8px; max-width: 74ch; font-size: 0.93rem; color: var(--text-dim); }
.callout p:last-child { margin-bottom: 0; }
.callout--warn { border-left-color: var(--warn); background: var(--warn-soft); }

/* ---- Card grid ---- */

.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 12px; margin-top: 14px; }
.card {
  border: 1px solid var(--border); border-radius: 6px; background: var(--panel);
  padding: 14px 16px; display: flex; flex-direction: column; gap: 4px;
  transition: border-color .12s, background .12s;
}
.card:hover { border-color: var(--accent); background: var(--row-hover); text-decoration: none; }
.card__t { font-weight: 650; color: var(--text); font-size: 0.95rem; }
.card__s { font-size: 0.8rem; color: var(--text-muted); }

/* ---- Supplier rows ---- */

.supgroup { margin-bottom: 34px; }
.supgroup h3 { display: flex; align-items: center; gap: 10px; margin-top: 0; }
.count {
  font-size: 0.74rem; font-weight: 700; background: var(--accent-soft); color: var(--accent);
  border-radius: 10px; padding: 1px 9px;
}
.supgroup__blurb { color: var(--text-muted); font-size: 0.86rem; margin: 0 0 14px; max-width: 74ch; }

.rows { list-style: none; margin: 0; padding: 0; }
.row {
  border: 1px solid var(--border); border-radius: 6px; background: var(--panel);
  padding: 13px 16px; margin-bottom: 9px;
}
.row__head { display: flex; align-items: baseline; gap: 10px; flex-wrap: wrap; }
.row__name { font-weight: 650; font-size: 1rem; }
.row__meta { font-size: 0.83rem; color: var(--text-muted); margin-top: 2px; }
.row__flags { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 9px; }
.row__note { font-size: 0.86rem; color: var(--text-dim); margin: 9px 0 0; max-width: 78ch; }
.row__src { font-size: 0.76rem; color: var(--text-muted); display: inline-block; margin-top: 8px; }

.tag {
  font-size: 0.72rem; border: 1px solid var(--chip-border); border-radius: 3px;
  padding: 1px 6px; color: var(--text-muted);
}
.flag {
  font-size: 0.74rem; border: 1px solid var(--chip-border); border-radius: 3px;
  padding: 2px 8px; color: var(--text-dim); background: var(--row-alt);
}
.flag--good { color: var(--good); background: var(--good-soft); border-color: transparent; font-weight: 600; }

.conf { font-size: 0.7rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.06em; }
.conf--high { color: var(--good); }
.conf--medium { color: var(--warn); }
.conf--low { color: var(--text-muted); }

/* ---- Tables ---- */

.tablescroll { overflow-x: auto; margin-top: 14px; -webkit-overflow-scrolling: touch; }
.tbl { border-collapse: collapse; width: 100%; font-size: 0.89rem; min-width: 560px; }
.tbl th, .tbl td {
  text-align: left; padding: 9px 14px; border-bottom: 1px solid var(--border); vertical-align: top;
}
.tbl thead th {
  background: var(--header-bg); font-size: 0.76rem; text-transform: uppercase;
  letter-spacing: 0.06em; color: var(--text-dim); white-space: nowrap;
}
.tbl tbody tr:nth-child(even) { background: var(--row-alt); }
.tbl tbody th { font-weight: 650; white-space: nowrap; }
.tbl .unit, .tbl .note { color: var(--text-muted); font-size: 0.84rem; }

.dl { display: grid; grid-template-columns: max-content 1fr; gap: 6px 20px; margin: 16px 0 0; font-size: 0.9rem; }
.dl dt { color: var(--text-muted); }
.dl dd { margin: 0; }

/* ---- Applications ---- */

.appgrid {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); gap: 20px; margin-top: 16px;
}
.appitem {
  border: 1px solid var(--border); border-radius: 6px; background: var(--panel); padding: 15px 18px;
}
.appitem h3 { margin: 0 0 7px; font-size: 0.95rem; }
.appitem p { margin: 0; font-size: 0.9rem; color: var(--text-dim); }
.appitem .ex { margin-top: 9px; font-size: 0.82rem; color: var(--text-muted); }

/* ---- Supply chain diagram ---- */

.scwrap { margin: 18px 0 0; }
.scscroll {
  overflow-x: auto; border: 1px solid var(--border); border-radius: 6px;
  background: var(--panel); padding: 22px; -webkit-overflow-scrolling: touch;
}
.scscroll svg { display: block; max-width: none; }
.scnode { stroke: var(--border-strong); stroke-width: 1; }
.scnode--product { fill: var(--node-product); }
.scnode--service { fill: var(--node-service); }
.scnode--input { fill: var(--node-input); }
.sclabel { font-size: 11.5px; fill: var(--text); font-family: inherit; }
.sclink .scnode { cursor: pointer; }
.sclink:hover .scnode { stroke: var(--accent); stroke-width: 2; }
.sclink:hover .sclabel { fill: var(--accent); }
.scstatic .sclabel { fill: var(--text-muted); }
/* A step with no supplier is not a rendering failure, so it must not look like one.
   Dashed = we looked and domestic capability is absent; that is a finding, and on this
   page it is the most important box, not the least. Faint = modeled but unworked. */
.scnode--absent {
  fill: none; stroke: var(--bad); stroke-width: 1.4; stroke-dasharray: 5 3;
}
.scstatic .scnode--absent + .sclabel { fill: var(--bad); }
.scnode--unworked { fill: none; stroke: var(--border); stroke-dasharray: 2 3; }
.sckey {
  display: inline-block; width: 22px; height: 10px; border-radius: 2px;
  vertical-align: -1px; margin-right: 3px;
}
.sckey--absent { border: 1.4px dashed var(--bad); }
.sckey--unworked { border: 1px dashed var(--border-strong); }
.scedge { fill: none; stroke: var(--border-strong); stroke-width: 1.3; }
.scarrow { fill: var(--border-strong); }
figcaption { font-size: 0.83rem; color: var(--text-muted); margin-top: 12px; max-width: 74ch; }

/* ---- Explorer ---- */

.explore { display: grid; grid-template-columns: 250px 1fr; gap: 32px; margin-top: 24px; align-items: start; }
.filters {
  border: 1px solid var(--border); border-radius: 6px; background: var(--panel);
  padding: 16px; position: sticky; top: 78px;
}
.filters__head {
  display: flex; justify-content: space-between; align-items: center;
  font-size: 0.78rem; text-transform: uppercase; letter-spacing: 0.08em;
  color: var(--text-muted); font-weight: 700; margin-bottom: 12px;
}
.linkbtn {
  background: none; border: none; color: var(--accent); cursor: pointer;
  font: inherit; font-size: 0.76rem; padding: 0; text-transform: none; letter-spacing: 0;
}
.fgroup { border-top: 1px solid var(--border); padding: 12px 0 4px; }
.fgroup:first-child { border-top: none; padding-top: 0; }
.fgroup h3 { font-size: 0.8rem; margin: 0 0 8px; color: var(--text-dim); }
.fopt { display: flex; align-items: center; gap: 8px; font-size: 0.85rem; margin-bottom: 5px; cursor: pointer; }
.fopt input { margin: 0; accent-color: var(--accent); }
.fopt span { color: var(--text-dim); }
.fopt .n { margin-left: auto; color: var(--text-muted); font-size: 0.76rem; }

.searchbar { margin-bottom: 14px; }
.searchbar input {
  width: 100%; padding: 11px 14px; font: inherit; font-size: 0.95rem;
  border: 1px solid var(--border-strong); border-radius: 6px;
  background: var(--panel); color: var(--text);
}
.searchbar input:focus { outline: 2px solid var(--accent); outline-offset: -1px; border-color: transparent; }
.resultcount { font-size: 0.82rem; color: var(--text-muted); margin: 0 0 12px; }
.empty { color: var(--text-muted); font-size: 0.9rem; }

.rtype {
  font-size: 0.7rem; text-transform: uppercase; letter-spacing: 0.06em;
  color: var(--text-muted); font-weight: 700;
}

/* ---- Footer ---- */

.foot { border-top: 1px solid var(--border); margin-top: 60px; padding: 26px 0 44px; background: var(--panel); }
.foot p { font-size: 0.83rem; color: var(--text-muted); margin: 0 0 8px; max-width: 78ch; }
.foot__meta { font-size: 0.8rem; }

/* ---- Responsive ---- */

@media (max-width: 860px) {
  .explore { grid-template-columns: 1fr; }
  .filters { position: static; }
  h1 { font-size: 1.6rem; }
  .wrap { padding: 0 16px; }
}

/* --- Industrial base findings (concentration page) ------------------------ */

.statline { color: var(--text-dim); font-size: 0.9rem; margin: 0 0 18px; }

.finding {
  border: 1px solid var(--border);
  border-left: 3px solid var(--border-strong);
  border-radius: 6px;
  background: var(--panel);
  padding: 18px 20px;
  margin-top: 16px;
}
.finding h3 { margin: 8px 0 6px; font-size: 1.06rem; line-height: 1.35; }
.finding__badges { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.finding__sum { margin: 0 0 10px; color: var(--text-dim); font-size: 0.94rem; }
.finding__meta { margin: 8px 0 0; font-size: 0.86rem; color: var(--text-muted); }
.finding__note {
  margin: 12px 0 0; padding-top: 10px;
  border-top: 1px dashed var(--border);
  font-size: 0.84rem; color: var(--text-muted);
}
.finding .src { margin: 8px 0 0; font-size: 0.8rem; }

/* A research gap is an admission the atlas is incomplete, not a chokepoint.
   It must not read as a finding about the industrial base. */
.finding--gap { border-left-color: var(--border); background: transparent; }

/* Severity gets its own class rather than extending .tag, which is already
   defined above and used on supplier rows -- redefining it would restyle those. */
.sev {
  display: inline-block; font-size: 0.68rem; font-weight: 700;
  text-transform: uppercase; letter-spacing: 0.06em;
  padding: 3px 7px; border-radius: 3px;
  border: 1px solid var(--chip-border);
  color: var(--text-dim); background: var(--row-alt);
}
.sev--critical { color: var(--bad); background: var(--bad-soft); border-color: var(--bad); }
.sev--high { color: var(--warn); background: var(--warn-soft); border-color: var(--warn); }
.sev--moderate { color: var(--text-dim); background: var(--row-alt); }

.finding--gap .sev--moderate { color: var(--text-muted); }

/* --- Explorer facet match-mode toggle (Any / All) ------------------------- */

.fmode { display: inline-flex; margin: 0 0 8px; border: 1px solid var(--border-strong); border-radius: 4px; overflow: hidden; }
.fmode__btn {
  font: inherit; font-size: 0.72rem; font-weight: 650;
  padding: 2px 10px; border: 0; cursor: pointer;
  background: var(--panel); color: var(--text-muted);
}
.fmode__btn + .fmode__btn { border-left: 1px solid var(--border-strong); }
.fmode__btn.is-on { background: var(--accent); color: #fff; }
.fmode__btn:hover:not(.is-on) { background: var(--row-hover); color: var(--text-dim); }
