/* ════════════════════════════════════════════════════════════════════
   Infra Atlas · Tools — shared chrome
   Used by /tools/, /tools/egress-cost/, /tools/subnet/, /tools/apim-limits/.
   Each tool keeps its own panel/results styling in an inline <style>
   block; the masthead, form controls, about block and colophon live here.
   ════════════════════════════════════════════════════════════════════ */

:root {
  --ink: #0A0907; --ink-2: #100E0C; --surface: #161310; --surface-2: #1E1A15;
  --line: rgba(244, 239, 230, 0.06); --line-2: rgba(244, 239, 230, 0.14); --line-3: rgba(244, 239, 230, 0.28);
  --paper: #F4EFE6; --paper-2: rgba(244, 239, 230, 0.66); --paper-3: rgba(244, 239, 230, 0.55);
  --accent: #FF7849; --accent-2: #FFA66E;
  --mint: #6FE7B5; --gold: #F4C660; --rose: #F47B7B;
  --serif: 'Instrument Serif', 'Times New Roman', serif;
  --mono: 'JetBrains Mono', ui-monospace, monospace;
  --sans: 'Manrope', -apple-system, system-ui, sans-serif;
}
* { box-sizing: border-box; margin: 0; padding: 0; }
html, body { background: var(--ink); color: var(--paper); font-family: var(--sans); font-size: 15px; line-height: 1.55; -webkit-font-smoothing: antialiased; min-height: 100vh; }
body {
  background:
    radial-gradient(ellipse at 100% -10%, rgba(255, 120, 73, 0.07), transparent 55%),
    radial-gradient(ellipse at -10% 110%, rgba(244, 198, 96, 0.05), transparent 65%),
    var(--ink);
  background-attachment: fixed; overflow-x: hidden;
}
.grain { pointer-events: none; position: fixed; inset: 0; z-index: 100; opacity: 0.08; mix-blend-mode: overlay;
  background-image: url("data:image/svg+xml;utf8,<svg viewBox='0 0 200 200' xmlns='http://www.w3.org/2000/svg'><filter id='n'><feTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='2' stitchTiles='stitch'/><feColorMatrix values='0 0 0 0 1 0 0 0 0 1 0 0 0 0 1 0 0 0 0.6 0'/></filter><rect width='100%25' height='100%25' filter='url(%23n)'/></svg>");
}
.scanlines { pointer-events: none; position: fixed; inset: 0; z-index: 99;
  background: repeating-linear-gradient(180deg, transparent, transparent 2px, rgba(244,239,230,0.012) 2px, rgba(244,239,230,0.012) 3px);
}
::selection { background: var(--accent); color: var(--ink); }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 2px; }

/* Page container — tools can override max-width by re-declaring .page in
   their inline style block. Default is 1100px. */
.page { max-width: 1100px; margin: 0 auto; padding: 56px 32px 96px; position: relative; }

/* Masthead — eyebrow + title + subtitle */
.masthead { padding-bottom: 28px; border-bottom: 1px solid var(--line); margin-bottom: 36px; }
.eyebrow { font-family: var(--mono); font-size: 10.5px; letter-spacing: 0.22em; color: var(--paper-3);
  text-transform: uppercase; display: inline-flex; align-items: center; gap: 12px; text-decoration: none; transition: color 0.2s ease; }
.eyebrow:hover { color: var(--paper); }
.eyebrow .arrow { color: var(--accent); transition: transform 0.2s ease; }
.eyebrow:hover .arrow { transform: translateX(-4px); }
h1.title { font-family: var(--serif); font-weight: 400; font-size: clamp(40px, 6.4vw, 76px); line-height: 0.98; letter-spacing: -0.02em; margin-top: 12px; color: var(--paper); }
h1.title em { font-style: italic; color: var(--accent); }
.subtitle { margin-top: 16px; font-size: 15.5px; color: var(--paper-2); line-height: 1.6; max-width: 720px; }
.subtitle a { color: var(--paper); text-decoration: underline; text-decoration-color: var(--accent); text-underline-offset: 3px; }
.subtitle code { font-family: var(--mono); font-size: 14px; color: var(--accent); }

/* Form controls — used by tools that take inputs */
.field { display: flex; flex-direction: column; gap: 8px; }
.field__label { font-family: var(--mono); font-size: 10px; letter-spacing: 0.16em; text-transform: uppercase; color: var(--paper-3); }
.field select, .field input {
  background: var(--ink); border: 1px solid var(--line-2); color: var(--paper);
  font-family: var(--mono); font-size: 14px; padding: 12px 14px; border-radius: 3px;
  outline: none; transition: border-color 0.15s; appearance: none;
}
.field select:focus, .field input:focus { border-color: var(--accent); }
.field input[type="number"] { -moz-appearance: textfield; }
.field input::-webkit-outer-spin-button, .field input::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }
.unit-toggle { display: inline-flex; border: 1px solid var(--line-2); border-radius: 3px; overflow: hidden; }
.unit-toggle button {
  flex: 1; background: transparent; border: 0; color: var(--paper-2);
  font-family: var(--mono); font-size: 13px; letter-spacing: 0.04em; padding: 12px 0; cursor: pointer; transition: all 0.15s;
}
.unit-toggle button.is-active { background: var(--paper); color: var(--ink); }
.unit-toggle button:not(.is-active):hover { color: var(--paper); }

/* About / caveat block — orange-tinted note at the bottom of each tool */
.about { padding: 20px 24px; border: 1px solid var(--line); border-radius: 5px;
  background: linear-gradient(180deg, rgba(255,120,73,0.05), rgba(255,120,73,0.01));
  border-color: rgba(255,120,73,0.22); margin-bottom: 28px; }
.about__mark { font-family: var(--serif); font-style: italic; font-size: 28px; color: var(--accent); float: left; margin: 0 14px 0 0; line-height: 0.9; }
.about p { font-size: 13.5px; color: var(--paper-2); line-height: 1.6; }
.about strong { color: var(--paper); font-weight: 600; }
.about a { color: var(--paper); text-decoration: underline; text-decoration-color: var(--accent); text-underline-offset: 3px; }
.about a:hover { color: var(--accent); }
.about code { font-family: var(--mono); font-size: 12.5px; color: var(--paper); background: rgba(244,239,230,0.06); padding: 1px 5px; border-radius: 3px; }
.about em { font-style: italic; }

/* Colophon */
.colophon { margin-top: 64px; padding-top: 28px; border-top: 1px solid var(--line);
  font-family: var(--mono); font-size: 11px; letter-spacing: 0.06em; color: var(--paper-3); }
.colophon a { color: var(--paper-2); text-decoration: underline; text-decoration-color: var(--line-2); text-underline-offset: 3px; }
.colophon a:hover { color: var(--accent); }

/* ════════════════════════════════════════════════════════════════════
   Toolbox components — used by /toolbox/ department pages
   (filter chips + tool row cards). Lives here so the chrome stays in
   one file.
   ════════════════════════════════════════════════════════════════════ */

/* Filter bar — sticky group of tag chips above the tool list */
.tbx-filters {
  display: flex; flex-wrap: wrap; align-items: center; gap: 6px;
  padding: 18px 20px; margin-bottom: 22px;
  background: linear-gradient(180deg, var(--surface) 0%, var(--ink-2) 100%);
  border: 1px solid var(--line-2); border-radius: 6px;
}
.tbx-filters::before {
  content: 'Filter';
  font-family: var(--mono); font-size: 9px; letter-spacing: 0.22em;
  text-transform: uppercase; color: var(--paper-3);
  flex-shrink: 0; align-self: center;
  padding-right: 14px; margin-right: 4px;
  border-right: 1px solid var(--line-2);
}
.tbx-filters__group { display: inline-flex; flex-wrap: wrap; align-items: center; gap: 6px; margin-right: 14px; }
.tbx-filters__group:last-of-type { margin-right: 0; }
.tbx-filters__label {
  font-family: var(--mono); font-size: 9.5px; letter-spacing: 0.18em;
  text-transform: uppercase; color: var(--paper-3); margin-right: 4px;
}
.tbx-chip {
  display: inline-flex; align-items: center; gap: 4px;
  font-family: var(--mono); font-size: 10.5px; letter-spacing: 0.04em;
  color: var(--paper-2);
  border: 1px solid var(--line-2); border-radius: 99px;
  padding: 5px 11px; cursor: pointer; user-select: none;
  background: transparent; transition: all 0.15s;
}
.tbx-chip:hover { color: var(--paper); border-color: var(--paper-3); }
.tbx-chip.is-active { background: var(--accent); color: var(--ink); border-color: var(--accent); }
.tbx-clear {
  margin-left: auto;
  font-family: var(--mono); font-size: 10px; letter-spacing: 0.12em; text-transform: uppercase;
  color: var(--paper-3); background: transparent; border: 0; cursor: pointer;
  padding: 4px 8px;
}
.tbx-clear:hover { color: var(--paper); }

/* Tools list — vertical stack of compact card rows */
.tbx-list { display: flex; flex-direction: column; gap: 10px; }
.tbx-row {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 8px 18px;
  padding: 18px 22px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 5px;
  transition: border-color 0.15s;
}
.tbx-row:hover { border-color: var(--line-3); }
.tbx-row.is-hidden { display: none; }
.tbx-row__head { display: flex; align-items: baseline; gap: 12px; flex-wrap: wrap; }
.tbx-row__name {
  font-family: var(--mono); font-size: 14px; font-weight: 600;
  letter-spacing: 0.02em; color: var(--paper);
}
.tbx-row__star {
  font-family: var(--serif); font-style: italic; font-size: 14px;
  color: var(--gold); margin-right: -8px;
}
.tbx-row__replaces {
  font-family: var(--mono); font-size: 10.5px; color: var(--paper-3);
}
.tbx-row__replaces strong { color: var(--paper-2); font-weight: 500; }
.tbx-row__tldr {
  font-family: var(--sans); font-size: 13.5px; color: var(--paper-2);
  line-height: 1.5; grid-column: 1;
}
.tbx-row__tags { grid-column: 1; display: flex; flex-wrap: wrap; gap: 5px; align-items: center; }
.tbx-row__tag {
  font-family: var(--mono); font-size: 9.5px; letter-spacing: 0.06em;
  color: var(--paper-3); border: 1px solid var(--line-2);
  border-radius: 99px; padding: 2px 8px;
}
.tbx-row__tag--form { color: var(--mint); border-color: rgba(111,231,181,0.32); }
.tbx-row__tag--lang { color: var(--gold); border-color: rgba(244,198,96,0.32); }
.tbx-row__repo {
  grid-column: 2; grid-row: 1 / span 3; align-self: stretch;
  display: flex; align-items: center;
  font-family: var(--mono); font-size: 11px;
  color: var(--paper-3); text-decoration: none;
  white-space: nowrap; transition: color 0.15s;
}
.tbx-row__repo:hover { color: var(--accent); }
.tbx-row__repo .arr { color: var(--accent); margin-left: 6px; }

.tbx-empty {
  padding: 40px 24px; text-align: center;
  font-family: var(--mono); font-size: 12px; color: var(--paper-3);
  border: 1px dashed var(--line-2); border-radius: 5px;
}

/* Hub cards — used on /toolbox/index.html */
.tbx-hub {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 14px;
}
.tbx-hub__card {
  display: flex; flex-direction: column; gap: 10px;
  padding: 22px;
  background: linear-gradient(180deg, var(--surface) 0%, var(--ink-2) 100%);
  border: 1px solid var(--line-2);
  border-radius: 5px;
  text-decoration: none; color: var(--paper);
  transition: border-color 0.2s, transform 0.15s;
  position: relative;
}
.tbx-hub__card:not(.is-stub):hover { border-color: var(--accent); transform: translateY(-2px); }
.tbx-hub__card.is-stub { opacity: 0.48; cursor: default; pointer-events: none; }
.tbx-hub__num {
  font-family: var(--mono); font-size: 10px; letter-spacing: 0.16em;
  text-transform: uppercase; color: var(--paper-3);
}
.tbx-hub__title {
  font-family: var(--serif); font-size: 22px; line-height: 1.1;
  color: var(--paper);
}
.tbx-hub__title em { font-style: italic; color: var(--accent); }
.tbx-hub__count {
  font-family: var(--mono); font-size: 10.5px; color: var(--paper-3);
  margin-top: auto;
}
.tbx-hub__count em { font-style: italic; color: var(--paper-2); }
.tbx-hub__card.is-stub .tbx-hub__count { color: var(--paper-3); }

@media (max-width: 760px) {
  .tbx-row { grid-template-columns: 1fr; }
  .tbx-row__repo { grid-column: 1; grid-row: auto; align-self: start; }
}
