/* ================================================================
   Catalog pages: tactical-graphics-catalog.html and metoc-catalog.html.

   The tiles are <img> pointing at img/catalog/*.svg, which are
   GENERATED: scripts/gen-catalog-svgs.js in the tactical-graphics
   repo asks the library to paint each symbol and transcribes the
   resulting Paint[] to SVG. Do not hand-edit anything in that
   directory, and do not hand-maintain the list: it comes from
   img/catalog/catalog.js (window.TG_CATALOG), which the same script
   writes alongside catalog.json.

   metoc-catalog.html works the same way from img/metoc/catalog/
   (window.METOC_CATALOG), drawn by @zaes/metoc's own
   metocThumbnailSvg. Regenerate both from their libraries.

   Symbol colors are DOCTRINAL and deliberately not themed. Page
   chrome uses the site's custom properties as usual.
   ================================================================ */

.tgc-mono { font-family: 'JetBrains Mono', ui-monospace, Menlo, Consolas, monospace; }

/* ── Masthead ─────────────────────────────────────────────── */
.tgc-head {
  position: relative;
  background: linear-gradient(155deg, var(--navy-950), var(--navy-800));
  padding: calc(var(--nav-height) + 54px) 0 46px;
  overflow: hidden;
}
.tgc-head::after {
  content: ''; position: absolute; inset: 0;
  background: radial-gradient(circle at 82% -10%, rgba(var(--cyan-rgb),0.16), transparent 58%);
  pointer-events: none;
}
.tgc-head .container { position: relative; z-index: 1; }
.tgc-crumb {
  font-size: 0.8rem; color: rgba(255,255,255,0.42); margin-bottom: 16px;
}
.tgc-crumb a { color: var(--cyan); }
.tgc-crumb a:hover { text-decoration: underline; }
.tgc-head h1 {
  font-size: clamp(2rem, 4vw, 2.9rem); font-weight: 800;
  letter-spacing: -0.025em; color: var(--white); margin-bottom: 14px;
}
.tgc-head p {
  color: rgba(255,255,255,0.66); max-width: 660px; line-height: 1.7; font-size: 1.02rem;
}
.tgc-head p strong { color: var(--white); font-weight: 600; }
.tgc-head p.tgc-caveat {
  margin-top: 14px; font-size: 0.88rem; color: rgba(255,255,255,0.46); max-width: 680px;
}
.tgc-head p.tgc-caveat strong { color: rgba(255,255,255,0.78); }

/* ── Filter bar ───────────────────────────────────────────── */
.tgc-bar {
  position: sticky; top: var(--nav-height); z-index: 40;
  background: rgba(255,255,255,0.94);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--gray-200);
  padding: 16px 0;
}
.tgc-bar-inner {
  max-width: var(--max-width); margin: 0 auto; padding: 0 24px;
  display: flex; flex-wrap: wrap; gap: 12px; align-items: center;
}
.tgc-search {
  position: relative; flex: 1 1 260px; min-width: 220px;
}
.tgc-search svg {
  position: absolute; left: 13px; top: 50%; transform: translateY(-50%);
  width: 17px; height: 17px; color: var(--text-muted); pointer-events: none;
}
.tgc-search input {
  width: 100%; padding: 11px 14px 11px 40px;
  border: 1px solid var(--gray-300); border-radius: var(--radius-sm);
  font: inherit; font-size: 0.92rem; color: var(--text-dark);
  background: var(--white);
  transition: border-color var(--transition), box-shadow var(--transition);
}
.tgc-search input:focus {
  outline: none; border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(var(--accent-rgb),0.14);
}
.tgc-select {
  padding: 11px 14px; border: 1px solid var(--gray-300);
  border-radius: var(--radius-sm); background: var(--white);
  font: inherit; font-size: 0.9rem; color: var(--text-dark); cursor: pointer;
  max-width: 100%;
}
.tgc-select:focus { outline: none; border-color: var(--accent); }
.tgc-chips { display: flex; gap: 7px; flex-wrap: wrap; }
.tgc-chip {
  padding: 9px 14px; border: 1px solid var(--gray-300);
  border-radius: 100px; background: var(--white);
  font: inherit; font-size: 0.82rem; font-weight: 550; color: var(--text-body);
  cursor: pointer; transition: all var(--transition);
}
.tgc-chip:hover { border-color: var(--accent); color: var(--accent); }
.tgc-chip.active {
  background: var(--accent); border-color: var(--accent); color: var(--white);
}
.tgc-count {
  margin-left: auto; font-size: 0.85rem; color: var(--text-muted);
  font-family: 'JetBrains Mono', monospace; white-space: nowrap;
}
.tgc-count strong { color: var(--text-dark); font-weight: 600; }

/* ── Grid ─────────────────────────────────────────────────── */
.tgc-wrap { padding: 40px 0 90px; background: var(--gray-50); min-height: 60vh; }
.tgc-group-title {
  grid-column: 1 / -1;
  display: flex; align-items: baseline; gap: 12px;
  margin: 26px 0 4px; padding-bottom: 10px;
  border-bottom: 1px solid var(--gray-200);
}
.tgc-group-title:first-child { margin-top: 0; }
.tgc-group-title h2 {
  font-size: 1.06rem; font-weight: 700; color: var(--text-dark); letter-spacing: -0.01em;
}
.tgc-group-title span {
  font-family: 'JetBrains Mono', monospace; font-size: 0.82rem; color: var(--text-muted);
}
.tgc-grid {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(232px, 1fr));
  gap: 16px;
}
.tgc-card {
  background: var(--white);
  border: 1px solid var(--gray-200);
  border-radius: var(--radius);
  overflow: hidden;
  display: flex; flex-direction: column;
  transition: transform var(--transition), box-shadow var(--transition), border-color var(--transition);
  /* 323 SVGs decode fast individually and slowly all at once. Skip the
     rendering work for cards that are off-screen; the intrinsic size keeps
     the scrollbar honest so nothing jumps as they come into view. */
  content-visibility: auto;
  contain-intrinsic-size: 300px;
}
.tgc-card:hover {
  transform: translateY(-3px);
  box-shadow: var(--shadow-md);
  border-color: rgba(var(--accent-rgb),0.4);
}
.tgc-art {
  background:
    linear-gradient(var(--gray-100) 1px, transparent 1px) 0 0 / 100% 22px,
    linear-gradient(90deg, var(--gray-100) 1px, transparent 1px) 0 0 / 22px 100%,
    var(--white);
  border-bottom: 1px solid var(--gray-100);
  display: flex; align-items: center; justify-content: center;
  padding: 8px;
}
.tgc-art img { width: 100%; height: auto; display: block; }
.tgc-meta { padding: 13px 15px 15px; }
.tgc-name {
  font-size: 0.91rem; font-weight: 600; color: var(--text-dark);
  line-height: 1.35; text-transform: capitalize; margin-bottom: 7px;
}
.tgc-tags { display: flex; gap: 6px; flex-wrap: wrap; align-items: center; }
.tgc-tag {
  font-size: 0.68rem; font-weight: 600; letter-spacing: 0.04em;
  padding: 3px 8px; border-radius: 4px;
  background: var(--gray-100); color: var(--text-muted);
}
.tgc-tag.tgc-base {
  background: rgba(var(--accent-rgb),0.09); color: var(--accent);
  font-family: 'JetBrains Mono', monospace; letter-spacing: 0;
}
.tgc-id {
  display: block; margin-top: 8px;
  font-family: 'JetBrains Mono', monospace; font-size: 0.72rem;
  color: var(--gray-400); word-break: break-all;
}

/* ── States ───────────────────────────────────────────────── */
.tgc-state {
  text-align: center; padding: 70px 20px; color: var(--text-muted);
}
.tgc-state h3 { color: var(--text-dark); font-size: 1.1rem; margin-bottom: 8px; font-weight: 650; }
.tgc-state code {
  font-family: 'JetBrains Mono', monospace; font-size: 0.85rem;
  background: var(--gray-100); padding: 2px 7px; border-radius: 4px; color: var(--text-dark);
}

/* ── Footnote ─────────────────────────────────────────────── */
.tgc-note {
  max-width: 780px; margin: 46px auto 0; padding: 22px 24px;
  border: 1px solid var(--gray-200); border-left: 3px solid var(--accent);
  border-radius: var(--radius-sm); background: var(--white);
  font-size: 0.88rem; color: var(--text-body); line-height: 1.72;
}
.tgc-note strong { color: var(--text-dark); font-weight: 650; }

@media (max-width: 640px) {
  .tgc-count { margin-left: 0; width: 100%; }
  .tgc-grid { grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); gap: 12px; }
}
