/* =====================================================================
   Uplive Publications — shared visual system
   --------------------------------------------------------------------
   The site is an in-house knowledge library for Uplive team reports.
   Visual register: editorial publication with one restrained nod to
   Uplive's broadcast / livestreaming world. Hairline rules + type do
   the structural work; rounded boxes are reserved for inputs.
   ===================================================================== */

@font-face {
  font-family: "Realce";
  src: url("/assets/Realce-Black.otf") format("opentype");
  font-style: normal;
  font-weight: 900;
  font-display: swap;
}

@font-face {
  font-family: "IBM Plex Sans";
  src: url("/assets/fonts/ibm-plex-sans.woff2") format("woff2-variations"),
       url("/assets/fonts/ibm-plex-sans.woff2") format("woff2");
  font-style: normal;
  font-weight: 100 700;
  font-display: swap;
}

@font-face {
  font-family: "IBM Plex Sans";
  src: url("/assets/fonts/ibm-plex-sans-italic.woff2") format("woff2-variations"),
       url("/assets/fonts/ibm-plex-sans-italic.woff2") format("woff2");
  font-style: italic;
  font-weight: 100 700;
  font-display: swap;
}

@font-face {
  font-family: "IBM Plex Mono";
  src: url("/assets/fonts/ibm-plex-mono-400.woff2") format("woff2");
  font-style: normal;
  font-weight: 400;
  font-display: swap;
}

@font-face {
  font-family: "IBM Plex Mono";
  src: url("/assets/fonts/ibm-plex-mono-500.woff2") format("woff2");
  font-style: normal;
  font-weight: 500;
  font-display: swap;
}

@font-face {
  font-family: "IBM Plex Mono";
  src: url("/assets/fonts/ibm-plex-mono-600.woff2") format("woff2");
  font-style: normal;
  font-weight: 600;
  font-display: swap;
}

:root {
  /* ── Color ─────────────────────────────────────────────────────── */
  /* Brand purple (fixed, do not edit). */
  --primary:           oklch(0.5213 0.2145 282.1200);
  --primary-deep:      oklch(0.34    0.1400 282.0000);
  --primary-tint:      oklch(0.97    0.0180 282.0000);
  /* Restrained broadcast red — used ONLY on the ●REC indicator. */
  --signal:            oklch(0.62    0.2100  25.0000);

  --ink:               oklch(0.20    0.0150 285.0000);  /* primary text */
  --ink-deep:          oklch(0.13    0.0180 285.0000);  /* headlines on white */
  --paper:             oklch(0.985   0.0040  80.0000);  /* main bg (slight warm) */
  --paper-cool:        oklch(0.965   0.0050 285.0000);  /* cards, slight cool */
  --rule:              oklch(0.91    0.0060 285.0000);  /* hairline divider */
  --rule-strong:       oklch(0.82    0.0100 285.0000);  /* emphasised rule */
  --mute:              oklch(0.50    0.0120 285.0000);  /* secondary text */
  --faint:             oklch(0.65    0.0080 285.0000);  /* tertiary text */
  --on-dark:           oklch(0.985   0.0040  80.0000);  /* text on primary */
  --on-dark-faint:     oklch(0.78    0.0200 285.0000);  /* faint text on primary */

  --shadow-purple:     oklch(0.30    0.1600 282.0000 / 0.10);

  /* Legacy aliases so the rest of the codebase that referenced old
     tokens keeps resolving cleanly. New code should prefer the names
     above. */
  --primary-foreground: var(--on-dark);
  --foreground:         var(--ink);
  --background:         var(--paper);
  --card:               var(--paper-cool);
  --border:             var(--rule);
  --accent:             var(--primary-tint);
  --ring:               var(--primary);
  --muted-foreground:   var(--mute);
  --destructive:        var(--signal);
  --footer-background:  var(--primary-deep);

  /* ── Type ──────────────────────────────────────────────────────── */
  --font-title: "Realce", "Arial Narrow", "Helvetica Neue Condensed", sans-serif;
  --font-body:  "IBM Plex Sans", "Helvetica Neue", "Segoe UI", system-ui, sans-serif;
  --font-mono:  "IBM Plex Mono", "SFMono-Regular", Menlo, ui-monospace, monospace;
  --font-sans:  var(--font-body);

  /* ── Type scale (modular, restrained) ──────────────────────────── */
  --text-xs:     0.75rem;
  --text-sm:     0.8125rem;
  --text-base:   1.0625rem;
  --text-md:     1.1875rem;
  --text-lg:     1.4375rem;
  --text-xl:     1.875rem;
  --text-2xl:    2.5rem;
  --text-3xl:    3.5rem;
  --text-display: clamp(3rem, 9vw, 7rem);

  /* ── Spacing (8px base) ────────────────────────────────────────── */
  --space-1:  0.25rem;
  --space-2:  0.5rem;
  --space-3:  0.75rem;
  --space-4:  1rem;
  --space-5:  1.5rem;
  --space-6:  2rem;
  --space-8:  3rem;
  --space-10: 4rem;
  --space-12: 5rem;
  --space-16: 7rem;

  /* ── Radius (mostly sharp) ─────────────────────────────────────── */
  --radius-sm: 0.125rem;
  --radius-md: 0.25rem;
  --radius-lg: 0.375rem;
  --radius:    0.25rem;       /* kept for legacy compatibility */
  --radius-xl: 0.375rem;
  --radius-pill: 999px;

  /* ── Containers ────────────────────────────────────────────────── */
  --container:    68rem;
  --container-narrow: 42rem;
  --rule-w:       1px;
  --rule-w-bold:  2px;
}

/* =====================================================================
   Reset + base
   ===================================================================== */

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--font-body);
  font-size: var(--text-base);
  font-weight: 400;
  line-height: 1.65;
  font-feature-settings: "ss01" 1, "ss02" 1, "kern" 1, "liga" 1;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

h1, h2, h3, h4 {
  font-family: var(--font-title);
  font-weight: 900;
  color: var(--ink-deep);
  letter-spacing: -0.025em;
  margin: 0;
  line-height: 1.04;
}

h1 { font-size: var(--text-3xl); letter-spacing: -0.035em; line-height: 0.96; }
h2 { font-size: var(--text-2xl); }
h3 { font-size: var(--text-xl);  letter-spacing: -0.02em; }
h4 { font-size: var(--text-lg);  letter-spacing: -0.015em; }

p { margin: 0 0 1.1em; }

a {
  color: var(--primary);
  text-decoration: none;
  text-underline-offset: 0.18em;
  text-decoration-thickness: 0.06em;
}
a:hover { text-decoration: underline; }

strong { font-weight: 600; }
em { font-style: italic; }

::selection { background: var(--primary); color: var(--on-dark); }

:focus-visible {
  outline: 2px solid var(--primary);
  outline-offset: 3px;
  border-radius: 1px;
}

/* =====================================================================
   Header — purple band, brand on left, monochrome wordmark on right
   ===================================================================== */

.site-header {
  background: var(--primary);
  color: var(--on-dark);
}

.site-header-inner {
  width: min(100% - 2rem, var(--container));
  margin: 0 auto;
  display: flex;
  align-items: center;
  gap: var(--space-6);
  min-height: 4.75rem;
  padding: var(--space-2) 0;
}

.site-brand {
  display: inline-flex;
  align-items: center;
  gap: var(--space-4);
  color: inherit;
  text-decoration: none;
  flex: 1 1 auto;
}

.site-brand img {
  display: block;
  width: clamp(6rem, 18vw, 9rem);
  height: auto;
}

.site-brand .wordmark {
  font-family: var(--font-mono);
  font-weight: 500;
  font-size: var(--text-sm);
  letter-spacing: 0.14em;
  text-transform: uppercase;
  padding-left: var(--space-4);
  border-left: 1px solid color-mix(in oklch, var(--on-dark) 35%, transparent);
  color: color-mix(in oklch, var(--on-dark) 88%, transparent);
}

.site-nav {
  display: flex;
  align-items: center;
  gap: var(--space-5);
  font-family: var(--font-mono);
  font-size: var(--text-xs);
  font-weight: 500;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}

.site-nav a {
  color: color-mix(in oklch, var(--on-dark) 85%, transparent);
  text-decoration: none;
  padding: var(--space-1) 0;
}

.site-nav a:hover,
.site-nav a[aria-current="page"] {
  color: var(--on-dark);
  text-decoration: none;
}

.site-nav a[aria-current="page"] {
  border-bottom: 2px solid var(--on-dark);
}

/* =====================================================================
   Signature element — The Broadcast Crawl
   --------------------------------------------------------------------
   Horizontal mono-typed strip, styled like a broadcast ticker / on-air
   bug. Static (no scroll animation — restrained). The small ●REC dot
   on the homepage is the only thing that animates. Carries the site's
   identity on every page.
   ===================================================================== */

.crawl {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  width: min(100% - 2rem, var(--container));
  margin: 0 auto;
  padding: var(--space-3) 0;
  border-top: var(--rule-w) solid var(--rule);
  border-bottom: var(--rule-w) solid var(--rule);
  font-family: var(--font-mono);
  font-size: var(--text-xs);
  font-weight: 500;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--mute);
}

.crawl-track {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--space-3) var(--space-4);
  flex: 1 1 auto;
}

.crawl-item {
  display: inline-flex;
  align-items: center;
  gap: var(--space-3);
}

.crawl-item + .crawl-item::before {
  content: "";
  display: inline-block;
  width: 4px;
  height: 4px;
  background: var(--rule-strong);
  border-radius: 50%;
  flex: 0 0 auto;
}

.crawl-item .label {
  color: var(--ink);
  font-weight: 600;
}

.crawl-item .value {
  color: var(--mute);
  font-weight: 500;
}

/* REC dot — the only motion in the whole site. */
.crawl-rec {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  color: var(--ink-deep);
  font-weight: 700;
}

.crawl-rec::before {
  content: "";
  display: inline-block;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--signal);
  box-shadow: 0 0 0 0 color-mix(in oklch, var(--signal) 50%, transparent);
  animation: crawl-pulse 2.4s ease-in-out infinite;
  flex: 0 0 auto;
}

@keyframes crawl-pulse {
  0%, 100% {
    transform: scale(1);
    box-shadow: 0 0 0 0 color-mix(in oklch, var(--signal) 50%, transparent);
  }
  50% {
    transform: scale(1.05);
    box-shadow: 0 0 0 6px color-mix(in oklch, var(--signal) 0%, transparent);
  }
}

@media (prefers-reduced-motion: reduce) {
  .crawl-rec::before { animation: none; }
}

/* Variant for header-band pages: the crawl sits inside the purple band
   and inverts to light type. */
.crawl.crawl--on-dark {
  border-color: color-mix(in oklch, var(--on-dark) 22%, transparent);
  color: color-mix(in oklch, var(--on-dark) 70%, transparent);
}

.crawl.crawl--on-dark .crawl-item .label { color: var(--on-dark); }
.crawl.crawl--on-dark .crawl-item .value { color: color-mix(in oklch, var(--on-dark) 70%, transparent); }
.crawl.crawl--on-dark .crawl-rec { color: var(--on-dark); }
.crawl.crawl--on-dark .crawl-item + .crawl-item::before {
  background: color-mix(in oklch, var(--on-dark) 45%, transparent);
}
.crawl.crawl--on-dark .crawl-rec::before {
  background: color-mix(in oklch, var(--on-dark) 90%, transparent);
  animation-name: crawl-pulse-on-dark;
}

@keyframes crawl-pulse-on-dark {
  0%, 100% {
    transform: scale(1);
    box-shadow: 0 0 0 0 color-mix(in oklch, var(--on-dark) 50%, transparent);
  }
  50% {
    transform: scale(1.05);
    box-shadow: 0 0 0 6px color-mix(in oklch, var(--on-dark) 0%, transparent);
  }
}

/* =====================================================================
   Layout containers
   ===================================================================== */

main,
.page,
.site-footer-inner {
  width: min(100% - 2rem, var(--container));
  margin: 0 auto;
}

main { padding: var(--space-8) 0 var(--space-12); }

.page {
  padding: var(--space-5) 0 var(--space-12);
  max-width: var(--container-narrow);
}

/* Two-column hero layout for the homepage. */
.hero {
  display: grid;
  grid-template-columns: minmax(0, 1.65fr) minmax(0, 1fr);
  gap: var(--space-8);
  align-items: end;
  padding-top: var(--space-8);
  padding-bottom: var(--space-10);
}

.hero-text { min-width: 0; }
.hero-aside { min-width: 0; }

@media (max-width: 56rem) {
  .hero {
    grid-template-columns: 1fr;
    gap: var(--space-6);
    align-items: start;
  }
}

/* =====================================================================
   Editorial typography primitives
   ===================================================================== */

.kicker {
  margin: 0 0 var(--space-4);
  font-family: var(--font-mono);
  font-size: var(--text-xs);
  font-weight: 600;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--primary);
}

.meta {
  margin: 0;
  color: var(--mute);
  font-size: var(--text-sm);
  line-height: 1.55;
}

.meta .sep {
  display: inline-block;
  margin: 0 0.45em;
  color: var(--rule-strong);
}

.meta .author {
  color: var(--ink);
  font-weight: 500;
}

/* =====================================================================
   Sections — hairline rule + section number + title
   ===================================================================== */

.section-rule {
  border: 0;
  border-top: var(--rule-w) solid var(--rule);
  margin: var(--space-10) 0 var(--space-5);
}

.section-rule + h2,
.section-rule + .section-head {
  margin-top: 0;
}

.section-head {
  display: grid;
  grid-template-columns: 6rem minmax(0, 1fr);
  gap: var(--space-5);
  align-items: baseline;
  margin: 0 0 var(--space-5);
}

.section-head .section-number {
  font-family: var(--font-mono);
  font-size: var(--text-xs);
  font-weight: 600;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--mute);
  padding-top: 0.45rem; /* visually align with h2 cap height */
}

.section-head .section-title {
  margin: 0;
  font-family: var(--font-title);
  font-weight: 900;
  font-size: var(--text-2xl);
  letter-spacing: -0.025em;
  line-height: 1.05;
  color: var(--ink-deep);
}

@media (max-width: 40rem) {
  .section-head {
    grid-template-columns: 1fr;
    gap: var(--space-2);
  }
  .section-head .section-number {
    padding-top: 0;
  }
}

/* =====================================================================
   Pull / Field note (replaces the generic `.callout` box)
   --------------------------------------------------------------------
   Editorial pull-note: hairline rules top + bottom, a mono label,
   body type below. No rounded box, no left border, no background tint.
   ===================================================================== */

.pull {
  margin: var(--space-8) 0;
  padding: var(--space-5) 0;
  border-top: var(--rule-w-bold) solid var(--ink);
  border-bottom: var(--rule-w) solid var(--rule);
}

.pull-label {
  display: block;
  margin: 0 0 var(--space-3);
  font-family: var(--font-mono);
  font-size: var(--text-xs);
  font-weight: 600;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--primary);
}

.pull p {
  margin: 0;
  font-size: var(--text-md);
  line-height: 1.55;
  color: var(--ink);
}

.pull p + p { margin-top: var(--space-3); }

/* Cross-reference tag — a small uppercase mono tag with a thin purple
   border, used inline to link to other reports or campaigns. */
.xref {
  display: inline-block;
  font-family: var(--font-mono);
  font-size: 0.85em;
  font-weight: 500;
  letter-spacing: 0.06em;
  color: var(--primary);
  padding: 0 0.36em;
  border: 1px solid color-mix(in oklch, var(--primary) 40%, transparent);
  border-radius: var(--radius-sm);
  text-transform: uppercase;
  vertical-align: 1px;
  text-decoration: none;
}
.xref:hover {
  background: var(--primary-tint);
  text-decoration: none;
}

/* =====================================================================
   Article primitive — the standard publication body
   ===================================================================== */

.article {
  max-width: var(--container-narrow);
  margin: 0 auto;
  padding: var(--space-6) var(--space-4) var(--space-10);
}

.article h2 {
  margin: 0 0 var(--space-5);
  padding-top: var(--space-5);
  border-top: var(--rule-w) solid var(--rule);
  font-family: var(--font-title);
  font-weight: 900;
  font-size: var(--text-2xl);
  letter-spacing: -0.025em;
  color: var(--ink-deep);
}

.article > h2:first-of-type {
  border-top: 0;
  padding-top: 0;
  margin-top: 0;
}

.article h3 {
  margin: var(--space-6) 0 var(--space-3);
  font-family: var(--font-title);
  font-weight: 900;
  font-size: var(--text-xl);
  letter-spacing: -0.015em;
  color: var(--ink-deep);
}

.article p,
.article ul,
.article ol {
  font-size: var(--text-base);
  line-height: 1.7;
  color: var(--ink);
}

/* =====================================================================
   Byline — masthead metadata strip below the title
   ===================================================================== */

.byline {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: var(--space-4) var(--space-6);
  align-items: baseline;
  padding-top: var(--space-5);
  padding-bottom: var(--space-5);
  border-top: var(--rule-w-bold) solid var(--ink);
  border-bottom: var(--rule-w) solid var(--rule);
  font-family: var(--font-mono);
  font-size: var(--text-xs);
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--mute);
}

.byline .byline-key { color: var(--ink); font-weight: 600; }
.byline .byline-value { color: var(--mute); }
.byline .byline-value strong { color: var(--ink); font-weight: 500; }

.byline .byline-meta {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-4) var(--space-5);
}
.byline .byline-meta > div { display: flex; gap: var(--space-2); }
.byline .byline-meta > div > .byline-key::after {
  content: ":";
  color: var(--rule-strong);
  margin-left: 1px;
}

@media (max-width: 40rem) {
  .byline {
    grid-template-columns: 1fr;
    gap: var(--space-3);
  }
}

/* =====================================================================
   Colophon — publication footer (replaces generic footer)
   ===================================================================== */

.colophon {
  max-width: var(--container-narrow);
  margin: 0 auto;
  padding: var(--space-6) var(--space-4) var(--space-12);
  border-top: var(--rule-w) solid var(--rule);
}

.colophon-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(11rem, 1fr));
  gap: var(--space-5);
  margin-bottom: var(--space-6);
  font-family: var(--font-mono);
  font-size: var(--text-xs);
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--mute);
}

.colophon dt { font-weight: 600; color: var(--ink); margin-bottom: 0.35em; }
.colophon dd { margin: 0; color: var(--mute); }
.colophon dd + dd { margin-top: 0.3em; }
.colophon dd a { color: var(--primary); }
.colophon .back-link { font-size: var(--text-sm); }
.colophon-note {
  margin: 0 0 var(--space-5);
  font-size: var(--text-sm);
  color: var(--mute);
  max-width: 42rem;
}

/* =====================================================================
   Editorial table — datasheet look
   --------------------------------------------------------------------
   Mono uppercase headers, top + bottom rules, no vertical lines,
   thin row dividers, first column slightly emphasised.
   ===================================================================== */

table {
  width: 100%;
  border-collapse: collapse;
  margin: var(--space-6) 0;
  font-size: var(--text-sm);
  font-variant-numeric: tabular-nums;
}

caption {
  caption-side: bottom;
  margin-top: var(--space-3);
  font-family: var(--font-mono);
  font-size: var(--text-xs);
  font-weight: 500;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--mute);
  text-align: left;
}

thead th {
  font-family: var(--font-mono);
  font-size: var(--text-xs);
  font-weight: 600;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--mute);
  text-align: left;
  padding: var(--space-3) var(--space-4) var(--space-3) 0;
  border-bottom: var(--rule-w-bold) solid var(--ink);
  background: transparent;
}

thead th:last-child { padding-right: 0; }

tbody td {
  padding: var(--space-3) var(--space-4) var(--space-3) 0;
  border-bottom: var(--rule-w) solid var(--rule);
  vertical-align: top;
  color: var(--ink);
}

tbody td:last-child { padding-right: 0; }

tbody tr:last-child td { border-bottom: var(--rule-w-bold) solid var(--ink); }

tbody td:first-child {
  font-family: var(--font-mono);
  color: var(--ink-deep);
  font-weight: 500;
  width: 4rem;
}

/* =====================================================================
   Inline code + preformatted blocks
   ===================================================================== */

code {
  font-family: var(--font-mono);
  font-size: 0.92em;
  padding: 0.08em 0.36em;
  background: var(--primary-tint);
  border-radius: var(--radius-sm);
  color: var(--ink-deep);
  font-weight: 500;
}

pre {
  font-family: var(--font-mono);
  font-size: var(--text-sm);
  line-height: 1.6;
  padding: var(--space-4) var(--space-5);
  background: var(--paper-cool);
  border: var(--rule-w) solid var(--rule);
  border-radius: var(--radius-md);
  overflow-x: auto;
  margin: var(--space-5) 0;
  color: var(--ink);
}

pre code {
  padding: 0;
  background: transparent;
  border-radius: 0;
  color: inherit;
  font-weight: 400;
}

/* =====================================================================
   Lists
   ===================================================================== */

ol, ul {
  padding-left: var(--space-5);
  margin: 0 0 var(--space-4);
}

li { margin: 0 0 var(--space-2); }
li::marker { color: var(--mute); }

/* =====================================================================
   Footer
   ===================================================================== */

.site-footer {
  margin-top: var(--space-12);
  padding: var(--space-5) 0;
  background: var(--primary-deep);
  color: var(--on-dark);
}

.site-footer-inner {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-4) var(--space-6);
  align-items: baseline;
  font-family: var(--font-mono);
  font-size: var(--text-xs);
  letter-spacing: 0.14em;
  text-transform: uppercase;
}

.site-footer p { margin: 0; color: color-mix(in oklch, var(--on-dark) 80%, transparent); }
.site-footer a { color: var(--on-dark); text-decoration: none; }
.site-footer a:hover { text-decoration: underline; }

.site-footer .footer-mark {
  font-weight: 600;
  color: var(--on-dark);
}

@media (max-width: 40rem) {
  .site-header-inner,
  .site-footer-inner { gap: var(--space-3); }
}

/* =====================================================================
   Utility
   ===================================================================== */

.back-link {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  font-family: var(--font-mono);
  font-size: var(--text-xs);
  font-weight: 600;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--mute);
  text-decoration: none;
  padding-top: var(--space-2);
}

.back-link::before {
  content: "←";
  display: inline-block;
}

.back-link:hover {
  color: var(--primary);
  text-decoration: none;
}