/*
 * demo.css — two visual worlds on purpose.
 *
 *   .demo-*   our chrome: near-black and the AdSentinel lime, matching the
 *             console. It has to read as OURS at a glance.
 *   the page  an ordinary publisher property: light, serif, a rail, ads spliced
 *             between paragraphs.
 *
 * The separation is not decoration. A wall demonstrated on a black product page
 * proves nothing about how it behaves on a newspaper — the layout patterns a
 * publisher actually ships are the ones cosmetic filters target and the ones our
 * rendering has to survive. So the article half stays deliberately ordinary, and
 * every pixel of ours stays visibly outside it.
 */

:root {
  /* One identity, one palette. The demo used to run two — our chrome in the
     console's dark, the article half in newspaper white. That split made the
     product look like a guest on someone else's site. It is OUR demo now. */
  --ink: #0b0b0b;          /* page */
  --surface: #131313;      /* raised: rails, wells, footer */
  --surface-2: #191919;
  --line: #262626;
  --line-soft: #1d1d1d;
  --text: #ededed;
  --muted: #8f8f8f;
  --dim: #6a6a6a;
  --accent: #c8f135;       /* AdSentinel lime */
  --accent-soft: rgba(200, 241, 53, 0.12);
  --accent-line: rgba(200, 241, 53, 0.3);

  /* Aliases kept so the chrome rules below need no rewrite. */
  --d-ink: var(--ink);
  --d-ink-2: var(--surface);
  --d-line: var(--line);
  --d-accent: var(--accent);
  --d-text: var(--text);
  --d-muted: var(--muted);

  --max: 1180px;
  --demo-bar-h: 46px;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--ink);
  color: var(--text);
  font: 17px/1.72 'Iowan Old Style', 'Palatino Linotype', Palatino, Georgia, serif;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

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

.wrap { max-width: var(--max); margin: 0 auto; padding: 0 22px; }

.sans { font-family: 'Helvetica Neue', Inter, Arial, sans-serif; }

/* ═══ Our chrome: the top bar ═══════════════════════════════════════════ */

.demo-bar {
  position: sticky;
  top: 0;
  z-index: 60;
  height: var(--demo-bar-h);
  background: var(--d-ink);
  color: var(--d-text);
  border-bottom: 1px solid var(--d-line);
  font: 500 13px/1 'Helvetica Neue', Inter, Arial, sans-serif;
}
.demo-bar .wrap {
  height: 100%;
  display: flex;
  align-items: center;
  gap: 16px;
}
.demo-bar a { color: var(--d-text); text-decoration: none; }
.demo-bar a:hover { color: var(--d-accent); text-decoration: none; }

.demo-logo {
  display: flex;
  align-items: center;
  gap: 8px;
  font-weight: 700;
  letter-spacing: -0.2px;
  white-space: nowrap;
}
.demo-logo .dot {
  width: 8px; height: 8px; border-radius: 50%;
  background: var(--d-accent);
  box-shadow: 0 0 10px rgba(200, 241, 53, 0.7);
}
.demo-logo .thin { color: var(--d-muted); font-weight: 400; }

.demo-bar .spacer { flex: 1; }

.demo-bar .crumb {
  color: var(--d-muted);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.demo-bar .crumb b { color: var(--d-text); font-weight: 600; }

.demo-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 5px 11px;
  border: 1px solid var(--d-line);
  border-radius: 999px;
  color: var(--d-muted);
  white-space: nowrap;
}
.demo-pill b { color: var(--d-text); font-weight: 600; }
.demo-pill .led { width: 7px; height: 7px; border-radius: 50%; background: #555; }
.demo-pill .led.on { background: var(--d-accent); box-shadow: 0 0 8px rgba(200, 241, 53, 0.8); }
.demo-pill .led.off { background: #4a4a4a; }
.demo-pill .led.wait { background: #d9a441; animation: d-pulse 1.4s ease-in-out infinite; }

@keyframes d-pulse { 0%, 100% { opacity: 1 } 50% { opacity: 0.35 } }

@media (max-width: 720px) {
  .demo-bar .crumb, .demo-pill.hide-sm { display: none; }
}

/* ═══ Home — the index, nothing else ══════════════════════════════════ */

.home {
  background: var(--d-ink);
  color: var(--d-text);
  font-family: 'Helvetica Neue', Inter, Arial, sans-serif;
  min-height: 100vh;
}
/* No demo top bar on the index: the page IS the navigation. */
.index-only .demo-bar { display: none; }

.idx-head { padding: 84px 0 12px; }
.idx-logo {
  height: 104px;
  width: auto;
  display: block;
  margin-left: -8px; /* optical: the mark carries transparent padding */
}
.idx-sub {
  margin-top: 14px;
  font-size: 14px;
  color: var(--d-muted);
  letter-spacing: 0.1px;
}

.idx-group { padding: 44px 0 0; }
.idx-group h2 {
  font: 600 11px/1 'Helvetica Neue', Inter, Arial, sans-serif;
  letter-spacing: 2.2px;
  text-transform: uppercase;
  color: var(--d-accent);
  margin: 0 0 4px;
  padding-bottom: 14px;
  border-bottom: 1px solid var(--d-line);
}

/* Rows, not cards. A card is a pitch; a row is an index entry. */
.idx-rows { display: flex; flex-direction: column; }

.idx-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto auto auto;
  align-items: baseline;
  gap: 18px;
  padding: 17px 4px 17px 0;
  border-bottom: 1px solid #1e1e1e;
  text-decoration: none;
  color: inherit;
  transition: padding-left 0.14s ease, border-color 0.14s ease;
}
.idx-row:hover {
  padding-left: 10px;
  border-bottom-color: rgba(200, 241, 53, 0.4);
  text-decoration: none;
}
.idx-name {
  font-size: 16.5px;
  font-weight: 500;
  color: var(--d-text);
  letter-spacing: -0.15px;
}
.idx-row:hover .idx-name { color: var(--d-accent); }
.idx-cfg {
  font: 500 11.5px/1 ui-monospace, SFMono-Regular, Menlo, monospace;
  letter-spacing: 0.3px;
  color: #7d7d7d;
  white-space: nowrap;
}
.idx-flag {
  font: 600 10px/1 'Helvetica Neue', Arial, sans-serif;
  letter-spacing: 0.6px;
  text-transform: uppercase;
  color: #d7b978;
  border: 1px solid #4a3f16;
  border-radius: 999px;
  padding: 4px 9px;
  white-space: nowrap;
}
.idx-go { color: #3f3f3f; font-size: 15px; }
.idx-row:hover .idx-go { color: var(--d-accent); }

main.wrap { padding-bottom: 110px; }

@media (max-width: 700px) {
  .idx-head { padding-top: 52px; }
  .idx-row { grid-template-columns: minmax(0, 1fr) auto; row-gap: 6px; }
  .idx-cfg { grid-column: 1 / -1; }
}

/* ═══ The site — a classic editorial layout, in our colours ════════════ */

header.site { border-bottom: 1px solid var(--line); background: var(--ink); }

/* A masthead, centred, the way a publication does it — the one place the logo
   gets to be a logo rather than a favicon. The asset carries a lot of
   transparent margin, so it is sized by its BOX, not by its ink. */
.masthead {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  padding: 18px 0 20px;
  text-align: center;
}
.masthead img.brand { height: 118px; width: auto; display: block; }
.dateline {
  font: 10.5px/1 'Helvetica Neue', Inter, Arial, sans-serif;
  color: var(--dim);
  text-transform: uppercase;
  letter-spacing: 2px;
}

nav.sections {
  border-top: 1px solid var(--line-soft);
  font: 600 12px/1 'Helvetica Neue', Inter, Arial, sans-serif;
  text-transform: uppercase;
  letter-spacing: 1.1px;
}
nav.sections ul {
  display: flex; justify-content: center; gap: 30px;
  list-style: none; margin: 0; padding: 15px 0; overflow-x: auto;
}
nav.sections a { color: var(--muted); white-space: nowrap; text-decoration: none; }
nav.sections a:hover { color: var(--text); text-decoration: none; }
nav.sections a.active { color: var(--accent); }

.layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 300px;
  gap: 56px;
  padding: 40px 0 80px;
}
@media (max-width: 900px) {
  .layout { grid-template-columns: minmax(0, 1fr); gap: 32px; }
  aside.rail { order: 2; }
}

h1.headline {
  font: 700 clamp(32px, 4.2vw, 46px)/1.16 'Iowan Old Style', Palatino, Georgia, serif;
  margin: 10px 0 16px; letter-spacing: -0.4px; color: #fff;
}
h2.kicker {
  font: 700 11px/1 'Helvetica Neue', Inter, Arial, sans-serif;
  color: var(--accent); text-transform: uppercase; letter-spacing: 2px; margin: 0;
}
.standfirst { font-size: 21px; line-height: 1.55; color: var(--muted); margin: 0 0 24px; }
.byline {
  font: 12.5px/1 'Helvetica Neue', Inter, Arial, sans-serif;
  color: var(--dim);
  border-top: 1px solid var(--line-soft);
  border-bottom: 1px solid var(--line-soft);
  padding: 12px 0; margin-bottom: 30px; letter-spacing: 0.3px;
}
article p { margin: 0 0 22px; color: #d8d8d8; }
article h3 {
  font: 700 23px/1.3 'Iowan Old Style', Palatino, Georgia, serif;
  margin: 36px 0 14px; color: #fff;
}
article blockquote {
  margin: 30px 0; padding: 0 0 0 22px;
  border-left: 2px solid var(--accent);
  font-size: 22px; line-height: 1.5; color: #fff;
}

.rail-title {
  font: 700 11px/1 'Helvetica Neue', Inter, Arial, sans-serif;
  text-transform: uppercase; letter-spacing: 2px;
  color: var(--accent);
  border-bottom: 1px solid var(--line);
  padding-bottom: 10px; margin: 0 0 6px;
}
.rail-list { list-style: none; margin: 0 0 34px; padding: 0; }
.rail-list li {
  border-bottom: 1px solid var(--line-soft);
  padding: 14px 0;
  font: 16px/1.45 'Iowan Old Style', Palatino, Georgia, serif;
}
.rail-list a { color: var(--text); text-decoration: none; }
.rail-list a:hover { color: var(--accent); text-decoration: none; }

/* Ad slots. The `advertisement` / `ad-slot` names are themselves filter-list
   targets, so keeping them is part of the demonstration, not sloppiness. */
.advertisement { margin: 34px 0; text-align: center; }
.advertisement > .ad-label {
  font: 9.5px/1 'Helvetica Neue', Arial, sans-serif;
  text-transform: uppercase; letter-spacing: 2px;
  color: var(--dim); margin-bottom: 9px;
}
.ad-slot {
  display: flex; align-items: center; justify-content: center; margin: 0 auto;
  background: var(--surface);
  border: 1px solid var(--line-soft);
  border-radius: 6px;
  overflow: hidden;
}
.ad-slot:empty::after {
  content: 'slot empty';
  font: 11px/1 'Helvetica Neue', Arial, sans-serif;
  color: #4a4a4a; letter-spacing: 0.4px;
}
aside.rail .advertisement { position: sticky; top: calc(var(--demo-bar-h) + 20px); }

footer.site {
  border-top: 1px solid var(--line);
  background: var(--surface);
  padding: 30px 0 42px;
  font: 13px/1.7 'Helvetica Neue', Inter, Arial, sans-serif;
  color: var(--dim);
}
footer.site a { color: var(--muted); text-decoration: underline; }
footer.site a:hover { color: var(--accent); }

/* ═══ The explainer panel ══════════════════════════════════════════════ */

.demo-panel {
  position: fixed;
  left: 18px;
  bottom: 18px;
  z-index: 2147482000; /* below the QA toolbar, far below a wall */
  width: 372px;
  max-height: min(62vh, 620px);
  display: flex;
  flex-direction: column;
  background: rgba(13, 13, 13, 0.97);
  color: var(--d-text);
  border: 1px solid #333;
  border-radius: 16px;
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.55);
  font: 13px/1.55 'Helvetica Neue', Inter, Arial, sans-serif;
  overflow: hidden;
  animation: d-rise 0.22s ease-out;
}
@keyframes d-rise { from { opacity: 0; transform: translateY(10px) } to { opacity: 1; transform: none } }
@media (prefers-reduced-motion: reduce) {
  .demo-panel, .card-s, .card-s .go .arr { animation: none; transition: none; }
}

.demo-panel .p-head {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 13px 14px;
  background: #151515;
  border-bottom: 1px solid #2b2b2b;
}
.demo-panel .p-head .badge {
  font: 600 10px/1 ui-monospace, SFMono-Regular, Menlo, monospace;
  letter-spacing: 0.5px;
  text-transform: uppercase;
  color: var(--d-accent);
  background: rgba(200, 241, 53, 0.1);
  border: 1px solid rgba(200, 241, 53, 0.24);
  border-radius: 5px;
  padding: 4px 7px;
  white-space: nowrap;
}
.demo-panel .p-head strong {
  flex: 1;
  font-size: 13.5px;
  font-weight: 700;
  letter-spacing: -0.2px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.demo-panel .p-body { overflow-y: auto; padding: 4px 14px 14px; }

.demo-panel h4 {
  font: 600 10px/1 'Helvetica Neue', Arial, sans-serif;
  letter-spacing: 1.5px;
  text-transform: uppercase;
  color: #7d7d7d;
  margin: 18px 0 8px;
}
.demo-panel p { margin: 0; color: #c4c4c4; font-size: 12.8px; line-height: 1.62; }
.demo-panel ol, .demo-panel ul { margin: 0; padding-left: 17px; color: #c4c4c4; font-size: 12.8px; }
.demo-panel li { margin-bottom: 6px; }
.demo-panel li::marker { color: var(--d-accent); }

.demo-panel code.rule {
  display: block;
  white-space: pre-wrap;
  background: #171717;
  border: 1px solid #2b2b2b;
  border-left: 2px solid var(--d-accent);
  border-radius: 8px;
  padding: 10px 12px;
  font: 11.5px/1.6 ui-monospace, SFMono-Regular, Menlo, monospace;
  color: #ddd;
}

.demo-panel .state { display: grid; grid-template-columns: auto 1fr; gap: 5px 12px; }
.demo-panel .state dt { color: #7d7d7d; font-size: 11.5px; }
.demo-panel .state dd {
  margin: 0;
  font: 11.5px/1.5 ui-monospace, SFMono-Regular, Menlo, monospace;
  color: #eee;
  overflow-wrap: anywhere;
}
.demo-panel .state dd.hl { color: var(--d-accent); }
.demo-panel .state dd.dim { color: #6a6a6a; font-style: italic; }

.demo-panel .p-foot {
  display: flex;
  gap: 8px;
  padding: 12px 14px;
  border-top: 1px solid #2b2b2b;
  background: #151515;
}
.demo-panel button, .demo-toggle {
  font: 600 12px/1 'Helvetica Neue', Inter, Arial, sans-serif;
  border-radius: 8px;
  cursor: pointer;
  border: 1px solid #3a3a3a;
  background: #242424;
  color: #e8e8e8;
  padding: 9px 12px;
  transition: background 0.14s ease, border-color 0.14s ease;
}
.demo-panel button:hover { background: #2f2f2f; border-color: #4a4a4a; }
.demo-panel button.primary {
  flex: 1;
  background: var(--d-accent);
  border-color: var(--d-accent);
  color: var(--d-ink);
}
.demo-panel button.primary:hover { background: #d5f542; }
.demo-panel button.icon { padding: 9px 11px; }

.demo-panel .langs { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 4px; }
.demo-panel .langs a {
  font: 600 11.5px/1 'Helvetica Neue', Arial, sans-serif;
  color: #ddd;
  border: 1px solid #3a3a3a;
  border-radius: 999px;
  padding: 6px 11px;
  text-decoration: none;
}
.demo-panel .langs a:hover { border-color: var(--d-accent); color: var(--d-accent); }

.demo-panel .pending {
  margin-top: 14px;
  border: 1px solid #4a3f16;
  background: rgba(217, 164, 65, 0.09);
  border-radius: 8px;
  padding: 9px 11px;
  color: #d7b978;
  font-size: 11.8px;
  line-height: 1.5;
}

/* Collapsed: a single pill, so the panel can never sit over the thing it
   exists to let you observe. */
.demo-toggle {
  position: fixed;
  left: 18px;
  bottom: 18px;
  z-index: 2147482000;
  display: none;
  align-items: center;
  gap: 8px;
  padding: 11px 16px;
  background: rgba(13, 13, 13, 0.97);
  box-shadow: 0 14px 34px rgba(0, 0, 0, 0.45);
  border-radius: 999px;
}
.demo-toggle .dot {
  width: 7px; height: 7px; border-radius: 50%;
  background: var(--d-accent);
  box-shadow: 0 0 8px rgba(200, 241, 53, 0.8);
}
body.demo-collapsed .demo-panel { display: none; }
body.demo-collapsed .demo-toggle { display: flex; }

@media (max-width: 560px) {
  .demo-panel { left: 10px; right: 10px; bottom: 10px; width: auto; max-height: 62vh; }
  .demo-toggle { left: 10px; bottom: 10px; }
}
