/*
Theme Name:       Pentaconn Global
Theme URI:        https://pentaconnglobal.com/
Author:           Pentaconn Global
Author URI:       https://pentaconnglobal.com/
Description:      Programmatic-SEO theme for the Pentaconn Global audio-connector parameter database. Requires the "Pentaconn Parameter Database" plugin for connector / part / standard data and routing for /pinout/, /compatibility/, /compare/, /spec/ URLs. Visual language is DigiKey/Mouser-style: datasheet-grade tables, navy + electric-blue, Inter + JetBrains Mono.
Version:          1.0.0
Tested up to:     6.6
Requires PHP:     7.4
License:          GPL-2.0-or-later
License URI:      https://www.gnu.org/licenses/gpl-2.0.html
Text Domain:      pentaconn-global
Tags:             custom-menu, responsive-layout, theme-options
*/

/* =====================================================================
   1. Design tokens
   ===================================================================== */
:root {
  --bg:           #ffffff;
  --bg-soft:      #f5f7fb;
  --bg-dark:      #0b1220;
  --bg-darker:    #060a14;
  --bg-mid:       #11253f;
  --text:         #11253f;
  --text-soft:    #5a6577;
  --text-faint:   #8a93a4;
  --rule:         #e3e7ee;
  --rule-strong:  #c8cfdb;
  --accent:       #0a5cff;
  --accent-soft:  #e8f0ff;
  --accent-dark:  #0742bf;
  --ok:           #1f9d55;
  --warn:         #c08200;
  --hot:          #cf3636;
  --shadow-sm:    0 1px 2px rgba(11,18,32,0.06);
  --shadow-md:    0 4px 16px rgba(11,18,32,0.08);
  --shadow-lg:    0 12px 40px rgba(11,18,32,0.14);
  --radius:       6px;
  --radius-lg:    12px;
  --container:    1200px;
  --font-sans:    "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --font-mono:    "JetBrains Mono", ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, "Liberation Mono", monospace;
}

/* =====================================================================
   2. Reset / base
   ===================================================================== */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; -webkit-font-smoothing: antialiased; -moz-osx-font-smoothing: grayscale; }
body {
  margin: 0;
  font-family: var(--font-sans);
  font-size: 16px;
  line-height: 1.6;
  color: var(--text);
  background: var(--bg);
}
img, svg { max-width: 100%; height: auto; display: block; }
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
h1, h2, h3, h4, h5, h6 { font-family: var(--font-sans); color: var(--text); line-height: 1.25; margin: 0 0 .6em; letter-spacing: -0.01em; }
h1 { font-size: 2.4rem; font-weight: 700; letter-spacing: -0.025em; }
h2 { font-size: 1.6rem; font-weight: 600; margin-top: 1.8em; }
h3 { font-size: 1.2rem; font-weight: 600; }
p { margin: 0 0 1em; }
code, kbd, pre, samp { font-family: var(--font-mono); }
code { font-size: .9em; background: var(--bg-soft); padding: 1px 5px; border-radius: 3px; }
hr { border: 0; border-top: 1px solid var(--rule); margin: 2em 0; }

.container { max-width: var(--container); margin: 0 auto; padding: 0 24px; }
.section { padding: 48px 0; }
.section-tight { padding: 24px 0; }
.eyebrow { font-family: var(--font-mono); font-size: .75rem; letter-spacing: .08em; color: var(--accent); text-transform: uppercase; font-weight: 500; display: inline-block; margin-bottom: 8px; }
.lead { font-size: 1.125rem; color: var(--text-soft); margin: 0 0 1em; max-width: 60ch; }

/* =====================================================================
   3. Site navigation
   ===================================================================== */
.site-nav {
  position: sticky;
  top: 0;
  z-index: 50;
  background: rgba(255, 255, 255, 0.92);
  -webkit-backdrop-filter: blur(12px);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--rule);
}
.site-nav-inner {
  max-width: var(--container);
  margin: 0 auto;
  padding: 0 24px;
  height: 64px;
  display: flex;
  align-items: center;
  gap: 32px;
}
.site-logo {
  font-weight: 700;
  font-size: 1.05rem;
  color: var(--text);
  letter-spacing: -0.01em;
  text-decoration: none;
  flex-shrink: 0;
}
.site-logo span { color: var(--accent); }
.site-logo:hover { text-decoration: none; }

.primary-nav {
  display: flex;
  align-items: center;
  gap: 24px;
  margin-left: auto;
  font-size: .92rem;
}
.primary-nav ul { list-style: none; margin: 0; padding: 0; display: flex; gap: 24px; }
.primary-nav a {
  color: var(--text);
  font-weight: 500;
  padding: 6px 0;
  border-bottom: 2px solid transparent;
  transition: color .15s ease, border-color .15s ease;
}
.primary-nav a:hover,
.primary-nav .current-menu-item > a,
.primary-nav .current_page_item > a,
.primary-nav .current-menu-parent > a {
  color: var(--accent);
  border-bottom-color: var(--accent);
  text-decoration: none;
}

.nav-search {
  position: relative;
  display: flex;
  align-items: center;
}
.nav-search input {
  width: 260px;
  height: 36px;
  border: 1px solid var(--rule-strong);
  border-radius: var(--radius);
  padding: 0 12px 0 36px;
  font-family: var(--font-sans);
  font-size: .9rem;
  background: var(--bg-soft) url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%235a6577' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'><circle cx='11' cy='11' r='7'/><line x1='21' y1='21' x2='16.65' y2='16.65'/></svg>") no-repeat 10px center;
  background-size: 16px;
}
.nav-search input:focus {
  outline: none;
  border-color: var(--accent);
  background-color: #fff;
}

.nav-toggle {
  display: none;
  background: none;
  border: 1px solid var(--rule-strong);
  width: 36px;
  height: 36px;
  border-radius: var(--radius);
  cursor: pointer;
  align-items: center;
  justify-content: center;
  margin-left: auto;
  color: var(--text);
}
.nav-toggle span { display: block; width: 16px; height: 2px; background: var(--text); position: relative; }
.nav-toggle span::before, .nav-toggle span::after { content: ""; position: absolute; left: 0; width: 16px; height: 2px; background: var(--text); }
.nav-toggle span::before { top: -5px; }
.nav-toggle span::after  { top:  5px; }

/* =====================================================================
   4. Hero (homepage)
   ===================================================================== */
.hero {
  background:
    radial-gradient(ellipse at top right, rgba(10, 92, 255, 0.16) 0%, transparent 50%),
    linear-gradient(180deg, var(--bg-darker) 0%, var(--bg-dark) 100%);
  color: #fff;
  padding: 88px 0 96px;
  position: relative;
  overflow: hidden;
}
.hero::before {
  content: "";
  position: absolute;
  inset: 0;
  background-image:
    linear-gradient(rgba(255,255,255,0.025) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255,255,255,0.025) 1px, transparent 1px);
  background-size: 48px 48px;
  pointer-events: none;
}
.hero-inner { position: relative; z-index: 1; max-width: var(--container); margin: 0 auto; padding: 0 24px; }
.hero h1 { color: #fff; font-size: 3rem; max-width: 18ch; margin-bottom: 16px; }
.hero .lead { color: rgba(255,255,255,.78); font-size: 1.2rem; max-width: 56ch; margin-bottom: 36px; }

.search-shell {
  background: rgba(255,255,255,0.04);
  border: 1px solid rgba(255,255,255,0.12);
  border-radius: var(--radius-lg);
  padding: 8px;
  max-width: 720px;
  position: relative;
}
.search-tabs { display: flex; gap: 4px; margin-bottom: 8px; padding: 0 4px; }
.search-tabs button {
  background: transparent;
  border: 0;
  color: rgba(255,255,255,0.62);
  font-family: var(--font-mono);
  font-size: .78rem;
  letter-spacing: .08em;
  text-transform: uppercase;
  padding: 8px 14px;
  cursor: pointer;
  border-radius: var(--radius);
  transition: color .15s ease, background .15s ease;
}
.search-tabs button:hover { color: #fff; }
.search-tabs button.active { color: #fff; background: rgba(10, 92, 255, .35); }

.search-input-wrap { position: relative; display: flex; }
.search-input-wrap input {
  flex: 1;
  height: 56px;
  border: 0;
  border-radius: var(--radius);
  padding: 0 24px 0 52px;
  font-family: var(--font-sans);
  font-size: 1.05rem;
  background: #fff url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%230a5cff' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'><circle cx='11' cy='11' r='7'/><line x1='21' y1='21' x2='16.65' y2='16.65'/></svg>") no-repeat 18px center;
  background-size: 20px;
  color: var(--text);
}
.search-input-wrap input:focus { outline: 2px solid var(--accent); outline-offset: -2px; }

.pcg-search-results {
  position: absolute;
  top: calc(100% + 6px);
  left: 0;
  right: 0;
  background: #fff;
  border: 1px solid var(--rule);
  border-radius: var(--radius);
  box-shadow: var(--shadow-lg);
  max-height: 420px;
  overflow-y: auto;
  z-index: 60;
  display: none;
}
.pcg-search-row {
  display: grid;
  grid-template-columns: 90px 1fr auto;
  gap: 14px;
  align-items: center;
  padding: 12px 16px;
  border-bottom: 1px solid var(--rule);
  color: var(--text);
  text-decoration: none;
}
.pcg-search-row:last-child { border-bottom: 0; }
.pcg-search-row:hover { background: var(--bg-soft); text-decoration: none; }
.pcg-search-kind {
  font-family: var(--font-mono);
  font-size: .68rem;
  letter-spacing: .08em;
  color: var(--accent);
  background: var(--accent-soft);
  padding: 3px 8px;
  border-radius: 3px;
  text-align: center;
  font-weight: 500;
}
.pcg-search-name { font-weight: 600; color: var(--text); }
.pcg-search-meta { color: var(--text-soft); font-size: .85rem; }
.pcg-search-empty { padding: 18px; text-align: center; color: var(--text-soft); }

/* Spec pill cluster under search */
.spec-pills { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 24px; max-width: 720px; }
.spec-pills a {
  font-size: .85rem;
  background: rgba(255,255,255,0.08);
  border: 1px solid rgba(255,255,255,0.16);
  color: #fff;
  padding: 6px 12px;
  border-radius: 999px;
  transition: background .15s ease, border-color .15s ease;
}
.spec-pills a:hover { background: rgba(10, 92, 255, 0.4); border-color: rgba(10, 92, 255, .6); text-decoration: none; }

/* =====================================================================
   5. Stats row
   ===================================================================== */
.stats-row {
  background: var(--bg-soft);
  border-bottom: 1px solid var(--rule);
  padding: 28px 0;
}
.stats-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 24px;
}
.stat .num { font-family: var(--font-mono); font-size: 2rem; font-weight: 700; color: var(--accent); }
.stat .label { font-size: .85rem; color: var(--text-soft); letter-spacing: .04em; text-transform: uppercase; font-weight: 500; }

/* =====================================================================
   6. Cards & grids
   ===================================================================== */
.grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 20px; }
.grid-2 { display: grid; grid-template-columns: repeat(2, 1fr); gap: 24px; }
.card {
  display: block;
  background: var(--bg);
  border: 1px solid var(--rule);
  border-radius: var(--radius-lg);
  padding: 22px 24px;
  color: var(--text);
  text-decoration: none;
  transition: border-color .15s ease, box-shadow .15s ease, transform .15s ease;
  position: relative;
}
.card:hover { border-color: var(--accent); box-shadow: var(--shadow-md); transform: translateY(-1px); text-decoration: none; }
.card h3 { margin: 4px 0 6px; font-size: 1.05rem; }
.card p { margin: 0; color: var(--text-soft); font-size: .92rem; line-height: 1.5; }
.card-meta {
  font-family: var(--font-mono);
  font-size: .68rem;
  letter-spacing: .08em;
  text-transform: uppercase;
  color: var(--accent);
  font-weight: 500;
}
.card .facet-meta { font-family: var(--font-mono); font-size: .82rem; color: var(--text-soft); margin-top: 6px; }

/* =====================================================================
   7. Page head
   ===================================================================== */
.page-head {
  padding: 40px 0 32px;
  border-bottom: 1px solid var(--rule);
  background: linear-gradient(180deg, var(--bg-soft) 0%, var(--bg) 100%);
}
.page-head h1 { font-size: 2.1rem; margin-bottom: 8px; max-width: 30ch; }
.page-head .lead { max-width: 70ch; margin-bottom: 8px; }
.page-head .tags { margin-top: 14px; }

/* Tag pills */
.tag {
  display: inline-block;
  font-family: var(--font-mono);
  font-size: .72rem;
  letter-spacing: .04em;
  padding: 4px 10px;
  border-radius: 4px;
  background: var(--bg-soft);
  color: var(--text);
  border: 1px solid var(--rule-strong);
  margin-right: 6px;
  margin-bottom: 6px;
}
.tag.accent { color: var(--accent); background: var(--accent-soft); border-color: rgba(10,92,255,0.25); }
.tag.ok   { color: #135a31; background: #e3f6ec; border-color: #b9e2c8; }
.tag.warn { color: #7e5500; background: #fdf3da; border-color: #ecd9a1; }
.tag.hot  { color: #8a1f1f; background: #fbe5e5; border-color: #f0bcbc; }

/* =====================================================================
   8. Spec / datasheet tables
   ===================================================================== */
.table-wrap { overflow-x: auto; border: 1px solid var(--rule); border-radius: var(--radius); margin: 24px 0; box-shadow: var(--shadow-sm); }
table.spec-table, table.parts-table, table.pinout-table, table.compare-table {
  width: 100%;
  border-collapse: collapse;
  font-size: .92rem;
}
.spec-table th, .spec-table td,
.parts-table th, .parts-table td,
.pinout-table th, .pinout-table td,
.compare-table th, .compare-table td {
  padding: 12px 16px;
  text-align: left;
  border-bottom: 1px solid var(--rule);
  vertical-align: top;
}
.spec-table th, .compare-table th {
  width: 36%;
  background: var(--bg-soft);
  color: var(--text-soft);
  font-weight: 500;
  font-size: .85rem;
  letter-spacing: .02em;
}
.parts-table thead th, .pinout-table thead th {
  background: var(--bg-dark);
  color: #fff;
  font-family: var(--font-mono);
  font-size: .75rem;
  letter-spacing: .08em;
  text-transform: uppercase;
  font-weight: 500;
  border-bottom: 0;
}
.parts-table tbody tr:hover { background: var(--bg-soft); }
.parts-table td:first-child { font-family: var(--font-mono); font-weight: 500; }
.pinout-table td:first-child { font-family: var(--font-mono); width: 80px; }
.spec-table td:last-child, .compare-table td { color: var(--text); font-family: var(--font-mono); font-size: .9rem; }
.compare-table th:first-child { width: 28%; }

/* =====================================================================
   9. Pinout SVG container
   ===================================================================== */
.diagram {
  background: var(--bg-soft);
  border: 1px solid var(--rule);
  border-radius: var(--radius-lg);
  padding: 32px;
  margin: 24px 0;
  text-align: center;
}
.diagram svg { max-width: 660px; width: 100%; height: auto; margin: 0 auto; }

/* =====================================================================
   10. Compatibility check-list
   ===================================================================== */
.check-list { list-style: none; padding: 0; margin: 16px 0; }
.check-list li {
  padding: 14px 18px 14px 50px;
  margin-bottom: 8px;
  border-radius: var(--radius);
  border: 1px solid var(--rule);
  position: relative;
  background: var(--bg);
}
.check-list li::before {
  content: "";
  position: absolute;
  left: 16px;
  top: 50%;
  transform: translateY(-50%);
  width: 22px;
  height: 22px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 14px;
  color: #fff;
}
.check-list li.ok { background: #f5fbf7; border-color: #cce8d4; }
.check-list li.ok::before { background: var(--ok); content: "✓"; line-height: 22px; text-align: center; }
.check-list li.no { background: #fdf5f5; border-color: #ecc3c3; }
.check-list li.no::before { background: var(--hot); content: "✕"; line-height: 22px; text-align: center; }

/* =====================================================================
   11. Buttons
   ===================================================================== */
.pcg-btn {
  display: inline-block;
  background: var(--accent);
  color: #fff;
  padding: 11px 20px;
  border-radius: var(--radius);
  font-weight: 500;
  font-size: .95rem;
  margin-right: 8px;
  margin-bottom: 8px;
  transition: background .15s ease;
}
.pcg-btn:hover { background: var(--accent-dark); color: #fff; text-decoration: none; }
.pcg-btn-ghost {
  background: transparent;
  color: var(--accent);
  border: 1px solid var(--accent);
}
.pcg-btn-ghost:hover { background: var(--accent-soft); color: var(--accent); }

/* =====================================================================
   12. Breadcrumbs
   ===================================================================== */
.pcg-breadcrumb {
  background: var(--bg);
  border-bottom: 1px solid var(--rule);
  padding: 12px 0;
  font-size: .85rem;
}
.pcg-breadcrumb ol { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: 8px; }
.pcg-breadcrumb li { color: var(--text-soft); }
.pcg-breadcrumb li::after { content: " / "; margin-left: 8px; color: var(--text-faint); }
.pcg-breadcrumb li:last-child::after { content: ""; }
.pcg-breadcrumb a { color: var(--text-soft); }
.pcg-breadcrumb a:hover { color: var(--accent); }
.pcg-breadcrumb [aria-current="page"] { color: var(--text); font-weight: 500; }

/* =====================================================================
   13. Notices / callouts
   ===================================================================== */
.notice {
  background: var(--accent-soft);
  border-left: 3px solid var(--accent);
  padding: 14px 18px;
  border-radius: 0 var(--radius) var(--radius) 0;
  margin: 20px 0;
  font-size: .95rem;
}

/* =====================================================================
   14. Footer
   ===================================================================== */
.site-footer {
  background: var(--bg-darker);
  color: rgba(255,255,255,0.65);
  padding: 56px 0 28px;
  margin-top: 80px;
  font-size: .9rem;
}
.site-footer a { color: rgba(255,255,255,0.9); }
.site-footer a:hover { color: #fff; }
.footer-grid {
  display: grid;
  grid-template-columns: 1.5fr 1fr 1fr 1fr;
  gap: 40px;
  margin-bottom: 40px;
}
.footer-col h4 {
  color: #fff;
  font-family: var(--font-mono);
  font-size: .78rem;
  letter-spacing: .08em;
  text-transform: uppercase;
  margin: 0 0 14px;
  font-weight: 500;
}
.footer-col ul { list-style: none; margin: 0; padding: 0; }
.footer-col li { margin-bottom: 8px; }
.footer-brand { color: #fff; font-weight: 700; font-size: 1.15rem; margin-bottom: 12px; }
.footer-brand span { color: var(--accent); }
.footer-bottom { border-top: 1px solid rgba(255,255,255,0.08); padding-top: 24px; font-size: .8rem; color: rgba(255,255,255,0.5); }

/* =====================================================================
   15. Archives, filters, sidebars
   ===================================================================== */
.archive-layout { display: grid; grid-template-columns: 260px 1fr; gap: 40px; }
.facet-sidebar { font-size: .92rem; }
.facet-sidebar h3 {
  font-family: var(--font-mono);
  font-size: .78rem;
  letter-spacing: .08em;
  text-transform: uppercase;
  color: var(--text-soft);
  margin: 0 0 10px;
  font-weight: 500;
}
.facet-group { margin-bottom: 28px; padding-bottom: 20px; border-bottom: 1px solid var(--rule); }
.facet-group ul { list-style: none; margin: 0; padding: 0; }
.facet-group li { margin-bottom: 6px; }
.facet-group a { color: var(--text); padding: 4px 0; display: inline-block; }
.facet-group a:hover { color: var(--accent); text-decoration: none; }
.facet-group .count { color: var(--text-faint); font-size: .82rem; font-family: var(--font-mono); margin-left: 6px; }

/* =====================================================================
   16. SEO copy section (homepage)
   ===================================================================== */
.copy-block { max-width: 70ch; margin: 0 auto; color: var(--text); }
.copy-block h2 { font-size: 1.5rem; }
.copy-block p { font-size: 1rem; color: var(--text-soft); }

/* =====================================================================
   17. 404
   ===================================================================== */
.error-page {
  padding: 96px 0;
  text-align: center;
}
.error-page .code {
  font-family: var(--font-mono);
  font-size: 4rem;
  color: var(--accent);
  margin-bottom: 8px;
}

/* =====================================================================
   18. Single-post layouts (connector / part / standard)
   ===================================================================== */
.spec-layout {
  display: grid;
  grid-template-columns: 1fr 320px;
  gap: 40px;
  align-items: start;
}
.spec-main { min-width: 0; }
.spec-side {
  position: sticky;
  top: 80px;
  background: var(--bg-soft);
  border: 1px solid var(--rule);
  border-radius: var(--radius-lg);
  padding: 24px;
}
.spec-side h4 {
  font-family: var(--font-mono);
  font-size: .78rem;
  letter-spacing: .08em;
  text-transform: uppercase;
  color: var(--text-soft);
  margin: 0 0 12px;
  font-weight: 500;
}
.spec-side ul { list-style: none; margin: 0 0 18px; padding: 0; font-size: .9rem; }
.spec-side li { padding: 4px 0; }

/* =====================================================================
   19. Responsive
   ===================================================================== */
@media (max-width: 980px) {
  .archive-layout { grid-template-columns: 1fr; }
  .spec-layout { grid-template-columns: 1fr; }
  .spec-side { position: static; }
  .footer-grid { grid-template-columns: 1fr 1fr; }
  .stats-grid { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 880px) {
  .primary-nav ul { display: none; }
  .nav-search { display: none; }
  .nav-toggle { display: flex; }
  .primary-nav.open ul {
    display: flex;
    flex-direction: column;
    position: absolute;
    top: 64px;
    left: 0;
    right: 0;
    background: #fff;
    border-bottom: 1px solid var(--rule);
    padding: 16px 24px;
    gap: 16px;
  }
  .primary-nav.open .nav-search { display: flex; padding-top: 8px; }
  .primary-nav.open .nav-search input { width: 100%; }
  .grid-3 { grid-template-columns: repeat(2, 1fr); }
  .hero h1 { font-size: 2.2rem; }
  .hero { padding: 64px 0 72px; }
}

@media (max-width: 680px) {
  h1 { font-size: 1.8rem; }
  h2 { font-size: 1.3rem; }
  .hero h1 { font-size: 1.8rem; }
  .hero .lead { font-size: 1rem; }
  .grid-3, .grid-2 { grid-template-columns: 1fr; }
  .footer-grid { grid-template-columns: 1fr; gap: 28px; }
  .stats-grid { grid-template-columns: repeat(2, 1fr); }
  .search-input-wrap input { height: 50px; font-size: 1rem; }
  .pcg-search-row { grid-template-columns: 70px 1fr; }
  .pcg-search-meta { grid-column: 2; font-size: .8rem; }
  .section { padding: 36px 0; }
}

/* Print */
@media print {
  .site-nav, .site-footer, .pcg-breadcrumb, .nav-toggle, .hero { display: none; }
  body { color: #000; background: #fff; }
  a { color: #000; text-decoration: underline; }
}

/* =====================================================================
   20. Skip link (accessibility)
   ===================================================================== */
.skip-link {
  position: absolute;
  top: -100px;
  left: 16px;
  background: var(--accent);
  color: #fff;
  padding: 10px 18px;
  border-radius: var(--radius);
  font-weight: 600;
  z-index: 100;
  text-decoration: none;
  transition: top .15s ease;
}
.skip-link:focus { top: 12px; outline: 2px solid #fff; outline-offset: 2px; color: #fff; }

/* =====================================================================
   21. Copy-to-clipboard button
   ===================================================================== */
.copy-btn {
  font-family: var(--font-mono);
  font-size: .78rem;
  letter-spacing: .04em;
  padding: 5px 10px;
  margin-left: 6px;
  border: 1px solid var(--rule-strong);
  background: var(--bg-soft);
  color: var(--text-soft);
  border-radius: 4px;
  cursor: pointer;
  vertical-align: middle;
  line-height: 1.2;
  transition: all .15s ease;
}
.copy-btn:hover { color: var(--accent); border-color: var(--accent); background: var(--accent-soft); }
.copy-btn.is-copied { color: var(--ok); border-color: var(--ok); background: #e3f6ec; }

/* =====================================================================
   22. Sortable table caret
   ===================================================================== */
table.sortable thead th { user-select: none; position: relative; }
table.sortable thead th .sort-caret {
  display: inline-block;
  width: 0; height: 0;
  margin-left: 6px;
  border-left: 4px solid transparent;
  border-right: 4px solid transparent;
  border-top: 5px solid currentColor;
  opacity: .35;
  vertical-align: middle;
  transition: opacity .15s ease;
}
table.sortable thead th[aria-sort="ascending"]  .sort-caret { border-top: 0; border-bottom: 5px solid currentColor; opacity: 1; }
table.sortable thead th[aria-sort="descending"] .sort-caret { border-bottom: 0; border-top: 5px solid currentColor; opacity: 1; }
table.sortable thead th:hover .sort-caret { opacity: .9; }

/* =====================================================================
   23. Mobile filter drawer
   ===================================================================== */
.filter-trigger {
  display: none;
  width: 100%;
  background: var(--bg);
  border: 1px solid var(--rule-strong);
  border-radius: var(--radius);
  padding: 12px 18px;
  font-family: var(--font-sans);
  font-size: .95rem;
  font-weight: 500;
  margin-bottom: 18px;
  cursor: pointer;
  text-align: left;
  position: relative;
  color: var(--text);
}
.filter-trigger::after {
  content: "";
  position: absolute;
  right: 18px; top: 50%;
  transform: translateY(-50%);
  width: 8px; height: 8px;
  border-right: 2px solid var(--text-soft);
  border-bottom: 2px solid var(--text-soft);
  rotate: 45deg;
}
@media (max-width: 880px) {
  .filter-trigger { display: block; }
  .archive-layout > .facet-sidebar {
    position: fixed;
    inset: 0;
    background: #fff;
    z-index: 90;
    padding: 64px 24px 24px;
    overflow-y: auto;
    transform: translateX(-100%);
    transition: transform .25s ease;
  }
  .archive-layout > .facet-sidebar.open { transform: translateX(0); }
  .filter-close {
    position: absolute;
    top: 16px; right: 16px;
    background: none; border: 0;
    font-size: 1.6rem; line-height: 1;
    cursor: pointer; color: var(--text);
    width: 44px; height: 44px;
  }
  body.drawer-open { overflow: hidden; }
}
@media (min-width: 881px) {
  .filter-close { display: none; }
}

/* =====================================================================
   24. Sticky TOC (guide / long-form)
   ===================================================================== */
.toc { font-size: .9rem; line-height: 1.55; }
.toc ul { list-style: none; margin: 0; padding: 0; }
.toc li { padding: 4px 0; border-left: 2px solid transparent; padding-left: 10px; margin-left: -12px; transition: border-color .15s ease, color .15s ease; }
.toc a { color: var(--text-soft); text-decoration: none; }
.toc a:hover { color: var(--accent); }
.toc a.active { color: var(--accent); font-weight: 500; }
.toc li:has(a.active) { border-left-color: var(--accent); }

/* =====================================================================
   25. Card grid (4-col, used for category tiles)
   ===================================================================== */
.grid-4 { display: grid; grid-template-columns: repeat(4, 1fr); gap: 18px; }
@media (max-width: 980px) { .grid-4 { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 560px) { .grid-4 { grid-template-columns: 1fr; } }

/* =====================================================================
   26. FAQ block (used in guides + spec pages)
   ===================================================================== */
.faq { margin: 24px 0; }
.faq details {
  border: 1px solid var(--rule);
  border-radius: var(--radius);
  margin-bottom: 8px;
  background: var(--bg);
  overflow: hidden;
}
.faq summary {
  padding: 14px 18px;
  font-weight: 500;
  cursor: pointer;
  list-style: none;
  position: relative;
  padding-right: 44px;
}
.faq summary::-webkit-details-marker { display: none; }
.faq summary::after {
  content: "+";
  position: absolute;
  right: 18px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--accent);
  font-size: 1.4rem;
  font-weight: 300;
  transition: transform .15s ease;
}
.faq details[open] summary::after { content: "−"; }
.faq details[open] summary { border-bottom: 1px solid var(--rule); }
.faq .faq-body { padding: 14px 18px; color: var(--text-soft); }

/* =====================================================================
   27. MPN code styling
   ===================================================================== */
.mpn {
  display: inline-block;
  font-family: var(--font-mono);
  font-size: 1.1rem;
  background: var(--bg-soft);
  padding: 4px 10px;
  border: 1px solid var(--rule-strong);
  border-radius: 4px;
  font-weight: 500;
}

/* =====================================================================
   28. Larger touch targets (mobile)
   ===================================================================== */
@media (max-width: 680px) {
  .nav-toggle, .copy-btn, .pcg-btn { min-height: 44px; min-width: 44px; }
  .filter-close { min-height: 44px; min-width: 44px; }
  .primary-nav a, .footer-col a { padding: 10px 0; display: inline-block; min-height: 44px; }
  .pcg-search-row { padding: 14px 16px; }
  .spec-pills a { padding: 10px 14px; min-height: 38px; display: inline-flex; align-items: center; }
}

/* =====================================================================
   29. Print refinements
   ===================================================================== */
@media print {
  .pcg-search-results, .filter-trigger, .copy-btn, .toc, .spec-side, .pcg-btn { display: none !important; }
  .spec-layout { grid-template-columns: 1fr !important; }
}

/* =====================================================================
   30. Archive layout (facet sidebar + main grid)
   ===================================================================== */
.archive-layout {
  display: grid;
  grid-template-columns: 240px 1fr;
  gap: 36px;
  align-items: start;
}
@media (max-width: 880px) {
  .archive-layout { grid-template-columns: 1fr; gap: 0; }
}
.facet-sidebar { font-size: .92rem; }
.facet-sidebar h3 { margin: 0 0 16px; font-size: 1rem; letter-spacing: .04em; text-transform: uppercase; color: var(--text-soft); }
.facet { margin-bottom: 18px; border-bottom: 1px solid var(--rule); padding-bottom: 14px; }
.facet[open] summary { margin-bottom: 10px; }
.facet summary {
  cursor: pointer;
  font-weight: 600;
  list-style: none;
  position: relative;
  padding-right: 24px;
  padding: 6px 0;
  user-select: none;
}
.facet summary::-webkit-details-marker { display: none; }
.facet summary::after {
  content: "";
  position: absolute;
  right: 4px; top: 50%;
  width: 7px; height: 7px;
  border-right: 2px solid var(--text-soft);
  border-bottom: 2px solid var(--text-soft);
  transform: translateY(-65%) rotate(45deg);
  transition: transform .15s ease;
}
.facet[open] summary::after { transform: translateY(-35%) rotate(-135deg); }
.facet-list { list-style: none; padding: 0; margin: 0; }
.facet-list li a {
  display: flex;
  justify-content: space-between;
  padding: 7px 0;
  color: var(--text-soft);
  text-decoration: none;
  border-bottom: 1px dashed transparent;
}
.facet-list li a:hover { color: var(--accent); border-bottom-color: var(--accent-soft); }
.facet-count { color: var(--text-soft); font-family: var(--font-mono); font-size: .78rem; }

/* Pagination */
.pagination { margin-top: 36px; }
.pagination .page-numbers {
  display: inline-block;
  padding: 8px 14px;
  margin-right: 4px;
  border: 1px solid var(--rule-strong);
  border-radius: var(--radius);
  color: var(--text-soft);
  text-decoration: none;
  font-family: var(--font-mono);
  font-size: .9rem;
}
.pagination .page-numbers.current { background: var(--accent); color: #fff; border-color: var(--accent); }
.pagination .page-numbers:hover { color: var(--accent); border-color: var(--accent); }

/* =====================================================================
   31. Search results page
   ===================================================================== */
.search-form-inline {
  display: flex;
  gap: 8px;
  max-width: 600px;
  margin: 18px 0 36px;
}
.search-form-inline input[type="search"] {
  flex: 1;
  padding: 12px 16px;
  border: 1px solid var(--rule-strong);
  border-radius: var(--radius);
  font: inherit;
  background: var(--bg);
}
.search-form-inline button {
  padding: 12px 22px;
  background: var(--accent);
  color: #fff;
  border: 0;
  border-radius: var(--radius);
  font-weight: 500;
  cursor: pointer;
  font: inherit;
}
.search-form-inline button:hover { background: var(--accent-strong, #084ad6); }

/* =====================================================================
   32. 404 page
   ===================================================================== */
.error-404 { text-align: center; padding: 80px 24px 120px; }
.error-404 h1 { font-size: 4rem; margin: 0 0 12px; letter-spacing: -.03em; color: var(--accent); }
.error-404 p.lead { max-width: 520px; margin: 0 auto 36px; font-size: 1.05rem; color: var(--text-soft); }
.error-404 .pcg-search-shell { max-width: 560px; margin: 0 auto; }
.error-404-suggest {
  display: flex; flex-wrap: wrap; gap: 10px; justify-content: center;
  margin-top: 24px;
}

/* =====================================================================
   33. Stats row — 8-column variant with mobile fallback
   ===================================================================== */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(8, 1fr);
  gap: 1px;
  background: var(--rule);
  border: 1px solid var(--rule);
  border-radius: var(--radius);
  overflow: hidden;
}
@media (max-width: 980px) { .stats-grid { grid-template-columns: repeat(4, 1fr); } }
@media (max-width: 560px) { .stats-grid { grid-template-columns: repeat(2, 1fr); } }
.stat { background: #fff; padding: 18px 14px; text-align: center; }
.stat .num { font-size: 1.6rem; font-weight: 700; color: var(--accent); letter-spacing: -.02em; }
.stat .label { font-size: .75rem; color: var(--text-soft); text-transform: uppercase; letter-spacing: .06em; margin-top: 4px; }

/* =====================================================================
   34. Inline nav-search shell (404 / search page / nav bar)
   ===================================================================== */
.pcg-search-shell-inline {
  position: relative;
  max-width: 640px;
  margin: 0 auto;
}
.pcg-search-shell-inline input[type="search"] {
  width: 100%;
  padding: 14px 18px;
  border: 1px solid var(--rule-strong);
  border-radius: var(--radius);
  font: inherit;
  background: #fff;
  font-size: 1rem;
}
.pcg-search-shell-inline input[type="search"]:focus { outline: 3px solid var(--accent-soft); border-color: var(--accent); }
.pcg-search-shell-inline .spec-pills { margin-top: 12px; justify-content: center; flex-wrap: wrap; }
.pcg-search-shell-inline .pcg-search-results {
  position: absolute;
  top: calc(100% + 4px); left: 0; right: 0;
  background: #fff;
  border: 1px solid var(--rule-strong);
  border-radius: var(--radius);
  box-shadow: 0 8px 24px rgba(0,0,0,.12);
  max-height: 360px;
  overflow-y: auto;
  z-index: 50;
  display: none;
}
