
:root {
  --accent: #4a5d8a;            /* overridden per-site via inline style */
  /* Links etc. use --accent-link, derived from --accent, so site colors
     picked against a light background stay legible in dark mode too. */
  --accent-link: var(--accent);
  --bg: #fdfdfb;
  --fg: #1c1c1a;
  --muted: #6e6e68;
  --rule: #e4e4de;
  --serif: 'Iowan Old Style', 'Charter', 'Georgia', serif;
  --sans: system-ui, -apple-system, 'Segoe UI', sans-serif;
}
@media (prefers-color-scheme: dark) {
  :root {
    /* Blend any accent 45% toward white: keeps the tenant's hue, fixes
       contrast on the dark background automatically. */
    --accent-link: color-mix(in srgb, var(--accent) 55%, white);
    --bg: #161614;
    --fg: #e8e6e1;
    --muted: #97958e;
    --rule: #2e2e2a;
  }
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0 auto;
  padding: 1.5rem 1.25rem 4rem;
  /* 36rem = 576px: a readable measure at 16px body text, and Instagram's
     1080px natives display at ~1.9x density at this width (build-plan
     layout section — settled). */
  max-width: 36rem;
  background: var(--bg);
  color: var(--fg);
  font-family: var(--serif);
  font-size: 1rem;
  line-height: 1.7;
}

a { color: var(--accent-link); text-decoration-thickness: 1px; text-underline-offset: 2px; }
a:hover { text-decoration-thickness: 2px; }

h1, h2, h3, h4 { font-family: var(--sans); line-height: 1.25; letter-spacing: -0.01em; }

.site-header { margin: 1.5rem 0 2.5rem; }
.site-header h1 { font-size: 1.5rem; margin: 0; }
.site-header h1 a { color: var(--fg); text-decoration: none; }
.site-header .intro { color: var(--muted); margin-top: .5rem; }

/* ------- the stream (tenant index) ------- */
.profile-links { font-size: .95rem; margin-top: .6rem; display: flex; flex-wrap: wrap; gap: .35rem .6rem; }
.profile-links .dot { color: var(--muted); }

.pills { display: flex; gap: .5rem; margin: 1.5rem 0 1rem; font-size: .9rem; }
.pill { padding: .25rem .85rem; border: 1px solid var(--rule); border-radius: 999px; text-decoration: none; color: var(--muted); }
.pill:hover { border-color: var(--accent-link); }
.pill.active { background: var(--fg); color: var(--bg); border-color: var(--fg); }
.pill .count { opacity: .65; margin-left: .15rem; }

.stream { list-style: none; margin: 0; padding: 0; }
.stream > li { padding: 2.5rem 0; border-bottom: 1px solid var(--rule); }
.stream h2 { font-size: 1.35rem; margin: .25rem 0 .5rem; }
.stream h2 a { color: var(--fg); text-decoration: none; }
.stream h2 a:hover { color: var(--accent-link); }
.stream .fold { margin: .5rem 0 .75rem; }
.stream .continue { font-size: .9rem; margin: 0; }
.stream .article-body figure { margin: 1.25rem 0; }

/* Small-caps metadata line: date · source · original link */
.entry-meta {
  font-size: .8rem;
  letter-spacing: .08em; text-transform: uppercase;
  color: var(--muted); margin: 0 0 .75rem;
  display: flex; gap: 1.1rem;
}
.entry-meta a { color: var(--muted); text-decoration: none; }
.entry-meta a:hover { color: var(--accent-link); }

.pagination { display: flex; justify-content: space-between; margin-top: 2rem; font-size: .9rem; }

/* ------- article pages ------- */
.article-header { margin: 2.5rem 0 2rem; }
.article-header h1 { font-size: 1.75rem; margin: 0 0 .5rem; }
.article-header time { font-size: .85rem; color: var(--muted); }

.article-body { overflow-wrap: break-word; }
/* Block + auto margins: images narrower than the column (portrait shots)
   center instead of hugging the left edge. */
.article-body img { display: block; margin-inline: auto; max-width: 100%; height: auto; border-radius: 3px; }
.article-body figure { margin: 2rem 0; text-align: center; }
.article-body figcaption { text-align: center; font-style: italic; font-size: .85rem; color: var(--muted); margin-top: .5rem; }
.article-body blockquote {
  margin: 1.5rem 0; padding: 0 0 0 1.25rem;
  border-left: 2px solid var(--accent-link);
  color: var(--muted); font-style: italic;
}
.article-body hr { border: none; border-top: 1px solid var(--rule); margin: 2.5rem auto; width: 6rem; }
.article-body pre { overflow-x: auto; padding: 1rem; background: color-mix(in srgb, var(--fg) 5%, transparent); border-radius: 4px; font-size: .85rem; }
/* Email-layout tables (Mailchimp et al) carry fixed pixel widths; constrain
   them to the column so campaigns don't overflow on mobile. */
.article-body table { max-width: 100% !important; width: 100% !important; border-collapse: collapse; }
.article-body td { max-width: 100%; }

.original-link { margin-top: 3rem; padding-top: 1rem; border-top: 1px solid var(--rule); font-size: .9rem; color: var(--muted); }

.site-footer { margin-top: 4rem; padding-top: 1rem; border-top: 1px solid var(--rule); font-size: .85rem; color: var(--muted); }

/* ------- the archive stream (build-plan §6 layout rules) ------- */
.post { padding: 2.5rem 0; border-bottom: 1px solid var(--rule); }
.post-media { margin: 0 0 1rem; }
/* Never upscale (height:auto + max-width caps at natural size via the
   width attribute); tall images stay impressive without eating screens. */
.post-media img, .post-media video {
  display: block; margin: 0 auto 0.75rem;
  max-width: 100%; height: auto; max-height: 85vh; object-fit: contain;
  border-radius: 3px;
}
.post-caption p { margin: 0 0 1em; }
.post-caption p:last-child { margin-bottom: 0; }
.post-meta {
  font-size: .8rem; letter-spacing: .08em; text-transform: uppercase;
  color: var(--muted); margin: .75rem 0 0; font-family: var(--sans);
}
.post-meta a { color: var(--muted); text-decoration: none; }
.post-meta a:hover { color: var(--accent-link); }
.empty { color: var(--muted); font-style: italic; }

.search { margin: 1.25rem 0; }
.search input {
  width: 100%; padding: .5rem .75rem; font: inherit;
  background: var(--bg); color: var(--fg);
  border: 1px solid var(--rule); border-radius: 6px;
}
.search input:focus { outline: 2px solid var(--accent-link); border-color: transparent; }
.snippet { margin: .25rem 0 0; }
.snippet mark { background: color-mix(in srgb, var(--accent-link) 25%, transparent); color: inherit; border-radius: 2px; padding: 0 .1em; }

.tag-cloud { line-height: 2.2; }
.tag-cloud a { margin-right: .9rem; white-space: nowrap; }
.tag-cloud .count { color: var(--muted); font-size: .8rem; }

/* ------- calendar heatmap (§6.4) -------
   Zero is a NEUTRAL GRAY, not the lightest ramp step. Dark ramp is
   stepped for the dark surface, not an inversion. */
:root {
  --hm0: #f0efec; --hm1: #cde2fb; --hm2: #9ec5f4;
  --hm3: #5598e7; --hm4: #2a78d6; --hm5: #184f95;
}
@media (prefers-color-scheme: dark) {
  :root {
    --hm0: #2c2c2a; --hm1: #184f95; --hm2: #256abf;
    --hm3: #3987e5; --hm4: #6da7ec; --hm5: #9ec5f4;
  }
}
.heatmap { margin: 2rem 0; }
.heatmap h3 { font-size: 1rem; margin: 1.25rem 0 .5rem; }
.heatmap h3 a { text-decoration: none; color: var(--fg); }
.heatmap .hm-count { color: var(--muted); font-weight: normal; }
.hm-scroll { overflow-x: auto; }
.hm-0 { fill: var(--hm0); } .hm-1 { fill: var(--hm1); } .hm-2 { fill: var(--hm2); }
.hm-3 { fill: var(--hm3); } .hm-4 { fill: var(--hm4); } .hm-5 { fill: var(--hm5); }
.hm-label { font-family: var(--sans); font-size: 9px; fill: var(--muted); }
.hm-legend {
  display: flex; align-items: center; gap: .5rem;
  font-size: .8rem; color: var(--muted); margin: .75rem 0 0;
}
.hm-table summary { font-size: .85rem; color: var(--muted); cursor: pointer; margin-top: .5rem; }
.hm-table table { font-size: .9rem; border-collapse: collapse; margin-top: .5rem; }
.hm-table td, .hm-table th { padding: .2rem .8rem .2rem 0; text-align: left; }

/* ------- curation grid (§7) -------
   The single-column rule applies to the PUBLIC site; curation is
   deliberately a dense grid — density is the point when reviewing
   thousands of posts. Thumbnails are the stored files rendered small via
   CSS; no thumbnail pipeline. */
.cur-head h1 { margin-bottom: .25rem; }
.cur-head p { margin: .25rem 0; color: var(--muted); }
.notice { padding: .5rem .75rem; border: 1px solid var(--accent-link); border-radius: 6px; }
.bulk summary { cursor: pointer; color: var(--muted); }
.bulk-form { display: flex; flex-wrap: wrap; gap: .5rem; margin: .75rem 0; }
.bulk-form select, .bulk-form input, .bulk-form button { font: inherit; font-size: .9rem; padding: .3rem .5rem; }
.bulk-confirm { padding: .75rem 1rem; border: 1px solid var(--accent-link); border-radius: 6px; margin: 1rem 0; }
.cur-filters { font-size: .9rem; display: flex; flex-wrap: wrap; gap: .35rem .8rem; }
.cur-filters .active { font-weight: bold; text-decoration: none; }
.cur-grid {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(110px, 1fr));
  gap: .6rem; margin: 1.25rem 0;
}
.cur-cell { position: relative; font-family: var(--sans); font-size: .7rem; }
.cur-cell img, .cur-cell video {
  width: 100%; aspect-ratio: 1; object-fit: cover; display: block;
  border-radius: 4px;
}
.cur-cell.is-hidden img, .cur-cell.is-hidden video { opacity: .35; }
.cur-cell .cur-meta { display: block; color: var(--muted); margin: .25rem 0 .15rem; }
.cur-cell.is-hidden .cur-meta { color: var(--accent-link); }
.cur-cell button { font-size: .7rem; padding: .1rem .5rem; }
/* Curation pages are wider than the reading column. */
body:has(.cur-grid) { max-width: 64rem; }

/* ------- upload page (M3) ------- */
.dropzone {
  border: 2px dashed var(--rule); border-radius: 8px;
  padding: 2.5rem 1rem; text-align: center; color: var(--muted);
  transition: border-color .15s;
}
.dropzone.over { border-color: var(--accent-link); }
.dropzone.busy { opacity: .6; pointer-events: none; }
.upload-log {
  min-height: 6rem; max-height: 16rem; overflow-y: auto;
  font-size: .8rem; background: color-mix(in srgb, var(--fg) 5%, transparent);
  padding: .75rem; border-radius: 6px; white-space: pre-wrap;
}

/* ------- brand accents (engine product site ONLY, via <html class="brand">).
   Background/text stay on the neutral light/dark theme. Customer archives
   are untouched — the archive should look like their site, not ours.
   One highlight color for links AND platform names: #FCBF49 gold, darkened
   toward black in light mode so it stays readable on the near-white bg.
   Links remain distinguishable by their underline. (#D62828 reserved) */
html.brand {
  --brand-gold: color-mix(in srgb, #fcbf49 55%, black);
  --accent: var(--brand-gold);
  --accent-link: var(--brand-gold);
}
@media (prefers-color-scheme: dark) {
  html.brand { --brand-gold: #fcbf49; }
}
html.brand .platform { color: var(--brand-gold); }
