/* ==========================================================================
   BobH3 — 2026 restyle
   Single stylesheet, no framework, no build step, no external requests.
   Everything here is CSP-safe: no inline styles anywhere in the markup.
   ========================================================================== */

/* --- Design tokens -------------------------------------------------------
   Light is the base; dark is applied via prefers-color-scheme and via an
   explicit [data-theme] on <html> so the toggle can win in both directions. */

:root {
  --bg:          #fbfbf9;
  --surface:     #ffffff;
  --surface-2:   #f4f4f1;
  --border:      #e3e3dd;
  --border-soft: #eeeee9;
  --text:        #14161a;
  --text-2:      #3f454e;
  --muted:       #6b7280;
  --accent:      #8a5a00;
  --accent-bg:   #fdf6e6;
  --accent-line: #d9a441;
  --shadow:      0 1px 2px rgba(16,18,22,.05), 0 8px 24px -12px rgba(16,18,22,.18);

  --font: ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto,
          "Helvetica Neue", Arial, sans-serif;
  --mono: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas,
          "Liberation Mono", monospace;

  --wrap: 1180px;
  --rail: 224px;
  --bar:  57px;

  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg:          #0c0e12;
    --surface:     #12151b;
    --surface-2:   #171b22;
    --border:      #242932;
    --border-soft: #1b1f27;
    --text:        #e8eaee;
    --text-2:      #b8bec8;
    --muted:       #858d9a;
    --accent:      #f0b429;
    --accent-bg:   #1d1a10;
    --accent-line: #7a5c17;
    --shadow:      0 1px 2px rgba(0,0,0,.4), 0 12px 32px -16px rgba(0,0,0,.7);
    color-scheme: dark;
  }
}

:root[data-theme="dark"] {
  --bg:          #0c0e12;
  --surface:     #12151b;
  --surface-2:   #171b22;
  --border:      #242932;
  --border-soft: #1b1f27;
  --text:        #e8eaee;
  --text-2:      #b8bec8;
  --muted:       #858d9a;
  --accent:      #f0b429;
  --accent-bg:   #1d1a10;
  --accent-line: #7a5c17;
  --shadow:      0 1px 2px rgba(0,0,0,.4), 0 12px 32px -16px rgba(0,0,0,.7);
  color-scheme: dark;
}

/* --- Reset ------------------------------------------------------------- */

*, *::before, *::after { box-sizing: border-box; }

/* The [hidden] attribute must beat any display rule below, or filtered-out
   rail links and sections stay on screen. */
[hidden] { display: none !important; }

html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; scroll-padding-top: calc(var(--bar) + 18px); }
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { animation-duration: .01ms !important; transition-duration: .01ms !important; }
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  font-size: 15px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

img { max-width: 100%; height: auto; display: block; }
a { color: inherit; }

:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
  border-radius: 3px;
}

.skip {
  position: absolute; left: -9999px; top: 0; z-index: 100;
  background: var(--surface); color: var(--text);
  padding: 10px 16px; border: 1px solid var(--border); border-radius: 0 0 8px 0;
}
.skip:focus { left: 0; }

/* --- Top bar ----------------------------------------------------------- */

.bar {
  position: sticky; top: 0; z-index: 50;
  height: var(--bar);
  display: flex; align-items: center; gap: 22px;
  padding: 0 24px;
  background: color-mix(in srgb, var(--bg) 88%, transparent);
  backdrop-filter: saturate(160%) blur(12px);
  -webkit-backdrop-filter: saturate(160%) blur(12px);
  border-bottom: 1px solid var(--border);
}
@supports not (backdrop-filter: blur(1px)) { .bar { background: var(--bg); } }

.brand {
  font-family: var(--mono);
  font-size: 15px; font-weight: 600; letter-spacing: -.01em;
  text-decoration: none; white-space: nowrap;
  display: inline-flex; align-items: center; gap: 9px;
}
.brand .dot {
  width: 7px; height: 7px; border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-bg);
  flex: none;
}

.bar nav { display: flex; gap: 4px; margin-right: auto; }
.bar nav a {
  text-decoration: none; color: var(--muted);
  font-size: 13.5px; font-weight: 500;
  padding: 7px 11px; border-radius: 7px;
  transition: color .13s, background .13s;
  white-space: nowrap;
}
.bar nav a:hover { color: var(--text); background: var(--surface-2); }
.bar nav a[aria-current="page"] { color: var(--text); background: var(--surface-2); font-weight: 600; }

.bar-tools { display: flex; align-items: center; gap: 8px; }

.iconbtn {
  width: 34px; height: 34px; flex: none;
  display: inline-grid; place-items: center;
  background: transparent; color: var(--muted);
  border: 1px solid var(--border); border-radius: 8px;
  cursor: pointer; padding: 0;
  transition: color .13s, border-color .13s, background .13s;
}
.iconbtn:hover { color: var(--text); background: var(--surface-2); border-color: var(--muted); }
.iconbtn svg { width: 16px; height: 16px; }
.theme-dark  { display: none; }
:root[data-theme="dark"] .theme-dark, :root[data-theme="dark"] .theme-light { display: none; }
:root[data-theme="dark"] .theme-light { display: block; }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .theme-light { display: block; }
  :root:not([data-theme="light"]) .theme-dark  { display: none; }
}

/* --- Page shell -------------------------------------------------------- */

.wrap { max-width: var(--wrap); margin: 0 auto; padding: 0 24px; }
main { display: block; }

.page-head { padding: 54px 0 30px; border-bottom: 1px solid var(--border); }
.eyebrow {
  font-family: var(--mono); font-size: 11.5px; font-weight: 600;
  letter-spacing: .09em; text-transform: uppercase;
  color: var(--accent); margin: 0 0 14px;
}
h1 {
  font-size: clamp(30px, 4.4vw, 43px);
  line-height: 1.1; letter-spacing: -.025em; font-weight: 680;
  margin: 0 0 16px; text-wrap: balance;
}
.lede {
  font-size: 17px; line-height: 1.62; color: var(--text-2);
  max-width: 68ch; margin: 0;
}

/* --- Counters ---------------------------------------------------------- */

.counts { display: flex; flex-wrap: wrap; gap: 34px; margin: 26px 0 0; padding: 0; list-style: none; }
.counts--home { margin-top: 30px; padding-top: 26px; border-top: 1px solid var(--border); }
.counts div { display: flex; flex-direction: column; gap: 2px; }
.counts b {
  font-family: var(--mono); font-size: 25px; font-weight: 600;
  letter-spacing: -.02em; line-height: 1;
}
.counts span { font-size: 12px; color: var(--muted); letter-spacing: .01em; }

/* --- Two-column reference layout --------------------------------------- */

.cols { display: grid; grid-template-columns: var(--rail) minmax(0,1fr); gap: 52px; padding: 34px 0 80px; align-items: start; }

.rail { position: sticky; top: calc(var(--bar) + 26px); max-height: calc(100vh - var(--bar) - 52px); overflow-y: auto; }
.rail h2 {
  font-family: var(--mono); font-size: 11px; font-weight: 600;
  letter-spacing: .09em; text-transform: uppercase; color: var(--muted);
  margin: 0 0 12px; padding-left: 11px;
}
.rail ol { list-style: none; margin: 0; padding: 0; }
.rail a {
  display: flex; justify-content: space-between; align-items: baseline; gap: 10px;
  text-decoration: none; color: var(--muted);
  font-size: 13.5px; padding: 5px 11px;
  border-left: 2px solid transparent; border-radius: 0 6px 6px 0;
  transition: color .13s, background .13s, border-color .13s;
}
.rail a:hover { color: var(--text); background: var(--surface-2); }
.rail a.active { color: var(--text); border-left-color: var(--accent); background: var(--surface-2); font-weight: 600; }
.rail a em { font-family: var(--mono); font-style: normal; font-size: 11px; color: var(--muted); flex: none; opacity: .8; }

/* --- Search ------------------------------------------------------------ */

.search { position: relative; margin: 0 0 34px; }
.search svg { position: absolute; left: 14px; top: 50%; transform: translateY(-50%); width: 16px; height: 16px; color: var(--muted); pointer-events: none; }
.search input {
  width: 100%; font: inherit; font-size: 14.5px;
  padding: 11px 88px 11px 41px;
  background: var(--surface); color: var(--text);
  border: 1px solid var(--border); border-radius: 10px;
  transition: border-color .13s, box-shadow .13s;
}
.search input::placeholder { color: var(--muted); }
.search input:focus {
  outline: none; border-color: var(--accent-line);
  box-shadow: 0 0 0 3px var(--accent-bg);
}
.search kbd {
  position: absolute; right: 13px; top: 50%; transform: translateY(-50%);
  font-family: var(--mono); font-size: 11px; color: var(--muted);
  border: 1px solid var(--border); border-radius: 5px;
  padding: 2px 6px; background: var(--surface-2);
}
.search-count { position: absolute; right: 13px; top: 50%; transform: translateY(-50%); font-family: var(--mono); font-size: 11.5px; color: var(--muted); display: none; }
.searching .search kbd { display: none; }
.searching .search-count { display: block; }

.noresults { display: none; padding: 30px 2px; color: var(--muted); font-size: 14.5px; }
.noresults b { color: var(--text); font-weight: 600; }

/* --- Sections and entries ---------------------------------------------- */

.sec { margin: 0 0 46px; }   /* offset comes from html{scroll-padding-top} alone */
.sec > h2 {
  font-size: 13px; font-weight: 600; font-family: var(--mono);
  letter-spacing: .05em; text-transform: uppercase; color: var(--text);
  margin: 0 0 4px; padding: 0 0 11px;
  border-bottom: 1px solid var(--border);
  display: flex; align-items: baseline; gap: 10px;
}
.sec > h2 .n { margin-left: auto; color: var(--muted); font-size: 11px; font-weight: 500; }

.entries { list-style: none; margin: 0; padding: 0; }
.entries > li {
  padding: 13px 14px 13px 15px;
  margin: 0 -14px;
  border-radius: 9px;
  border-left: 2px solid transparent;
  transition: background .13s, border-color .13s;
}
.entries > li + li { box-shadow: 0 -1px 0 var(--border-soft); }
.entries > li:hover { background: var(--surface-2); border-left-color: var(--accent-line); box-shadow: none; }
.entries > li:hover + li { box-shadow: none; }

.entry-name {
  font-weight: 600; font-size: 14.5px; color: var(--text);
  text-decoration: none; letter-spacing: -.005em;
  border-bottom: 1px solid transparent;
}
a.entry-name:hover { color: var(--accent); border-bottom-color: var(--accent-line); }
.entry-desc { color: var(--muted); font-size: 13.5px; line-height: 1.58; }
.entry-line { margin: 0; max-width: 82ch; font-size: 13.5px; line-height: 1.62; color: var(--muted); }
.entry-line .entry-name { font-size: 14.5px; margin-right: 1px; }
.entry-desc a { color: var(--text-2); text-underline-offset: 2px; }
.entry-desc a:hover { color: var(--accent); }
.entries > li p { margin: 0; }

.src {
  font-family: var(--mono); font-size: 10.5px; font-style: normal;
  color: var(--muted); border: 1px solid var(--border); border-radius: 4px;
  padding: 1px 5px; margin-left: 7px; white-space: nowrap; vertical-align: 1px;
}

/* Compact variant for the shortcut card grids */
.cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(252px, 1fr)); gap: 18px; }
.cards-2 { grid-template-columns: repeat(auto-fit, minmax(320px, 1fr)); max-width: 860px; }
.card {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: 12px; padding: 18px 19px 16px;
}
.card > h2, .card > h3 {
  font-family: var(--mono); font-size: 11px; font-weight: 600;
  letter-spacing: .07em; text-transform: uppercase; color: var(--muted);
  margin: 0 0 12px;
}
.card ul { list-style: none; margin: 0; padding: 0; }
.card li + li { margin-top: 1px; }
.card li { display: flex; align-items: baseline; gap: 0; }
.card li a,
.card li .cardtext {
  flex: 1 1 auto; min-width: 0; text-decoration: none; color: var(--text-2);
  font-size: 13.5px; padding: 4px 7px; margin: 0 -7px; border-radius: 6px;
  transition: color .13s, background .13s;
}

/* Sidebar entries whose link was removed: same metrics, no affordance. */
.card li .cardtext { color: var(--muted); }
.card li a:hover { color: var(--text); background: var(--surface-2); }

/* An unlinked entry keeps its weight but offers no hover. */
span.entry-name { color: var(--text-2); }
.card p { margin: 0 0 11px; font-size: 13.5px; color: var(--muted); line-height: 1.58; }
.card p:last-child { margin-bottom: 0; }
.card p a { color: var(--text); font-weight: 600; text-decoration: none; border-bottom: 1px solid var(--accent-line); }
.card p a:hover { color: var(--accent); }

.block-head {
  font-size: 13px; font-weight: 600; font-family: var(--mono);
  letter-spacing: .05em; text-transform: uppercase; color: var(--text);
  margin: 0 0 20px; padding: 0 0 11px; border-bottom: 1px solid var(--border);
}

/* --- Home -------------------------------------------------------------- */

.hero { padding: 72px 0 34px; }
.hero h1 { font-size: clamp(34px, 5.6vw, 56px); max-width: 17ch; }
.hero .lede { font-size: 18px; max-width: 60ch; }

.pills { display: flex; flex-wrap: wrap; gap: 8px; margin: 26px 0 0; padding: 0; list-style: none; }
.pills li {
  font-size: 13px; color: var(--text-2);
  background: var(--surface); border: 1px solid var(--border);
  border-radius: 999px; padding: 6px 14px;
}

.home-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(268px, 1fr)); gap: 18px; padding: 0; }
.nav-card {
  display: flex; flex-direction: column; text-decoration: none;
  background: var(--surface); border: 1px solid var(--border);
  border-radius: 13px; padding: 22px 22px 20px;
  transition: border-color .15s, transform .15s, box-shadow .15s;
}
.nav-card:hover { border-color: var(--accent-line); transform: translateY(-2px); box-shadow: var(--shadow); }
.nav-card h2 { margin: 0 0 6px; font-size: 16.5px; font-weight: 650; letter-spacing: -.015em; line-height: 1.3; }
.nav-card p { margin: 0; font-size: 13.5px; color: var(--muted); line-height: 1.55; font-family: var(--mono); }
.nav-card .go {
  display: inline-flex; align-items: center; gap: 6px; margin-top: auto; padding-top: 15px;
  font-family: var(--mono); font-size: 11.5px; font-weight: 600;
  letter-spacing: .05em; text-transform: uppercase; color: var(--accent);
}
.nav-card .go svg { width: 13px; height: 13px; transition: transform .15s; }
.nav-card:hover .go svg { transform: translateX(3px); }

.people { padding: 46px 0 8px; }
.people .lede { margin-bottom: 0; font-size: 15.5px; }
.portraits { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 14px; max-width: 620px; margin: 22px 0 0; }
@media (max-width: 620px) { .portraits { grid-template-columns: repeat(2, minmax(0,1fr)); } }
.portrait {
  position: relative; display: block; overflow: hidden;
  border: 1px solid var(--border); border-radius: 11px;
  background: var(--surface-2);
  transition: border-color .15s, transform .15s;
}
.portrait img { width: 100%; filter: grayscale(1) contrast(1.04); transition: filter .28s, transform .5s; }
.portrait:hover, .portrait:focus-visible { border-color: var(--accent-line); transform: translateY(-2px); }
.portrait:hover img, .portrait:focus-visible img { filter: grayscale(0) contrast(1); transform: scale(1.03); }
.portrait .who {
  position: absolute; inset: auto 0 0 0;
  padding: 26px 12px 10px;
  font-size: 12.5px; font-weight: 600; color: #fff;
  background: linear-gradient(to top, rgba(6,7,9,.92), rgba(6,7,9,0));
  opacity: 0; transition: opacity .2s;
}
.portrait:hover .who, .portrait:focus-visible .who { opacity: 1; }

/* --- Footer ------------------------------------------------------------ */

footer {
  border-top: 1px solid var(--border);
  padding: 30px 0 46px; margin-top: 30px;
}
footer .wrap { display: flex; flex-wrap: wrap; gap: 14px 26px; align-items: center; justify-content: space-between; }
footer p { margin: 0; font-size: 13.5px; color: var(--muted); }
footer nav { display: flex; gap: 18px; }
footer nav a { color: var(--muted); font-size: 13.5px; text-decoration: none; }
footer nav a:hover { color: var(--text); }

/* --- Responsive --------------------------------------------------------- */

@media (max-width: 940px) {
  .cols { grid-template-columns: 1fr; gap: 0; padding-top: 26px; }
  .rail {
    position: static; max-height: none; overflow: visible;
    margin: 0 0 30px; padding: 0 0 22px; border-bottom: 1px solid var(--border);
  }
  .rail ol { display: flex; flex-wrap: wrap; gap: 6px; }
  .rail a { border-left: 0; border: 1px solid var(--border); border-radius: 999px; padding: 5px 12px; }
  .rail a.active { border-color: var(--accent-line); }
  .rail a em { display: none; }
}

@media (max-width: 720px) {
  .wrap { padding: 0 18px; }
  .bar { padding: 0 16px; gap: 12px; overflow-x: auto; scrollbar-width: none; }
  .bar::-webkit-scrollbar { display: none; }
  .bar nav { gap: 0; }
  .bar nav a { padding: 7px 8px; font-size: 13px; }
  .hero { padding: 46px 0 32px; }
  .page-head { padding: 34px 0 24px; }
  .counts { gap: 22px; }
  .counts b { font-size: 21px; }
  .entries > li { margin: 0 -10px; padding: 12px 10px; }
}

@media print {
  .bar, .rail, .search, .iconbtn { display: none !important; }
  body { background: #fff; color: #000; font-size: 11pt; }
  .cols { display: block; }
  a.entry-name::after { content: " (" attr(href) ")"; font-size: 8pt; font-weight: 400; word-break: break-all; }
}
