/* kanvas public surface — shared by the homepage and public entity pages
   (extracted from index.html in NEMOS-199 so both shells use one stylesheet). */
:root {
  --bg: #f4f1ea;
  --surface: #fdfcf8;
  --border: #26241f;
  --border-soft: #d8d2c2;
  --text: #3d3931;
  --text-strong: #26241f;
  --text-muted: #8a857a;
  --accent: #e34317;
  --shadow: #26241f;
  --mono: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  --serif: Charter, 'Iowan Old Style', Georgia, serif;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #17140e;
    --surface: #1f1b13;
    --border: #57503f;
    --border-soft: #35301f;
    --text: #cfc7b2;
    --text-strong: #efe8d6;
    --text-muted: #7c7461;
    --accent: #ff8257;
    --shadow: rgba(0, 0, 0, 0.65);
  }
}

:root[data-theme="dark"] {
    --bg: #17140e;
    --surface: #1f1b13;
    --border: #57503f;
    --border-soft: #35301f;
    --text: #cfc7b2;
    --text-strong: #efe8d6;
    --text-muted: #7c7461;
    --accent: #ff8257;
    --shadow: rgba(0, 0, 0, 0.65);
}

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

body {
  font-family: var(--serif);
  background-color: var(--bg);
  color: var(--text);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

/* NEMOS-199/205: the page shares the newspaper's full-bleed gutters, so the
   header and footer line up with the spread instead of floating in an indented
   column. */
.wrap { width: 100%; margin: 0 auto; padding: 0 1.5rem; box-sizing: border-box; }

/* ── Header ── */
/* NEMOS-205: slim and quiet — the front page below is the pitch. */
.site-bar { padding: 1rem 0; border-bottom: 1px solid var(--border-soft); }

header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1.4rem 0;
}
.wordmark {
  font-family: var(--mono);
  font-size: 1.15rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  color: var(--text-strong);
  text-decoration: none;
}
.wordmark::after { content: '_'; color: var(--accent); }
.header-signin {
  font-size: 0.85rem;
  color: var(--text-muted);
  text-decoration: none;
}
.header-signin:hover { color: var(--accent); }
/* NEMOS-202: LOG IN is quiet, SIGN UP carries the accent — the waitlist is the
   action we actually want from a logged-out visitor. */
.header-signup {
  font-family: var(--mono);
  font-size: 0.7rem;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--accent);
  text-decoration: none;
  border: 1px solid var(--accent);
  border-radius: 2px;
  padding: 0.3rem 0.65rem;
}
.header-signup:hover { background: var(--accent); color: #fff; }
.header-actions { display: inline-flex; align-items: center; gap: 0.9rem; }
.theme-toggle {
  all: unset;
  cursor: pointer;
  font-size: 0.95rem;
  line-height: 1;
  color: var(--text-muted);
  width: 1.5rem;
  height: 1.5rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 1.5px solid transparent;
  transition: color 0.1s, border-color 0.1s;
}
.theme-toggle:hover { color: var(--text-strong); border-color: var(--border); }

/* Buttons — still used by the entity page's "track this organization" CTA
   (NEMOS-199). The homepage's own CTA row went with the pitch (NEMOS-205). */
.btn {
  display: inline-block;
  font-family: var(--mono);
  font-size: 0.85rem;
  font-weight: 600;
  padding: 0.7rem 1.4rem;
  border-radius: 2px;
  text-decoration: none;
  transition: filter 0.1s, background 0.1s, color 0.1s, box-shadow 0.1s, transform 0.1s;
}
.btn-primary { background: var(--accent); color: #fff; }
.btn-primary:hover { filter: brightness(1.08); box-shadow: 3px 3px 0 var(--shadow); transform: translate(-1px, -1px); }

/* ── The newspaper: the live global front page ── */
.paper-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 1rem;
  padding: 1.1rem 0 0.9rem;
  flex-wrap: wrap;
}
.paper-kicker {
  font-family: var(--mono);
  font-size: 0.66rem;
  font-weight: 700;
  letter-spacing: 0.13em;
  text-transform: uppercase;
  color: var(--text-strong);
}
.paper-sub { font-family: var(--mono); font-size: 0.66rem; color: var(--text-muted); }

/* NEMOS-199 — the front page spreads across the whole viewport while the
   header and footer keep the readable gutters. auto-fill +
   a 340px floor gives 2 columns on a laptop and 3–4 on a wide display without
   hard-coding breakpoints. */
.paper-bleed {
  width: 100%;
  padding: 0 1.5rem;
  box-sizing: border-box;
}

.paper-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(340px, 1fr));
  /* dense: a wide headline otherwise leaves an empty bordered cell beside it —
     later short items backfill the hole instead. */
  grid-auto-flow: dense;
  gap: 0;
  border-top: 1px solid var(--border);
}
.paper-item {
  display: flex;
  gap: 0.75rem;
  align-items: flex-start;
  padding: 1rem 1.1rem 1.1rem 0;
  border-bottom: 1px solid var(--border-soft);
  border-right: 1px solid var(--border-soft);
  min-width: 0;
}
.paper-item + .paper-item { padding-left: 1.1rem; }
.paper-item.headline { grid-column: span 2; }
.paper-item.headline .paper-text { font-size: 1.15rem; line-height: 1.4; }
.paper-item.headline .paper-entity { font-size: 0.8rem; }

.paper-logo {
  width: 38px;
  height: 38px;
  flex-shrink: 0;
  box-sizing: border-box;
  object-fit: contain;
  padding: 5px;
  border: 1.5px solid var(--border);
  border-radius: 2px;
  background: var(--surface);
}
.paper-main { min-width: 0; flex: 1; }
.paper-entity {
  font-family: var(--mono);
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--accent);
  display: block;
  margin-bottom: 0.25rem;
}
.paper-text {
  font-size: 0.95rem;
  line-height: 1.5;
  color: var(--text);
  margin-bottom: 0.55rem;
  overflow-wrap: anywhere;
}
/* Read more (mirrors the app's NEMOS-177 affordance) */
.read-more {
  display: inline-flex;
  align-items: baseline;
  gap: 0.45rem;
  max-width: 100%;
  font-family: var(--mono);
  text-decoration: none;
  color: var(--text-muted);
  padding: 0.3rem 0.6rem;
  border: 1px solid var(--border-soft);
  border-radius: 2px;
  transition: color 0.1s, border-color 0.1s;
}
.read-more:hover { color: var(--accent); border-color: var(--accent); }
.rm-label {
  font-size: 0.62rem;
  font-weight: 600;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  white-space: nowrap;
  color: var(--text-strong);
}
.read-more:hover .rm-label { color: var(--accent); }
.rm-host { font-size: 0.66rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.paper-date { font-family: var(--mono); font-size: 0.66rem; color: var(--text-muted); margin-left: 0.5rem; }

/* Sponsored slot (NEMOS-198) — sits in the grid, dashed and quiet so it
   reads as an ad and never as a finding. */
.ad-slot {
  border: 1px dashed var(--border-soft);
  border-radius: 2px;
  padding: 0.85rem 1rem;
  margin: 0.9rem 0;
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  min-width: 0;
  align-self: start;
}
.ad-kicker {
  font-family: var(--mono);
  font-size: 0.58rem;
  font-weight: 600;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--text-muted);
}
.ad-body { display: flex; flex-direction: column; gap: 0.2rem; text-decoration: none; color: inherit; min-width: 0; }
.ad-title { font-family: var(--mono); font-size: 0.8rem; font-weight: 600; color: var(--text-strong); }
.ad-body:hover .ad-title { color: var(--accent); }
.ad-text { font-size: 0.82rem; line-height: 1.45; color: var(--text-muted); overflow-wrap: anywhere; }

.paper-empty {
  padding: 2.5rem 0 3rem;
  text-align: center;
  color: var(--text-muted);
  font-size: 0.95rem;
  border-top: 1px solid var(--border);
}

/* ── Waitlist ── */
.waitlist {
  text-align: center;
  padding: 4rem 0 5rem;
  border-top: 1px solid var(--border);
}
.waitlist h2 {
  font-family: var(--mono);
  font-size: 1.4rem;
  color: var(--text-strong);
  margin-bottom: 0.6rem;
}
.waitlist p {
  max-width: 28rem;
  margin: 0 auto 1.8rem;
}

/* ── Footer ── */
footer {
  border-top: 1px solid var(--border);
  padding: 1.6rem 0 2.2rem;
  font-size: 0.78rem;
  color: var(--text-muted);
}

@media (max-width: 760px) {
  .paper-bleed { padding: 0 1.1rem; }
  .paper-grid { grid-template-columns: 1fr; }
  /* A span-2 headline in a 1-column grid creates a phantom second column
     and squeezes text to one character per line — reset the span. */
  .paper-item.headline { grid-column: auto; }
  .paper-item,
  .paper-item:nth-child(2n) { padding: 0.9rem 0; border-right: none; padding-left: 0; }
  .paper-item.headline .paper-text { font-size: 1.05rem; }
  .read-more { padding: 0.35rem 0.65rem; }
}


/* ── Public entity page (NEMOS-199) ──────────────────────────────────────────
   One indexable, citation-backed page per organization. Reads as a dossier:
   the citations are the product, so they are on the page, not behind a click. */
/* Entity pages keep a single readable column rather than the paper's spread. */
.entity-page { max-width: 900px; }

.entity-head {
  display: flex;
  gap: 1rem;
  align-items: flex-start;
  padding: 2rem 0 1.2rem;
  border-bottom: 3px double var(--border);
}
.entity-logo {
  width: 54px;
  height: 54px;
  flex-shrink: 0;
  box-sizing: border-box;
  object-fit: contain;
  padding: 7px;
  border: 1.5px solid var(--border);
  border-radius: 2px;
  background: var(--surface);
}
.entity-headline { min-width: 0; }
.entity-name {
  font-family: var(--mono);
  font-size: clamp(1.4rem, 3vw, 2rem);
  font-weight: 750;
  letter-spacing: -0.02em;
  color: var(--text-strong);
  line-height: 1.15;
}
.entity-meta {
  font-family: var(--mono);
  font-size: 0.7rem;
  color: var(--text-muted);
  margin-top: 0.35rem;
  display: flex;
  gap: 0.75rem;
  flex-wrap: wrap;
}
.entity-desc { font-size: 1.05rem; line-height: 1.6; margin: 1.4rem 0 0.5rem; max-width: 46rem; }
.entity-verified { font-family: var(--mono); font-size: 0.66rem; color: var(--text-muted); }

.entity-section { padding: 1.8rem 0 0; }
.entity-section h2 {
  font-family: var(--mono);
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.13em;
  text-transform: uppercase;
  color: var(--text-strong);
  margin-bottom: 0.8rem;
}

.fact-list, .rel-list, .dev-list { list-style: none; display: flex; flex-direction: column; gap: 0.85rem; }
.fact-text { display: block; font-size: 0.95rem; line-height: 1.5; }
.cite-row { display: flex; flex-wrap: wrap; gap: 0.4rem; margin-top: 0.35rem; }
.cite {
  font-family: var(--mono);
  font-size: 0.62rem;
  color: var(--text-muted);
  text-decoration: none;
  border: 1px solid var(--border-soft);
  border-radius: 2px;
  padding: 0.15rem 0.4rem;
  max-width: 22rem;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.cite:hover { color: var(--accent); border-color: var(--accent); }
/* Block, not inline: as a sibling of .fact-text it otherwise butts straight
   against the fact ("HQ Denver, COno source on file yet"). */
.cite-none {
  display: block;
  margin-top: 0.35rem;
  font-family: var(--mono);
  font-size: 0.62rem;
  color: var(--text-muted);
  opacity: 0.75;
}

.rel-item { font-size: 0.95rem; line-height: 1.5; }
.rel-other { font-family: var(--mono); font-size: 0.8rem; color: var(--accent); text-decoration: none; font-weight: 600; }
.rel-other:hover { text-decoration: underline; }
.rel-other.plain { color: var(--text-strong); }

.dev-item { border-left: 2px solid var(--border-soft); padding-left: 0.8rem; }
.dev-text { font-size: 0.95rem; line-height: 1.5; margin-bottom: 0.4rem; }

.entity-links { display: flex; flex-wrap: wrap; gap: 0.5rem; }
.entity-link {
  font-family: var(--mono);
  font-size: 0.7rem;
  color: var(--text);
  text-decoration: none;
  border: 1px solid var(--border-soft);
  border-radius: 2px;
  padding: 0.3rem 0.6rem;
}
.entity-link:hover { color: var(--accent); border-color: var(--accent); }

/* Entity names in the newspaper are links now (NEMOS-199) */
a.paper-entity { text-decoration: none; }
a.paper-entity:hover { text-decoration: underline; }

.entity-back {
  font-family: var(--mono);
  font-size: 0.7rem;
  color: var(--text-muted);
  text-decoration: none;
  display: inline-block;
  padding: 1.2rem 0 0;
}
.entity-back:hover { color: var(--accent); }
