/* =========================================================================
   Kenyan Bulletin — Design System
   Editorial newspaper aesthetic with a modern, accessible UI.
   Palette draws from the Kenyan flag (black, red, green, white) elevated
   into a refined publication system. Light + dark themes.
   ========================================================================= */

/* ---------- Reset & base ---------- */
*,
*::before,
*::after { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; -webkit-font-smoothing: antialiased; -moz-osx-font-smoothing: grayscale; }
body { margin: 0; min-height: 100vh; }

img, svg, video { display: block; max-width: 100%; }
img { height: auto; }

button { font: inherit; cursor: pointer; border: 0; background: transparent; color: inherit; }
input, select, textarea { font: inherit; color: inherit; }

a { color: inherit; text-decoration: none; }

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

::selection { background: var(--accent-soft); color: var(--ink); }

/* ---------- Design tokens (light) ---------- */
:root {
  /* Brand palette */
  --kb-black: #0c0d0e;
  --kb-red: #b42318;
  --kb-red-deep: #8b1812;
  --kb-green: #146c43;
  --kb-green-deep: #0e5333;
  --kb-gold: #c78b18;
  --kb-cream: #fbfaf6;

  /* Semantic — light */
  --paper:        #fbfaf6;
  --surface:      #ffffff;
  --surface-2:    #f5f4ef;
  --surface-3:    #ecebe4;
  --ink:          #0c0d0e;
  --ink-soft:     #2a2d31;
  --muted:        #5b6168;
  --muted-2:      #8a8f96;
  --line:         #e2e0d6;
  --line-strong:  #c9c6b8;
  --accent:       var(--kb-red);
  --accent-deep:  var(--kb-red-deep);
  --accent-soft:  rgba(180, 35, 24, 0.12);
  --positive:     var(--kb-green);
  --positive-soft: rgba(20, 108, 67, 0.12);
  --gold:         var(--kb-gold);

  /* Effects */
  --shadow-sm: 0 1px 2px rgba(12, 13, 14, 0.06);
  --shadow:    0 4px 14px rgba(12, 13, 14, 0.08), 0 1px 3px rgba(12, 13, 14, 0.04);
  --shadow-lg: 0 18px 50px rgba(12, 13, 14, 0.16), 0 4px 12px rgba(12, 13, 14, 0.06);

  /* Radii */
  --r-sm: 4px;
  --r:    8px;
  --r-lg: 8px;
  --r-xl: 12px;
  --r-pill: 999px;

  /* Type */
  --font-sans: ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  --font-serif: ui-serif, Georgia, Cambria, "Times New Roman", serif;

  /* Layout */
  --shell-max: 1240px;
  --gutter: clamp(16px, 4vw, 56px);
  --header-h: 64px;
  --ticker-h: 38px;

  /* Motion */
  --ease: cubic-bezier(0.2, 0.7, 0.2, 1);
  --t-fast: 120ms var(--ease);
  --t:      220ms var(--ease);
  --t-slow: 360ms var(--ease);
}

/* ---------- Dark theme ---------- */
:root[data-theme="dark"] {
  --paper:        #0c0d0e;
  --surface:      #15171a;
  --surface-2:    #1b1e22;
  --surface-3:    #232730;
  --ink:          #f4f1e8;
  --ink-soft:     #d8d4c7;
  --muted:        #9aa0a8;
  --muted-2:      #6e747c;
  --line:         #2a2e35;
  --line-strong:  #3a4049;
  --accent:       #ef4f44;
  --accent-deep:  #c8362b;
  --accent-soft:  rgba(239, 79, 68, 0.16);
  --positive:     #2faa72;
  --positive-soft: rgba(47, 170, 114, 0.16);
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.45);
  --shadow:    0 6px 18px rgba(0, 0, 0, 0.55), 0 1px 2px rgba(0, 0, 0, 0.4);
  --shadow-lg: 0 22px 60px rgba(0, 0, 0, 0.65), 0 6px 14px rgba(0, 0, 0, 0.4);
}

/* ---------- Base typography ---------- */
body {
  background: var(--paper);
  color: var(--ink);
  font-family: var(--font-sans);
  font-feature-settings: "ss01", "cv11";
  font-size: 16px;
  line-height: 1.55;
  overflow-x: hidden;
  transition: background var(--t), color var(--t);
}

h1, h2, h3, h4 { margin: 0 0 .4em; line-height: 1.1; letter-spacing: 0; }
p { margin: 0 0 1em; }

.serif { font-family: var(--font-serif); font-weight: 600; letter-spacing: 0; }

.eyebrow {
  color: var(--accent);
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}
.eyebrow::before {
  content: "";
  width: 18px;
  height: 2px;
  background: currentColor;
  display: inline-block;
}
.eyebrow-link {
  color: inherit;
}

.muted { color: var(--muted); }

/* ---------- Skip link ---------- */
.skip-link {
  position: absolute;
  left: -9999px;
  top: 0;
  background: var(--ink);
  color: var(--paper);
  padding: 10px 14px;
  z-index: 100;
  border-radius: var(--r);
}
.skip-link:focus { left: 12px; top: 12px; }

/* ---------- Site header ---------- */
.site-header {
  background: color-mix(in srgb, var(--paper) 86%, transparent);
  backdrop-filter: saturate(160%) blur(14px);
  -webkit-backdrop-filter: saturate(160%) blur(14px);
  border-bottom: 1px solid var(--line);
  position: sticky;
  top: 0;
  z-index: 30;
  transition: background var(--t), border-color var(--t);
}

.header-inner {
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: 22px;
  height: var(--header-h);
  max-width: var(--shell-max);
  margin: 0 auto;
  padding: 0 var(--gutter);
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  font-weight: 800;
  letter-spacing: 0;
  font-size: 1.02rem;
}
.brand-mark {
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background:
    conic-gradient(from 0deg,
      var(--kb-black) 0 25%,
      var(--kb-red) 25% 50%,
      var(--kb-cream) 50% 75%,
      var(--kb-green) 75% 100%);
  box-shadow: 0 0 0 1.5px var(--paper) inset, 0 0 0 1.5px var(--ink-soft);
  flex-shrink: 0;
}
:root[data-theme="dark"] .brand-mark {
  box-shadow: 0 0 0 1.5px var(--paper) inset, 0 0 0 1.5px var(--line-strong);
}
.brand-name { display: inline-flex; align-items: baseline; gap: 6px; }
.brand-name small {
  color: var(--muted);
  font-weight: 600;
  font-size: 0.74rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.nav-primary {
  display: flex;
  align-items: center;
  justify-content: flex-start;
  gap: 4px;
  flex-wrap: nowrap;
  min-width: 0;
  overflow-x: auto;
  scrollbar-width: none;
}
.nav-primary::-webkit-scrollbar {
  display: none;
}
.nav-primary a {
  position: relative;
  padding: 8px 12px;
  font-size: 0.92rem;
  color: var(--ink-soft);
  border-radius: var(--r-sm);
  white-space: nowrap;
  transition: color var(--t-fast), background var(--t-fast);
}
.nav-primary a:hover { color: var(--ink); background: var(--surface-2); }
.nav-primary a[aria-current="page"] {
  color: var(--accent);
  background: var(--accent-soft);
}

.header-actions {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

/* Icon button */
.icon-btn {
  display: inline-grid;
  place-items: center;
  width: 38px;
  height: 38px;
  border-radius: var(--r);
  color: var(--ink-soft);
  transition: background var(--t-fast), color var(--t-fast), transform var(--t-fast);
}
.icon-btn:hover { background: var(--surface-2); color: var(--ink); }
.icon-btn:active { transform: scale(0.96); }
.icon-btn svg { width: 18px; height: 18px; }

.icon-btn--accent { background: var(--accent); color: #fff; }
.icon-btn--accent:hover { background: var(--accent-deep); color: #fff; }

/* Theme toggle shows sun in dark mode, moon in light */
.theme-toggle .moon { display: inline; }
.theme-toggle .sun { display: none; }
:root[data-theme="dark"] .theme-toggle .moon { display: none; }
:root[data-theme="dark"] .theme-toggle .sun  { display: inline; }

/* Mobile hamburger */
.menu-toggle { display: none; }

/* ---------- Breaking ticker ---------- */
.ticker {
  background: var(--ink);
  color: var(--kb-cream);
  height: var(--ticker-h);
  display: flex;
  align-items: center;
  overflow: hidden;
  border-bottom: 1px solid var(--ink);
  position: relative;
  contain: layout paint;
}
:root[data-theme="dark"] .ticker { background: #000; }
.ticker-label {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: var(--accent);
  color: #fff;
  font-size: 0.72rem;
  font-weight: 800;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  padding: 0 14px;
  height: 100%;
  min-width: 76px;
  justify-content: center;
  flex-shrink: 0;
  position: relative;
  z-index: 2;
}
.ticker-label::before {
  content: "";
  width: 7px; height: 7px;
  background: #fff;
  border-radius: 50%;
  animation: pulse 1.6s ease-in-out infinite;
}
@keyframes pulse {
  0%, 100% { opacity: 1; transform: scale(1); }
  50%      { opacity: 0.35; transform: scale(0.7); }
}
.ticker-track {
  display: inline-flex;
  align-items: center;
  gap: 38px;
  white-space: nowrap;
  position: absolute;
  inset: 0 auto 0 76px;
  padding-left: 22px;
  animation: ticker-scroll 48s linear infinite;
}
.ticker:hover .ticker-track { animation-play-state: paused; }
.ticker-track a {
  font-size: 0.88rem;
  color: var(--kb-cream);
  opacity: 0.92;
  transition: opacity var(--t-fast);
}
.ticker-track a:hover { opacity: 1; color: #fff; }
.ticker-track .dot {
  width: 4px; height: 4px;
  background: var(--muted);
  border-radius: 50%;
  display: inline-block;
}
@keyframes ticker-scroll {
  from { transform: translateX(0); }
  to   { transform: translateX(-50%); }
}

/* ---------- Main shell ---------- */
.shell {
  max-width: var(--shell-max);
  margin: 0 auto;
  padding: clamp(28px, 4vw, 48px) var(--gutter) 64px;
}

/* ---------- Lead / hero (homepage) ---------- */
.lead {
  display: grid;
  grid-template-columns: minmax(0, 1.45fr) minmax(0, 1fr);
  gap: clamp(20px, 3vw, 40px);
  padding-bottom: clamp(28px, 4vw, 48px);
  border-bottom: 1px solid var(--line);
  margin-bottom: clamp(28px, 4vw, 48px);
}

.lead-headline {
  font-family: var(--font-serif);
  font-weight: 700;
  font-size: 4rem;
  line-height: 0.98;
  letter-spacing: 0;
  margin: 14px 0 18px;
  max-width: 14ch;
}
.lead-copy {
  color: var(--ink-soft);
  font-size: 1.12rem;
  max-width: 50ch;
}
.lead-meta {
  display: inline-flex;
  align-items: center;
  gap: 14px;
  flex-wrap: wrap;
  margin-top: 22px;
  color: var(--muted);
  font-size: 0.82rem;
}
.lead-meta .pill { background: var(--surface-2); padding: 4px 10px; border-radius: var(--r-pill); color: var(--ink-soft); font-weight: 600; }

/* Featured story card */
.featured {
  display: grid;
  grid-template-rows: auto 1fr;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  overflow: hidden;
  box-shadow: var(--shadow-sm);
  transition: transform var(--t), box-shadow var(--t), border-color var(--t);
}
.featured:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow);
  border-color: var(--line-strong);
}
.featured-media {
  position: relative;
  aspect-ratio: 16 / 10;
  background: var(--surface-2);
  overflow: hidden;
}
.featured-media img {
  width: 100%; height: 100%;
  object-fit: cover;
  transition: transform var(--t-slow);
}
.featured:hover .featured-media img { transform: scale(1.03); }
.featured-tag {
  position: absolute;
  top: 12px; left: 12px;
  background: var(--ink);
  color: var(--paper);
  font-size: 0.7rem;
  font-weight: 800;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  padding: 6px 10px;
  border-radius: var(--r-pill);
}
.featured-body { padding: 18px 20px 22px; }
.featured-body strong {
  display: block;
  font-family: var(--font-serif);
  font-weight: 700;
  font-size: 1.25rem;
  line-height: 1.2;
  letter-spacing: 0;
  margin-bottom: 8px;
}
.featured-body p {
  color: var(--muted);
  margin: 0;
  font-size: 0.92rem;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

/* Image placeholder when no media */
.featured-media.is-empty,
.image-fallback {
  display: grid;
  place-items: center;
  background:
    linear-gradient(135deg, var(--surface-2), var(--surface-3));
  color: var(--muted);
  font-weight: 800;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  font-size: 0.78rem;
}
.image-error::after {
  content: attr(data-fallback-label);
}
.image-error span {
  display: none;
}

/* ---------- Section heading ---------- */
.section-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  flex-wrap: wrap;
  margin-bottom: 22px;
}
.section-head h2 {
  font-family: var(--font-serif);
  font-size: 1.7rem;
  font-weight: 700;
  letter-spacing: 0;
  margin: 0;
  display: inline-flex;
  align-items: center;
  gap: 12px;
}
.section-head h2::before {
  content: "";
  width: 6px; height: 22px;
  background: var(--accent);
  border-radius: 2px;
  display: inline-block;
}

/* ---------- Search ---------- */
.search {
  position: relative;
  display: inline-flex;
  align-items: center;
}
.search input {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-pill);
  min-height: 42px;
  min-width: min(340px, 70vw);
  padding: 8px 14px 8px 40px;
  color: var(--ink);
  transition: border-color var(--t-fast), box-shadow var(--t-fast), background var(--t-fast);
}
.search input::placeholder { color: var(--muted-2); }
.search input:hover { border-color: var(--line-strong); }
.search input:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 4px var(--accent-soft);
}
.search::before {
  content: "";
  position: absolute;
  left: 14px; top: 50%;
  width: 16px; height: 16px;
  transform: translateY(-50%);
  background: currentColor;
  color: var(--muted);
  -webkit-mask: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='currentColor' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'><circle cx='11' cy='11' r='7'/><path d='m20 20-3.5-3.5'/></svg>") center/contain no-repeat;
          mask: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='currentColor' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'><circle cx='11' cy='11' r='7'/><path d='m20 20-3.5-3.5'/></svg>") center/contain no-repeat;
}

/* ---------- Article grid + cards ---------- */
.article-grid {
  display: grid;
  gap: 22px;
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.article-card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  transition: transform var(--t), box-shadow var(--t), border-color var(--t);
  box-shadow: var(--shadow-sm);
}
.article-card:hover {
  transform: translateY(-3px);
  box-shadow: var(--shadow);
  border-color: var(--line-strong);
}

.card-media-link {
  display: block;
  color: inherit;
}
.card-media {
  position: relative;
  aspect-ratio: 16 / 10;
  overflow: hidden;
  background: var(--surface-2);
}
.card-media img {
  width: 100%; height: 100%;
  object-fit: cover;
  transition: transform var(--t-slow);
}
.article-card:hover .card-media img { transform: scale(1.05); }

.card-body {
  padding: 18px 18px 20px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  flex: 1;
}

.card-meta {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  color: var(--muted);
  font-size: 0.78rem;
}
.card-meta time { color: var(--muted); }
.tag {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: var(--accent-soft);
  color: var(--accent);
  font-weight: 700;
  font-size: 0.7rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  padding: 4px 10px;
  border-radius: var(--r-pill);
}
.tag--ghost {
  background: var(--surface-2);
  color: var(--ink-soft);
}

.card-title {
  font-family: var(--font-serif);
  font-weight: 700;
  font-size: 1.18rem;
  line-height: 1.22;
  letter-spacing: 0;
  margin: 0;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
  overflow-wrap: break-word;
}
.card-title a { transition: color var(--t-fast); }
.card-title a:hover { color: var(--accent); }

.card-dek {
  color: var(--muted);
  font-size: 0.92rem;
  margin: 0;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

/* ---------- Feed toolbar ---------- */
.feed-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  margin-bottom: 22px;
  flex-wrap: wrap;
}
.feed-toolbar--compact {
  margin-bottom: 10px;
}
.feed-status {
  color: var(--muted);
  font-size: 0.86rem;
}

/* HTMX loading state */
.htmx-indicator {
  display: none;
  width: 16px; height: 16px;
  border: 2px solid var(--line-strong);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}
.htmx-request .htmx-indicator { display: inline-block; }
.htmx-request.htmx-indicator { display: inline-block; }
@keyframes spin { to { transform: rotate(360deg); } }

#article-feed.htmx-request { opacity: 0.55; transition: opacity var(--t-fast); }

/* ---------- Empty state ---------- */
.empty-state {
  border: 1px dashed var(--line-strong);
  border-radius: var(--r-lg);
  color: var(--muted);
  padding: 44px 24px;
  text-align: center;
  background: var(--surface);
}
.empty-state h3 {
  color: var(--ink);
  font-family: var(--font-serif);
  font-size: 1.4rem;
  margin: 0 0 6px;
}
.empty-state p { margin: 0; }

/* ---------- Page heading (category etc) ---------- */
.page-heading {
  padding: clamp(20px, 4vw, 40px) 0 clamp(20px, 3vw, 32px);
  border-bottom: 1px solid var(--line);
  margin-bottom: clamp(24px, 4vw, 40px);
  display: grid;
  gap: 16px;
}
.page-heading h1 {
  font-family: var(--font-serif);
  font-weight: 700;
  font-size: 3.4rem;
  line-height: 1;
  letter-spacing: 0;
  margin: 0;
}
.page-heading p {
  color: var(--ink-soft);
  max-width: 60ch;
  font-size: 1.05rem;
  margin: 0;
}
.page-heading .stats {
  display: inline-flex;
  align-items: center;
  gap: 14px;
  color: var(--muted);
  font-size: 0.86rem;
}
.page-heading .stats span { display: inline-flex; align-items: center; gap: 6px; }

/* ---------- Article detail ---------- */
.reading-progress {
  position: fixed;
  top: 0; left: 0;
  height: 3px;
  width: 0;
  background: linear-gradient(90deg, var(--accent), var(--gold));
  z-index: 50;
  transition: width 80ms linear;
}

.article-detail {
  width: 100%;
  max-width: 1080px;
  margin: 0 auto;
  padding-top: clamp(20px, 4vw, 40px);
  overflow-wrap: break-word;
}

.article-hero {
  display: grid;
  grid-template-columns: minmax(0, 1.05fr) minmax(0, 1fr);
  gap: clamp(24px, 4vw, 48px);
  align-items: center;
  padding-bottom: clamp(24px, 3vw, 36px);
  border-bottom: 1px solid var(--line);
  margin-bottom: clamp(28px, 4vw, 44px);
}
.article-hero > * {
  min-width: 0;
}
.article-hero .meta-line {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
  margin-top: 18px;
  color: var(--muted);
  font-size: 0.88rem;
}
.article-hero h1 {
  font-family: var(--font-serif);
  font-weight: 700;
  font-size: 3.4rem;
  line-height: 1.02;
  letter-spacing: 0;
  margin: 14px 0 16px;
  max-width: 100%;
  overflow-wrap: break-word;
}
.article-hero .lead-copy { font-size: 1.15rem; }
.article-hero-media {
  display: grid;
  min-height: 280px;
  aspect-ratio: 5 / 4;
  overflow: hidden;
  border-radius: var(--r-lg);
  box-shadow: var(--shadow-sm);
  border: 1px solid var(--line);
  background: var(--surface-2);
}
.article-hero-media img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.article-body {
  font-family: var(--font-serif);
  font-weight: 400;
  font-size: 1.18rem;
  line-height: 1.7;
  color: var(--ink-soft);
  max-width: 70ch;
  width: 100%;
  margin: 0 auto;
  overflow-wrap: break-word;
}
.article-body p { margin: 0 0 1.1em; }
.article-body p:first-of-type::first-letter {
  font-weight: 700;
  font-size: 3.2em;
  line-height: 0.86;
  float: left;
  padding: 6px 12px 0 0;
  color: var(--accent);
  font-family: var(--font-serif);
}
.article-body h2, .article-body h3 {
  font-family: var(--font-serif);
  color: var(--ink);
  margin-top: 1.6em;
}
.article-body h2 { font-size: 1.7rem; }
.article-body h3 { font-size: 1.35rem; }
.article-body a {
  color: var(--accent);
  text-decoration: underline;
  text-decoration-thickness: 1.5px;
  text-underline-offset: 3px;
}
.article-body img {
  border-radius: var(--r);
  margin: 1.6em 0;
  border: 1px solid var(--line);
}
.article-image-missing {
  display: grid;
  place-items: center;
  min-height: 130px;
  margin: 1.6em 0;
  border: 1px dashed var(--line-strong);
  border-radius: var(--r);
  background: var(--surface-2);
  color: var(--muted);
  font-family: var(--font-sans);
  font-size: 0.86rem;
  font-weight: 700;
}
.article-body blockquote {
  border-left: 4px solid var(--accent);
  margin: 1.4em 0;
  padding: 4px 0 4px 18px;
  font-style: italic;
  color: var(--ink);
}
.article-body ul, .article-body ol { padding-left: 1.4em; margin: 0 0 1.2em; }
.article-body li { margin: 0.4em 0; }
.article-body iframe,
.article-body table,
.article-body figure {
  max-width: 100%;
}
.article-body table {
  display: block;
  overflow-x: auto;
}
.article-body code {
  background: var(--surface-2);
  border: 1px solid var(--line);
  padding: 1px 6px;
  border-radius: 6px;
  font-size: 0.92em;
}

/* Share rail */
.share-rail {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  margin: 36px auto 8px;
  max-width: 70ch;
  padding-top: 28px;
  border-top: 1px solid var(--line);
}
.share-rail span {
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  margin-right: 6px;
}
.share-rail .icon-btn { background: var(--surface-2); }
.share-rail .icon-btn:hover { background: var(--accent); color: #fff; }

/* Related */
.related {
  margin-top: clamp(48px, 6vw, 80px);
  padding-top: clamp(28px, 4vw, 40px);
  border-top: 1px solid var(--line);
}

/* ---------- Footer ---------- */
.site-footer {
  background: var(--ink);
  color: var(--kb-cream);
  margin-top: clamp(48px, 6vw, 80px);
  padding: clamp(40px, 5vw, 64px) var(--gutter) 28px;
}
:root[data-theme="dark"] .site-footer { background: #000; border-top: 1px solid var(--line); }
.footer-inner {
  max-width: var(--shell-max);
  margin: 0 auto;
}
.footer-grid {
  display: grid;
  grid-template-columns: 1.4fr repeat(3, 1fr);
  gap: 40px;
  padding-bottom: 36px;
  border-bottom: 1px solid rgba(255,255,255,0.1);
}
.footer-grid h4 {
  color: var(--kb-cream);
  font-size: 0.76rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  margin: 0 0 14px;
  opacity: 0.78;
}
.footer-grid ul { list-style: none; padding: 0; margin: 0; display: grid; gap: 10px; }
.footer-grid a {
  color: rgba(251, 250, 246, 0.78);
  font-size: 0.92rem;
  transition: color var(--t-fast);
}
.footer-grid a:hover { color: #fff; }
.footer-brand .brand-name { color: #fff; }
.footer-brand p { color: rgba(251, 250, 246, 0.7); max-width: 38ch; margin: 12px 0 0; font-size: 0.92rem; }
.footer-flag {
  display: inline-flex;
  margin-top: 16px;
  width: 78px;
  height: 5px;
  border-radius: 2px;
  overflow: hidden;
}
.footer-flag span { flex: 1; }
.footer-flag .b { background: var(--kb-black); }
.footer-flag .r { background: var(--kb-red); }
.footer-flag .w { background: #fff; }
.footer-flag .g { background: var(--kb-green); }

.footer-bottom {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding-top: 22px;
  color: rgba(251, 250, 246, 0.6);
  font-size: 0.84rem;
  gap: 14px;
  flex-wrap: wrap;
}

/* ---------- Mobile drawer ---------- */
.drawer {
  position: fixed;
  inset: 0;
  z-index: 60;
  display: none;
}
.drawer[aria-hidden="false"] { display: block; }
.drawer-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(12,13,14,0.5);
  animation: fade-in var(--t) both;
}
.drawer-panel {
  position: absolute;
  top: 0; right: 0;
  height: 100%;
  width: min(360px, 84vw);
  background: var(--surface);
  border-left: 1px solid var(--line);
  padding: 22px 22px 32px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 22px;
  animation: slide-in var(--t) both;
}
@keyframes fade-in { from { opacity: 0; } to { opacity: 1; } }
@keyframes slide-in { from { transform: translateX(20px); opacity: 0; } to { transform: none; opacity: 1; } }
.drawer-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
}
.drawer nav {
  display: grid;
  gap: 4px;
}
.drawer nav a {
  display: block;
  padding: 12px 14px;
  border-radius: var(--r);
  font-size: 1rem;
  color: var(--ink-soft);
  transition: background var(--t-fast), color var(--t-fast);
}
.drawer nav a:hover, .drawer nav a[aria-current="page"] { background: var(--surface-2); color: var(--ink); }
.drawer .search { width: 100%; }
.drawer .search input { width: 100%; }

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 10px 16px;
  border-radius: var(--r-pill);
  font-weight: 600;
  font-size: 0.92rem;
  background: var(--surface-2);
  color: var(--ink);
  border: 1px solid var(--line);
  transition: background var(--t-fast), color var(--t-fast), border-color var(--t-fast), transform var(--t-fast);
}
.btn:hover { background: var(--surface-3); border-color: var(--line-strong); }
.btn:active { transform: scale(0.98); }
.btn--primary { background: var(--accent); color: #fff; border-color: var(--accent); }
.btn--primary:hover { background: var(--accent-deep); border-color: var(--accent-deep); color: #fff; }

/* ---------- Responsive ---------- */
@media (max-width: 980px) {
  .article-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .lead { grid-template-columns: 1fr; }
  .lead-headline { font-size: 3.25rem; }
  .article-hero { grid-template-columns: 1fr; }
  .article-hero h1,
  .page-heading h1 { font-size: 2.8rem; }
  .footer-grid { grid-template-columns: 1fr 1fr; }
}

@media (max-width: 720px) {
  .header-inner { grid-template-columns: auto 1fr auto; gap: 10px; }
  .nav-primary { display: none; }
  .menu-toggle { display: inline-grid; }
  .article-grid { grid-template-columns: 1fr; }
  .section-head { align-items: stretch; }
  .section-head .search { width: 100%; }
  .section-head .search input { width: 100%; min-width: 0; }
  .feed-toolbar { flex-direction: column; align-items: stretch; }
  .feed-toolbar .search { width: 100%; }
  .feed-toolbar .search input { width: 100%; min-width: 0; }
  .lead-headline { font-size: 2.35rem; line-height: 1.04; }
  .article-hero h1,
  .page-heading h1 { font-size: 2.05rem; line-height: 1.08; }
  .article-hero .lead-copy { font-size: 1.02rem; }
  .article-body { font-size: 1rem; line-height: 1.68; }
  .article-body p:first-of-type::first-letter { font-size: 2.6em; }
  .brand-name small { display: none; }
  .footer-grid { grid-template-columns: 1fr; gap: 28px; }
  .footer-bottom { flex-direction: column; align-items: flex-start; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    transition-duration: 0.01ms !important;
  }
  .ticker-track { animation: none; }
}
