
: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);
  /* Pure white on purpose (decided 2026-08-17): years of Instagram users
     padded images with white (Whitagram et al.) to beat the app's crop —
     a white page makes those images borderless instead of framed in
     off-white rectangles. */
  --bg: #ffffff;
  --fg: #1c1c1a;
  --muted: #6e6e68;
  --rule: #e4e4de;
  --serif: 'Iowan Old Style', 'Charter', 'Georgia', serif;
  --sans: system-ui, -apple-system, 'Segoe UI', sans-serif;
}
/* Dark mode is deliberately NOT automatic (no prefers-color-scheme): the
   white ground is a content decision, not a theme default. The palette
   below ships inert behind an html.dark class until a user-facing toggle
   sets it (future work). */
html.dark {
  /* Blend any accent 45% toward white: keeps the site'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;
  /* 650px = Substack's content column (trialing 2026-08-17, was 576px):
     more presence for photography, and layout parity if newsletter
     import returns as a source. Density: measured exports deliver mostly
     1440px-wide images (not the folkloric 1080), so 650px displays at
     ~2.2x — retina-perfect. */
  max-width: 650px;
  background: var(--bg);
  color: var(--fg);
  font-family: var(--serif);
  /* 18px everywhere — Substack's pairing for a ~650px column (decided
     2026-08-17 after trying 17: better on desktop, close enough on
     mobile; a per-breakpoint size can come later if anyone complains).
     UI text (chips, meta) is rem-sized against the 16px root, so it
     stays quiet while prose grows. */
  font-size: 1.125rem;
  line-height: 1.7;
}

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

/* Type scale (settled 2026-08-18): 16 everything · 18 prose/captions ·
   21 h2 · 24 h1 — plus ONE annotation exception at 14: post dates and
   chip counts, which must sit visibly beneath what they annotate. */
h1, h2, h3, h4 { font-family: var(--sans); line-height: 1.25; letter-spacing: -0.01em; }
h2 { font-size: 1.3125rem; }

.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: 1rem; margin-top: .6rem; display: flex; flex-wrap: wrap; gap: .35rem .6rem; }
.profile-links .dot { color: var(--muted); }
.profile-links .nav-group { display: flex; gap: .35rem .6rem; }
.nav-break { display: none; }
/* Phones: archive-nav and outbound links on separate lines. */
@media (max-width: 640px) {
  .nav-joint { display: none; }
  .nav-break { display: block; flex-basis: 100%; height: 0; }
}




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


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

/* Long unbroken tokens (the magic upload link) wrap instead of forcing a
   sideways scroll, and one click/tap selects the whole thing for copying. */
code { overflow-wrap: anywhere; user-select: all; -webkit-user-select: all; }

/* ------- 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 {
  /* Vertical gap matches the body's side padding (1.25rem): uniform air
     on all sides of a photograph, carousel or margin alike (founder
     decision 2026-08-18). Post-to-post separation (2.5rem padding each
     side of the hairline) keeps carousels reading as one group. */
  display: block; margin: 0 auto 1.25rem;
  max-width: 100%; height: auto; max-height: 85vh; object-fit: contain;
  /* No rounded corners on the work itself (founder decision 2026-08-17):
     Instagram doesn't round, and the corner belongs to the photograph. */
}
/* Portrait VIDEO: when 85vh caps the height, the width must follow the
   aspect ratio down (width:auto) — otherwise the element stays
   column-wide and the browser paints its own gray letterbox beside the
   frame (founder screenshot, 2026-08-21). Images never showed this:
   their spare box area is transparent; video's is UA-painted. The
   width/height attributes still reserve the right box before load. */
.post-media video {
  width: auto;
}
/* Click-to-enlarge (native <dialog> lightbox; anchor is the no-JS fallback) */
a.lb { display: block; cursor: zoom-in; }
.lightbox { border: 0; padding: 0; background: transparent; max-width: 95vw; max-height: 95vh; outline: none; }
.lightbox img { max-width: 95vw; max-height: 95vh; display: block; cursor: zoom-out; }
/* Pure black, fully opaque (founder decision 2026-08-17): the dimmed
   page behind was a distraction — in the lightbox, only the photograph
   exists. */
.lightbox::backdrop { background: #000; }
.lb-close {
  position: fixed; top: .75rem; right: .75rem;
  width: 44px; height: 44px; border: 0; border-radius: 50%;
  background: rgba(255, 255, 255, .12); color: #fff;
  font-size: 1.5rem; line-height: 1; cursor: pointer;
  outline: none; /* showModal focuses this button; the circle is the affordance */
}

/* Defensive: customer-written text can contain unbreakable strings
   (long URLs, 30-char hashtags). overflow-wrap only intervenes when a
   line would otherwise push the page sideways. */
.post-caption, .intro, .snippet { overflow-wrap: anywhere; }

.post-caption p { margin: 0 0 1em; }
.post-caption p:last-child { margin-bottom: 0; }
.post-meta {
  font-size: .875rem; 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; }
a.search-hit {
  display: flex; gap: 1rem; align-items: flex-start; padding: 1.25rem 0;
  color: inherit; text-decoration: none;
}
a.search-hit:hover .snippet { text-decoration: underline; text-decoration-thickness: 1px; text-underline-offset: 2px; }
.hit-thumb { flex: none; }
.hit-thumb img, .hit-thumb video {
  width: 72px; height: 72px; object-fit: cover; display: block; border-radius: 2px;
}
.hit-body { min-width: 0; display: block; }
.hit-body .post-meta, .hit-body .snippet { display: block; }
.hit-body .post-meta { margin: 0 0 .25rem; }
.snippet mark { background: color-mix(in srgb, var(--accent-link) 25%, transparent); color: inherit; border-radius: 2px; padding: 0 .1em; }

.sort-links { font-family: var(--sans); font-size: 1rem; color: var(--muted); }
.sort-links a { color: var(--muted); }

/* Same chip voice as the month index on /history/ (flex-wrap fixes the
   unbreakable-row overflow: JSX emits no whitespace between anchors). */
.tag-cloud {
  display: flex; flex-wrap: wrap; gap: .35rem 1.1rem;
  font-family: var(--sans); font-size: 1rem;
}
.tag-cloud a { text-decoration: none; white-space: nowrap; }
.tag-cloud .count { color: var(--muted); font-size: .875rem; }

/* ------- 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;
}
html.dark {
  --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 svg { width: 100%; height: auto; display: block; }
/* Phones: 53 weeks can't fit legibly in ~390px — render each year at
   tappable size and let its band scroll sideways (a native gesture,
   unlike pinch-zooming the page). Desktop keeps the at-a-glimpse fit. */
@media (max-width: 640px) {
  .hm-scroll { overflow-x: auto; -webkit-overflow-scrolling: touch; }
  .hm-scroll svg { width: 700px; }
}
.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: 1rem; color: var(--muted); margin: .75rem 0 0;
}
.hm-months summary { font-size: 1rem; color: var(--muted); cursor: pointer; margin-top: .5rem; }
.hm-months-row {
  display: flex; flex-wrap: wrap; gap: .35rem 1.1rem;
  margin: 0; padding: .5rem 0;
  border-top: 1px solid var(--rule);   /* hairline between years */
  font-family: var(--sans); font-size: 1rem;
}
.hm-months-row:first-of-type { border-top: none; margin-top: .5rem; }
.hm-months-row a { text-decoration: none; white-space: nowrap; }
.hm-months-row .count { color: var(--muted); font-size: .875rem; }
.hm-months-row .hm-year-label { font-weight: 700; color: var(--fg); min-width: 3.2em; }

/* ------- 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. */
.detail-actions { margin: 1.25rem 0; } /* the standard air unit */
.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: 1rem; padding: .3rem .5rem; }
/* The value field must fit its own placeholder ("date / tag / keyword")
   and grows to fill whatever line it wraps onto. */
.bulk-form input { flex: 1 1 auto; min-width: 13rem; }
.bulk-confirm { padding: .75rem 1rem; border: 1px solid var(--accent-link); border-radius: 6px; margin: 1rem 0; }
.cur-filters { font-size: 1rem; 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;
}
/* Cell labels are annotations on thumbnails → 14 per the type scale's
   annotation exception; the Hide/Show buttons keep 16 for tap size. */
.cur-cell { position: relative; font-family: var(--sans); font-size: .875rem; }
.cur-cell img, .cur-cell video {
  /* height:auto keeps aspect-ratio in charge even if width/height
     attributes appear on a thumb — an attribute height overrides
     aspect-ratio otherwise (the 2026-08-21 distorted-grid bug). */
  width: 100%; height: auto; 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: 1rem; padding: .3rem .8rem; }
/* 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; }
/* Touch devices can't drag a file onto a page: hide the drag language,
   leave a comfortable tap target. */
@media (pointer: coarse) {
  .dropzone .drag-hint, .dropzone .or-word { display: none; }
  .dropzone { padding: 1.5rem 1rem; }
  .dropzone input[type="file"] { font-size: 1rem; }
}
/* Timezone (asked once, §5.2) — quiet UI text, not prose. The default
   reads as a statement, not a question; the hint is the annotation tier
   (14) and only appears behind "change". */
.tz-row { font-family: var(--sans); font-size: 1rem; color: var(--muted); }
.tz-row select { font: inherit; padding: .3rem .5rem; max-width: 100%; }
.tz-row .tz-hint { font-size: .875rem; display: inline-block; margin-top: .35rem; }
.linklike {
  background: none; border: 0; padding: 0; font: inherit;
  color: var(--accent-link); text-decoration: underline;
  text-decoration-thickness: 1px; text-underline-offset: 2px; cursor: pointer;
}

.upload-done {
  padding: 1rem 1.25rem; margin: 1rem 0;
  border: 1px solid var(--accent-link); border-radius: 8px;
}
.upload-done p { margin: 0 0 .75rem; font-weight: 600; }
.btn {
  display: inline-block; padding: .55rem 1.1rem;
  background: var(--accent); color: #fff !important;
  border-radius: 6px; text-decoration: none; font-family: var(--sans);
  border: 0; font-size: 1rem; cursor: pointer;
}

.upload-log {
  min-height: 6rem; max-height: 16rem; overflow-y: auto;
  font-size: 1rem; background: color-mix(in srgb, var(--fg) 5%, transparent);
  padding: .75rem; border-radius: 6px; white-space: pre-wrap;
}

/* ------- product page (engine host) ------- */
.steps li, .promises li { margin: 0 0 1rem; }
.steps, .promises { padding-left: 1.25rem; }
.cta { margin: 2.5rem 0 .5rem; }
.cta .btn { font-size: 1rem; padding: .7rem 1.4rem; }
.cta-note { color: var(--muted); font-size: 1rem; }

/* ------- 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);
}
html.dark.brand { --brand-gold: #fcbf49; }
html.brand .platform { color: var(--brand-gold); }
