/* main.css — tuebor reading surface
   Human-first. Evidence-reading typography.
   sensation = the gap between data and feeling */

:root {
  --bg: #0d1117;
  --surface: #161b22;
  --border: #30363d;
  --fg: #e6edf3;
  --fg-dim: #8b949e;
  --fg-muted: #484f58;
  --accent: #58a6ff;
  --green: #3fb950;
  --yellow: #d29922;
  --red: #f85149;
  --purple: #a371f7;
  --orange: #f0883e;
  --font-body: -apple-system, 'Segoe UI', system-ui, sans-serif;
  --font-mono: 'JetBrains Mono', 'Fira Code', 'Cascadia Code', monospace;
  --max-w: 52rem;
  --line-h: 1.72;
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html {
  font-size: 17px;
  scroll-behavior: smooth;
  -webkit-text-size-adjust: 100%;
}

body {
  font-family: var(--font-body);
  background: var(--bg);
  color: var(--fg);
  line-height: var(--line-h);
  min-height: 100vh;
}

/* ══════════════════════════════════════
   SKIP LINK
   ══════════════════════════════════════ */
.skip-link {
  position: absolute; top: -100px; left: 0;
  background: var(--accent); color: #000; padding: 8px 16px;
  z-index: 999; font-weight: 600; text-decoration: none;
}
.skip-link:focus { top: 0; }

/* ══════════════════════════════════════
   NAVIGATION — the top bar
   ══════════════════════════════════════ */
.site-nav {
  position: sticky; top: 0; z-index: 100;
  background: rgba(13, 17, 23, 0.92);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border);
  padding: 0 1rem;
}
.nav-inner {
  max-width: 72rem;
  margin: 0 auto;
  display: flex;
  align-items: center;
  gap: 0.75rem;
  height: 48px;
}
.nav-brand {
  font-weight: 700;
  font-size: 1rem;
  color: var(--fg) !important;
  text-decoration: none !important;
  letter-spacing: -0.01em;
  flex-shrink: 0;
  margin-right: 0.5rem;
}
.nav-links {
  display: flex;
  gap: 2px;
  flex-wrap: wrap;
  align-items: center;
}
.nav-links a {
  color: var(--fg-dim);
  text-decoration: none;
  font-size: 0.82rem;
  padding: 4px 8px;
  border-radius: 4px;
  transition: background 0.15s, color 0.15s;
  white-space: nowrap;
}
.nav-links a:hover {
  background: rgba(88, 166, 255, 0.08);
  color: var(--fg);
  text-decoration: none;
}

/* Search in nav */
.nav-search {
  margin-left: auto;
  flex-shrink: 0;
  position: relative;
}
.nav-search input {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 5px 10px;
  color: var(--fg);
  font-size: 0.82rem;
  width: 180px;
  font-family: var(--font-body);
  transition: border-color 0.15s, width 0.2s;
}
.nav-search input:focus {
  outline: none;
  border-color: var(--accent);
  width: 240px;
}
.nav-search input::placeholder { color: var(--fg-muted); }
.search-results {
  position: absolute; right: 0; top: 100%; margin-top: 4px;
  background: var(--surface); border: 1px solid var(--border);
  border-radius: 6px; max-height: 400px; overflow-y: auto;
  width: 320px; z-index: 200;
  box-shadow: 0 8px 24px rgba(0,0,0,0.4);
}
.search-results a {
  display: block; padding: 8px 12px;
  color: var(--fg); text-decoration: none;
  font-size: 0.85rem; border-bottom: 1px solid var(--border);
}
.search-results a:hover { background: rgba(88,166,255,0.08); }
.search-results a:last-child { border-bottom: none; }

/* ══════════════════════════════════════
   MAIN CONTENT
   ══════════════════════════════════════ */
.site-main {
  max-width: var(--max-w);
  margin: 0 auto;
  padding: 2.5rem 1.5rem 4rem;
}
.page-content { }

/* ══════════════════════════════════════
   TYPOGRAPHY — the sensation layer
   ══════════════════════════════════════ */
h1 {
  font-size: 2rem;
  font-weight: 700;
  line-height: 1.25;
  margin-bottom: 0.5rem;
  color: var(--fg);
  letter-spacing: -0.02em;
}
h2 {
  font-size: 1.35rem;
  font-weight: 600;
  margin-top: 2.5rem;
  margin-bottom: 0.75rem;
  color: var(--fg);
  border-bottom: 1px solid var(--border);
  padding-bottom: 0.35rem;
}
h3 {
  font-size: 1.1rem;
  font-weight: 600;
  margin-top: 1.8rem;
  margin-bottom: 0.5rem;
  color: var(--fg);
}
h4, h5, h6 {
  font-size: 0.95rem;
  font-weight: 600;
  margin-top: 1.5rem;
  margin-bottom: 0.4rem;
  color: var(--fg-dim);
  text-transform: uppercase;
  letter-spacing: 0.03em;
}

p {
  margin-bottom: 1.1rem;
}

a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }

strong { font-weight: 600; color: var(--fg); }
em { font-style: italic; }

.page-date, time {
  display: block;
  color: var(--fg-muted);
  font-size: 0.85rem;
  margin-bottom: 2rem;
}

/* ══════════════════════════════════════
   LISTS
   ══════════════════════════════════════ */
ul, ol { margin: 0.5rem 0 1.1rem 1.5rem; }
li { margin-bottom: 0.4rem; }
li > ul, li > ol { margin-top: 0.35rem; margin-bottom: 0; }

/* ══════════════════════════════════════
   BLOCKQUOTE — evidence emphasis
   ══════════════════════════════════════ */
blockquote {
  border-left: 3px solid var(--accent);
  padding: 0.6rem 1.2rem;
  margin: 1.2rem 0;
  color: var(--fg-dim);
  background: rgba(88, 166, 255, 0.04);
  border-radius: 0 6px 6px 0;
}
blockquote p:last-child { margin-bottom: 0; }

/* ══════════════════════════════════════
   CODE
   ══════════════════════════════════════ */
code {
  font-family: var(--font-mono);
  font-size: 0.88em;
  background: var(--surface);
  padding: 0.15em 0.4em;
  border-radius: 4px;
  color: var(--orange);
}
pre {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 1rem;
  margin: 1.2rem 0;
  overflow-x: auto;
  font-size: 0.85rem;
  line-height: 1.5;
}
pre code {
  background: none;
  padding: 0;
  color: var(--fg);
  font-size: inherit;
}

/* ══════════════════════════════════════
   TABLES — evidence grids
   ══════════════════════════════════════ */
table {
  width: 100%;
  border-collapse: collapse;
  margin: 1.2rem 0;
  font-size: 0.88rem;
}
th {
  text-align: left;
  padding: 8px 12px;
  border-bottom: 2px solid var(--border);
  color: var(--fg-dim);
  font-weight: 600;
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}
td {
  padding: 8px 12px;
  border-bottom: 1px solid var(--border);
  vertical-align: top;
}
tr:hover { background: rgba(88, 166, 255, 0.04); }

/* ══════════════════════════════════════
   IMAGES
   ══════════════════════════════════════ */
img {
  max-width: 100%;
  height: auto;
  border-radius: 6px;
  margin: 1rem 0;
}

/* ══════════════════════════════════════
   HR
   ══════════════════════════════════════ */
hr {
  border: none;
  border-top: 1px solid var(--border);
  margin: 2.5rem 0;
}

/* ══════════════════════════════════════
   SECTION LISTING — article index
   ══════════════════════════════════════ */
.subsection-list {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 1rem;
  margin-top: 1.5rem;
}
.subsection-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 1.2rem;
  transition: border-color 0.15s;
}
.subsection-card:hover { border-color: var(--accent); }
.subsection-card h3 {
  margin: 0 0 0.4rem;
  font-size: 1rem;
}
.subsection-card p {
  color: var(--fg-dim);
  font-size: 0.85rem;
  margin: 0;
}

/* ══════════════════════════════════════
   CROSS-LINKS — graph navigation
   ══════════════════════════════════════ */
.cross-links {
  margin-top: 3rem;
  padding-top: 1.5rem;
  border-top: 1px solid var(--border);
}
.cross-links h2 { border-bottom: none; padding-bottom: 0; }
.cross-desc { color: var(--fg-dim); font-size: 0.9rem; margin-bottom: 1rem; }

/* ══════════════════════════════════════
   OPSONIZE — share what you know
   ══════════════════════════════════════ */
.opsonize {
  margin-top: 3rem;
  border-top: 1px solid var(--border);
  padding-top: 2rem;
}
.opsn-header h2 { border-bottom: none; }
.opsn-subtitle { color: var(--fg-dim); font-size: 0.9rem; margin-bottom: 1.5rem; }
.opsn-channels {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 1rem;
}
.opsn-channel {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 1.25rem;
}
.opsn-channel-header {
  display: flex; align-items: center; gap: 8px;
  margin-bottom: 0.75rem;
}
.opsn-channel-header h3 {
  font-size: 1rem; margin: 0; border: none; padding: 0;
}
.opsn-icon { font-size: 1.2rem; }
.opsn-badge {
  font-size: 0.7rem; padding: 2px 8px; border-radius: 12px;
  background: rgba(88,166,255,0.12); color: var(--accent);
  font-weight: 600;
}
.opsn-badge-public { background: rgba(63,185,80,0.12); color: var(--green); }
.opsn-badge-secure { background: rgba(163,113,247,0.12); color: var(--purple); }
.opsn-desc { color: var(--fg-dim); font-size: 0.85rem; margin-bottom: 1rem; }
.opsn-form label {
  display: block; font-size: 0.85rem; font-weight: 500;
  margin-bottom: 4px; color: var(--fg-dim);
}
.opsn-field { margin-bottom: 1rem; }
.opsn-form select,
.opsn-form input,
.opsn-form textarea {
  width: 100%; padding: 8px 10px;
  background: var(--bg); border: 1px solid var(--border);
  border-radius: 6px; color: var(--fg);
  font-family: var(--font-body); font-size: 0.9rem;
  transition: border-color 0.15s;
}
.opsn-form select:focus,
.opsn-form input:focus,
.opsn-form textarea:focus {
  outline: none; border-color: var(--accent);
}
.opsn-form textarea { resize: vertical; min-height: 80px; }
.opsn-hint { color: var(--fg-muted); font-size: 0.75rem; }
.opsn-submit {
  background: var(--accent); color: #000; border: none;
  padding: 8px 20px; border-radius: 6px; font-weight: 600;
  cursor: pointer; font-size: 0.9rem;
  transition: opacity 0.15s;
}
.opsn-submit:hover { opacity: 0.88; }
.opsn-result {
  margin-top: 0.75rem; padding: 10px 14px;
  border-radius: 6px; font-size: 0.85rem;
}
.opsn-result-ok {
  background: rgba(63,185,80,0.08);
  border: 1px solid rgba(63,185,80,0.2);
  color: var(--green);
}
.opsn-result-err {
  background: rgba(248,81,73,0.08);
  border: 1px solid rgba(248,81,73,0.2);
  color: var(--red);
}
.opsn-tip { color: var(--fg-muted); font-size: 0.8rem; margin-top: 0.75rem; }
.opsn-noscript { color: var(--fg-dim); font-size: 0.85rem; }
.opsn-email-btn {
  display: inline-block; padding: 4px 12px;
  border: 1px solid var(--border); border-radius: 4px;
  color: var(--fg-dim); text-decoration: none; font-size: 0.82rem;
  transition: border-color 0.15s, color 0.15s;
}
.opsn-email-btn:hover {
  border-color: var(--accent); color: var(--accent);
  text-decoration: none;
}
.opsn-tag-label {
  display: inline-block;
  background: rgba(163,113,247,0.1);
  color: var(--purple);
  padding: 1px 6px;
  border-radius: 3px;
  font-size: 0.78rem;
  font-weight: 500;
}
.opsn-signal-card {
  padding: 10px 0;
  border-bottom: 1px solid var(--border);
  font-size: 0.88rem;
}
.opsn-signal-time { color: var(--fg-muted); font-size: 0.78rem; margin-left: 6px; }

/* ══════════════════════════════════════
   FOOTER
   ══════════════════════════════════════ */
.site-footer {
  border-top: 1px solid var(--border);
  padding: 2rem 1.5rem;
  text-align: center;
  color: var(--fg-muted);
  font-size: 0.82rem;
  max-width: var(--max-w);
  margin: 2rem auto 0;
}
.site-footer p { margin-bottom: 0.6rem; }
.site-footer a { color: var(--fg-dim); }
.site-footer a:hover { color: var(--accent); }
.footer-license { opacity: 0.7; }

/* ══════════════════════════════════════
   HOME-SPECIFIC
   ══════════════════════════════════════ */
.home-content h2 {
  margin-top: 3rem;
}

/* ══════════════════════════════════════
   RESPONSIVE
   ══════════════════════════════════════ */
@media (max-width: 768px) {
  html { font-size: 16px; }
  .site-main { padding: 1.5rem 1rem 3rem; }
  h1 { font-size: 1.6rem; }
  .nav-inner { flex-wrap: wrap; height: auto; padding: 6px 0; }
  .nav-links { gap: 0; }
  .nav-links a { padding: 3px 5px; font-size: 0.76rem; }
  .nav-search { width: 100%; margin-top: 4px; }
  .nav-search input { width: 100%; }
  .opsn-channels { grid-template-columns: 1fr; }
  .subsection-list { grid-template-columns: 1fr; }
}

@media (max-width: 480px) {
  .nav-links a { font-size: 0.72rem; padding: 2px 4px; }
}

/* ══════════════════════════════════════
   PRINT — evidence must print clean
   ══════════════════════════════════════ */
@media print {
  body { background: #fff; color: #000; font-size: 12pt; }
  .site-nav, .nav-search, .opsonize, .cross-links { display: none; }
  a { color: #000; text-decoration: underline; }
  .site-footer { border: none; }
  pre { border: 1px solid #ccc; }
  code { background: #f6f6f6; color: #333; }
}
