/* ─────────────────────────────────────────────────────────────
   HighVis shared stylesheet — Claude design system
   Used by: highvis.html, highvis-summary.html, research-log.html,
            highvis-blog.html, highvis-social.html, highvis-scripts.html
   ───────────────────────────────────────────────────────────── */

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

:root {
  --bg: #F5F0E8;
  --bg-deep: #EFE7DA;
  --surface: #FBF7F0;
  --ink: #1F1E1D;
  --ink-soft: #4A4742;
  --ink-muted: #7A746C;
  --rule: #D9CFBF;
  --accent: #C15F3C;
  --accent-soft: #E5825F;
  --accent-bg: #F5E2D6;
  --code-bg: #EFE7DA;
  --serif: 'Source Serif 4', 'Iowan Old Style', 'Apple Garamond', Georgia, serif;
  --sans: 'Inter', -apple-system, 'Segoe UI', sans-serif;
  --mono: 'JetBrains Mono', 'SF Mono', Menlo, Consolas, monospace;
}

html { scroll-behavior: smooth; }
body {
  background: var(--bg);
  color: var(--ink);
  font-family: var(--serif);
  font-size: 18px;
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* ── Top bar ───────────────────────────────────────────────── */
.topbar {
  position: sticky; top: 0; z-index: 50;
  background: rgba(245, 240, 232, 0.92);
  backdrop-filter: saturate(180%) blur(12px);
  -webkit-backdrop-filter: saturate(180%) blur(12px);
  border-bottom: 1px solid var(--rule);
}
.topbar-inner {
  max-width: 1200px; margin: 0 auto;
  display: flex; align-items: center; justify-content: space-between;
  padding: 14px 32px;
  font-family: var(--sans); font-size: 13px;
  gap: 24px; flex-wrap: wrap;
}
.topbar a { color: var(--ink-soft); text-decoration: none; }
.topbar a:hover { color: var(--accent); }
.brand {
  font-weight: 600; letter-spacing: -0.01em; color: var(--ink);
  display: flex; align-items: center; gap: 10px; flex-shrink: 0;
}
.brand-dot {
  width: 10px; height: 10px; border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 0 0 4px var(--accent-bg);
}
.topbar-nav {
  display: flex; gap: 4px; flex-wrap: wrap; align-items: center;
}
.topbar-nav a {
  display: inline-block;
  padding: 6px 12px; border-radius: 8px;
  color: var(--ink-soft); font-weight: 500;
  transition: all 0.15s;
}
.topbar-nav a:hover { background: var(--surface); color: var(--accent); }
.topbar-nav a.active {
  background: var(--accent-bg); color: var(--accent);
  box-shadow: inset 0 0 0 1px var(--accent-soft);
}
.topbar-pill {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 4px 10px; border-radius: 999px;
  background: var(--accent-bg); color: var(--accent);
  font-size: 11px; font-weight: 600; letter-spacing: 0.04em; text-transform: uppercase;
  flex-shrink: 0;
}
.pulse {
  width: 6px; height: 6px; border-radius: 50%;
  background: var(--accent);
  animation: pulse 2s ease-in-out infinite;
}
@keyframes pulse {
  0%, 100% { opacity: 1; }
  50%      { opacity: 0.4; }
}

/* ── Layout (article + TOC) ────────────────────────────────── */
.layout {
  max-width: 1200px; margin: 0 auto;
  display: grid; grid-template-columns: minmax(0, 1fr) 240px;
  gap: 64px;
  padding: 56px 32px 96px;
}
.layout--single { grid-template-columns: minmax(0, 1fr); }
@media (max-width: 960px) {
  .layout { grid-template-columns: 1fr; gap: 0; padding: 32px 20px 64px; }
  .toc { display: none; }
}

/* ── Hero ──────────────────────────────────────────────────── */
.hero { margin-bottom: 56px; max-width: 720px; }
.hero--wide { max-width: 920px; }
.eyebrow {
  font-family: var(--sans); font-size: 12px; font-weight: 600;
  text-transform: uppercase; letter-spacing: 0.14em;
  color: var(--accent); margin-bottom: 16px;
}
h1.title {
  font-family: var(--serif); font-weight: 600;
  font-size: clamp(36px, 5vw, 56px);
  line-height: 1.08; letter-spacing: -0.02em;
  color: var(--ink); margin-bottom: 20px;
}
.subtitle {
  font-size: 21px; line-height: 1.5; color: var(--ink-soft);
  max-width: 640px;
}
.meta-grid {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 20px; margin-top: 36px;
  padding: 20px 24px; border: 1px solid var(--rule); border-radius: 12px;
  background: var(--surface);
}
.meta-item .meta-label {
  font-family: var(--sans); font-size: 11px; font-weight: 600;
  text-transform: uppercase; letter-spacing: 0.1em;
  color: var(--ink-muted); margin-bottom: 6px;
}
.meta-item .meta-value {
  font-family: var(--sans); font-size: 14px; color: var(--ink);
}

/* ── Article body (markdown rendered) ──────────────────────── */
article { max-width: 720px; }
article.article--wide { max-width: 880px; }

article h2 {
  font-family: var(--serif); font-weight: 600;
  font-size: clamp(26px, 3vw, 32px);
  letter-spacing: -0.015em; line-height: 1.2;
  color: var(--ink);
  margin: 64px 0 12px;
  padding-top: 24px;
  border-top: 1px solid var(--rule);
  scroll-margin-top: 84px;
}
article h2:first-child { border-top: none; padding-top: 0; margin-top: 0; }

article h3 {
  font-family: var(--serif); font-weight: 600;
  font-size: 19px; letter-spacing: -0.005em;
  color: var(--accent);
  margin: 36px 0 12px;
  scroll-margin-top: 84px;
}

article h4 {
  font-family: var(--sans); font-weight: 600;
  font-size: 15px; letter-spacing: 0.005em;
  color: var(--ink);
  margin: 28px 0 8px;
}

article p { margin-bottom: 18px; color: var(--ink); }
article p strong { color: var(--ink); font-weight: 600; }

article a {
  color: var(--accent); text-decoration: none;
  border-bottom: 1px solid var(--accent-soft);
  transition: all 0.15s;
}
article a:hover { background: var(--accent-bg); border-bottom-color: var(--accent); }

article ul, article ol { margin: 0 0 22px 24px; }
article li { margin-bottom: 8px; }
article li::marker { color: var(--accent); }

article hr { border: none; height: 1px; background: var(--rule); margin: 48px 0; }

/* code & pre */
article code {
  font-family: var(--mono); font-size: 0.86em;
  background: var(--code-bg); color: var(--ink);
  padding: 2px 6px; border-radius: 4px;
  word-break: break-word;
}
article pre {
  background: var(--code-bg); border: 1px solid var(--rule);
  border-radius: 10px; padding: 18px 20px;
  overflow-x: auto; margin: 0 0 24px;
  font-family: var(--mono); font-size: 13.5px; line-height: 1.6;
}
article pre code { background: none; padding: 0; font-size: inherit; }

/* tables */
.table-wrap { overflow-x: auto; margin: 0 0 28px; border-radius: 10px; border: 1px solid var(--rule); }
article table {
  width: 100%; border-collapse: collapse;
  font-family: var(--sans); font-size: 14px;
  background: var(--surface);
}
article th {
  text-align: left; font-weight: 600;
  padding: 12px 16px; border-bottom: 2px solid var(--rule);
  color: var(--ink); background: var(--bg-deep);
  white-space: nowrap;
}
article td {
  padding: 12px 16px; border-bottom: 1px solid var(--rule);
  color: var(--ink-soft); vertical-align: top;
}
article tbody tr:last-child td { border-bottom: none; }
article tbody tr:hover { background: var(--bg-deep); }

/* blockquote / callout */
article blockquote {
  border-left: 3px solid var(--accent);
  background: var(--accent-bg);
  margin: 24px 0; padding: 16px 22px;
  border-radius: 0 10px 10px 0;
  color: var(--ink);
}
article blockquote p:last-child { margin-bottom: 0; }

/* ── TOC ──────────────────────────────────────────────────── */
.toc {
  position: sticky; top: 92px; align-self: start;
  font-family: var(--sans); font-size: 13px;
  max-height: calc(100vh - 120px); overflow-y: auto;
  padding-right: 8px;
}
.toc-title {
  font-size: 11px; font-weight: 600;
  text-transform: uppercase; letter-spacing: 0.12em;
  color: var(--ink-muted);
  margin-bottom: 16px;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--rule);
}
.toc ul { list-style: none; margin: 0; padding: 0; }
.toc li { margin: 0; }
.toc a {
  display: block; padding: 5px 10px; margin: 1px 0;
  color: var(--ink-muted); text-decoration: none;
  line-height: 1.4; border-radius: 6px;
  border-left: 2px solid transparent;
  transition: all 0.15s;
}
.toc a:hover { color: var(--accent); background: var(--surface); }
.toc a.active { color: var(--accent); border-left-color: var(--accent); background: var(--accent-bg); }

/* ── Hub cards (used on highvis.html) ─────────────────────── */
.hub-grid {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 20px; margin: 48px 0 32px;
}
.hub-card {
  display: block; padding: 28px 26px;
  background: var(--surface); border: 1px solid var(--rule);
  border-radius: 14px; text-decoration: none;
  transition: all 0.2s;
}
.hub-card:hover {
  transform: translateY(-2px);
  border-color: var(--accent-soft);
  box-shadow: 0 12px 32px -16px rgba(193, 95, 60, 0.25);
}
.hub-card .card-eyebrow {
  font-family: var(--sans); font-size: 11px; font-weight: 600;
  text-transform: uppercase; letter-spacing: 0.12em;
  color: var(--accent); margin-bottom: 12px;
}
.hub-card .card-title {
  font-family: var(--serif); font-weight: 600;
  font-size: 22px; letter-spacing: -0.01em; line-height: 1.25;
  color: var(--ink); margin-bottom: 10px;
}
.hub-card .card-body {
  font-size: 15px; line-height: 1.55;
  color: var(--ink-soft); margin-bottom: 16px;
}
.hub-card .card-meta {
  font-family: var(--sans); font-size: 12px;
  color: var(--ink-muted); display: flex; gap: 12px; align-items: center;
}
.hub-card .card-meta .arrow {
  color: var(--accent); font-weight: 600;
  margin-left: auto;
}

/* ── Post cards (blog / social / scripts pages) ───────────── */
.post-stack { display: flex; flex-direction: column; gap: 56px; }
.post-card {
  border: 1px solid var(--rule); border-radius: 14px;
  background: var(--surface);
  padding: 36px 38px;
}
.post-card .post-eyebrow {
  font-family: var(--sans); font-size: 11px; font-weight: 600;
  text-transform: uppercase; letter-spacing: 0.12em;
  color: var(--accent); margin-bottom: 10px;
}
.post-card .post-title {
  font-family: var(--serif); font-weight: 600;
  font-size: 26px; letter-spacing: -0.01em; line-height: 1.2;
  color: var(--ink); margin-bottom: 6px;
}
.post-card .post-meta {
  font-family: var(--sans); font-size: 12px; color: var(--ink-muted);
  margin-bottom: 22px;
}
.post-card .post-body article { max-width: none; }
.post-card .post-body article h1 { display: none; }
.post-card .post-body article > p:first-child { margin-top: 0; }
.post-card .image-suggestion {
  margin-top: 24px; padding: 14px 18px;
  background: var(--bg-deep); border-radius: 10px;
  border-left: 3px solid var(--accent-soft);
  font-family: var(--sans); font-size: 13px; line-height: 1.55;
  color: var(--ink-soft);
}
.post-card .image-suggestion strong {
  color: var(--accent); font-weight: 600;
  display: block; margin-bottom: 4px; font-size: 11px;
  text-transform: uppercase; letter-spacing: 0.1em;
}

/* ── Footer / colophon ────────────────────────────────────── */
.colophon {
  max-width: 720px; margin: 80px auto 0;
  padding: 28px 32px;
  border-top: 1px solid var(--rule);
  font-family: var(--sans); font-size: 13px; color: var(--ink-muted);
  text-align: center;
}
.colophon strong { color: var(--ink-soft); font-weight: 600; }
.colophon ul {
  text-align: left; max-width: 640px; margin: 16px auto 0;
  font-family: var(--mono); font-size: 12px; line-height: 1.7;
  list-style: none; padding: 0;
}

/* ── Loading state ────────────────────────────────────────── */
.loading {
  display: flex; align-items: center; justify-content: center;
  min-height: 240px; color: var(--ink-muted);
  font-family: var(--sans); font-size: 14px;
}
