/* =========================================================================
   Kenyan Bulletin — Public site
   A polished editorial design system. Tokens, components, responsive,
   no broken images, no duplicated chrome.
   ========================================================================= */

/* ----- Reset ----- */
*, *::before, *::after { box-sizing: border-box; }
html {
  -webkit-text-size-adjust: 100%;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
}
body { margin: 0; min-height: 100vh; }
img, svg, video { display: block; max-width: 100%; }
img { height: auto; }
a { color: inherit; text-decoration: none; }
button { font: inherit; cursor: pointer; border: 0; background: transparent; color: inherit; }
input, textarea, select { font: inherit; color: inherit; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; border-radius: 4px; }
::selection { background: var(--accent-soft); color: var(--ink); }

/* ----- Tokens ----- */
:root {
  /* Kenyan flag palette, used judiciously */
  --kb-black: #0c0d0e;
  --kb-red:   #b42318;
  --kb-red-deep: #8b1812;
  --kb-green: #146c43;
  --kb-cream: #fbfaf6;

  /* Semantic colors */
  --ink:        #0c0d0e;
  --ink-soft:   #2a2d31;
  --body:       #3a3f46;
  --muted:      #5b6168;
  --muted-2:    #8a8f96;

  --paper:      #ffffff;
  --surface:    #ffffff;
  --surface-2:  #faf9f4;
  --surface-3:  #f1efe7;
  --line:       #e3e1d6;
  --line-strong:#cdcabb;

  --accent:     var(--kb-red);
  --accent-deep:var(--kb-red-deep);
  --accent-soft:rgba(180, 35, 24, 0.10);
  --success:    var(--kb-green);

  /* Effects */
  --shadow-xs:  0 1px 2px rgba(12, 13, 14, 0.05);
  --shadow-sm:  0 2px 6px rgba(12, 13, 14, 0.06);
  --shadow:     0 8px 24px rgba(12, 13, 14, 0.10), 0 1px 2px rgba(12, 13, 14, 0.05);
  --shadow-lg:  0 18px 50px rgba(12, 13, 14, 0.16);

  /* Radii */
  --r-sm: 6px;
  --r:    8px;
  --r-md: 10px;
  --r-lg: 14px;
  --r-pill: 999px;

  /* Type */
  --font-sans: "Inter", ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  --font-serif: "Source Serif 4", "Source Serif Pro", Georgia, "Times New Roman", serif;

  /* Layout */
  --shell-max: 1240px;
  --gutter: clamp(16px, 4vw, 48px);

  /* 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);
}

/* ----- Base ----- */
body {
  background: var(--paper);
  color: var(--body);
  font-family: var(--font-sans);
  font-size: 16px;
  line-height: 1.55;
}

h1, h2, h3, h4 {
  margin: 0 0 .4em;
  color: var(--ink);
  line-height: 1.12;
  letter-spacing: -0.015em;
}

p { margin: 0 0 1em; }

.kb-shell {
  max-width: var(--shell-max);
  margin-inline: auto;
  padding-inline: var(--gutter);
}

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

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

/* ----- Icon helpers ----- */
.kb-i { width: 18px; height: 18px; display: inline-block; flex-shrink: 0; }
.kb-i-sm { width: 14px; height: 14px; }

/* =========================================================================
   Header
   ========================================================================= */
.kb-header {
  background: var(--surface);
  position: relative;
  z-index: 5;
}

/* Utility row */
.kb-utility {
  background: var(--kb-black);
  color: rgba(251, 250, 246, 0.78);
  font-size: 0.8rem;
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
}
.kb-utility-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  height: 38px;
}
.kb-today {
  letter-spacing: 0.04em;
}
.kb-social {
  display: inline-flex;
  align-items: center;
  gap: 4px;
}
.kb-social a {
  display: inline-grid;
  place-items: center;
  width: 32px;
  height: 32px;
  border-radius: var(--r-pill);
  color: rgba(251, 250, 246, 0.7);
  transition: background var(--t-fast), color var(--t-fast);
}
.kb-social a:hover { background: rgba(255, 255, 255, 0.08); color: #fff; }
.kb-social a .kb-i { width: 15px; height: 15px; }

/* Masthead */
.kb-masthead {
  border-bottom: 1px solid var(--line);
  background: var(--surface);
}
.kb-masthead-inner {
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: 16px;
  min-height: 92px;
  padding-block: 14px;
}
.kb-brand {
  justify-self: center;
  color: var(--ink);
  display: inline-flex;
  align-items: center;
}
.kb-logo {
  display: block;
  height: 64px;
  width: auto;
  max-width: min(420px, 60vw);
  object-fit: contain;
}
.kb-icon-btn {
  display: inline-grid;
  place-items: center;
  width: 40px;
  height: 40px;
  border-radius: var(--r-pill);
  color: var(--ink-soft);
  transition: background var(--t-fast), color var(--t-fast);
}
.kb-icon-btn:hover { background: var(--surface-3); color: var(--ink); }
.kb-icon-btn .kb-i { width: 20px; height: 20px; }
.kb-menu-toggle { display: none; }
.kb-search-toggle { justify-self: end; }

/* Search drop-down */
.kb-header-search {
  border-top: 1px solid var(--line);
  background: var(--surface);
  overflow: hidden;
  max-height: 0;
  transition: max-height var(--t);
}
.kb-header-search:not([hidden]) { max-height: 100px; }
.kb-header-search.is-open { max-height: 100px; }
.kb-header-search .kb-search-row { padding-block: 14px; }

.kb-search-row {
  display: flex;
  align-items: center;
  gap: 10px;
  background: var(--surface);
  border: 1px solid var(--line-strong);
  border-radius: var(--r-pill);
  padding: 8px 16px;
  transition: border-color var(--t-fast), box-shadow var(--t-fast);
}
.kb-search-row:focus-within {
  border-color: var(--accent);
  box-shadow: 0 0 0 4px var(--accent-soft);
}
.kb-search-row .kb-i { color: var(--muted); }
.kb-search-row input {
  flex: 1;
  border: 0;
  background: transparent;
  min-height: 32px;
  padding: 0;
  font-size: 0.96rem;
  color: var(--ink);
}
.kb-search-row input::placeholder { color: var(--muted-2); }
.kb-search-row input:focus { outline: none; }
.kb-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 8px 16px;
  border-radius: var(--r-pill);
  background: var(--ink);
  color: #fff;
  font-weight: 700;
  font-size: 0.86rem;
  border: 0;
  cursor: pointer;
}
.kb-btn:hover { background: var(--accent); color: #fff; }

/* Sections strip */
.kb-sections {
  background: var(--surface);
  border-bottom: 1px solid var(--line);
}
.kb-sections-inner {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
  flex-wrap: wrap;
}
.kb-sections a {
  position: relative;
  padding: 14px 16px;
  font-size: 0.88rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--ink-soft);
  transition: color var(--t-fast);
}
.kb-sections a::after {
  content: "";
  position: absolute;
  left: 16px; right: 16px; bottom: 0;
  height: 2px;
  background: transparent;
  transition: background var(--t-fast);
}
.kb-sections a:hover { color: var(--accent); }
.kb-sections a:hover::after { background: var(--accent); }
.kb-sections a[aria-current="page"] { color: var(--accent); }
.kb-sections a[aria-current="page"]::after { background: var(--accent); }

/* Trending strip */
.kb-trending {
  background: var(--surface-2);
  border-bottom: 1px solid var(--line);
}
.kb-trending-inner {
  display: flex;
  align-items: center;
  gap: 16px;
  padding-block: 10px;
  overflow: hidden;
}
.kb-trending-label {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
  background: var(--accent);
  color: #fff;
  padding: 5px 12px;
  border-radius: var(--r-pill);
  font-size: 0.72rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}
.kb-trending-dot {
  width: 7px; height: 7px;
  background: #fff;
  border-radius: 50%;
  animation: kb-pulse 1.6s ease-in-out infinite;
}
@keyframes kb-pulse {
  0%, 100% { opacity: 1; transform: scale(1); }
  50%      { opacity: 0.4; transform: scale(0.7); }
}
.kb-trending-list {
  display: flex;
  align-items: center;
  gap: 28px;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
}
.kb-trending-list::-webkit-scrollbar { display: none; }
.kb-trending-item {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  flex-shrink: 0;
  color: var(--ink-soft);
  font-size: 0.86rem;
  font-weight: 500;
  max-width: 280px;
  transition: color var(--t-fast);
}
.kb-trending-item:hover { color: var(--accent); }
.kb-trending-thumb {
  width: 32px; height: 32px;
  border-radius: 50%;
  overflow: hidden;
  background: var(--surface-3);
  flex-shrink: 0;
  position: relative;
}
.kb-trending-thumb img {
  width: 100%; height: 100%;
  object-fit: cover;
}
.kb-trending-title {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* =========================================================================
   Main shell
   ========================================================================= */
.kb-main {
  background: var(--paper);
  min-height: 60vh;
  padding-block: clamp(28px, 4vw, 48px) 64px;
}
.kb-section {
  margin-bottom: clamp(40px, 6vw, 72px);
}

/* Section heads */
.kb-section-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  margin-bottom: 22px;
  padding-bottom: 14px;
  border-bottom: 1px solid var(--line);
}
.kb-section-title {
  font-family: var(--font-serif);
  font-size: clamp(1.3rem, 2.2vw, 1.7rem);
  font-weight: 700;
  letter-spacing: -0.015em;
  margin: 0;
  display: inline-flex;
  align-items: center;
  gap: 12px;
}
.kb-section-title::before {
  content: "";
  width: 6px; height: 22px;
  background: var(--accent);
  border-radius: 2px;
  flex-shrink: 0;
}
.kb-link-muted {
  color: var(--muted);
  font-size: 0.86rem;
  font-weight: 600;
  transition: color var(--t-fast);
}
.kb-link-muted:hover { color: var(--accent); }

/* =========================================================================
   Tags / meta
   ========================================================================= */
.kb-tag {
  display: inline-flex;
  align-items: center;
  background: var(--accent);
  color: #fff;
  font-size: 0.7rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  padding: 4px 10px;
  border-radius: var(--r-pill);
  transition: background var(--t-fast);
}
.kb-tag:hover { background: var(--accent-deep); color: #fff; }
.kb-tag--ghost {
  background: var(--surface-3);
  color: var(--ink-soft);
}
.kb-tag--ghost:hover { background: var(--surface-3); color: var(--accent); }

.kb-meta {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 500;
}
.kb-meta .kb-i { color: var(--muted-2); }

/* =========================================================================
   Hero (homepage)
   ========================================================================= */
.kb-hero-section { margin-bottom: clamp(36px, 5vw, 60px); }
.kb-hero {
  display: grid;
  grid-template-columns: minmax(0, 1.7fr) minmax(0, 1fr);
  grid-template-rows: repeat(3, 1fr);
  gap: 18px;
  min-height: 540px;
}
.kb-hero-lead {
  position: relative;
  grid-row: 1 / -1;
  border-radius: var(--r-lg);
  overflow: hidden;
  background: var(--surface-3);
  isolation: isolate;
  min-height: 360px;
  box-shadow: var(--shadow-xs);
}
.kb-hero-media {
  position: absolute;
  inset: 0;
  display: block;
  z-index: 0;
}
.kb-hero-media img {
  width: 100%; height: 100%;
  object-fit: cover;
  transition: transform var(--t-slow);
}
.kb-hero-lead:hover .kb-hero-media img { transform: scale(1.04); }
.kb-hero-shade {
  position: absolute;
  inset: 0;
  background: linear-gradient(180deg, rgba(0,0,0,0) 30%, rgba(0,0,0,0.72) 100%);
  z-index: 1;
}
.kb-hero-copy {
  position: absolute;
  inset: auto 0 0 0;
  z-index: 2;
  color: #fff;
  padding: clamp(20px, 3vw, 36px);
  display: grid;
  gap: 12px;
}
.kb-hero-copy .kb-tag {
  align-self: flex-start;
  background: var(--accent);
  color: #fff;
}
.kb-hero-title {
  font-family: var(--font-serif);
  font-size: clamp(1.6rem, 3.8vw, 2.8rem);
  font-weight: 700;
  line-height: 1.08;
  letter-spacing: -0.02em;
  color: #fff;
  margin: 0;
  text-shadow: 0 2px 12px rgba(0,0,0,0.4);
}
.kb-hero-title a:hover { color: rgba(255, 255, 255, 0.85); }
.kb-hero-dek {
  margin: 0;
  color: rgba(255, 255, 255, 0.9);
  font-size: 0.96rem;
  line-height: 1.5;
  max-width: 60ch;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.kb-hero-copy .kb-meta { color: rgba(255, 255, 255, 0.78); }
.kb-hero-copy .kb-meta .kb-i { color: rgba(255, 255, 255, 0.6); }

.kb-hero-sub {
  position: relative;
  display: grid;
  grid-template-columns: 120px minmax(0, 1fr);
  gap: 14px;
  padding: 12px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  box-shadow: var(--shadow-xs);
  transition: transform var(--t), box-shadow var(--t), border-color var(--t);
}
.kb-hero-sub:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-sm);
  border-color: var(--line-strong);
}
.kb-hero-sub-media {
  width: 120px;
  height: 100%;
  min-height: 86px;
  border-radius: var(--r);
  overflow: hidden;
  background: var(--surface-3);
  display: block;
  position: relative;
}
.kb-hero-sub-media img {
  width: 100%; height: 100%;
  object-fit: cover;
}
.kb-hero-sub-copy { display: grid; gap: 6px; align-content: center; min-width: 0; }
.kb-hero-sub-title {
  font-family: var(--font-serif);
  font-size: 1.02rem;
  font-weight: 700;
  line-height: 1.25;
  letter-spacing: -0.012em;
  margin: 0;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.kb-hero-sub-title a:hover { color: var(--accent); }

/* =========================================================================
   Two-column body layout
   ========================================================================= */
.kb-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 320px;
  gap: clamp(28px, 4vw, 48px);
}
.kb-main-column { min-width: 0; }
.kb-sidebar { min-width: 0; }

/* =========================================================================
   Card grid (main feed)
   ========================================================================= */
.kb-card-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 20px;
}
.kb-card {
  display: flex;
  flex-direction: column;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  overflow: hidden;
  box-shadow: var(--shadow-xs);
  transition: transform var(--t), box-shadow var(--t), border-color var(--t);
}
.kb-card:hover {
  transform: translateY(-3px);
  box-shadow: var(--shadow);
  border-color: var(--line-strong);
}
.kb-card-media {
  display: block;
  position: relative;
  aspect-ratio: 16 / 10;
  overflow: hidden;
  background: var(--surface-3);
}
.kb-card-media img {
  width: 100%; height: 100%;
  object-fit: cover;
  transition: transform var(--t-slow);
}
.kb-card:hover .kb-card-media img { transform: scale(1.05); }
.kb-card-body {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 16px 18px 18px;
  flex: 1;
}
.kb-card-meta {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}
.kb-card-title {
  font-family: var(--font-serif);
  font-size: 1.18rem;
  font-weight: 700;
  line-height: 1.22;
  letter-spacing: -0.012em;
  margin: 0;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.kb-card-title a:hover { color: var(--accent); }
.kb-card-dek {
  color: var(--muted);
  font-size: 0.92rem;
  line-height: 1.5;
  margin: 0;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

/* =========================================================================
   Sidebar list
   ========================================================================= */
.kb-sidebar-row {
  display: grid;
  grid-template-columns: 84px minmax(0, 1fr);
  gap: 14px;
  align-items: start;
  padding-block: 16px;
  border-bottom: 1px solid var(--line);
}
.kb-sidebar-row:last-of-type { border-bottom: 0; }
.kb-sidebar-row--lead {
  grid-template-columns: 1fr;
  gap: 12px;
  padding-bottom: 22px;
  margin-bottom: 6px;
  border-bottom: 1px solid var(--line);
}
.kb-sidebar-row--lead .kb-sidebar-media {
  width: 100%;
  aspect-ratio: 16 / 10;
}
.kb-sidebar-row--lead h3 { font-size: 1.15rem; }
.kb-sidebar-media {
  width: 84px; height: 64px;
  border-radius: var(--r);
  overflow: hidden;
  background: var(--surface-3);
  display: block;
  position: relative;
}
.kb-sidebar-media img {
  width: 100%; height: 100%;
  object-fit: cover;
}
.kb-sidebar-copy { display: grid; gap: 6px; min-width: 0; }
.kb-sidebar-copy h3 {
  margin: 0;
  font-family: var(--font-serif);
  font-size: 0.98rem;
  font-weight: 700;
  line-height: 1.22;
  letter-spacing: -0.01em;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.kb-sidebar-copy h3 a:hover { color: var(--accent); }

/* =========================================================================
   Image fallbacks (no broken-image icons, ever)
   ========================================================================= */
[data-fallback-label].is-empty,
[data-fallback-label].image-error,
.kb-card-media.is-empty,
.kb-hero-media.is-empty,
.kb-hero-sub-media.is-empty,
.kb-sidebar-media.is-empty,
.kb-trending-thumb.is-empty {
  background:
    linear-gradient(135deg, var(--surface-2), var(--surface-3));
  position: relative;
}
[data-fallback-label].is-empty::after,
[data-fallback-label].image-error::after {
  content: attr(data-fallback-label);
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  color: var(--muted-2);
  font-family: var(--font-sans);
  font-size: 0.74rem;
  font-weight: 800;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  text-align: center;
  padding: 8px;
}
.kb-trending-thumb.is-empty::after { font-size: 0.6rem; letter-spacing: 0.06em; }

/* =========================================================================
   Empty states
   ========================================================================= */
.kb-empty {
  text-align: center;
  padding: 48px 24px;
  border: 1px dashed var(--line-strong);
  border-radius: var(--r-lg);
  background: var(--surface);
  color: var(--muted);
}
.kb-empty svg { margin: 0 auto 12px; color: var(--muted-2); }
.kb-empty h3 {
  font-family: var(--font-serif);
  color: var(--ink);
  font-size: 1.3rem;
  margin: 0 0 6px;
  letter-spacing: -0.01em;
}
.kb-empty p { margin: 0; }
.kb-empty--compact {
  padding: 22px 16px;
  font-size: 0.9rem;
}

/* =========================================================================
   Breadcrumbs
   ========================================================================= */
.kb-breadcrumbs {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: var(--muted);
  font-size: 0.82rem;
  margin-bottom: 16px;
}
.kb-breadcrumbs a { color: var(--ink-soft); font-weight: 600; }
.kb-breadcrumbs a:hover { color: var(--accent); }
.kb-breadcrumbs span[aria-hidden="true"] { color: var(--muted-2); }

/* =========================================================================
   Archive / category masthead
   ========================================================================= */
.kb-archive-head {
  margin-bottom: clamp(28px, 4vw, 40px);
  padding-bottom: clamp(20px, 3vw, 32px);
  border-bottom: 1px solid var(--line);
  display: grid;
  gap: 14px;
}
.kb-archive-head h1 {
  font-family: var(--font-serif);
  font-size: clamp(2.2rem, 5vw, 3.4rem);
  line-height: 1;
  letter-spacing: -0.022em;
  margin: 0;
}
.kb-archive-head .kb-tag { justify-self: start; }
.kb-archive-head .lead-copy {
  color: var(--body);
  font-size: 1.06rem;
  max-width: 60ch;
  margin: 0;
}
.kb-archive-search { max-width: 480px; }
.kb-archive-search .kb-spinner { display: none; }

.kb-spinner {
  display: none;
  width: 14px; height: 14px;
  border: 2px solid var(--line-strong);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: kb-spin 0.7s linear infinite;
}
.htmx-request .kb-spinner,
.htmx-request.kb-spinner { display: inline-block; }
.kb-archive-search.htmx-request .kb-spinner { display: inline-block; }
@keyframes kb-spin { to { transform: rotate(360deg); } }
#article-feed.htmx-request { opacity: 0.6; transition: opacity var(--t-fast); }

/* =========================================================================
   Article detail
   ========================================================================= */
.article-detail {
  max-width: 1100px;
  margin: 0 auto;
}
.article-hero {
  padding-bottom: clamp(20px, 3vw, 32px);
  border-bottom: 1px solid var(--line);
  margin-bottom: clamp(28px, 4vw, 44px);
}
.article-hero .kb-tag { margin-bottom: 12px; }
.article-hero h1 {
  font-family: var(--font-serif);
  font-size: clamp(2rem, 5vw, 3.4rem);
  font-weight: 700;
  line-height: 1.04;
  letter-spacing: -0.022em;
  margin: 4px 0 14px;
  max-width: 22ch;
}
.article-hero .lead-copy {
  font-family: var(--font-serif);
  color: var(--body);
  font-size: 1.18rem;
  line-height: 1.5;
  max-width: 60ch;
  margin: 0 0 14px;
}
.meta-line {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: var(--muted);
  font-size: 0.88rem;
}
.meta-line .kb-i { color: var(--muted-2); }
.article-hero-media {
  margin: clamp(20px, 3vw, 32px) 0 0;
  border-radius: var(--r-lg);
  overflow: hidden;
  background: var(--surface-3);
  position: relative;
  aspect-ratio: 16 / 9;
}
.article-hero-media img {
  width: 100%; height: 100%;
  object-fit: cover;
}

.article-body {
  font-family: var(--font-serif);
  font-size: 1.18rem;
  line-height: 1.72;
  color: var(--ink-soft);
  max-width: 70ch;
  margin: 0 auto;
}
.article-body p { margin: 0 0 1.15em; }
.article-body > p:first-of-type::first-letter {
  font-family: var(--font-serif);
  font-weight: 700;
  font-size: 3.2em;
  line-height: 0.86;
  float: left;
  padding: 6px 12px 0 0;
  color: var(--accent);
}
.article-body h2,
.article-body h3 {
  color: var(--ink);
  font-family: var(--font-serif);
  margin: 1.4em 0 0.5em;
}
.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 a:hover { color: var(--accent-deep); }
.article-body img {
  margin: 1.6em 0;
  width: 100%;
  border-radius: var(--r);
  border: 1px solid var(--line);
}
.article-body figure { margin: 1.6em 0; }
.article-body figcaption {
  color: var(--muted);
  font-family: var(--font-sans);
  font-size: 0.86rem;
  line-height: 1.45;
  text-align: center;
  margin-top: 8px;
}
.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 code {
  background: var(--surface-2);
  border: 1px solid var(--line);
  padding: 1px 6px;
  border-radius: 6px;
  font-size: 0.94em;
}
.article-image-missing {
  margin: 1.6em 0;
  padding: 28px;
  border: 1px dashed var(--line-strong);
  border-radius: var(--r);
  background: var(--surface-2);
  color: var(--muted);
  font-family: var(--font-sans);
  text-align: center;
  font-size: 0.9rem;
}

/* Embeds */
.article-body iframe,
.article-body table,
.article-body figure { max-width: 100%; }
.article-embed { clear: both; margin: 1.8em auto; width: 100%; }
.article-embed-frame { background: #000; overflow: hidden; border-radius: var(--r); }
.article-embed-video,
.article-embed-frame.article-embed-video { aspect-ratio: 16 / 9; }
.article-embed-wide { background: var(--surface-2); min-height: 152px; border-radius: var(--r); }
.article-embed iframe,
.article-embed video { display: block; width: 100%; border: 0; }
.article-embed-frame iframe { height: 100%; min-height: 360px; }
.article-embed-wide iframe { min-height: 152px; }
.article-embed-video video { height: 100%; background: #000; }
.article-embed-social { display: flex; justify-content: center; padding: 8px 0; }
.article-embed-social blockquote { max-width: min(100%, 560px); width: 100%; }
.article-embed-tiktok blockquote { max-width: min(100%, 605px); }
.article-body table { display: block; overflow-x: auto; }

/* Share rail */
.share-rail {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 10px;
  max-width: 70ch;
  margin: 40px auto 8px;
  padding-top: 28px;
  border-top: 1px solid var(--line);
}
.share-rail-label {
  color: var(--muted);
  font-size: 0.74rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  margin-right: 4px;
}
.icon-btn {
  display: inline-grid;
  place-items: center;
  width: 40px;
  height: 40px;
  border-radius: var(--r-pill);
  background: var(--surface-2);
  color: var(--ink-soft);
  border: 1px solid var(--line);
  transition: background var(--t-fast), color var(--t-fast), border-color var(--t-fast), transform var(--t-fast);
}
.icon-btn:hover {
  background: var(--accent);
  color: #fff;
  border-color: var(--accent);
  transform: translateY(-1px);
}
.icon-btn:active { transform: scale(0.96); }
.icon-btn.is-copied {
  background: var(--success);
  color: #fff;
  border-color: var(--success);
}

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

/* =========================================================================
   Footer
   ========================================================================= */
.kb-footer {
  background: var(--kb-black);
  color: rgba(251, 250, 246, 0.78);
  padding-top: clamp(40px, 5vw, 64px);
  padding-bottom: 32px;
  margin-top: clamp(48px, 6vw, 80px);
}
.kb-footer .kb-shell { padding-inline: var(--gutter); }
.kb-footer-flag {
  display: flex;
  height: 4px;
  width: 80px;
  border-radius: 2px;
  overflow: hidden;
  margin-bottom: 36px;
}
.kb-footer-flag span { flex: 1; }
.kb-footer-flag .b { background: var(--kb-black); border: 1px solid rgba(255, 255, 255, 0.2); }
.kb-footer-flag .r { background: var(--kb-red); }
.kb-footer-flag .w { background: #fff; }
.kb-footer-flag .g { background: var(--kb-green); }

.kb-footer-grid {
  display: grid;
  grid-template-columns: 1.5fr repeat(3, 1fr);
  gap: 40px;
  padding-bottom: 36px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}
.kb-footer-brand .kb-brand--footer {
  display: inline-flex;
  align-items: center;
  background: #fff;
  border-radius: var(--r);
  padding: 8px 10px;
  margin-bottom: 14px;
  box-shadow: var(--shadow-sm);
}
.kb-footer-brand .kb-logo {
  height: 42px;
  max-width: min(320px, 100%);
}
.kb-footer-brand p {
  color: rgba(251, 250, 246, 0.7);
  font-size: 0.92rem;
  line-height: 1.55;
  max-width: 42ch;
  margin: 0 0 16px;
}
.kb-social--footer a {
  color: rgba(251, 250, 246, 0.7);
}
.kb-social--footer a:hover {
  background: rgba(255, 255, 255, 0.1);
  color: #fff;
}

.kb-footer-col h4 {
  color: #fff;
  font-size: 0.74rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  margin: 0 0 14px;
  opacity: 0.8;
}
.kb-footer-col ul {
  list-style: none;
  padding: 0;
  margin: 0;
  display: grid;
  gap: 10px;
}
.kb-footer-col a {
  color: rgba(251, 250, 246, 0.78);
  font-size: 0.92rem;
  transition: color var(--t-fast);
}
.kb-footer-col a:hover { color: #fff; }

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

/* =========================================================================
   Mobile drawer
   ========================================================================= */
.kb-drawer {
  position: fixed;
  inset: 0;
  z-index: 60;
  display: none;
}
.kb-drawer[aria-hidden="false"] { display: block; }
.kb-drawer-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(12, 13, 14, 0.55);
  animation: kb-fade-in var(--t) both;
}
.kb-drawer-panel {
  position: absolute;
  top: 0; left: 0;
  height: 100%;
  width: min(340px, 86vw);
  background: var(--surface);
  padding: 18px 18px 24px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 18px;
  animation: kb-slide-in var(--t) both;
  box-shadow: var(--shadow-lg);
}
@keyframes kb-fade-in { from { opacity: 0; } to { opacity: 1; } }
@keyframes kb-slide-in { from { transform: translateX(-12px); opacity: 0; } to { transform: none; opacity: 1; } }
.kb-drawer-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}
.kb-drawer-head .kb-logo {
  height: 36px;
  max-width: 230px;
}
.kb-drawer-search input { font-size: 0.94rem; }
.kb-drawer-nav {
  display: grid;
  gap: 2px;
}
.kb-drawer-nav a {
  display: block;
  padding: 12px 14px;
  border-radius: var(--r);
  font-size: 0.96rem;
  font-weight: 600;
  color: var(--ink-soft);
  transition: background var(--t-fast), color var(--t-fast);
}
.kb-drawer-nav a:hover { background: var(--surface-2); color: var(--ink); }
.kb-drawer-nav a:first-child { color: var(--accent); }
.kb-drawer-foot {
  margin-top: auto;
  padding-top: 14px;
  border-top: 1px solid var(--line);
}
.kb-drawer-foot .kb-social a {
  color: var(--ink-soft);
  background: var(--surface-2);
}
.kb-drawer-foot .kb-social a:hover { background: var(--accent); color: #fff; }

/* =========================================================================
   Responsive
   ========================================================================= */
@media (max-width: 1080px) {
  .kb-hero {
    grid-template-columns: minmax(0, 1.4fr) minmax(0, 1fr);
    grid-template-rows: repeat(3, 1fr);
  }
  .kb-layout {
    grid-template-columns: 1fr;
  }
  .kb-sidebar { display: grid; gap: 0; }
}

@media (max-width: 820px) {
  .kb-utility { display: none; }
  .kb-masthead-inner {
    grid-template-columns: auto 1fr auto;
    min-height: 64px;
  }
  .kb-menu-toggle { display: inline-grid; }
  .kb-brand { justify-self: start; padding-left: 6px; }
  .kb-logo {
    height: 34px;
    max-width: min(225px, 58vw);
  }
  .kb-sections { display: none; }
  .kb-trending-inner { padding-block: 8px; }
  .kb-trending-label { font-size: 0.66rem; padding: 4px 10px; }
  .kb-trending-item { font-size: 0.82rem; max-width: 220px; }
  .kb-hero {
    grid-template-columns: 1fr;
    grid-template-rows: auto;
    min-height: 0;
    gap: 14px;
  }
  .kb-hero-lead { min-height: 320px; }
  .kb-hero-sub-media { width: 100px; min-height: 76px; }
  .kb-card-grid { grid-template-columns: 1fr; }
  .kb-footer-grid {
    grid-template-columns: 1fr 1fr;
    gap: 32px;
  }
  .kb-footer-bottom { flex-direction: column; align-items: flex-start; }
  .article-hero h1 { font-size: clamp(1.8rem, 6vw, 2.4rem); }
  .article-body { font-size: 1.06rem; }
  .article-body > p:first-of-type::first-letter { font-size: 2.6em; }
}

@media (max-width: 480px) {
  .kb-hero-sub { grid-template-columns: 90px minmax(0, 1fr); padding: 10px; }
  .kb-hero-sub-media { width: 90px; min-height: 70px; }
  .kb-hero-sub-title { font-size: 0.94rem; }
  .kb-sidebar-row { grid-template-columns: 72px minmax(0, 1fr); }
  .kb-sidebar-media { width: 72px; height: 54px; }
  .kb-footer-grid { grid-template-columns: 1fr; gap: 28px; }
}

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