/* =====================================================
   UPCLASS BLOG  (/blog/ on upclass.ai)
   Loaded only by blog_mgmt/public/upclass/*.html, on top of upstyle.css. Everything
   is scoped under .upb (the blog's <main>) so none of it can reach the rest of the
   marketing site. Colours come from the site's own palette (--primary & co.) plus the
   blog tokens below; dark mode follows the site's [data-theme="dark"] switch.
   ===================================================== */

/* ---------- Tokens ---------- */
.upb {
  --upb-nav-h: 72px;
  --upb-surface: #ffffff;
  --upb-surface-2: #f8fafc;
  --upb-surface-3: #eef2f7;
  --upb-card: #ffffff;
  --upb-ink: #0f172a;
  --upb-ink-2: #334155;
  --upb-muted: #64748b;
  --upb-line: #e2e8f0;
  --upb-line-strong: #cbd5e1;
  --upb-accent: #044FC0;
  --upb-accent-hover: #033a8c;
  --upb-accent-soft: rgba(4, 79, 192, 0.08);
  --upb-accent-line: rgba(4, 79, 192, 0.18);
  --upb-focus: #2f6fd6;
  --upb-grid-line: rgba(15, 23, 42, 0.055);
  --upb-shadow-sm: 0 1px 2px rgba(15, 23, 42, 0.04), 0 2px 8px -2px rgba(15, 23, 42, 0.06);
  --upb-shadow-md: 0 16px 36px -18px rgba(15, 23, 42, 0.22);
  --upb-shadow-lg: 0 28px 56px -24px rgba(15, 23, 42, 0.30);
  --upb-code-bg: #0b1324;
  --upb-code-ink: #e2e8f0;
  --upb-radius-card: 24px;

  display: block;
  color: var(--upb-ink);
  background: var(--upb-surface);
}

[data-theme="dark"] .upb {
  --upb-surface: #0a1628;
  --upb-surface-2: #0c1a2f;
  --upb-surface-3: #13233d;
  --upb-card: #0f1f36;
  --upb-ink: #f1f5f9;
  --upb-ink-2: #cbd5e1;
  --upb-muted: #94a3b8;
  --upb-line: #1e3a5f;
  --upb-line-strong: #2b4d78;
  --upb-accent: #7cb0ff;
  --upb-accent-hover: #a9caff;
  --upb-accent-soft: rgba(124, 176, 255, 0.11);
  --upb-accent-line: rgba(124, 176, 255, 0.24);
  --upb-focus: #7cb0ff;
  --upb-grid-line: rgba(148, 163, 184, 0.075);
  --upb-shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.35);
  --upb-shadow-md: 0 16px 36px -18px rgba(0, 0, 0, 0.7);
  --upb-shadow-lg: 0 28px 56px -24px rgba(0, 0, 0, 0.8);
  --upb-code-bg: #050c18;
}

/* Category tones: covers, pills, chips, archive badges. Picked per category by
   blog_mgmt.upclass_design.category_theme. a/b/c build the gradient; ink/soft are the
   text and background of a pill (both pairs pass WCAG AA). */
.upb-tone-blue   { --tone-a: #033a8c; --tone-b: #2f74dd; --tone-c: #8cc2ff; --tone-ink: #044FC0; --tone-soft: #e8f0fe; }
.upb-tone-teal   { --tone-a: #0b4a57; --tone-b: #0d9488; --tone-c: #5eead4; --tone-ink: #0f766e; --tone-soft: #e1f4f1; }
.upb-tone-amber  { --tone-a: #b4390b; --tone-b: #f59e0b; --tone-c: #fde68a; --tone-ink: #9a4507; --tone-soft: #fef2df; }
.upb-tone-violet { --tone-a: #4c1d95; --tone-b: #8b5cf6; --tone-c: #ddd6fe; --tone-ink: #6d28d9; --tone-soft: #f1ecfe; }
.upb-tone-indigo { --tone-a: #1e1b4b; --tone-b: #4f46e5; --tone-c: #a5b4fc; --tone-ink: #4338ca; --tone-soft: #eceefe; }
.upb-tone-rose   { --tone-a: #881337; --tone-b: #e11d48; --tone-c: #fda4af; --tone-ink: #be123c; --tone-soft: #fdebef; }
.upb-tone-brand  { --tone-a: #022c6b; --tone-b: #044FC0; --tone-c: #7cb0ff; --tone-ink: #044FC0; --tone-soft: #e8f0fe; }

[data-theme="dark"] .upb-tone-blue   { --tone-ink: #93c0ff; --tone-soft: rgba(47, 116, 221, 0.2); }
[data-theme="dark"] .upb-tone-teal   { --tone-ink: #5eead4; --tone-soft: rgba(13, 148, 136, 0.2); }
[data-theme="dark"] .upb-tone-amber  { --tone-ink: #fcd34d; --tone-soft: rgba(245, 158, 11, 0.17); }
[data-theme="dark"] .upb-tone-violet { --tone-ink: #c4b5fd; --tone-soft: rgba(139, 92, 246, 0.2); }
[data-theme="dark"] .upb-tone-indigo { --tone-ink: #a5b4fc; --tone-soft: rgba(79, 70, 229, 0.24); }
[data-theme="dark"] .upb-tone-rose   { --tone-ink: #fda4af; --tone-soft: rgba(225, 29, 72, 0.18); }
[data-theme="dark"] .upb-tone-brand  { --tone-ink: #93c0ff; --tone-soft: rgba(4, 79, 192, 0.3); }

/* ---------- Layout ---------- */
.upb .container {
  --bs-gutter-x: 2rem; /* 16px each side on phones */
}

@media (min-width: 768px) {
  .upb .container {
    --bs-gutter-x: 3rem;
  }
}

@media (min-width: 1400px) {
  .upb .container {
    max-width: 1240px;
  }
}

.upb-listing {
  padding-top: 20px;
  padding-bottom: 88px;
}

/* ---------- Focus ---------- */
.upb a:focus-visible,
.upb button:focus-visible,
.upb summary:focus-visible {
  outline: 3px solid var(--upb-focus);
  outline-offset: 3px;
  border-radius: 10px;
}

/* A card's link is stretched over the whole card, so ring the card, not the title. */
.upb-card:has(.upb-card-link:focus-visible),
.upb-featured:has(.upb-card-link:focus-visible) {
  outline: 3px solid var(--upb-focus);
  outline-offset: 4px;
}

@supports selector(:has(*)) {
  .upb .upb-card-link:focus-visible {
    outline: none;
  }
}

/* ---------- Atoms ---------- */
.upb-pill {
  position: relative;
  z-index: 2; /* above the card's stretched link */
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 26px;
  padding: 0 11px;
  border-radius: 999px;
  background: var(--tone-soft, var(--upb-accent-soft));
  color: var(--tone-ink, var(--upb-accent));
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: 0.01em;
  line-height: 1;
  white-space: nowrap;
  text-decoration: none;
  transition: box-shadow 0.2s ease, transform 0.2s ease;
}

.upb-pill:hover,
.upb-pill:focus-visible {
  color: var(--tone-ink, var(--upb-accent));
  box-shadow: inset 0 0 0 1px currentColor;
}

.upb-pill--lg {
  height: 34px;
  padding: 0 15px;
  font-size: 0.86rem;
  gap: 8px;
}

.upb-kicker {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px 12px;
  min-height: 26px;
}

.upb-kicker-meta {
  font-size: 0.8rem;
  font-weight: 500;
  color: var(--upb-muted);
}

.upb-author {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}

.upb-avatar {
  flex: 0 0 auto;
  display: inline-grid;
  place-items: center;
  width: 30px;
  height: 30px;
  border-radius: 50%;
  color: #fff;
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.03em;
  background: linear-gradient(135deg, var(--tone-a, #033a8c), var(--tone-b, #044FC0));
  box-shadow: 0 0 0 2px var(--upb-card), 0 4px 10px -4px rgba(15, 23, 42, 0.35);
}

.upb-avatar--brand {
  background: linear-gradient(135deg, #033a8c, #3b7de0);
}

.upb-avatar-shield {
  fill: #fff;
}

.upb-avatar-check {
  fill: #044FC0;
}

.upb-author-name {
  overflow: hidden;
  font-size: 0.88rem;
  font-weight: 600;
  color: var(--upb-ink);
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* A founder's byline links to their section of the About page. */
a.upb-author-name {
  text-decoration: none;
}

a.upb-author-name:hover {
  color: var(--upb-accent);
  text-decoration: underline;
  text-underline-offset: 3px;
}

.upb-meta-line {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px 12px;
  color: var(--upb-muted);
  font-size: 0.9rem;
}

.upb-meta-dot,
.upb-meta-rest::before {
  width: 3px;
  height: 3px;
  border-radius: 50%;
  background: currentColor;
  opacity: 0.7;
}

/* Date and reading time travel together, with their separator in front, so a wrap
   never leaves a dangling dot at the end of a line. */
.upb-meta-rest {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  white-space: nowrap;
}

.upb-meta-rest::before {
  content: '';
  flex: 0 0 auto;
}

/* Phones: the byline on one line, "date · reading time" under it. */
@media (max-width: 575.98px) {
  .upb-meta-line {
    flex-direction: column;
    align-items: flex-start;
    gap: 8px;
  }

  .upb-meta-line--article {
    align-items: center;
  }

  .upb-meta-rest::before {
    display: none;
  }
}

.upb-date {
  flex: 0 0 auto;
  font-size: 0.82rem;
  color: var(--upb-muted);
  white-space: nowrap;
}

.upb-link {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: var(--upb-accent);
  font-weight: 600;
  font-size: 0.95rem;
  text-decoration: none;
}

.upb-link:hover {
  color: var(--upb-accent-hover);
}

.upb-link .bi-arrow-right {
  transition: transform 0.2s ease;
}

.upb-link:hover .bi-arrow-right {
  transform: translateX(3px);
}

.upb-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  min-height: 50px;
  padding: 0 24px;
  border: 1px solid transparent;
  border-radius: 14px;
  font-size: 0.98rem;
  font-weight: 600;
  line-height: 1.2;
  text-decoration: none;
  white-space: nowrap;
  cursor: pointer;
  transition: background-color 0.2s ease, color 0.2s ease, border-color 0.2s ease,
              box-shadow 0.2s ease, transform 0.2s ease;
}

.upb-btn:hover {
  transform: translateY(-1px);
}

.upb-btn--primary {
  background: var(--primary);
  color: #fff;
  box-shadow: 0 10px 24px -10px rgba(4, 79, 192, 0.65);
}

.upb-btn--primary:hover {
  background: var(--primary-dark);
  color: #fff;
}

.upb-btn--outline {
  background: var(--upb-card);
  border-color: var(--upb-line-strong);
  color: var(--upb-ink);
}

.upb-btn--outline:hover {
  border-color: #25D366;
  background: rgba(37, 211, 102, 0.08);
  color: var(--upb-ink);
}

.upb-btn .bi-whatsapp {
  color: #25D366;
  font-size: 1.1rem;
}

.upb-btn--light {
  background: #fff;
  color: #033a8c;
  box-shadow: 0 12px 28px -12px rgba(0, 0, 0, 0.45);
}

.upb-btn--light:hover {
  background: #eef4ff;
  color: #022c6b;
}

.upb-btn--ghost {
  background: rgba(255, 255, 255, 0.08);
  border-color: rgba(255, 255, 255, 0.38);
  color: #fff;
}

.upb-btn--ghost:hover {
  background: rgba(255, 255, 255, 0.16);
  border-color: #fff;
  color: #fff;
}

.upb-btn--ghost .bi-whatsapp {
  color: #fff;
}

.upb-btn--soft {
  min-height: 44px;
  padding: 0 18px;
  background: var(--upb-accent-soft);
  color: var(--upb-accent);
}

.upb-btn--soft:hover {
  background: var(--upb-accent-line);
  color: var(--upb-accent-hover);
}

/* ---------- Hero (index + archives) ---------- */
.upb-hero {
  position: relative;
  z-index: 2; /* above the listing, so search suggestions can hang over it */
  isolation: isolate;
  overflow: visible;
  overflow-x: clip; /* the backdrop still can't cause sideways scrolling */
  padding: calc(var(--upb-nav-h) + 64px) 0 12px;
  text-align: center;
}

.upb-hero-bg {
  position: absolute;
  inset: 0;
  z-index: -1;
  background:
    radial-gradient(ellipse 55% 60% at 50% -5%, rgba(59, 125, 224, 0.17), transparent 70%),
    radial-gradient(ellipse 32% 42% at 8% 18%, rgba(4, 79, 192, 0.07), transparent 70%),
    radial-gradient(ellipse 32% 42% at 92% 26%, rgba(124, 92, 255, 0.07), transparent 70%),
    linear-gradient(180deg, var(--upb-surface-2) 0%, var(--upb-surface) 100%);
}

.upb-hero-bg::before,
.upb-article-hero-bg::before {
  content: '';
  position: absolute;
  inset: 0;
  background-image:
    linear-gradient(to right, var(--upb-grid-line) 1px, transparent 1px),
    linear-gradient(to bottom, var(--upb-grid-line) 1px, transparent 1px);
  background-size: 56px 56px;
  -webkit-mask-image: radial-gradient(ellipse 65% 70% at 50% 0%, #000 25%, transparent 75%);
  mask-image: radial-gradient(ellipse 65% 70% at 50% 0%, #000 25%, transparent 75%);
}

.upb-hero--archive .upb-hero-bg {
  background:
    radial-gradient(ellipse 50% 60% at 50% -5%, color-mix(in srgb, var(--tone-b) 20%, transparent), transparent 70%),
    linear-gradient(180deg, var(--upb-surface-2) 0%, var(--upb-surface) 100%);
}

.upb-eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin: 0 0 22px;
  padding: 7px 15px;
  border: 1px solid var(--upb-accent-line);
  border-radius: 999px;
  background: var(--upb-accent-soft);
  color: var(--upb-accent);
  font-size: 0.85rem;
  font-weight: 600;
}

.upb-hero-title {
  margin: 0;
  font-family: var(--font-heading);
  font-size: clamp(2.6rem, 7.2vw, 4.6rem);
  font-weight: 700;
  line-height: 1.02;
  letter-spacing: -0.04em;
  color: var(--upb-ink);
}

.upb-hero-title--archive {
  font-size: clamp(2.2rem, 5.6vw, 3.6rem);
  letter-spacing: -0.035em;
}

.upb-gradient-text {
  background-image: linear-gradient(110deg, #044FC0 5%, #3b7de0 55%, #7b8cff 95%);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

[data-theme="dark"] .upb-gradient-text {
  background-image: linear-gradient(110deg, #7cb0ff 5%, #a9caff 50%, #c4b5fd 95%);
}

@supports not ((-webkit-background-clip: text) or (background-clip: text)) {
  .upb-gradient-text {
    color: var(--upb-accent);
  }
}

.upb-hash {
  color: var(--tone-ink, var(--upb-accent));
  margin-right: 0.04em;
}

.upb-hero-sub {
  max-width: 620px;
  margin: 18px auto 0;
  color: var(--upb-muted);
  font-size: clamp(1.05rem, 1.7vw, 1.2rem);
  line-height: 1.6;
  text-wrap: balance;
}

.upb-archive-count {
  display: inline-flex;
  align-items: center;
  margin: 16px 0 0;
  padding: 5px 13px;
  border-radius: 999px;
  background: var(--tone-soft, var(--upb-accent-soft));
  color: var(--tone-ink, var(--upb-accent));
  font-size: 0.82rem;
  font-weight: 600;
}

.upb-hero--archive .upb-hero-sub {
  margin-top: 14px;
}

.upb-archive-badge {
  display: inline-grid;
  place-items: center;
  width: 64px;
  height: 64px;
  margin-bottom: 20px;
  border-radius: 20px;
  color: #fff;
  font-size: 1.65rem;
  background: linear-gradient(135deg, var(--tone-a), var(--tone-b));
  box-shadow: 0 16px 32px -14px var(--tone-b), inset 0 1px 0 rgba(255, 255, 255, 0.28);
}

/* Search */
.upb-search {
  position: relative;
  max-width: 480px;
  margin: 32px auto 0;
}

.upb-search-input {
  width: 100%;
  height: 54px;
  padding: 0 62px 0 50px;
  border: 1px solid var(--upb-line);
  border-radius: 999px;
  background: var(--upb-card);
  color: var(--upb-ink);
  font: inherit;
  font-size: 1rem;
  box-shadow: var(--upb-shadow-sm);
  -webkit-appearance: none;
  appearance: none;
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.upb-search-input::placeholder {
  color: var(--upb-muted);
  opacity: 1;
}

.upb-search-input:focus {
  outline: none;
  border-color: var(--upb-accent);
  box-shadow: 0 0 0 4px var(--upb-accent-line), var(--upb-shadow-sm);
}

.upb-search-icon {
  position: absolute;
  top: 50%;
  left: 20px;
  transform: translateY(-50%);
  color: var(--upb-muted);
  pointer-events: none;
}

.upb-search-btn {
  position: absolute;
  top: 7px;
  right: 7px;
  display: grid;
  place-items: center;
  width: 40px;
  height: 40px;
  border: 0;
  border-radius: 50%;
  background: var(--primary);
  color: #fff;
  transition: background-color 0.2s ease;
}

.upb-search-btn:hover {
  background: var(--primary-dark);
}

/* Smaller box inside pages (category and tag heroes, the end of an article). */
.upb-search--compact {
  max-width: 420px;
  margin: 20px auto 0;
}

.upb-search--compact .upb-search-input {
  height: 46px;
  padding-right: 54px;
  font-size: 0.9375rem;
}

.upb-search--compact .upb-search-btn {
  top: 5px;
  right: 5px;
  width: 36px;
  height: 36px;
}

/* Suggestions as you type (upblog.js initSearch). */
.upb-suggest {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  left: 0;
  z-index: 30;
  margin: 0;
  padding: 6px;
  list-style: none;
  border: 1px solid var(--upb-line);
  border-radius: 16px;
  background: var(--upb-card);
  box-shadow: 0 18px 40px -18px rgba(15, 23, 42, 0.35);
  text-align: left;
}

.upb-suggest a {
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 9px 12px;
  border-radius: 10px;
  color: var(--upb-ink);
  text-decoration: none;
}

.upb-suggest a:hover,
.upb-suggest [aria-selected="true"] a {
  background: var(--upb-accent-line);
}

.upb-suggest-title {
  font-weight: 600;
  line-height: 1.35;
}

.upb-suggest-meta {
  color: var(--upb-muted);
  font-size: 0.8125rem;
}

.upb-suggest-all a {
  flex-direction: row;
  align-items: center;
  gap: 6px;
  color: var(--primary);
  font-weight: 600;
  font-size: 0.875rem;
}

.upb-suggest-empty {
  padding: 10px 12px;
  color: var(--upb-muted);
  font-size: 0.875rem;
}

.upb-article-search {
  margin: 40px 0 8px;
  padding: 22px 20px 24px;
  border: 1px solid var(--upb-line);
  border-radius: 18px;
  background: var(--upb-card);
  text-align: center;
}

.upb-article-search-title {
  margin: 0;
  font-size: 1.125rem;
}

.upb-article-search .upb-search--compact {
  margin-top: 14px;
}

/* Category chips */
.upb-chips {
  margin-top: 30px;
}

.upb-chips-list {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 8px;
  margin: 0;
  padding: 4px 0;
  list-style: none;
}

/* Wide screens wrap the chips into centred rows of about four, which stay balanced
   (4 + 3 for the default six categories) instead of leaving a lone chip on a
   second line. Phones scroll them sideways instead -- see further down. */
@media (min-width: 768px) {
  .upb-chips-list {
    max-width: 780px;
    margin: 0 auto;
  }
}

.upb-chip {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  height: 40px;
  padding: 0 16px;
  border: 1px solid var(--upb-line);
  border-radius: 999px;
  background: var(--upb-card);
  color: var(--upb-ink-2);
  font-size: 0.9rem;
  font-weight: 500;
  white-space: nowrap;
  text-decoration: none;
  box-shadow: var(--upb-shadow-sm);
  transition: border-color 0.2s ease, color 0.2s ease, background-color 0.2s ease, transform 0.2s ease;
}

.upb-chip .bi {
  color: var(--tone-ink, var(--upb-accent));
  font-size: 0.95rem;
}

.upb-chip:hover {
  border-color: var(--tone-ink, var(--upb-accent));
  color: var(--upb-ink);
  transform: translateY(-1px);
}

.upb-chip.is-active {
  background: var(--upb-ink);
  border-color: var(--upb-ink);
  color: var(--upb-surface);
  box-shadow: 0 8px 18px -10px rgba(15, 23, 42, 0.6);
}

.upb-chip.is-active .bi {
  color: inherit;
}

/* Breadcrumbs */
.upb-crumbs ol {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 6px 12px;
  margin: 0 0 22px;
  padding: 0;
  list-style: none;
  color: var(--upb-muted);
  font-size: 0.9rem;
}

.upb-crumbs li {
  display: inline-flex;
  align-items: center;
  gap: 12px;
}

.upb-crumbs li + li::before {
  content: '';
  width: 6px;
  height: 6px;
  border-top: 1.5px solid currentColor;
  border-right: 1.5px solid currentColor;
  transform: rotate(45deg);
  opacity: 0.55;
}

.upb-crumbs a:not(.upb-pill) {
  color: var(--upb-muted);
  font-weight: 500;
  text-decoration: none;
}

.upb-crumbs a:not(.upb-pill):hover {
  color: var(--upb-accent);
}

.upb-crumbs [aria-current] {
  color: var(--upb-ink);
  font-weight: 600;
}

/* ---------- Covers ---------- */
.upb-cover {
  position: relative;
  isolation: isolate;
  overflow: hidden;
  aspect-ratio: 16 / 9;
  border-radius: 16px;
  background: var(--upb-surface-3);
  container-type: inline-size;
}

.upb-cover-img {
  position: absolute;
  inset: 0;
  z-index: 1;
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.6s cubic-bezier(0.2, 0.7, 0.2, 1);
}

.upb-cover.is-broken .upb-cover-img {
  display: none;
}

/* Behind a real image only the gradient stays (a backdrop for transparent PNGs); the
   badge, label and icon return if the image fails. */
.upb-cover.has-img:not(.is-broken) .upb-gencover-badge,
.upb-cover.has-img:not(.is-broken) .upb-gencover-label,
.upb-cover.has-img:not(.is-broken) .upb-gencover-mark {
  visibility: hidden;
}

/* The generated cover: gradient + grid + oversized icon + glass badge + label. Sized
   in container units so one design works from a 300px card to the article banner. */
.upb-gencover {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  justify-content: space-between;
  overflow: hidden;
  padding: 20px;
  padding: 6.5cqw;
  color: #fff;
  background-color: var(--tone-b, #044FC0);
  background-image:
    radial-gradient(circle at 88% 10%, rgba(255, 255, 255, 0.32) 0, transparent 36%),
    radial-gradient(ellipse 85% 75% at 0% 110%, color-mix(in srgb, var(--tone-c, #7cb0ff) 60%, transparent) 0, transparent 62%),
    linear-gradient(135deg, var(--tone-a, #033a8c) 0%, var(--tone-b, #044FC0) 100%);
}

.upb-gencover-grid {
  position: absolute;
  inset: 0;
  background-image:
    linear-gradient(rgba(255, 255, 255, 0.12) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, 0.12) 1px, transparent 1px);
  background-size: 32px 32px;
  background-size: 8cqw 8cqw;
  -webkit-mask-image: radial-gradient(ellipse 70% 85% at 82% 18%, #000 5%, transparent 72%);
  mask-image: radial-gradient(ellipse 70% 85% at 82% 18%, #000 5%, transparent 72%);
}

.upb-gencover-mark {
  position: absolute;
  right: -7cqw;
  bottom: -15cqw;
  font-size: 180px;
  font-size: 60cqw;
  line-height: 1;
  color: #fff;
  opacity: 0.15;
  transform: rotate(-14deg);
  transition: transform 0.6s cubic-bezier(0.2, 0.7, 0.2, 1);
}

.upb-gencover-badge {
  position: relative;
  display: grid;
  place-items: center;
  width: 17cqw;
  height: 17cqw;
  min-width: 46px;
  min-height: 46px;
  max-width: 84px;
  max-height: 84px;
  border: 1px solid rgba(255, 255, 255, 0.36);
  border-radius: 28%;
  background: rgba(255, 255, 255, 0.16);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.35), 0 14px 30px -10px rgba(0, 0, 0, 0.35);
  -webkit-backdrop-filter: blur(8px);
  backdrop-filter: blur(8px);
  font-size: clamp(1.3rem, 7.5cqw, 2.4rem);
}

.upb-gencover-label {
  position: relative;
  max-width: 78%;
  font-family: var(--font-heading);
  font-size: clamp(1rem, 5.2cqw, 2rem);
  font-weight: 600;
  line-height: 1.15;
  letter-spacing: -0.015em;
  text-shadow: 0 2px 14px rgba(0, 0, 0, 0.18);
}

[data-theme="dark"] .upb-gencover {
  filter: brightness(0.9) saturate(0.95);
}

/* ---------- Featured (page 1 lead story) ---------- */
.upb-featured {
  position: relative;
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  margin-top: 36px;
  padding: 12px;
  border: 1px solid var(--upb-line);
  border-radius: 30px;
  background: var(--upb-card);
  box-shadow: var(--upb-shadow-md);
  transition: box-shadow 0.3s ease, border-color 0.3s ease, transform 0.3s ease;
}

.upb-featured:hover {
  border-color: var(--upb-line-strong);
  box-shadow: var(--upb-shadow-lg);
}

.upb-featured .upb-cover {
  aspect-ratio: 16 / 10;
  border-radius: 20px;
}

.upb-featured-body {
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding: 22px 12px 14px;
}

.upb-flag {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: var(--upb-accent);
  font-size: 0.74rem;
  font-weight: 700;
  letter-spacing: 0.09em;
  text-transform: uppercase;
}

.upb-flag .bi {
  color: #f59e0b;
}

.upb-featured-title {
  margin: 16px 0 14px;
  font-family: var(--font-heading);
  font-size: clamp(1.65rem, 3vw, 2.45rem);
  font-weight: 700;
  line-height: 1.12;
  letter-spacing: -0.03em;
  color: var(--upb-ink);
  text-wrap: balance;
}

.upb-featured-excerpt {
  display: -webkit-box;
  margin: 0 0 24px;
  overflow: hidden;
  color: var(--upb-muted);
  font-size: 1.05rem;
  line-height: 1.65;
  -webkit-line-clamp: 4;
  -webkit-box-orient: vertical;
}

.upb-readmore {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin-top: 28px;
  color: var(--upb-accent);
  font-weight: 600;
}

.upb-readmore .bi {
  transition: transform 0.25s ease;
}

.upb-featured:hover .upb-readmore .bi {
  transform: translateX(4px);
}

@media (min-width: 992px) {
  .upb-featured {
    grid-template-columns: minmax(0, 1.18fr) minmax(0, 1fr);
    margin-top: 44px;
    padding: 14px;
  }

  .upb-featured .upb-cover {
    aspect-ratio: auto;
    height: 100%;
    min-height: 400px;
  }

  .upb-featured-body {
    padding: 40px 44px 40px 48px;
  }
}

/* ---------- Section heads ---------- */
.upb-section-head {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  justify-content: space-between;
  gap: 12px 16px;
  margin: 72px 0 26px;
}

.upb-listing > .upb-section-head:first-child {
  margin-top: 32px;
}

.upb-section-head--results {
  align-items: center;
}

.upb-section-title {
  margin: 0;
  font-family: var(--font-heading);
  font-size: clamp(1.4rem, 2.4vw, 1.8rem);
  font-weight: 700;
  letter-spacing: -0.025em;
  color: var(--upb-ink);
}

.upb-section-note {
  margin-left: 10px;
  font-family: var(--font-primary);
  font-size: 0.9rem;
  font-weight: 500;
  letter-spacing: 0;
  color: var(--upb-muted);
}

/* ---------- Card grid ---------- */
.upb-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 24px;
}

@media (min-width: 768px) {
  .upb-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 28px;
  }
}

@media (min-width: 1024px) {
  .upb-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 34px 28px;
  }
}

.upb-card {
  position: relative;
  display: flex;
  flex-direction: column;
  height: 100%;
  padding: 10px;
  border: 1px solid var(--upb-line);
  border-radius: var(--upb-radius-card);
  background: var(--upb-card);
  box-shadow: var(--upb-shadow-sm);
  transition: transform 0.3s cubic-bezier(0.2, 0.7, 0.2, 1), box-shadow 0.3s ease, border-color 0.3s ease;
}

.upb-card:hover {
  transform: translateY(-4px);
  border-color: var(--upb-line-strong);
  box-shadow: var(--upb-shadow-lg);
}

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

.upb-card-title {
  display: -webkit-box;
  margin: 14px 0 10px;
  overflow: hidden;
  font-family: var(--font-heading);
  font-size: 1.22rem;
  font-weight: 700;
  line-height: 1.3;
  letter-spacing: -0.015em;
  color: var(--upb-ink);
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
}

.upb-card-link {
  color: inherit;
  text-decoration: none;
  transition: color 0.2s ease;
}

/* The stretched link: the whole card is one target (see _card.html). */
.upb-card-link::after {
  content: '';
  position: absolute;
  inset: 0;
  z-index: 1;
  border-radius: var(--upb-radius-card);
}

.upb-card:hover .upb-card-link,
.upb-featured:hover .upb-card-link {
  color: var(--upb-accent);
}

.upb-card-excerpt {
  display: -webkit-box;
  margin: 0 0 18px;
  overflow: hidden;
  color: var(--upb-muted);
  font-size: 0.95rem;
  line-height: 1.6;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
}

.upb-card-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-top: auto;
  padding-top: 16px;
  border-top: 1px solid var(--upb-line);
}

.upb-card:hover .upb-cover-img,
.upb-featured:hover .upb-cover-img {
  transform: scale(1.045);
}

.upb-card:hover .upb-gencover-mark,
.upb-featured:hover .upb-gencover-mark {
  transform: rotate(-7deg) scale(1.06);
}

/* ---------- Pagination ---------- */
.upb-pagination {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 12px;
  margin-top: 56px;
}

.upb-page-list {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 6px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.upb-page {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-width: 44px;
  height: 44px;
  padding: 0 12px;
  border: 1px solid var(--upb-line);
  border-radius: 12px;
  background: var(--upb-card);
  color: var(--upb-ink-2);
  font-size: 0.95rem;
  font-weight: 600;
  text-decoration: none;
  transition: border-color 0.2s ease, color 0.2s ease, background-color 0.2s ease;
}

a.upb-page:hover {
  border-color: var(--upb-accent);
  color: var(--upb-accent);
}

.upb-page.is-current {
  border-color: var(--primary);
  background: var(--primary);
  color: #fff;
}

a.upb-page.is-current:hover {
  color: #fff;
}

.upb-page--gap {
  min-width: 20px;
  padding: 0;
  border-color: transparent;
  background: transparent;
}

.upb-page--step {
  padding: 0 16px;
}

.upb-page.is-disabled {
  opacity: 0.45;
}

/* ---------- Empty state ---------- */
.upb-empty {
  max-width: 560px;
  margin: 36px auto 0;
  padding: 56px 28px;
  border: 1px dashed var(--upb-line-strong);
  border-radius: 28px;
  background: var(--upb-surface-2);
  text-align: center;
}

.upb-empty-art {
  position: relative;
  width: 92px;
  height: 92px;
  margin: 0 auto 26px;
}

.upb-empty-sheet {
  position: absolute;
  inset: 0;
  border-radius: 24px;
}

.upb-empty-sheet--back {
  background: linear-gradient(135deg, #c7dafc, #eaf1fe);
  transform: rotate(-11deg) translate(-8px, 4px);
}

[data-theme="dark"] .upb-empty-sheet--back {
  background: linear-gradient(135deg, rgba(124, 176, 255, 0.28), rgba(124, 176, 255, 0.08));
}

.upb-empty-sheet--front {
  display: grid;
  place-items: center;
  background: linear-gradient(135deg, #044FC0, #3b7de0);
  color: #fff;
  font-size: 2.1rem;
  transform: rotate(5deg);
  box-shadow: 0 18px 32px -14px rgba(4, 79, 192, 0.6);
}

.upb-empty-title {
  margin: 0 0 10px;
  font-size: 1.5rem;
  letter-spacing: -0.02em;
  color: var(--upb-ink);
}

.upb-empty-text {
  max-width: 420px;
  margin: 0 auto;
  color: var(--upb-muted);
  line-height: 1.6;
}

.upb-empty .upb-btn {
  margin-top: 24px;
}

/* ---------- CTA band ---------- */
.upb-cta {
  padding: 0 0 96px;
}

.upb-cta-panel {
  position: relative;
  isolation: isolate;
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  align-items: center;
  gap: 32px;
  overflow: hidden;
  padding: clamp(32px, 6vw, 64px);
  border-radius: 32px;
  color: #fff;
  background:
    radial-gradient(ellipse 60% 80% at 100% 0%, rgba(124, 176, 255, 0.45), transparent 60%),
    radial-gradient(ellipse 50% 70% at 0% 100%, rgba(59, 125, 224, 0.4), transparent 60%),
    linear-gradient(135deg, #044FC0 0%, #033a8c 55%, #021d4a 100%);
  box-shadow: 0 34px 64px -34px rgba(4, 79, 192, 0.75);
}

.upb-cta-panel::before {
  content: '';
  position: absolute;
  inset: 0;
  z-index: -1;
  background-image:
    linear-gradient(rgba(255, 255, 255, 0.07) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, 0.07) 1px, transparent 1px);
  background-size: 44px 44px;
  -webkit-mask-image: radial-gradient(ellipse 60% 90% at 85% 40%, #000 10%, transparent 75%);
  mask-image: radial-gradient(ellipse 60% 90% at 85% 40%, #000 10%, transparent 75%);
}

.upb-cta-copy {
  position: relative;
  max-width: 640px;
}

.upb-cta-eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin: 0 0 18px;
  padding: 6px 13px;
  border: 1px solid rgba(255, 255, 255, 0.24);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.12);
  font-size: 0.82rem;
  font-weight: 600;
}

.upb-cta-title {
  margin: 0 0 14px;
  color: #fff;
  font-size: clamp(1.8rem, 3.6vw, 2.7rem);
  line-height: 1.1;
  letter-spacing: -0.03em;
  text-wrap: balance;
}

.upb-cta-text {
  max-width: 540px;
  margin: 0 0 30px;
  color: rgba(255, 255, 255, 0.84);
  font-size: 1.08rem;
  line-height: 1.6;
}

.upb-cta-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
}

.upb-cta-art {
  display: none;
  position: relative;
  width: 240px;
  height: 240px;
  justify-self: center;
}

.upb-cta-ring {
  position: absolute;
  inset: 0;
  border: 1px solid rgba(255, 255, 255, 0.18);
  border-radius: 50%;
}

.upb-cta-ring--2 {
  inset: 38px;
  border-color: rgba(255, 255, 255, 0.28);
  background: radial-gradient(circle, rgba(255, 255, 255, 0.14), transparent 70%);
}

.upb-cta-shield {
  position: absolute;
  inset: 74px;
  display: grid;
  place-items: center;
  border: 1px solid rgba(255, 255, 255, 0.32);
  border-radius: 26px;
  background: rgba(255, 255, 255, 0.14);
  font-size: 2.6rem;
  box-shadow: 0 22px 40px -14px rgba(0, 0, 0, 0.45), inset 0 1px 0 rgba(255, 255, 255, 0.32);
  transform: rotate(-6deg);
  -webkit-backdrop-filter: blur(6px);
  backdrop-filter: blur(6px);
}

@media (min-width: 992px) {
  .upb-cta-panel {
    grid-template-columns: minmax(0, 1fr) 260px;
  }

  .upb-cta-copy {
    grid-column: 1;
    grid-row: 1;
  }

  .upb-cta-art {
    display: block;
    grid-column: 2;
    grid-row: 1;
  }
}

/* ---------- Article ---------- */
.upb-preview-bar {
  position: sticky;
  top: var(--upb-nav-h);
  z-index: 990;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 6px 14px;
  margin-top: var(--upb-nav-h);
  padding: 11px 16px;
  border-bottom: 1px solid #f3d27a;
  background: #fff6db;
  color: #664d03;
  font-size: 0.9rem;
  text-align: center;
}

[data-theme="dark"] .upb-preview-bar {
  border-color: #6b5410;
  background: #33290a;
  color: #fde68a;
}

.upb-preview-edit {
  color: inherit;
  font-weight: 600;
  text-decoration: underline;
  text-underline-offset: 3px;
}

.upb-preview-edit:hover {
  color: inherit;
}

.upb-progress {
  position: fixed;
  top: 0;
  right: 0;
  left: 0;
  z-index: 1100; /* over the site nav (1000) */
  height: 3px;
  pointer-events: none;
}

.upb-progress-bar {
  display: block;
  height: 100%;
  background: linear-gradient(90deg, #044FC0, #3b7de0 60%, #7cb0ff);
  transform: scaleX(0);
  transform-origin: 0 50%;
  will-change: transform;
}

.upb-article {
  padding-bottom: 88px;
}

.upb-article-hero {
  position: relative;
  isolation: isolate;
  padding: calc(var(--upb-nav-h) + 56px) 0 0;
  text-align: center;
}

.upb.is-preview .upb-article-hero {
  padding-top: 48px;
}

.upb-article-hero-bg {
  position: absolute;
  top: 0;
  right: 0;
  left: 0;
  z-index: -1;
  height: calc(100% + 200px);
  background:
    radial-gradient(ellipse 60% 70% at 50% 0%, color-mix(in srgb, var(--tone-b) 17%, transparent), transparent 70%),
    linear-gradient(180deg, var(--upb-surface-2) 0%, var(--upb-surface) 88%);
}

.upb-article-head {
  max-width: 880px;
  margin: 0 auto;
}

.upb-article-title {
  margin: 0 0 18px;
  font-family: var(--font-heading);
  font-size: clamp(2.05rem, 5.4vw, 3.65rem);
  font-weight: 700;
  line-height: 1.08;
  letter-spacing: -0.035em;
  color: var(--upb-ink);
  text-wrap: balance;
}

.upb-article-dek {
  max-width: 720px;
  margin: 0 auto;
  color: var(--upb-muted);
  font-size: clamp(1.08rem, 1.9vw, 1.3rem);
  line-height: 1.6;
  text-wrap: pretty;
}

.upb-meta-line--article {
  justify-content: center;
  margin-top: 28px;
  font-size: 0.95rem;
}

.upb-meta-line--article .upb-avatar {
  width: 36px;
  height: 36px;
  font-size: 0.8rem;
}

.upb-meta-line--article .upb-author-name {
  font-size: 0.95rem;
}

.upb-meta-line .bi-clock {
  margin-right: 4px;
}

.upb-article-cover {
  max-width: 1120px;
  margin: 44px auto 0;
}

.upb-article-cover .upb-cover {
  aspect-ratio: 16 / 9;
  border-radius: 20px;
  box-shadow: var(--upb-shadow-lg);
}

@media (min-width: 768px) {
  .upb-article-cover .upb-cover {
    aspect-ratio: 2 / 1;
    border-radius: 28px;
  }

  /* Without a picture the banner only carries the category's look; keep it slimmer. */
  .upb-article-cover .upb-cover:not(.has-img) {
    aspect-ratio: 3 / 1;
  }
}

/* Body grid: the article column, with the table of contents and the share rail
   beside it on wide screens (sticky), and folded into the column on small ones. */
.upb-article-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  max-width: 720px;
  margin: 56px auto 0;
}

.upb-rail {
  display: none;
}

.upb-rail-inner {
  position: sticky;
  top: calc(var(--upb-nav-h) + 32px);
}

.upb.is-preview .upb-rail-inner {
  top: calc(var(--upb-nav-h) + 80px);
}

.upb-rail-label {
  margin: 0 0 14px;
  color: var(--upb-muted);
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

@media (min-width: 992px) {
  .upb-article-grid.has-toc {
    grid-template-columns: minmax(0, 1fr) 220px;
    column-gap: 56px;
    max-width: none;
  }

  .upb-article-grid.has-toc .upb-article-main {
    grid-column: 1;
    grid-row: 1;
  }

  .upb-article-grid.has-toc .upb-rail--toc {
    display: block;
    grid-column: 2;
    grid-row: 1;
  }

  .upb-toc-mobile {
    display: none;
  }
}

@media (min-width: 1200px) {
  .upb-article-grid,
  .upb-article-grid.has-toc {
    grid-template-columns: minmax(0, 1fr) minmax(0, 720px) minmax(0, 1fr);
    column-gap: 44px;
    max-width: none;
  }

  .upb-article-grid .upb-article-main,
  .upb-article-grid.has-toc .upb-article-main {
    grid-column: 2;
    grid-row: 1;
  }

  .upb-article-grid .upb-rail--toc,
  .upb-article-grid.has-toc .upb-rail--toc {
    display: block;
    grid-column: 3;
    grid-row: 1;
  }

  .upb-article-grid .upb-rail--share {
    display: block;
    grid-column: 1;
    grid-row: 1;
    justify-self: end;
  }
}

/* Table of contents */
.upb-toc {
  max-height: calc(100vh - var(--upb-nav-h) - 140px);
  margin: 0;
  padding: 0;
  overflow-y: auto;
  border-left: 1px solid var(--upb-line);
  list-style: none;
  scrollbar-width: thin;
}

.upb-toc a {
  display: block;
  margin-left: -1px;
  padding: 7px 0 7px 16px;
  border-left: 2px solid transparent;
  color: var(--upb-muted);
  font-size: 0.87rem;
  line-height: 1.45;
  text-decoration: none;
  transition: color 0.2s ease, border-color 0.2s ease;
}

.upb-toc-item--h3 a {
  padding-left: 30px;
  font-size: 0.83rem;
}

.upb-toc a:hover {
  color: var(--upb-ink);
}

.upb-toc a.is-active {
  border-left-color: var(--upb-accent);
  color: var(--upb-accent);
  font-weight: 600;
}

.upb-toc-mobile {
  margin: 0 0 36px;
  overflow: hidden;
  border: 1px solid var(--upb-line);
  border-radius: 18px;
  background: var(--upb-surface-2);
}

.upb-toc-mobile summary {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 15px 18px;
  color: var(--upb-ink);
  font-weight: 600;
  list-style: none;
  cursor: pointer;
}

.upb-toc-mobile summary::-webkit-details-marker {
  display: none;
}

.upb-toc-mobile-label .bi {
  margin-right: 6px;
  color: var(--upb-accent);
}

.upb-toc-mobile-count {
  margin-left: auto;
  color: var(--upb-muted);
  font-size: 0.82rem;
  font-weight: 500;
}

.upb-toc-chevron {
  color: var(--upb-muted);
  transition: transform 0.25s ease;
}

.upb-toc-mobile[open] .upb-toc-chevron {
  transform: rotate(180deg);
}

.upb-toc-mobile .upb-toc {
  max-height: none;
  margin: 0 18px 14px;
  padding-top: 8px;
  border-top: 1px solid var(--upb-line);
  border-left: 0;
}

.upb-toc-mobile .upb-toc a {
  margin-left: 0;
  padding: 9px 0;
  border-left: 0;
  font-size: 0.93rem;
}

.upb-toc-mobile .upb-toc-item--h3 a {
  padding-left: 16px;
}

/* ---------- Prose: the article body from the editor ---------- */
.upb-prose {
  color: var(--upb-ink-2);
  font-size: 1.0625rem;
  line-height: 1.78;
  overflow-wrap: break-word;
}

@media (min-width: 768px) {
  .upb-prose {
    font-size: 1.125rem;
  }
}

.upb-prose > :first-child {
  margin-top: 0;
}

.upb-prose > :last-child {
  margin-bottom: 0;
}

.upb-prose p {
  margin: 0 0 1.35em;
}

.upb-prose h1,
.upb-prose h2,
.upb-prose h3,
.upb-prose h4,
.upb-prose h5,
.upb-prose h6 {
  font-family: var(--font-heading);
  font-weight: 700;
  color: var(--upb-ink);
  letter-spacing: -0.02em;
  scroll-margin-top: calc(var(--upb-nav-h) + 28px); /* = SCROLL_OFFSET in upblog.js */
}

/* A heading reached from the TOC takes focus (upblog.js) so keyboard users carry on
   from there; it is a landing spot, not a control, so no focus ring. */
.upb-prose [tabindex="-1"]:focus {
  outline: none;
}

.upb-prose h1,
.upb-prose h2 {
  margin: 2.1em 0 0.65em;
  font-size: clamp(1.55rem, 2.6vw, 1.9rem);
  line-height: 1.25;
}

.upb-prose h3 {
  margin: 1.8em 0 0.55em;
  font-size: clamp(1.25rem, 2vw, 1.4rem);
  line-height: 1.35;
}

.upb-prose h4,
.upb-prose h5,
.upb-prose h6 {
  margin: 1.6em 0 0.5em;
  font-size: 1.1rem;
  line-height: 1.4;
}

.upb-prose a {
  color: var(--upb-accent);
  font-weight: 500;
  text-decoration: underline;
  text-decoration-color: var(--upb-accent-line);
  text-decoration-thickness: 2px;
  text-underline-offset: 4px;
  transition: text-decoration-color 0.2s ease, color 0.2s ease;
}

.upb-prose a:hover {
  color: var(--upb-accent-hover);
  text-decoration-color: currentColor;
}

.upb-prose strong,
.upb-prose b {
  color: var(--upb-ink);
  font-weight: 700;
}

.upb-prose ul,
.upb-prose ol {
  margin: 0 0 1.4em;
  padding-left: 1.5em;
}

.upb-prose li {
  margin: 0.5em 0;
  padding-left: 0.35em;
}

.upb-prose li::marker {
  color: var(--upb-accent);
}

.upb-prose ol > li::marker {
  font-family: var(--font-heading);
  font-weight: 700;
}

.upb-prose li > ul,
.upb-prose li > ol {
  margin: 0.4em 0 0.2em;
}

/* The editor's sanitizer appends <br /><br /> to every list item
   (core_lib.clean_and_linkify_editor_data); here the list's own spacing does that. */
.upb-prose li > br:nth-last-child(-n+2) {
  display: none;
}

.upb-prose blockquote {
  position: relative;
  margin: 2em 0;
  padding: 1.3em 1.5em 1.3em 1.7em;
  border-left: 4px solid var(--upb-accent);
  border-radius: 0 18px 18px 0;
  background: var(--upb-accent-soft);
  color: var(--upb-ink);
  font-family: var(--font-heading);
  font-size: 1.16em;
  font-weight: 500;
  line-height: 1.55;
  letter-spacing: -0.01em;
}

.upb-prose blockquote p:last-child {
  margin-bottom: 0;
}

.upb-prose code {
  padding: 0.16em 0.42em;
  border: 1px solid var(--upb-line);
  border-radius: 6px;
  background: var(--upb-surface-3);
  color: var(--upb-ink);
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, 'Liberation Mono', monospace;
  font-size: 0.86em;
  word-break: break-word;
}

.upb-prose pre {
  margin: 1.8em 0;
  padding: 1.15em 1.35em;
  overflow-x: auto;
  border: 1px solid rgba(255, 255, 255, 0.06);
  border-radius: 16px;
  background: var(--upb-code-bg);
  color: var(--upb-code-ink);
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, 'Liberation Mono', monospace;
  font-size: 0.88rem;
  line-height: 1.7;
  box-shadow: var(--upb-shadow-md);
}

/* Inner scrollers get thin, quiet scrollbars instead of the site's 10px blue ones
   (the standard properties switch off upstyle.css's ::-webkit-scrollbar styling). */
.upb-prose pre {
  scrollbar-width: thin;
  scrollbar-color: rgba(255, 255, 255, 0.28) transparent;
}

.upb-prose .upb-table-wrap,
.upb-toc {
  scrollbar-width: thin;
  scrollbar-color: var(--upb-line-strong) transparent;
}

.upb-prose pre code {
  padding: 0;
  border: 0;
  background: none;
  color: inherit;
  font-size: inherit;
  word-break: normal;
}

.upb-prose img {
  display: block;
  max-width: 100%;
  height: auto;
  margin: 2em auto;
  border-radius: 16px;
}

.upb-prose p > img:only-child {
  margin: 0 auto;
}

.upb-prose iframe {
  display: block;
  width: 100%;
  max-width: 100%;
  margin: 2em 0;
  border: 0;
  border-radius: 16px;
}

.upb-prose iframe[src*="youtube"],
.upb-prose iframe[src*="youtu.be"],
.upb-prose iframe[src*="vimeo"] {
  height: auto;
  aspect-ratio: 16 / 9;
}

.upb-prose hr {
  height: auto;
  margin: 3em 0;
  border: 0;
  color: var(--upb-muted);
  text-align: center;
  opacity: 1;
}

.upb-prose hr::before {
  content: '\2022\2002\2022\2002\2022';
  font-size: 1rem;
  letter-spacing: 0.4em;
}

/* Tables arrive as <table class="table table-bordered"> from the sanitizer, and
   upclass_design.wrap_tables puts each in a scroll box. Neutralise Bootstrap's white
   cell backgrounds (wrong in dark mode) and its cell grid. */
.upb-prose .upb-table-wrap {
  margin: 2em 0;
  overflow-x: auto;
  border: 1px solid var(--upb-line);
  border-radius: 16px;
  background: var(--upb-card);
  -webkit-overflow-scrolling: touch;
}

.upb-prose .upb-table-wrap table {
  --bs-table-bg: transparent;
  --bs-table-color: inherit;
  --bs-table-border-color: var(--upb-line);
  width: 100%;
  min-width: 480px;
  margin: 0;
  border: 0;
  border-color: var(--upb-line);
  border-collapse: collapse;
  color: inherit;
  font-size: 0.95rem;
  line-height: 1.55;
}

/* .table-bordered draws row borders too; rows here are ruled by their cells. */
.upb-prose .upb-table-wrap tbody,
.upb-prose .upb-table-wrap tr {
  border-width: 0;
}

.upb-prose .upb-table-wrap th,
.upb-prose .upb-table-wrap td {
  padding: 0.85em 1.1em;
  border: 0;
  border-bottom: 1px solid var(--upb-line);
  background: transparent;
  box-shadow: none;
  color: inherit;
  text-align: left;
  vertical-align: top;
}

.upb-prose .upb-table-wrap tr:last-child > td,
.upb-prose .upb-table-wrap tr:last-child > th {
  border-bottom: 0;
}

.upb-prose .upb-table-wrap th {
  background: var(--upb-surface-2);
  color: var(--upb-ink);
  font-family: var(--font-heading);
  font-size: 0.9rem;
  font-weight: 600;
}

.upb-prose .upb-table-wrap tr:hover > td {
  background: var(--upb-accent-soft);
}

@media (max-width: 575.98px) {
  .upb-prose img {
    float: none !important;
  }
}

/* ---------- Article end: tags, share, CTA ---------- */
.upb-article-end {
  display: flex;
  flex-direction: column;
  gap: 22px;
  margin-top: 52px;
  padding-top: 28px;
  border-top: 1px solid var(--upb-line);
}

.upb-end-group {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 12px 16px;
}

.upb-end-label {
  min-width: 150px;
  color: var(--upb-muted);
  font-size: 0.76rem;
  font-weight: 700;
  letter-spacing: 0.09em;
  text-transform: uppercase;
}

.upb-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.upb-tag {
  display: inline-flex;
  align-items: center;
  height: 36px;
  padding: 0 14px;
  border: 1px solid var(--upb-line);
  border-radius: 999px;
  background: var(--upb-surface-2);
  color: var(--upb-ink-2);
  font-size: 0.88rem;
  font-weight: 500;
  text-decoration: none;
  transition: border-color 0.2s ease, color 0.2s ease;
}

.upb-tag:hover {
  border-color: var(--upb-accent);
  color: var(--upb-accent);
}

.upb-share {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.upb-share-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-width: 40px;
  height: 40px;
  padding: 0 15px;
  border: 1px solid var(--upb-line);
  border-radius: 999px;
  background: var(--upb-card);
  color: var(--upb-ink-2);
  font-size: 0.88rem;
  font-weight: 600;
  text-decoration: none;
  cursor: pointer;
  transition: background-color 0.2s ease, border-color 0.2s ease, color 0.2s ease, transform 0.2s ease;
}

.upb-share-btn[hidden] {
  display: none;
}

.upb-share-btn .bi {
  font-size: 1rem;
}

.upb-share-btn:hover {
  transform: translateY(-1px);
}

.upb-share-btn--whatsapp:hover {
  border-color: #25D366;
  background: #25D366;
  color: #fff;
}

.upb-share-btn--linkedin:hover {
  border-color: #0A66C2;
  background: #0A66C2;
  color: #fff;
}

.upb-share-btn--x:hover {
  border-color: #0f1419;
  background: #0f1419;
  color: #fff;
}

[data-theme="dark"] .upb-share-btn--x:hover {
  border-color: #f1f5f9;
  background: #f1f5f9;
  color: #0f1419;
}

.upb-share-btn--copy:hover {
  border-color: var(--upb-accent);
  color: var(--upb-accent);
}

.upb-share-btn.is-copied,
.upb-share-btn.is-copied:hover {
  border-color: #16a34a;
  background: #16a34a;
  color: #fff;
}

.upb-share--rail {
  flex-direction: column;
  align-items: center;
}

.upb-share--rail .upb-share-btn {
  width: 44px;
  height: 44px;
  padding: 0;
}

.upb-rail--share .upb-rail-inner {
  display: flex;
  flex-direction: column;
  align-items: center;
}

.upb-cta-card {
  position: relative;
  isolation: isolate;
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 18px;
  margin-top: 48px;
  padding: 28px 24px;
  overflow: hidden;
  border: 1.5px solid transparent;
  border-radius: 26px;
  background:
    linear-gradient(var(--upb-card), var(--upb-card)) padding-box,
    linear-gradient(135deg, #044FC0, #7cb0ff 50%, #b8a6ff) border-box;
  box-shadow: var(--upb-shadow-md);
}

.upb-cta-card::before {
  content: '';
  position: absolute;
  inset: 0;
  z-index: -1;
  background: radial-gradient(circle at 100% 0%, rgba(59, 125, 224, 0.14), transparent 55%);
}

.upb-cta-card-icon {
  display: grid;
  place-items: center;
  width: 56px;
  height: 56px;
  border-radius: 16px;
  background: linear-gradient(135deg, #044FC0, #3b7de0);
  color: #fff;
  font-size: 1.5rem;
  box-shadow: 0 14px 26px -12px rgba(4, 79, 192, 0.65);
}

.upb-cta-card-title {
  margin: 0 0 8px;
  font-size: 1.45rem;
  letter-spacing: -0.02em;
  color: var(--upb-ink);
}

.upb-cta-card-text {
  margin: 0 0 22px;
  color: var(--upb-muted);
  line-height: 1.6;
}

@media (min-width: 576px) {
  .upb-cta-card {
    grid-template-columns: auto minmax(0, 1fr);
    gap: 22px;
    padding: 32px;
  }
}

/* ---------- Previous / next article (same category) ---------- */
.upb-postnav {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 14px;
  margin-top: 40px;
}

.upb-postnav-link {
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 18px 20px;
  border: 1px solid var(--upb-line);
  border-radius: 18px;
  background: var(--upb-surface-2);
  color: var(--upb-ink);
  text-decoration: none;
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.upb-postnav-link:hover {
  border-color: var(--upb-accent-line);
  box-shadow: var(--upb-shadow-sm);
  color: var(--upb-ink);
}

.upb-postnav-link:hover .upb-postnav-title {
  color: var(--upb-accent);
}

.upb-postnav-dir {
  color: var(--upb-muted);
  font-size: 0.76rem;
  font-weight: 700;
  letter-spacing: 0.09em;
  text-transform: uppercase;
}

.upb-postnav-title {
  font-family: var(--font-heading);
  font-size: 1.02rem;
  font-weight: 700;
  line-height: 1.35;
  letter-spacing: -0.01em;
  transition: color 0.2s ease;
}

@media (min-width: 576px) {
  .upb-postnav {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  /* Next stays in the right-hand column even when there is no previous article. */
  .upb-postnav-link--next {
    grid-column: 2;
    align-items: flex-end;
    text-align: right;
  }
}

/* ---------- Related ---------- */
.upb-related {
  padding: 72px 0 96px;
  border-top: 1px solid var(--upb-line);
  background: var(--upb-surface-2);
}

.upb-related .upb-section-head {
  margin-top: 0;
}

/* ---------- Phones ---------- */
@media (max-width: 575.98px) {
  .upb-hero {
    padding-top: calc(var(--upb-nav-h) + 44px);
  }

  .upb-article-hero {
    padding-top: calc(var(--upb-nav-h) + 36px);
  }

  .upb-article-cover {
    margin-top: 32px;
  }

  .upb-article-grid {
    margin-top: 40px;
  }

  .upb-card-body {
    padding: 16px 8px 8px;
  }

  .upb-featured {
    border-radius: 24px;
    padding: 10px;
  }

  .upb-featured .upb-cover {
    border-radius: 16px;
  }

  .upb-featured-body {
    padding: 18px 8px 10px;
  }

  .upb-readmore {
    margin-top: 20px;
  }

  .upb-cta {
    padding-bottom: 64px;
  }

  .upb-cta-panel {
    border-radius: 24px;
  }

  .upb-cta-actions .upb-btn {
    flex: 1 1 100%;
  }

  .upb-page--step span {
    display: none;
  }

  .upb-page--step {
    padding: 0;
  }

  .upb-end-label {
    min-width: 0;
    width: 100%;
  }

  .upb-related {
    padding: 56px 0 72px;
  }
}

/* One scrollable row of chips on phones and small tablets. */
@media (max-width: 767.98px) {
  .upb-chips {
    margin-right: -1rem;
    margin-left: -1rem;
  }

  .upb-chips-list {
    flex-wrap: nowrap;
    justify-content: flex-start;
    padding: 4px 1rem 10px;
    overflow-x: auto;
    overscroll-behavior-x: contain;
    scroll-padding: 0 1rem;
    scroll-snap-type: x proximity;
    scrollbar-width: none;
    -webkit-overflow-scrolling: touch;
    -webkit-mask-image: linear-gradient(90deg, transparent 0, #000 14px, #000 calc(100% - 28px), transparent 100%);
    mask-image: linear-gradient(90deg, transparent 0, #000 14px, #000 calc(100% - 28px), transparent 100%);
  }

  .upb-chips-list::-webkit-scrollbar {
    display: none;
  }

  .upb-chips-list > li {
    flex: 0 0 auto;
    scroll-snap-align: start;
  }
}

/* ---------- Motion & print ---------- */
@media (prefers-reduced-motion: reduce) {
  .upb *,
  .upb *::before,
  .upb *::after {
    transition-duration: 0.01ms !important;
    animation-duration: 0.01ms !important;
  }

  .upb-card:hover,
  .upb-btn:hover,
  .upb-chip:hover,
  .upb-share-btn:hover,
  .upb-card:hover .upb-cover-img,
  .upb-featured:hover .upb-cover-img {
    transform: none;
  }

  .upb-card:hover .upb-gencover-mark,
  .upb-featured:hover .upb-gencover-mark {
    transform: rotate(-14deg);
  }
}

@media print {
  .upb-progress,
  .upb-rail,
  .upb-toc-mobile,
  .upb-cta,
  .upb-cta-card,
  .upb-postnav,
  .upb-related,
  .upb-share,
  .upb-preview-bar {
    display: none !important;
  }
}
