/* =============================================================================
   Hamidun News — Brand System v2 (from Claude Design handoff)
   Based on Figma "Hamidun & CLOUT" brandbook
   ============================================================================= */

@font-face {
  font-family: "Inter Tight";
  font-style: normal;
  font-weight: 100 900;
  font-display: swap;
  src:
    url("/portal/fonts/InterTight-Variable.woff2") format("woff2-variations"),
    url("/portal/fonts/InterTight-Variable.woff2") format("woff2");
}
@font-face {
  font-family: "Manrope";
  font-style: normal;
  font-weight: 100 900;
  font-display: swap;
  src:
    url("/portal/fonts/Manrope-Variable.woff2") format("woff2-variations"),
    url("/portal/fonts/Manrope-Variable.woff2") format("woff2");
}

:root {
  /* Brand colors (from Figma brandbook) */
  --h-primary: #2d2fe8;
  --h-primary-hover: #2022c7;
  --h-deep: #010334;
  --h-black: #010106;
  --h-cyan: #29a9ff;
  --h-green: #62c584;
  --h-red: #f95d51;
  --h-accent-light: #c7d2e9;

  /* Wave 18 — WCAG AA text-safe accent tokens.
     Brand accents (--h-cyan/--h-green/--h-red/--h-primary) stay for fills,
     borders and dark surfaces; these darker twins are for TEXT on light
     backgrounds (≥4.5:1 on #fff/#efefef/#f7f6f3). Dark themes override
     them back to the bright brand values. */
  --h-link: #2d2fe8;        /* text links / accents (7.8:1 on #fff) */
  --h-focus-ring: #2d2fe8;  /* :focus-visible outline */
  --h-red-text: #c0392b;    /* 5.4:1 on #fff */
  --h-green-text: #1f7a4d;  /* 5.3:1 on #fff */
  --h-cyan-text: #0073cf;   /* 4.8:1 on #fff */

  /* Surface */
  --h-bg: #ffffff;
  --h-bg-soft: #efefef;
  --h-bg-warm: #f7f6f3;
  --h-surface: #ffffff;
  --h-surface-2: #fafaf8;
  --h-border: #e8e8e6;
  --h-border-strong: #d4d4d0;
  --h-divider: #ededea;

  /* Text */
  --h-text: #111111;
  --h-text-muted: #4a4a55;
  --h-text-subtle: #65656d; /* Wave 18: was #7a7a82 (4.27:1 on #fff) → ≥4.9:1 on all light surfaces */
  --h-text-inverse: #ffffff;

  /* Type scale */
  --h-hero: clamp(44px, 5vw, 72px);
  --h-h1: 40px;
  --h-h2: 32px;
  --h-h3: 24px;
  --h-lead: 18px;
  --h-body: 16px;
  --h-small: 14px;
  --h-tiny: 12px;

  /* Spacing */
  --h-sp-1: 4px;
  --h-sp-2: 8px;
  --h-sp-3: 12px;
  --h-sp-4: 16px;
  --h-sp-5: 24px;
  --h-sp-6: 32px;
  --h-sp-7: 48px;
  --h-sp-8: 64px;
  --h-sp-9: 96px;

  /* Radius */
  --h-r-sm: 6px;
  --h-r-md: 10px;
  --h-r-lg: 16px;
  --h-r-xl: 24px;
  --h-r-pill: 999px;

  /* Shadow */
  --h-shadow-xs: 0 1px 2px rgba(1, 1, 6, 0.04);
  --h-shadow-sm: 0 2px 6px rgba(1, 1, 6, 0.06);
  --h-shadow-md: 0 8px 24px rgba(1, 1, 6, 0.08);
  --h-shadow-lg: 0 20px 60px rgba(1, 3, 52, 0.12);

  /* Fonts */
  --h-font-head: "Inter Tight", "Helvetica Neue", Helvetica, Arial, sans-serif;
  --h-font-body: "Manrope", "Helvetica Neue", Helvetica, Arial, sans-serif;
  --h-font-mono: ui-monospace, "SF Mono", Menlo, Consolas, monospace;

  /* Legacy fallback aliases */
  --bg: var(--h-bg);
  --text: var(--h-text);
  --text-secondary: var(--h-text-muted);
  --text-muted: var(--h-text-subtle);
  --accent: var(--h-primary);
  --font: var(--h-font-head);
  --font-body: var(--h-font-body);
}

/* Explicit dark theme (outside @media) — manual toggle */
html[data-theme="dark"] {
  --h-bg: #070926;
  --h-bg-soft: #0c0f35;
  --h-bg-warm: #0a0c30;
  --h-surface: #0f1238;
  --h-surface-2: #141748;
  --h-border: #1f2350;
  --h-border-strong: #2b2f65;
  --h-divider: #1a1e45;
  --h-text: #f0f1fa;
  --h-text-muted: #a8aac4;
  --h-text-subtle: #8b8eba; /* Wave 18: was #7174a0 (4.0:1 on surface) → ≥5.3:1 */
  --h-text-inverse: #010334;
  /* Wave 18 — accent text flips back to bright values on dark surfaces */
  --h-link: #8a8cff;
  --h-focus-ring: #29a9ff;
  --h-red-text: #f95d51;
  --h-green-text: #62c584;
  --h-cyan-text: #29a9ff;
}
html[data-theme="dark"] body {
  background: var(--h-bg);
  color: var(--h-text);
}

@media (prefers-color-scheme: dark) {
  :root.h-auto-dark,
  html[data-theme="dark"] {
    --h-bg: #070926;
    --h-bg-soft: #0c0f35;
    --h-bg-warm: #0a0c30;
    --h-surface: #0f1238;
    --h-surface-2: #141748;
    --h-border: #1f2350;
    --h-border-strong: #2b2f65;
    --h-divider: #1a1e45;
    --h-text: #f0f1fa;
    --h-text-muted: #a8aac4;
    --h-text-subtle: #8b8eba; /* Wave 18 contrast fix */
    --h-text-inverse: #010334;
    --h-link: #8a8cff;
    --h-focus-ring: #29a9ff;
    --h-red-text: #f95d51;
    --h-green-text: #62c584;
    --h-cyan-text: #29a9ff;
  }
}

/* Global resets */
* {
  box-sizing: border-box;
}
html,
body {
  margin: 0;
  padding: 0;
  background: var(--h-bg);
  color: var(--h-text);
  font-family: var(--h-font-body);
  font-size: var(--h-body);
  line-height: 1.55;
  letter-spacing: -0.005em;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}
h1,
h2,
h3,
h4,
h5,
h6 {
  font-family: var(--h-font-head);
  letter-spacing: -0.02em;
  line-height: 1.08;
  font-weight: 700; /* heavier display weight — components may override down */
  color: var(--h-text);
  margin: 0;
}
p {
  margin: 0;
}
a {
  color: inherit;
  text-decoration: none;
}
button {
  font-family: inherit;
  cursor: pointer;
}
::selection {
  background: var(--h-primary);
  color: #fff;
}
img {
  max-width: 100%;
  height: auto;
  display: block;
}

/* LQIP pattern for placeholders */
.h-lqip {
  background-color: var(--h-accent-light);
  background-image:
    linear-gradient(135deg, rgba(1, 3, 52, 0.06) 0 1px, transparent 1px 14px),
    linear-gradient(135deg, rgba(1, 3, 52, 0.03) 0 2px, transparent 2px 14px);
  background-size:
    14px 14px,
    14px 14px;
  position: relative;
  overflow: hidden;
  color: #010334;
}
.h-lqip::after {
  content: attr(data-label);
  position: absolute;
  left: 10px;
  bottom: 8px;
  font-family: var(--h-font-mono);
  font-size: 10px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: rgba(1, 3, 52, 0.55);
  background: rgba(255, 255, 255, 0.7);
  padding: 2px 6px;
  border-radius: 3px;
}

/* =================== NAVIGATION =================== */
.nav {
  display: flex;
  align-items: center;
  gap: 32px;
  padding: 18px 40px;
  border-bottom: 1px solid var(--h-border);
  background: var(--h-bg);
  color: var(--h-text);
  position: relative;
  z-index: 5;
}
.nav--dark {
  background: var(--h-deep);
  color: #fff;
  border-bottom-color: rgba(255, 255, 255, 0.08);
}
.nav__inner {
  display: flex;
  align-items: center;
  gap: 32px;
  width: 100%;
  max-width: 1440px;
  margin: 0 auto;
}
.nav__logo {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  font-family: var(--h-font-head);
  font-weight: 700;
  font-size: 20px;
  letter-spacing: -0.03em;
  text-decoration: none;
  color: inherit;
  flex-shrink: 0;
}
.nav__logo-mark {
  width: 32px;
  height: 32px;
  display: block;
  border-radius: 6px;
  overflow: hidden;
  flex-shrink: 0;
}
.nav__logo-slash {
  opacity: 0.5;
}
.nav__links {
  display: flex;
  align-items: center;
  gap: 4px;
  list-style: none;
  padding: 0;
  margin: 0;
}
.nav__links a {
  padding: 8px 12px;
  border-radius: 8px;
  font-size: 14px;
  font-weight: 520;
  color: var(--h-text-muted);
  transition: background 0.15s;
  white-space: nowrap;
}
.nav--dark .nav__links a {
  color: rgba(255, 255, 255, 0.65);
}
.nav__links a:hover,
.nav__links a.active {
  background: var(--h-bg-soft);
  color: var(--h-text);
}
.nav--dark .nav__links a:hover,
.nav--dark .nav__links a.active {
  background: rgba(255, 255, 255, 0.08);
  color: #fff;
}
.nav__spacer {
  flex: 1;
}
.nav__search {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 14px;
  border-radius: var(--h-r-pill);
  border: 1px solid var(--h-border);
  color: var(--h-text-muted);
  font-size: 13px;
  min-width: 220px;
  cursor: pointer;
  background: none;
  font-family: var(--h-font-body);
}
.nav--dark .nav__search {
  border-color: rgba(255, 255, 255, 0.15);
  color: rgba(255, 255, 255, 0.75);
}
.nav__search-kbd {
  font-family: var(--h-font-mono);
  font-size: 11px;
  opacity: 0.6;
  padding: 1px 5px;
  border-radius: 4px;
  border: 1px solid var(--h-border-strong);
  margin-left: auto;
}
.nav--dark .nav__search-kbd {
  border-color: rgba(255, 255, 255, 0.2);
}
.nav__locales {
  display: flex;
  align-items: center;
  gap: 2px;
  padding: 3px;
  border-radius: var(--h-r-pill);
  border: 1px solid var(--h-border);
}
.nav--dark .nav__locales {
  border-color: rgba(255, 255, 255, 0.15);
}
.nav__locale {
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.04em;
  padding: 5px 8px;
  border-radius: 999px;
  color: var(--h-text-muted);
  background: transparent;
  border: 0;
  cursor: pointer;
  text-transform: uppercase;
  font-family: var(--h-font-body);
}
.nav--dark .nav__locale {
  color: rgba(255, 255, 255, 0.7);
}
.nav__locale.active,
.nav__locale[aria-current="true"] {
  background: var(--h-deep);
  color: #fff;
}
.nav--dark .nav__locale.active,
.nav--dark .nav__locale[aria-current="true"] {
  background: #fff;
  color: var(--h-deep);
}
.nav__user,
.nav__theme {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: var(--h-bg-soft);
  color: var(--h-text);
  border: none;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  cursor: pointer;
  transition:
    background 0.15s ease,
    color 0.15s ease;
}
.nav__theme {
  margin-right: 8px;
}
.nav__theme:hover {
  background: var(--h-border);
}
.nav__theme-icon--moon {
  display: none;
}
html[data-theme="dark"] .nav__theme-icon--sun {
  display: none;
}
html[data-theme="dark"] .nav__theme-icon--moon {
  display: block;
}
.nav--dark .nav__user,
.nav--dark .nav__theme {
  background: rgba(255, 255, 255, 0.08);
  color: #fff;
}
.nav--dark .nav__theme:hover {
  background: rgba(255, 255, 255, 0.16);
}

/* Hide screen-reader-only Q&A used for AI crawlers */
.qa-box--sr-only {
  position: absolute;
  left: -9999px;
  top: -9999px;
  width: 1px;
  height: 1px;
  overflow: hidden;
}

/* =================== HERO =================== */
.hero {
  position: relative;
  background: var(--h-deep);
  color: #fff;
  overflow: hidden;
  padding: 60px 40px 80px;
}
.hero__glow {
  position: absolute;
  inset: 0;
  background:
    radial-gradient(circle at 15% 110%, #29a9ff 0%, rgba(41, 169, 255, 0) 35%),
    radial-gradient(circle at 85% -20%, rgba(1, 1, 6, 0.8) 0%, rgba(1, 1, 6, 0) 50%);
  opacity: 0.85;
  pointer-events: none;
}
.hero__grid {
  position: absolute;
  inset: 0;
  background-image: linear-gradient(to right, rgba(255, 255, 255, 0.04) 1px, transparent 1px);
  background-size: 80px 80px;
  pointer-events: none;
}
.hero__inner {
  position: relative;
  display: grid;
  grid-template-columns: 1.4fr 1fr;
  gap: 60px;
  align-items: end;
  min-height: 380px;
  max-width: 1440px;
  margin: 0 auto;
}
.hero__badge {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 6px 12px 6px 8px;
  background: rgba(255, 255, 255, 0.08);
  border-radius: 999px;
  font-size: 12px;
  letter-spacing: 0.04em;
  margin-bottom: 32px;
}
.hero__badge-dot {
  width: 6px;
  height: 6px;
  border-radius: 999px;
  background: var(--h-green);
  box-shadow: 0 0 8px var(--h-green);
}
.hero__title {
  font-size: clamp(52px, 6vw, 88px);
  line-height: 0.98;
  font-weight: 700;
  letter-spacing: -0.035em;
  text-wrap: balance;
  font-family: var(--h-font-head);
  color: #fff;
}
.hero__title-accent {
  color: var(--h-cyan);
}
.hero__lead {
  margin-top: 24px;
  font-size: 20px;
  line-height: 1.45;
  color: rgba(255, 255, 255, 0.72);
  max-width: 540px;
}
.hero__cta-row {
  display: flex;
  gap: 10px;
  margin-top: 32px;
  flex-wrap: wrap;
}
.hero__brief {
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: var(--h-r-lg);
  padding: 24px;
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
}
.hero__brief-label {
  font-size: 11px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--h-cyan);
  font-weight: 640;
  margin-bottom: 14px;
  display: flex;
  align-items: center;
  gap: 8px;
}
.hero__brief-list {
  display: flex;
  flex-direction: column;
  gap: 14px;
  list-style: none;
  padding: 0;
  margin: 0;
}
.hero__brief-item {
  display: flex;
  gap: 12px;
  font-size: 14px;
  line-height: 1.35;
}
.hero__brief-num {
  color: rgba(255, 255, 255, 0.62); /* Wave 18: was 0.4 (3.6:1 on deep navy) → ≥7:1 */
  font-family: var(--h-font-mono);
  font-size: 11px;
  margin-top: 2px;
  flex-shrink: 0;
}
.hero__brief-text {
  color: rgba(255, 255, 255, 0.92);
}
.hero__brief-foot {
  margin-top: 20px;
  padding-top: 16px;
  border-top: 1px solid rgba(255, 255, 255, 0.1);
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 12px;
  color: rgba(255, 255, 255, 0.62); /* Wave 18: was 0.55 (~4.4:1 over the brief's lighter glass bg) → ≥5.5:1 */
}

/* =================== CATEGORY RAIL =================== */
.category-rail {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 24px 40px;
  border-bottom: 1px solid var(--h-border);
  overflow-x: auto;
  max-width: 1520px;
  margin: 0 auto;
}
.category-rail::-webkit-scrollbar {
  display: none;
}

/* =================== CHIPS =================== */
.chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: var(--h-bg-soft);
  color: var(--h-text);
  border: 1px solid transparent;
  border-radius: var(--h-r-pill);
  padding: 6px 12px;
  font-family: var(--h-font-body);
  font-size: 13px;
  font-weight: 520;
  letter-spacing: -0.005em;
  white-space: nowrap;
  text-decoration: none;
  cursor: pointer;
}
.chip--outline {
  background: transparent;
  border-color: var(--h-border-strong);
}
.chip--primary {
  background: var(--h-primary);
  color: #fff;
  border-color: var(--h-primary);
}
.chip--dark {
  background: var(--h-deep);
  color: #fff;
  border-color: var(--h-deep);
}
.chip--ghost {
  background: transparent;
  color: var(--h-text-muted);
  border-color: var(--h-border);
}
.chip--hot {
  background: rgba(249, 93, 81, 0.1);
  color: var(--h-red-text); /* Wave 18: brand red was 2.8:1 on the pink chip */
  border-color: rgba(249, 93, 81, 0.3);
}
.chip.active {
  background: var(--h-deep);
  color: #fff;
  border-color: var(--h-deep);
}
.chip--sm {
  font-size: 11px;
  padding: 4px 10px;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  font-weight: 620;
}

/* =================== BUTTONS =================== */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  background: var(--h-primary);
  color: #fff;
  border: 1px solid var(--h-primary);
  border-radius: var(--h-r-md);
  padding: 10px 18px;
  font-family: var(--h-font-body);
  font-size: 14px;
  font-weight: 580;
  letter-spacing: -0.005em;
  height: 40px;
  text-decoration: none;
  cursor: pointer;
  transition:
    background 0.15s,
    transform 0.1s;
}
.btn:hover {
  background: var(--h-primary-hover);
}
.btn:active {
  transform: translateY(1px);
}
.btn--sm {
  padding: 6px 12px;
  font-size: 13px;
  height: 30px;
}
.btn--lg {
  padding: 14px 24px;
  font-size: 15px;
  height: 48px;
}
.btn--dark {
  background: var(--h-deep);
  color: #fff;
  border-color: var(--h-deep);
}
.btn--outline {
  background: transparent;
  color: var(--h-text);
  border-color: var(--h-border-strong);
}
.btn--ghost {
  background: transparent;
  color: var(--h-text);
  border-color: transparent;
}
.btn--white {
  background: #fff;
  color: var(--h-deep);
  border-color: #fff;
}

/* =================== MAIN =================== */
.content {
  max-width: 1520px;
  margin: 0 auto;
  padding: 0 40px 80px;
}
.section-label {
  font-size: 11px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  font-weight: 640;
  color: var(--h-text-subtle);
}
.section-header {
  display: flex;
  flex-direction: column; /* JHA-FIX stack eyebrow/title/subtitle */
  align-items: flex-start;
  gap: 8px;
  padding: 48px 0 24px;
}
.section__header--centered {
  text-align: center;
  align-items: center;
}
.section-title {
  font-size: 28px;
  font-weight: 640;
  letter-spacing: -0.02em;
}

/* =================== CARDS =================== */
.featured-card {
  display: grid;
  grid-template-columns: 1.1fr 1fr;
  gap: 32px;
  padding: 32px 0;
  border-top: 1px solid var(--h-border);
  border-bottom: 1px solid var(--h-border);
}
.featured-card__image {
  aspect-ratio: 4/3;
  min-height: 320px;
  border-radius: var(--h-r-md);
  overflow: hidden;
}
.featured-card__image img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.6s cubic-bezier(0.2, 0.8, 0.2, 1);
}
.featured-card:hover .featured-card__image img {
  transform: scale(1.045);
}
.featured-card__title a {
  transition: color 0.18s ease;
}
.featured-card:hover .featured-card__title a {
  color: var(--h-link);
}
.featured-card__body {
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  padding: 8px 0;
}
.featured-card__chips {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 16px;
}
.featured-card__title {
  font-size: 44px;
  line-height: 1.05;
  font-weight: 640;
  letter-spacing: -0.025em;
  margin-bottom: 18px;
  text-wrap: balance;
}
.featured-card__title a {
  color: inherit;
}
.featured-card__dek {
  font-size: 18px;
  line-height: 1.5;
  color: var(--h-text-muted);
  margin-bottom: 20px;
  max-width: 520px;
}
.featured-card__meta {
  display: flex;
  align-items: center;
  gap: 14px;
  font-size: 13px;
  color: var(--h-text-muted);
  flex-wrap: wrap;
}
.meta-sep {
  opacity: 0.4;
}

/* Regular card */
.card {
  display: flex;
  flex-direction: column;
  gap: 14px;
  text-decoration: none;
  color: inherit;
}
.card__image {
  aspect-ratio: 16/10;
  border-radius: var(--h-r-md);
  overflow: hidden;
}
.card__image img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.55s cubic-bezier(0.2, 0.8, 0.2, 1);
}
.card:hover .card__image img {
  transform: scale(1.05);
}
.card__title {
  transition: color 0.18s ease;
}
.card:hover .card__title {
  color: var(--h-link);
}
.card__cat {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 11px;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  font-weight: 620;
  color: var(--h-link);
}
.card__title {
  font-size: 20px;
  line-height: 1.15;
  font-weight: 620;
  letter-spacing: -0.02em;
  text-wrap: balance;
  color: var(--h-text);
  margin: 0;
}
.card--sm .card__title {
  font-size: 17px;
}
.card--lg .card__title {
  font-size: 24px;
}
.card__dek {
  font-size: 14px;
  line-height: 1.5;
  color: var(--h-text-muted);
}
.card__meta {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 12px;
  color: var(--h-text-subtle);
  margin-top: auto;
  flex-wrap: wrap;
}

/* Compact card */
.compact-card {
  display: grid;
  grid-template-columns: 32px 1fr;
  gap: 14px;
  padding: 16px 0;
  border-bottom: 1px solid var(--h-divider);
  text-decoration: none;
  color: inherit;
}
.compact-card:last-child {
  border-bottom: none;
}
.compact-card__num {
  font-family: var(--h-font-head);
  font-size: 20px;
  font-weight: 700;
  color: var(--h-text-subtle);
  letter-spacing: -0.02em;
}
.compact-card__cat {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 11px;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  font-weight: 620;
  color: var(--h-link);
  margin-bottom: 8px;
}
.compact-card__title {
  font-size: 16px;
  font-weight: 600;
  line-height: 1.3;
  letter-spacing: -0.015em;
  margin: 0;
}
.compact-card__meta {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 12px;
  color: var(--h-text-subtle);
  margin-top: 8px;
}

/* List row (search results, tag page) */
.list-row {
  display: grid;
  grid-template-columns: 180px 1fr;
  gap: 24px;
  padding: 24px 0;
  border-bottom: 1px solid var(--h-border);
  text-decoration: none;
  color: inherit;
}
.list-row__image {
  aspect-ratio: 4/3;
  border-radius: var(--h-r-md);
  overflow: hidden;
}
.list-row__image img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}
.list-row__title {
  font-size: 22px;
  line-height: 1.2;
  letter-spacing: -0.02em;
  margin: 10px 0;
  text-wrap: balance;
}
.list-row__dek {
  font-size: 15px;
  line-height: 1.5;
  color: var(--h-text-muted);
  margin-bottom: 12px;
}
.list-row__meta {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 12px;
  color: var(--h-text-subtle);
  flex-wrap: wrap;
}

/* Source chip */
.source-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 13px;
  color: var(--h-text-muted);
  font-weight: 520;
}
.source-chip__dot {
  width: 8px;
  height: 8px;
  border-radius: 2px;
  flex-shrink: 0;
}

/* =================== TRENDING SIDEBAR =================== */
.sidebar-card {
  background: var(--h-bg-warm);
  border-radius: var(--h-r-lg);
  padding: 28px;
  margin-bottom: 24px;
}
.sidebar-card__label {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 11px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  font-weight: 640;
  color: var(--h-red-text); /* Wave 18: brand red was 2.9:1 on warm bg */
  margin-bottom: 16px;
}
.newsletter-card {
  background: var(--h-deep);
  color: #fff;
  border-radius: var(--h-r-lg);
  padding: 28px;
  position: relative;
  overflow: hidden;
}
.newsletter-card__glow {
  position: absolute;
  inset: 0;
  background: radial-gradient(circle at 20% 110%, var(--h-cyan) 0%, transparent 45%);
  opacity: 0.3;
  pointer-events: none;
}
.newsletter-card__inner {
  position: relative;
}
.newsletter-card__label {
  font-size: 11px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  font-weight: 640;
  color: var(--h-cyan);
  margin-bottom: 14px;
}
.newsletter-card__title {
  color: #fff;
  font-size: 22px;
  letter-spacing: -0.02em;
  margin-bottom: 12px;
  text-wrap: balance;
}
.newsletter-card__lead {
  font-size: 13px;
  color: rgba(255, 255, 255, 0.7);
  margin-bottom: 18px;
}
.newsletter-form {
  display: flex;
  gap: 6px;
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.15);
  border-radius: var(--h-r-md);
  padding: 5px;
}
.newsletter-form input {
  flex: 1;
  background: transparent;
  border: none;
  outline: none;
  color: #fff;
  font-size: 14px;
  padding: 6px 10px;
  font-family: var(--h-font-body);
}
.newsletter-form input::placeholder {
  color: rgba(255, 255, 255, 0.62); /* Wave 18: was 0.4 (3.6:1 on deep navy) → ≥7:1 */
}

/* =================== FOOTER =================== */
.footer {
  padding: 64px 40px 32px;
  background: var(--h-deep);
  color: rgba(255, 255, 255, 0.85);
}
.footer__inner {
  max-width: 1440px;
  margin: 0 auto;
  display: grid;
  grid-template-columns: 2fr 1fr 1fr 1fr;
  gap: 40px;
}
.footer__about {
  margin-top: 16px;
  max-width: 340px;
  color: rgba(255, 255, 255, 0.65);
  font-size: 14px;
  line-height: 1.55;
}
.footer__socials {
  display: flex;
  gap: 8px;
  margin-top: 20px;
}
.footer__social {
  width: 36px;
  height: 36px;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.08);
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  text-decoration: none;
}
.footer__col-title {
  font-size: 12px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: rgba(255, 255, 255, 0.62); /* Wave 18: was 0.5 (4.3:1 on deep navy) → ≥5.7:1 */
  font-weight: 600;
  margin-bottom: 16px;
}
.footer__col-links {
  display: flex;
  flex-direction: column;
  gap: 10px;
  list-style: none;
  padding: 0;
  margin: 0;
}
.footer__col-links a {
  font-size: 14px;
  color: rgba(255, 255, 255, 0.82);
  text-decoration: none;
}
.footer__col-links a:hover {
  color: #fff;
}
.footer__bottom {
  max-width: 1440px;
  margin: 48px auto 0;
  padding-top: 24px;
  border-top: 1px solid rgba(255, 255, 255, 0.08);
  display: flex;
  justify-content: space-between;
  font-size: 12px;
  color: rgba(255, 255, 255, 0.62); /* Wave 18: was 0.5 (4.3:1 on deep navy) → ≥5.7:1 */
  flex-wrap: wrap;
  gap: 20px;
}
.footer__bottom-links {
  display: flex;
  gap: 20px;
}
.footer__bottom-links a {
  color: inherit;
  text-decoration: none;
}

/* =================== RESPONSIVE =================== */
@media (max-width: 1024px) {
  .hero__inner {
    grid-template-columns: 1fr;
    gap: 40px;
  }
  .featured-card {
    grid-template-columns: 1fr;
  }
  .featured-card__title {
    font-size: 32px;
  }
  .content > .grid-3 {
    grid-template-columns: repeat(2, 1fr) !important;
  }
  .content > .split-2\\:1 {
    grid-template-columns: 1fr !important;
  }
  .footer__inner {
    grid-template-columns: 1fr 1fr;
  }
}
@media (max-width: 640px) {
  .nav {
    padding: 14px 20px;
    gap: 16px;
    flex-wrap: wrap;
  }
  .nav__links {
    display: none;
  }
  .nav__search {
    display: none;
  }
  .hero {
    padding: 24px 20px 28px;
  }
  .hero__inner {
    min-height: auto;
    gap: 22px;
  }
  .hero__title {
    font-size: 34px;
  }
  .hero__lead {
    margin-top: 14px;
    font-size: 15px;
    line-height: 1.4;
  }
  .hero__cta-row {
    margin-top: 18px;
  }
  .hero__brief {
    padding: 16px;
  }
  .hero__brief-list {
    gap: 10px;
  }
  .hero__brief-item {
    font-size: 13px;
  }
  /* Trim BRIEF to top-3 on mobile so the first article card clears the fold */
  .hero__brief-list .hero__brief-item:nth-child(n+4) {
    display: none;
  }
  .hero__brief-foot {
    margin-top: 14px;
    padding-top: 12px;
  }
  .category-rail {
    padding: 12px 20px;
  }
  .content {
    padding: 0 20px 60px;
  }
  .content > .grid-3 {
    grid-template-columns: 1fr !important;
  }
  .footer__inner {
    grid-template-columns: 1fr;
  }
  .footer__bottom {
    flex-direction: column;
    align-items: flex-start;
  }
}
@media (min-width: 1600px) {
  .content > .grid-3.wide-4 {
    grid-template-columns: repeat(4, 1fr) !important;
  }
}

/* Grid utilities */
.grid-3 {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 32px;
}
.split-2\:1 {
  display: grid;
  grid-template-columns: 2fr 1fr;
  gap: 48px;
  margin-top: 72px;
  padding-top: 48px;
  border-top: 1px solid var(--h-border);
}

/* =============================================================================
   ARTICLE PAGE
   ============================================================================= */
.reading-progress {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  height: 3px;
  background: var(--h-border);
  z-index: 20;
}
.reading-progress__fill {
  height: 100%;
  background: var(--h-primary);
  width: 0;
  transition: width 0.1s linear;
}
.article {
  display: grid;
  grid-template-columns: 56px 220px minmax(0, 1fr) 300px;
  gap: 32px;
  padding: 40px 40px 80px;
  max-width: 1440px;
  margin: 0 auto;
}
/* Without TOC (no h2/h3 in body), drop the 220px TOC column */
.article.article--no-toc {
  grid-template-columns: 56px minmax(0, 1fr) 300px;
}
.article__share {
  position: sticky;
  top: 40px;
  align-self: start;
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding-top: 8px;
  z-index: 5;
}
.article__share-btn {
  width: 40px;
  height: 40px;
  border-radius: var(--h-r-md);
  background: var(--h-bg);
  border: 1px solid var(--h-border);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--h-text);
  cursor: pointer;
  text-decoration: none;
}
.article__share-btn:hover {
  background: var(--h-bg-soft);
}
.article__share-font {
  font-family: var(--h-font-head);
  font-weight: 700;
  font-size: 13px;
  background: none;
}
.article__share-divider {
  height: 1px;
  background: var(--h-border);
  margin: 4px 6px;
}
.article__toc {
  position: sticky;
  top: 40px;
  align-self: start;
  padding-top: 8px;
  max-height: calc(100vh - 80px);
  overflow-y: auto;
}
.article__toc-label {
  font-size: 11px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  font-weight: 640;
  color: var(--h-text-subtle);
  margin-bottom: 18px;
}
.article__toc-list {
  display: flex;
  flex-direction: column;
  gap: 2px;
  list-style: none;
  padding: 0;
  margin: 0;
}
.article__toc-item {
  display: flex;
  gap: 10px;
  align-items: baseline;
  padding: 8px 0 8px 12px;
  margin-left: -12px;
  font-size: 13px;
  line-height: 1.35;
  color: var(--h-text-muted);
  font-weight: 440;
  border-left: 2px solid var(--h-border);
  text-decoration: none;
}
.article__toc-item:hover,
.article__toc-item.active {
  color: var(--h-text);
  font-weight: 600;
  border-left-color: var(--h-primary);
}
.article__toc-num {
  font-family: var(--h-font-mono);
  font-size: 10px;
  color: var(--h-text-subtle);
}
.article__body {
  max-width: 720px;
}
.article__source-chip {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 6px 12px;
  background: var(--h-bg-soft);
  border-radius: var(--h-r-pill);
  font-size: 12px;
  margin-bottom: 20px;
  text-decoration: none;
  color: var(--h-text);
}
.article__source-chip .source-chip__dot {
  width: 8px;
  height: 8px;
}
.article__source-chip-orig {
  color: var(--h-text-muted);
}
.article__breadcrumbs {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 13px;
  color: var(--h-text-subtle);
  margin-bottom: 16px;
}
.article__breadcrumbs a {
  color: inherit;
}
.article__breadcrumbs .current {
  color: var(--h-text);
  font-weight: 520;
}
.article__title {
  font-size: 48px;
  line-height: 1.05;
  letter-spacing: -0.03em;
  font-weight: 680;
  margin: 0 0 20px;
  text-wrap: balance;
}
.article__dek {
  font-size: 22px;
  line-height: 1.45;
  color: var(--h-text-muted);
  margin-bottom: 32px;
  font-family: var(--h-font-body);
  font-weight: 400;
}
.article__byline {
  display: flex;
  align-items: center;
  gap: 14px;
  padding-bottom: 24px;
  margin-bottom: 32px;
  border-bottom: 1px solid var(--h-border);
  font-size: 13px;
  color: var(--h-text-muted);
}
.article__author-avatar {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--h-primary), var(--h-cyan));
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--h-font-head);
  font-weight: 700;
  font-size: 14px;
  flex-shrink: 0;
}
.article__author-name {
  color: var(--h-text);
  font-weight: 600;
  font-size: 14px;
}
.article__author-role {
  font-size: 12px;
  color: var(--h-text-muted);
}
.article__byline-meta {
  margin-left: auto;
  display: flex;
  gap: 10px;
  align-items: center;
  font-size: 13px;
}
/* Wave 14 -- EEAT: AI-assistance disclosure badge under the byline
   (EU AI Act Art. 50). Subtle gray, links to /:lang/standards#ai. */
.ai-disclosure {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin: -20px 0 28px;
  font-size: 12px;
  line-height: 1.4;
  color: var(--h-text-subtle);
  text-decoration: none;
}
.ai-disclosure:hover {
  color: var(--h-text-muted);
  text-decoration: underline;
}
.ai-disclosure svg {
  flex-shrink: 0;
  opacity: 0.7;
}
.article__hero {
  aspect-ratio: 16/9;
  border-radius: var(--h-r-md);
  overflow: hidden;
  margin: 0 0 10px;
}
.article__hero img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}
.article__hero-caption {
  font-size: 12px;
  color: var(--h-text-subtle);
  margin: 0 0 32px;
}
.article__content {
  font-size: 19px;
  line-height: 1.75;
  color: var(--h-text);
  font-family: var(--h-font-body);
  max-width: 68ch; /* classic editorial measure (~646px at 19px Manrope) */
  /* Better hyphenation + smart-quote rendering */
  hyphens: auto;
  -webkit-hyphens: auto;
  text-rendering: optimizeLegibility;
  font-feature-settings: "liga", "kern";
}
.article__content p {
  margin: 0 0 24px;
}
/* Lede — first paragraph, larger, slightly heavier, with drop cap */
.article__content .article__lede {
  font-size: 22px;
  line-height: 1.55;
  font-weight: 460;
  color: var(--h-text);
  margin-bottom: 28px;
  letter-spacing: -0.005em;
}
.article__content .article__lede::first-letter {
  font-family: var(--h-font-head);
  font-size: 4.6em;
  line-height: 0.85;
  font-weight: 700;
  float: left;
  margin: 8px 14px 0 0;
  color: var(--h-link);
  letter-spacing: -0.04em;
}
/* Wave 17: paragraph opens with a digit/symbol — giant drop cap looks broken,
   SSR adds --nodrop and we reset ::first-letter back to normal flow.
   Doubled class beats the 720px media-query font-size override below. */
.article__content .article__lede.article__lede--nodrop::first-letter {
  font-family: inherit;
  font-size: inherit;
  line-height: inherit;
  font-weight: inherit;
  float: none;
  margin: 0;
  color: inherit;
  letter-spacing: inherit;
}
/* Pull quote — extends slightly into margin, breaks the column rhythm */
.article__pull-quote {
  position: relative;
  margin: 48px -32px;
  padding: 28px 32px 28px 56px;
  font-family: var(--h-font-head);
  font-size: 26px;
  line-height: 1.3;
  font-weight: 560;
  letter-spacing: -0.02em;
  color: var(--h-text);
  border-top: 2px solid var(--h-primary);
  border-bottom: 1px solid var(--h-border);
  background: var(--h-bg-warm);
  border-radius: var(--h-r-md);
}
.article__pull-quote::before {
  content: "";
  position: absolute;
  left: 18px;
  top: 18px;
  bottom: 18px;
  width: 4px;
  border-radius: 2px;
  background: var(--h-primary);
}
.article__pull-quote .article__pull-quote-mark {
  font-family: Georgia, "Times New Roman", serif;
  font-size: 64px;
  line-height: 0;
  position: relative;
  top: 14px;
  margin-right: 8px;
  color: var(--h-link);
  opacity: 0.3;
}
@media (max-width: 720px) {
  .article__pull-quote {
    margin: 32px 0;
    padding: 20px 20px 20px 40px;
    font-size: 20px;
  }
  .article__pull-quote::before {
    left: 12px;
  }
  .article__content .article__lede {
    font-size: 19px;
  }
  .article__content .article__lede::first-letter {
    font-size: 3.8em;
  }
}
.article__content h2 {
  font-size: 32px;
  margin: 48px 0 20px;
  letter-spacing: -0.025em;
  font-weight: 640;
}
.article__content h3 {
  font-size: 24px;
  margin: 32px 0 16px;
  letter-spacing: -0.02em;
  font-weight: 640;
}
.article__content a {
  color: var(--h-link);
  text-decoration: underline;
  text-decoration-thickness: 1px;
  text-underline-offset: 3px;
}
.article__content blockquote {
  margin: 32px 0;
  padding: 20px 24px;
  border-left: 3px solid var(--h-primary);
  background: var(--h-bg-warm);
  border-radius: 0 var(--h-r-md) var(--h-r-md) 0;
  font-size: 22px;
  line-height: 1.4;
  letter-spacing: -0.015em;
  font-family: var(--h-font-head);
  font-weight: 560;
}
.article__content ul,
.article__content ol {
  margin: 0 0 20px;
  padding-left: 24px;
}
.article__content li {
  margin-bottom: 8px;
}
.article__content img {
  width: 100%;
  border-radius: var(--h-r-md);
  margin: 24px 0;
}

/* Font size toggle via class on article body */
.article__body[data-font-size="s"] .article__content {
  font-size: 16px;
  line-height: 1.65;
}
.article__body[data-font-size="m"] .article__content {
  font-size: 18px;
  line-height: 1.7;
}
.article__body[data-font-size="l"] .article__content {
  font-size: 21px;
  line-height: 1.75;
}

/* Key Takeaways (AIO block) */
.key-takeaways {
  margin: 40px 0;
  padding: 24px;
  background: var(--h-bg-soft);
  border-radius: var(--h-r-lg);
  border: 1px solid var(--h-border);
}
.key-takeaways__label {
  font-size: 11px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  font-weight: 640;
  color: var(--h-link);
  margin-bottom: 14px;
  display: flex;
  align-items: center;
  gap: 8px;
}
.key-takeaways__list {
  margin: 0;
  padding-left: 18px;
  font-size: 15px;
  line-height: 1.7;
  color: var(--h-text);
}
.key-takeaways__list li {
  margin-bottom: 6px;
}

/* Q&A box (AIO-friendly, indexable by LLM crawlers) */
.qa-box {
  margin: 40px 0;
  padding: 24px;
  background: #fff;
  border-radius: var(--h-r-lg);
  border: 1px solid var(--h-border);
}
.qa-box__label {
  font-size: 11px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  font-weight: 640;
  color: var(--h-cyan-text); /* Wave 18: brand cyan was 2.6:1 on light bg */
  margin-bottom: 14px;
}
.qa-item {
  margin-bottom: 20px;
}
.qa-item:last-child {
  margin-bottom: 0;
}
.qa-item__q {
  font-size: 16px;
  font-weight: 640;
  color: var(--h-text);
  margin: 0 0 8px;
  letter-spacing: -0.01em;
}
.qa-item__a {
  font-size: 15px;
  line-height: 1.65;
  color: var(--h-text-muted);
  margin: 0;
}

/* Author card */
.author-card {
  margin-top: 48px;
  padding: 24px;
  border: 1px solid var(--h-border);
  border-radius: var(--h-r-lg);
  display: flex;
  gap: 20px;
}
.author-card__avatar {
  width: 56px;
  height: 56px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--h-primary), var(--h-cyan));
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--h-font-head);
  font-weight: 700;
  font-size: 22px;
  flex-shrink: 0;
}
.author-card__name {
  font-size: 16px;
  font-weight: 620;
}
.author-card__bio {
  font-size: 13px;
  color: var(--h-text-muted);
  margin: 2px 0 14px;
}
.author-card__actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

/* JSON-LD badge */
.jsonld-badge {
  margin-top: 16px;
  padding: 10px 14px;
  border-radius: var(--h-r-md);
  background: var(--h-bg-warm);
  font-size: 11px;
  font-family: var(--h-font-mono);
  color: var(--h-text-subtle);
  display: flex;
  align-items: center;
  gap: 8px;
}
.jsonld-badge-check {
  color: var(--h-green-text); /* Wave 18: brand green was 2.1:1 on light bg */
  font-size: 12px;
}

/* Article sidebar */
.article__sidebar {
  display: flex;
  flex-direction: column;
  gap: 32px;
}
.article__sidebar-label {
  font-size: 11px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  font-weight: 640;
  color: var(--h-text-subtle);
  margin-bottom: 14px;
}
.related-item {
  display: grid;
  grid-template-columns: 64px 1fr;
  gap: 12px;
  text-decoration: none;
  color: inherit;
  margin-bottom: 16px;
}
.related-item__image {
  aspect-ratio: 1;
  border-radius: var(--h-r-sm);
  overflow: hidden;
}
.related-item__image img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}
.related-item__cat {
  font-size: 10px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  font-weight: 640;
  color: var(--h-link);
  margin-bottom: 4px;
}
.related-item__title {
  font-size: 13px;
  line-height: 1.3;
  font-weight: 600;
  letter-spacing: -0.01em;
  margin: 0;
}
.trending-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}
.article__newsletter {
  padding: 20px;
  background: var(--h-bg-warm);
  border-radius: var(--h-r-lg);
}
.article__newsletter-label {
  font-size: 11px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  font-weight: 640;
  color: var(--h-link);
  margin-bottom: 10px;
}
.article__newsletter-title {
  font-size: 15px;
  line-height: 1.35;
  font-weight: 580;
  letter-spacing: -0.015em;
  margin-bottom: 12px;
}
.article__newsletter form {
  display: flex;
  gap: 6px;
  background: #fff;
  border-radius: var(--h-r-md);
  padding: 4px;
  border: 1px solid var(--h-border);
}
.article__newsletter input {
  flex: 1;
  border: none;
  outline: none;
  font-size: 13px;
  padding: 6px 10px;
  background: transparent;
  font-family: var(--h-font-body);
}

/* Read next + Comments */
.read-next {
  margin-top: 72px;
}
.read-next__label {
  font-size: 11px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  font-weight: 640;
  color: var(--h-text-subtle);
  margin-bottom: 20px;
}
.read-next__grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 24px;
}

.comments {
  margin-top: 64px;
  padding-top: 48px;
  border-top: 1px solid var(--h-border);
}
.comments__header {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  margin-bottom: 24px;
}
.comments__header h2 {
  font-size: 28px;
  letter-spacing: -0.02em;
}
.comments__count {
  color: var(--h-text-subtle);
  font-weight: 500;
}
.comments__input {
  padding: 16px;
  border: 1px solid var(--h-border);
  border-radius: var(--h-r-md);
  background: var(--h-surface);
  margin-bottom: 32px;
}
.comments__input-placeholder {
  font-size: 14px;
  color: var(--h-text-subtle);
  padding: 16px 0;
}
.comment {
  display: grid;
  grid-template-columns: 40px 1fr;
  gap: 16px;
  padding: 20px 0;
  border-bottom: 1px solid var(--h-divider);
}
.comment__avatar {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: var(--h-bg-soft);
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--h-font-head);
  font-weight: 600;
  font-size: 14px;
}
.comment__header {
  display: flex;
  gap: 10px;
  align-items: center;
  margin-bottom: 6px;
}
.comment__name {
  font-weight: 620;
  font-size: 14px;
}
.comment__time {
  font-size: 12px;
  color: var(--h-text-subtle);
}
.comment__body {
  font-size: 15px;
  line-height: 1.55;
  color: var(--h-text);
  margin: 0;
}
.comment__actions {
  display: flex;
  gap: 16px;
  margin-top: 10px;
  font-size: 12px;
  color: var(--h-text-muted);
}

/* Drop cap for first paragraph */
.article__content p:first-child::first-letter {
  font-family: var(--h-font-head);
  font-size: 72px;
  font-weight: 680;
  float: left;
  line-height: 0.9;
  margin-right: 10px;
  margin-top: 4px;
  color: var(--h-link);
  letter-spacing: -0.04em;
}

/* Article page responsive */
@media (max-width: 1200px) {
  .article,
  .article.article--no-toc {
    grid-template-columns: 56px minmax(0, 1fr) 280px;
  }
  .article__toc {
    display: none;
  }
}
@media (max-width: 900px) {
  .article,
  .article.article--no-toc {
    grid-template-columns: 1fr !important;
    padding: 20px 20px 60px;
    gap: 24px;
  }
  .article__share {
    flex-direction: row;
    position: static;
    overflow-x: auto;
  }
  .article__sidebar {
    order: 99;
  }
  .article__title {
    font-size: 32px;
  }
  .article__dek {
    font-size: 18px;
  }
  .article__content {
    font-size: 17px;
  }
  .read-next__grid {
    grid-template-columns: 1fr;
  }
}

/* =============================================================================
   AI DIALOG (floating button + bottom sheet)
   ============================================================================= */
.ai-fab {
  position: fixed;
  bottom: 24px;
  right: 24px;
  z-index: 20;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 12px 18px;
  background: var(--h-deep);
  color: #fff;
  border: 1px solid var(--h-cyan);
  border-radius: var(--h-r-pill);
  font-size: 14px;
  font-weight: 600;
  box-shadow: 0 8px 24px rgba(1, 3, 52, 0.25);
  cursor: pointer;
  transition:
    transform 0.15s,
    box-shadow 0.15s;
}
.ai-fab:hover {
  transform: translateY(-2px);
  box-shadow: 0 12px 32px rgba(1, 3, 52, 0.35);
}
.ai-fab[hidden] {
  display: none !important;
}
.ai-fab svg {
  color: var(--h-cyan);
}

.ai-dialog {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: flex;
  align-items: flex-end;
  justify-content: center;
}
.ai-dialog[hidden] {
  display: none !important;
}
.ai-dialog__backdrop {
  position: absolute;
  inset: 0;
  background: rgba(1, 3, 52, 0.55);
  backdrop-filter: blur(4px);
}
.ai-dialog__sheet {
  position: relative;
  width: 100%;
  max-width: 640px;
  max-height: 85vh;
  background: var(--h-bg);
  border-radius: var(--h-r-xl) var(--h-r-xl) 0 0;
  box-shadow: var(--h-shadow-lg);
  display: flex;
  flex-direction: column;
  animation: ai-sheet-up 0.25s ease-out;
}
@keyframes ai-sheet-up {
  from {
    transform: translateY(100%);
    opacity: 0;
  }
  to {
    transform: translateY(0);
    opacity: 1;
  }
}
.ai-dialog__header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  padding: 20px 24px 12px;
  border-bottom: 1px solid var(--h-border);
}
.ai-dialog__label {
  font-size: 11px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  font-weight: 640;
  color: var(--h-cyan-text); /* Wave 18: brand cyan was 2.6:1 on the light sheet */
  margin-bottom: 4px;
}
.ai-dialog__title {
  font-size: 22px;
  font-weight: 640;
  letter-spacing: -0.02em;
  margin: 0;
}
.ai-dialog__close {
  width: 36px;
  height: 36px;
  border-radius: var(--h-r-md);
  background: var(--h-bg-soft);
  border: none;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  color: var(--h-text);
}
.ai-dialog__quick {
  display: flex;
  gap: 8px;
  padding: 12px 24px;
  border-bottom: 1px solid var(--h-border);
  overflow-x: auto;
  scrollbar-width: none;
}
.ai-dialog__quick::-webkit-scrollbar {
  display: none;
}
.ai-dialog__chat {
  flex: 1;
  padding: 20px 24px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 12px;
  min-height: 120px;
}
.ai-dialog__chat:empty::before {
  content: "Задайте любой вопрос о статье — AI ответит на основе её содержания";
  color: var(--h-text-subtle);
  font-size: 14px;
  text-align: center;
  display: block;
  padding: 40px 20px;
}
.ai-msg {
  max-width: 85%;
  padding: 12px 16px;
  border-radius: var(--h-r-lg);
  font-size: 15px;
  line-height: 1.55;
  white-space: pre-wrap;
  word-wrap: break-word;
}
.ai-msg--user {
  align-self: flex-end;
  background: var(--h-primary);
  color: #fff;
  border-bottom-right-radius: 4px;
}
.ai-msg--assistant {
  align-self: flex-start;
  background: var(--h-bg-soft);
  color: var(--h-text);
  border-bottom-left-radius: 4px;
}
.ai-dialog__form {
  display: flex;
  gap: 8px;
  padding: 16px 24px 20px;
  border-top: 1px solid var(--h-border);
}
.ai-dialog__form textarea {
  flex: 1;
  padding: 10px 14px;
  border-radius: var(--h-r-md);
  border: 1px solid var(--h-border);
  outline: none;
  font-family: var(--h-font-body);
  font-size: 15px;
  resize: none;
  min-height: 44px;
  max-height: 120px;
}
.ai-dialog__form textarea:focus {
  border-color: var(--h-primary);
}
.ai-dialog__form button {
  height: 44px;
  width: 44px;
  padding: 0;
  flex-shrink: 0;
}

@media (max-width: 640px) {
  .ai-fab {
    bottom: 16px;
    right: 16px;
    padding: 10px 14px;
    font-size: 13px;
  }
  .ai-dialog__sheet {
    max-height: 92vh;
  }
  .ai-dialog__header {
    padding: 16px 20px 10px;
  }
  .ai-dialog__chat {
    padding: 16px 20px;
  }
  .ai-dialog__form {
    padding: 12px 20px 16px;
  }
}

/* Hide FAB when not on article page */
body:not(:has(.article-reader)) .ai-fab {
  display: none !important;
}

/* ============ Mobile burger menu ============ */
.nav__burger {
  display: none;
  background: none;
  border: 0;
  width: 40px;
  height: 40px;
  padding: 8px;
  cursor: pointer;
  align-items: center;
  justify-content: center;
  flex-direction: column;
  gap: 4px;
  flex-shrink: 0;
  color: inherit;
}
.nav__burger span {
  display: block;
  width: 22px;
  height: 2px;
  background: currentColor;
  transition:
    transform 0.2s,
    opacity 0.2s;
}
.nav--dark .nav__burger {
  color: #fff !important;
}
.nav--dark .nav__burger span {
  background: #fff !important;
}
.nav__burger span {
  background: currentColor !important;
}

.nav__burger[aria-expanded="true"] span:nth-child(1) {
  transform: translateY(6px) rotate(45deg);
}
.nav__burger[aria-expanded="true"] span:nth-child(2) {
  opacity: 0;
}
.nav__burger[aria-expanded="true"] span:nth-child(3) {
  transform: translateY(-6px) rotate(-45deg);
}

.nav__mobile-drawer {
  display: none;
  position: fixed;
  top: 68px;
  left: 0;
  right: 0;
  background: var(--h-bg, #fff);
  border-bottom: 1px solid var(--h-border);
  padding: 16px;
  flex-direction: column;
  gap: 4px;
  z-index: 100;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.08);
  max-height: calc(100vh - 68px);
  overflow-y: auto;
}
.nav--dark .nav__mobile-drawer {
  background: var(--h-deep, #010334);
  color: #fff;
  border-bottom-color: rgba(255, 255, 255, 0.08);
}
.nav__mobile-drawer.is-open {
  display: flex;
}
.nav__mobile-drawer a {
  padding: 14px 16px;
  font-size: 17px;
  font-weight: 600;
  color: inherit;
  text-decoration: none;
  border-radius: 10px;
}
.nav__mobile-drawer a:hover,
.nav__mobile-drawer a.active {
  background: var(--h-bg-soft, rgba(0, 0, 0, 0.04));
}
.nav--dark .nav__mobile-drawer a:hover,
.nav--dark .nav__mobile-drawer a.active {
  background: rgba(255, 255, 255, 0.08);
}

@media (max-width: 900px) {
  .nav__burger {
    display: inline-flex;
  }
  .nav__links {
    display: none !important;
  }
  .nav__search {
    display: none !important;
  }
  .nav__locales {
    display: none !important;
  }
}

/* ============ Bookmark button active state ============ */
.article__share-btn[data-bookmark].is-active,
button[data-bookmark].is-active {
  color: var(--h-link, #2d2fe8) !important;
}
.article__share-btn[data-bookmark].is-active::after,
button[data-bookmark].is-active::after {
  content: "";
  position: absolute;
  top: 4px;
  right: 4px;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--h-primary, #2d2fe8);
}

/* ============ AI dialog chat scroll ============ */
.ai-dialog__chat {
  max-height: 55vh;
  overflow-y: auto;
  scroll-behavior: smooth;
  padding-bottom: 8px;
}
.ai-dialog__sheet {
  max-height: 85vh;
  display: flex;
  flex-direction: column;
}

/* ============ Copy toast ============ */
.h-toast {
  position: fixed;
  left: 50%;
  bottom: 80px;
  transform: translateX(-50%) translateY(20px);
  background: #111;
  color: #fff;
  padding: 10px 18px;
  border-radius: 10px;
  font-size: 14px;
  opacity: 0;
  pointer-events: none;
  transition:
    opacity 0.2s,
    transform 0.2s;
  z-index: 10000;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.3);
}
.h-toast.is-shown {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
  pointer-events: auto;
}

/* ============ RTL support — Arabic ============ */
html[dir="rtl"] {
  direction: rtl;
  text-align: right;
}
html[dir="rtl"] body {
  text-align: right;
}
html[dir="rtl"] .nav__logo-slash {
  margin-left: 0;
  margin-right: 2px;
}
html[dir="rtl"] .nav__inner {
  flex-direction: row-reverse;
}
html[dir="rtl"] .category-rail {
  direction: rtl;
}
html[dir="rtl"] .hero__brief-num {
  margin-right: 0;
  margin-left: 12px;
}
html[dir="rtl"] .hero__brief-foot {
  flex-direction: row-reverse;
}
html[dir="rtl"] .hero__cta-row {
  flex-direction: row-reverse;
  justify-content: flex-end;
}
html[dir="rtl"] .featured-card,
html[dir="rtl"] .card,
html[dir="rtl"] .compact-card,
html[dir="rtl"] .list-row,
html[dir="rtl"] .related-item {
  text-align: right;
}
html[dir="rtl"] .article__share {
  /* Sidebar share buttons — flip to right side */
  right: auto;
  left: 24px;
}
html[dir="rtl"] .article__byline {
  flex-direction: row-reverse;
}
html[dir="rtl"] .article__byline-meta {
  margin-left: 0;
  margin-right: auto;
}
html[dir="rtl"] .article__source-chip-orig::before {
  content: "← ";
}
html[dir="rtl"] .article__source-chip-orig {
  /* Override the "→ оригинал" arrow if any */
}
html[dir="rtl"] .nav__search-kbd {
  margin-left: 0;
  margin-right: auto;
}
html[dir="rtl"] .source-chip {
  flex-direction: row-reverse;
}
html[dir="rtl"] .stories-rail__scroll {
  flex-direction: row-reverse;
}
html[dir="rtl"] .h-cmt {
  flex-direction: row-reverse;
}
html[dir="rtl"] .h-cmt-user-bar {
  flex-direction: row-reverse;
}
html[dir="rtl"] .breadcrumbs {
  flex-direction: row-reverse;
}
html[dir="rtl"] .key-takeaways {
  border-left: none;
  border-right: 4px solid var(--h-cyan);
  padding-left: 16px;
  padding-right: 20px;
}
html[dir="rtl"] .article__pull-quote {
  border-left: none;
  border-right: 4px solid var(--h-primary);
}
/* Forms — flip label/input direction */
html[dir="rtl"] .article__comment-form-row {
  flex-direction: row-reverse;
}
html[dir="rtl"] .nav__locales {
  flex-direction: row-reverse;
}

/* ─── JHA-222 / JHA-223 / JHA-227: engagement (audio + reactions + comments) ─── */
.article__engagement {
  margin: 32px 0;
  padding: 24px;
  background: var(--h-surface);
  border: 1px solid var(--h-border);
  border-radius: 16px;
}
.article__engagement-title {
  font-family: var(--h-font-head);
  font-size: 13px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--h-link);
  margin-bottom: 16px;
}
.article__reactions {
  display: flex;
  gap: 12px;
  margin-bottom: 20px;
}
.article__reactions-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 14px;
  background: var(--h-bg);
  color: var(--h-text);
  border: 1px solid var(--h-border);
  border-radius: 24px;
  font-family: inherit;
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.15s;
}
.article__reactions-btn[disabled] {
  cursor: default;
  opacity: 0.6;
}
.article__reactions-btn:not([disabled]):hover {
  border-color: var(--h-primary);
  color: var(--h-link);
}
.article__reactions-btn.is-active {
  background: var(--h-primary);
  border-color: var(--h-primary);
  color: #fff;
}
.article__reactions-btn.is-active:hover {
  background: var(--h-primary);
  color: #fff;
}

/* Public comment form */
.article__comment-form {
  margin-top: 24px;
  padding: 20px;
  border: 1px solid var(--h-border);
  border-radius: var(--h-r-md);
  background: var(--h-bg-warm);
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.article__comment-name-input,
.article__comment-text-input {
  width: 100%;
  padding: 10px 14px;
  border: 1px solid var(--h-border);
  border-radius: var(--h-r-sm, 10px);
  background: var(--h-bg);
  color: var(--h-text);
  font-family: inherit;
  font-size: 15px;
  line-height: 1.45;
  resize: vertical;
}
.article__comment-name-input:focus,
.article__comment-text-input:focus {
  outline: none;
  border-color: var(--h-primary);
  box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.12);
}
.article__comment-form-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
}
.article__comment-form-hint {
  font-size: 12px;
  color: var(--h-text-muted);
}
.article__comment-form-error {
  font-size: 13px;
  color: #d97757;
  background: rgba(217, 119, 87, 0.08);
  padding: 8px 12px;
  border-radius: 6px;
}
.article__audio {
  margin-bottom: 24px;
}
.article__audio audio {
  width: 100%;
  margin-top: 8px;
}
.article__audio-gen {
  padding: 10px 18px;
  background: var(--h-primary);
  color: #fff;
  border: 0;
  border-radius: 10px;
  font: inherit;
  font-weight: 600;
  cursor: pointer;
}
.article__audio-gen[disabled] {
  opacity: 0.5;
  cursor: wait;
}
.article__audio-error {
  margin-top: 8px;
  color: #c0392b;
  font-size: 13px;
}
.article__comments-title {
  font-family: var(--h-font-head);
  font-size: 22px;
  font-weight: 700;
  margin: 32px 0 16px;
}
.article__comments-empty {
  padding: 24px;
  text-align: center;
  color: var(--h-text-subtle);
  background: var(--h-bg);
  border-radius: 12px;
}
.article__comment {
  padding: 16px;
  background: var(--h-bg);
  border: 1px solid var(--h-border);
  border-radius: 12px;
  margin-bottom: 12px;
}
.article__comment-head {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 8px;
}
.article__comment-avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: var(--h-primary);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 13px;
  font-weight: 700;
  overflow: hidden;
  flex-shrink: 0;
}
.article__comment-avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}
.article__comment-name {
  font-weight: 600;
  font-size: 14px;
}
.article__comment-date {
  font-size: 12px;
  color: var(--h-text-subtle);
  margin-left: auto;
}
.article__comment-text {
  font-size: 15px;
  line-height: 1.55;
  color: var(--h-text);
  white-space: pre-wrap;
  word-wrap: break-word;
}
.article__comment-score {
  margin-top: 8px;
  font-size: 12px;
  color: var(--h-text-subtle);
}
.article__comments-cta {
  margin-top: 16px;
  padding: 16px;
  background: var(--h-bg-warm);
  border: 1px dashed var(--h-border-strong);
  border-radius: 12px;
  font-size: 14px;
  text-align: center;
  color: var(--h-text-subtle);
}
.article__comments-cta a {
  color: var(--h-link);
  font-weight: 600;
  text-decoration: none;
}

/* ======= Stories rail (home page) — editorial style ======= */
.stories-rail {
  margin: 24px -40px 32px;
  padding: 0 40px;
  overflow: hidden;
  position: relative;
}
.stories-rail__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 12px;
}
.stories-rail__label {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--h-link);
}
.stories-rail__scroll {
  display: flex;
  gap: 18px;
  overflow-x: auto;
  scroll-snap-type: x mandatory;
  scrollbar-width: none;
  padding: 4px 4px 16px;
  -webkit-overflow-scrolling: touch;
}
.stories-rail__scroll::-webkit-scrollbar {
  display: none;
}
.story-tile {
  flex: 0 0 auto;
  width: 132px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  text-decoration: none;
  color: var(--h-text);
  scroll-snap-align: start;
  cursor: pointer;
  transition: transform 0.18s ease;
}
.story-tile:hover {
  transform: translateY(-2px);
}
.story-tile:hover .story-tile__title {
  color: var(--h-link);
}
/* Viewed stories: keep the brand ring color, just recede — don't gray out */
.story-tile.story-tile--seen .story-tile__ring {
  opacity: 0.3;
}
.story-tile.story-tile--seen .story-tile__title {
  color: var(--h-text-subtle);
}
.story-tile__ring {
  position: relative;
  width: 88px;
  height: 88px;
  border-radius: 50%;
  padding: 3px;
  display: block;
  flex-shrink: 0;
}
.story-tile__ring--muted {
  opacity: 0.85;
}
.story-tile__inner {
  border-radius: 50%;
  background: var(--h-bg, #faf7f2);
  border: 3px solid var(--h-bg, #faf7f2);
  overflow: hidden;
  display: block;
  position: absolute;
  inset: 3px;
}
.story-tile__inner img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}
.story-tile__badge {
  position: absolute;
  bottom: -2px;
  left: 50%;
  transform: translateX(-50%);
  font-size: 9px;
  font-weight: 800;
  letter-spacing: 0.1em;
  padding: 2px 8px;
  background: var(--h-cyan);
  color: #fff;
  border-radius: 999px;
  border: 2px solid var(--h-bg, #faf7f2);
  line-height: 1.2;
}
.story-tile__source {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--h-link);
  text-align: center;
  max-width: 132px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.story-tile__title {
  font-size: 12px;
  line-height: 1.3;
  color: var(--h-text);
  text-align: center;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  max-width: 132px;
  transition: color 0.15s ease;
}
@media (max-width: 720px) {
  .stories-rail {
    margin: 16px -16px 24px;
    padding: 0 16px;
  }
  .story-tile {
    width: 108px;
  }
  .story-tile__ring {
    width: 76px;
    height: 76px;
  }
  .story-tile__title {
    font-size: 11px;
    -webkit-line-clamp: 2;
  }
}

/* Stories full-screen viewer */
.stories-viewer {
  position: fixed;
  inset: 0;
  z-index: 9999;
  background: rgba(20, 16, 12, 0.96);
  display: none;
  align-items: stretch;
  justify-content: center;
  padding: 24px;
  -webkit-tap-highlight-color: transparent;
}
.stories-viewer[hidden] {
  display: none;
}
.stories-viewer.is-open {
  display: flex;
}
.stories-viewer__progress {
  position: absolute;
  top: 16px;
  left: 16px;
  right: 16px;
  display: flex;
  gap: 4px;
  z-index: 2;
}
.stories-viewer__progress-bar {
  flex: 1;
  height: 3px;
  background: rgba(255, 255, 255, 0.25);
  border-radius: 2px;
  overflow: hidden;
}
.stories-viewer__progress-fill {
  height: 100%;
  background: #fff;
  width: 0;
  transition: width 0.1s linear;
}
.stories-viewer__close {
  position: absolute;
  top: 12px;
  right: 12px;
  z-index: 3;
  width: 36px;
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.12);
  color: #fff;
  border: none;
  font-size: 22px;
  cursor: pointer;
  line-height: 1;
}
.stories-viewer__close:hover {
  background: rgba(255, 255, 255, 0.2);
}
.stories-viewer__card {
  width: 100%;
  max-width: 420px;
  height: min(720px, 90vh);
  margin-top: 32px;
  border-radius: 16px;
  overflow: hidden;
  position: relative;
  background: #1a1612;
  display: flex;
  flex-direction: column;
}
.stories-viewer__image {
  position: absolute;
  inset: 0;
  background-size: cover;
  background-position: center;
}
.stories-viewer__image::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(
    180deg,
    rgba(0, 0, 0, 0.05) 0%,
    rgba(0, 0, 0, 0.05) 60%,
    rgba(0, 0, 0, 0.85) 100%
  );
}
.stories-viewer__body {
  position: relative;
  margin-top: auto;
  padding: 24px;
  color: #fff !important;
  z-index: 3;
  background: linear-gradient(
    180deg,
    transparent 0%,
    rgba(0, 0, 0, 0.65) 30%,
    rgba(0, 0, 0, 0.92) 100%
  );
}
.stories-viewer__source {
  font-size: 12px !important;
  font-weight: 700 !important;
  color: rgba(255, 255, 255, 0.85) !important;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  margin-bottom: 10px;
}
.stories-viewer__title {
  font-size: clamp(20px, 3.6vw, 26px) !important;
  font-weight: 700 !important;
  line-height: 1.25;
  margin: 0 0 18px !important;
  letter-spacing: -0.02em;
  color: #fff !important;
  text-shadow: 0 2px 16px rgba(0, 0, 0, 0.4);
}
.stories-viewer__cta {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: #fff;
  color: #1a1612 !important;
  padding: 11px 20px;
  border-radius: 999px;
  text-decoration: none;
  font-weight: 700;
  font-size: 14px;
  position: relative;
  z-index: 4;
}
.stories-viewer__cta:hover {
  background: rgba(255, 255, 255, 0.92);
  transform: translateY(-1px);
}
.stories-viewer__nav {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 30%; /* leave bottom 30% for body+CTA so they're clickable */
  display: grid;
  grid-template-columns: 1fr 1fr;
  z-index: 2;
}
.stories-viewer__nav button {
  background: transparent;
  border: 0;
  cursor: pointer;
}

/* ============================================================
   Reduced motion — respect user OS-level setting
   ============================================================ */
@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
  .card:hover .card__image img,
  .featured-card:hover .featured-card__image img,
  .story-tile:hover {
    transform: none !important;
  }
  /* Wave 18: scroll-reveal, hero settle-zoom, rail glide and the sticky
     artbar slide must not move — content appears in place. */
  .reveal,
  .is-visible {
    opacity: 1 !important;
    transform: none !important;
  }
  .article__hero img,
  .category-rail__indicator,
  .artbar,
  .continue-bar,
  .page-enter {
    transition: none !important;
    animation: none !important;
  }
  html {
    scroll-behavior: auto;
  }
}

/* ============================================================
   Small phones (<480px) — final responsive layer
   ============================================================ */
@media (max-width: 480px) {
  /* Tighter padding */
  .article {
    padding: 16px 16px 64px;
    gap: 16px;
  }
  /* Stack vertically — drop sidebars */
  .article,
  .article.article--no-toc {
    grid-template-columns: 1fr;
  }
  /* Hide left rail on phone — actions move to a sticky bottom bar */
  .article__share {
    position: static;
    flex-direction: row;
    flex-wrap: wrap;
    margin: 0 0 12px;
  }
  .article__share-divider {
    display: none;
  }
  .article__sidebar {
    display: none;
  }
  /* Smaller article title on phone */
  .article__title {
    font-size: 32px;
    line-height: 1.1;
    letter-spacing: -0.02em;
  }
  .article__dek {
    font-size: 17px;
  }
  /* Body type — slightly smaller for phone reading */
  .article__content {
    font-size: 17px;
    line-height: 1.7;
  }
  .article__content .article__lede {
    font-size: 18px;
  }
  .article__content .article__lede::first-letter {
    font-size: 3.4em;
  }
  /* Hero image — full bleed on phone */
  .article__hero {
    margin: 0 -16px 16px;
    border-radius: 0;
  }
  /* Nav: hide desktop links, keep theme + burger + user */
  .nav__inner {
    padding: 12px 16px;
  }
  .nav__links,
  .nav__locales,
  .nav__search-kbd {
    display: none;
  }
  .nav__search {
    width: 40px;
    padding: 0;
    justify-content: center;
  }
  .nav__search span:not(.nav__search-kbd) {
    display: none;
  }
  /* Section padding scales down */
  .content {
    padding: 0 16px;
  }
  /* Cards: full-width grids → single column */
  .grid-3 {
    grid-template-columns: 1fr;
    gap: 24px;
  }
  /* Featured card stacks */
  .featured-card {
    grid-template-columns: 1fr;
    gap: 16px;
    padding: 24px 0;
  }
  .featured-card__title {
    font-size: 28px;
  }
  .featured-card__image {
    min-height: 220px;
  }
  /* Hero rail */
  .hero {
    padding: 32px 16px 48px;
  }
  /* Pull quote — full bleed on phone */
  .article__pull-quote {
    margin: 32px -16px;
    padding: 20px 20px 20px 36px;
    font-size: 19px;
    border-radius: 0;
  }
  /* Touch target — buttons get min 44×44 for accessibility */
  .btn,
  .chip,
  .nav__user,
  .nav__theme,
  .article__share-btn,
  .article__reactions-btn {
    min-height: 44px;
  }
}

/* ============================================================
   Smooth scroll fallback (when motion not reduced)
   ============================================================ */
@media (prefers-reduced-motion: no-preference) {
  html {
    scroll-behavior: smooth;
  }
}

/* ============================================================
   Continue-reading floating bar (article pages)
   ============================================================ */
.continue-bar {
  position: fixed;
  left: 50%;
  bottom: 16px;
  transform: translateX(-50%) translateY(160%);
  width: min(640px, calc(100vw - 32px));
  background: var(--h-bg);
  color: var(--h-text);
  border: 1px solid var(--h-border);
  border-radius: 999px;
  box-shadow:
    0 12px 32px rgba(0, 0, 0, 0.12),
    0 2px 8px rgba(0, 0, 0, 0.06);
  padding: 8px 12px 8px 16px;
  display: flex;
  align-items: center;
  gap: 12px;
  z-index: 90;
  transition:
    transform 0.35s cubic-bezier(0.2, 0.8, 0.2, 1),
    opacity 0.25s ease;
  opacity: 0;
}
.continue-bar.is-visible {
  transform: translateX(-50%) translateY(0);
  opacity: 1;
}
.continue-bar__progress {
  width: 28px;
  height: 28px;
  flex-shrink: 0;
  position: relative;
}
.continue-bar__progress svg {
  width: 100%;
  height: 100%;
  transform: rotate(-90deg);
}
.continue-bar__progress circle {
  fill: none;
  stroke-width: 2.4;
}
.continue-bar__progress-track {
  stroke: var(--h-border);
}
.continue-bar__progress-fill {
  stroke: var(--h-primary);
  stroke-linecap: round;
  transition: stroke-dashoffset 0.18s ease;
}
.continue-bar__text {
  flex: 1;
  font-size: 13px;
  line-height: 1.3;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: var(--h-text-muted);
}
.continue-bar__text strong {
  color: var(--h-text);
  font-weight: 600;
}
.continue-bar__close {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  border: 0;
  background: var(--h-bg-soft);
  color: var(--h-text-muted);
  cursor: pointer;
  font-size: 18px;
  line-height: 1;
  flex-shrink: 0;
}
.continue-bar__close:hover {
  background: var(--h-border);
  color: var(--h-text);
}
@media (max-width: 480px) {
  .continue-bar {
    bottom: 8px;
    padding: 6px 8px 6px 12px;
  }
  .continue-bar__text {
    font-size: 12px;
  }
}

/* ============================================================
 * Audio player (Sprint 5.1) — used on article pages.
 * Mirrors mini-app .ap styles.
 * ============================================================ */
.ap-block {
  margin: 24px 0;
  padding: 20px;
  background: linear-gradient(135deg, rgba(99, 102, 241, 0.08), rgba(0, 180, 200, 0.06));
  border: 1px solid rgba(99, 102, 241, 0.15);
  border-radius: 16px;
}
.ap-block__head {
  font-family: var(--h-font-display, "Georgia", serif);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--h-link);
  margin-bottom: 12px;
  display: flex;
  align-items: center;
  gap: 10px;
}
.ap {
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.ap__row {
  display: flex;
  align-items: center;
  gap: 10px;
}
.ap__btn {
  flex-shrink: 0;
  width: 38px;
  height: 38px;
  border-radius: 50%;
  background: var(--h-bg);
  border: 1px solid var(--h-border);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--h-text);
  font-size: 14px;
  transition: transform 0.1s, background 0.15s;
}
.ap__btn:hover {
  background: var(--h-bg-soft);
}
.ap__btn:active {
  transform: scale(0.92);
}
.ap__btn--play {
  width: 50px;
  height: 50px;
  background: var(--h-primary);
  color: #fff;
  border-color: var(--h-primary);
  font-size: 18px;
}
.ap__btn--play:hover {
  background: var(--h-primary);
  filter: brightness(1.08);
}
.ap__btn--small {
  width: 36px;
  height: 36px;
  font-size: 11px;
  font-weight: 600;
}
.ap__progress {
  flex: 1;
  position: relative;
  height: 5px;
  background: var(--h-border);
  border-radius: 3px;
  cursor: pointer;
}
.ap__progress-fill {
  position: absolute;
  left: 0;
  top: 0;
  height: 100%;
  background: var(--h-primary);
  border-radius: 3px;
  width: 0%;
  transition: width 0.1s linear;
}
.ap__progress-thumb {
  position: absolute;
  top: 50%;
  transform: translate(-50%, -50%);
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: var(--h-primary);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.15s;
}
.ap__progress:hover .ap__progress-thumb {
  opacity: 1;
}
.ap__time {
  font-size: 12px;
  color: var(--h-text-muted);
  font-variant-numeric: tabular-nums;
  min-width: 40px;
}
.ap__time--right {
  text-align: right;
}
.ap__speed {
  background: transparent;
  border: 1px solid var(--h-border);
  border-radius: 8px;
  font-size: 12px;
  font-weight: 600;
  padding: 4px 10px;
  color: var(--h-text);
  cursor: pointer;
}
.ap__speed:hover {
  background: var(--h-bg-soft);
}
.ap__gen-btn {
  width: 100%;
  padding: 12px 16px;
  background: var(--h-primary);
  color: #fff;
  border: 0;
  border-radius: 10px;
  font-weight: 600;
  font-size: 14px;
  cursor: pointer;
}
.ap__gen-btn:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}
.ap__error {
  color: var(--h-error, #d33);
  font-size: 13px;
}
@media (max-width: 480px) {
  .ap-block {
    margin: 18px -8px;
    padding: 16px;
    border-radius: 12px;
  }
  .ap__btn {
    width: 36px;
    height: 36px;
  }
  .ap__btn--play {
    width: 46px;
    height: 46px;
  }
  .ap__btn--small {
    width: 32px;
    height: 32px;
    font-size: 10px;
  }
}

/* ============================================================
   Cases page — case-card design (added to design system)
   ============================================================ */
.cases-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 24px;
  margin-top: 32px;
}
@media (max-width: 880px) { .cases-grid { grid-template-columns: 1fr; } }

.case-card {
  display: flex;
  flex-direction: column;
  gap: 16px;
  padding: 32px 28px;
  background: #fff;
  border: 1px solid var(--h-border);
  border-radius: 20px;
  text-decoration: none;
  color: inherit;
  transition: transform 0.2s, box-shadow 0.2s, border-color 0.2s;
  min-height: 380px; /* JHA-FIX uniform grid rows */
}
.case-card:hover {
  transform: translateY(-3px);
  box-shadow: 0 16px 36px rgba(0,0,0,0.06);
  border-color: var(--h-text);
}
.case-card__icon {
  font-size: 32px;
  line-height: 1;
  width: 56px;
  height: 56px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--h-bg-warm);
  border-radius: 14px;
}
.case-card__industry {
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--h-text-muted);
}
.case-card__title {
  font-size: 22px;
  font-weight: 700;
  line-height: 1.25;
  letter-spacing: -0.015em;
  margin: 0;
  color: var(--h-text);
  display: -webkit-box;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 3;
  line-clamp: 3;
  overflow: hidden;
  min-height: calc(1.25em * 2); /* reserve ≥2 lines */
}
.case-card__result {
  font-size: 15px;
  line-height: 1.55;
  color: var(--h-text-muted);
  margin: 0;
  display: -webkit-box;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 3;
  line-clamp: 3;
  overflow: hidden;
}
.case-card__metrics {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px;
  margin-top: auto;
  padding-top: 16px;
  border-top: 1px solid var(--h-border);
}
.case-card__metrics > div {
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.case-card__metric-value {
  font-size: 22px;
  font-weight: 800;
  letter-spacing: -0.02em;
  color: var(--h-text);
  font-variant-numeric: tabular-nums;
}
.case-card__metric-label {
  font-size: 11px;
  font-weight: 600;
  color: var(--h-text-subtle);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  line-height: 1.3;
}

/* Mobile/tablet responsive — show nav scroll bar (base hides at 900px) */
@media (max-width: 900px) {
  .nav__inner {
    flex-wrap: wrap !important;
    gap: 12px;
  }
  .nav__links {
    display: flex !important;
    width: 100%;
    order: 3;
    gap: 14px;
    overflow-x: auto;
    scrollbar-width: none;
    padding: 4px 0 6px;
    border-top: 1px solid var(--h-border);
    margin-top: 4px;
  }
  .nav__links::-webkit-scrollbar { display: none; }
  .nav__links a {
    flex-shrink: 0;
    font-size: 14px;
  }
}
@media (max-width: 480px) {
  .case-card { padding: 24px 20px; }
  .case-card__title { font-size: 19px; }
  .case-card__metrics { grid-template-columns: 1fr 1fr; }
  .case-card__metric-value { font-size: 18px; }
}

/* Lang switcher — pill row of small buttons */
.lang-switch,
#lang-switcher {
  display: inline-flex !important;
  align-items: center;
  gap: 2px;
  padding: 3px;
  background: var(--h-bg-warm);
  border-radius: 999px;
  border: 1px solid var(--h-border);
}
.nav__lang-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 32px;
  height: 26px;
  padding: 0 8px;
  border: 0;
  background: transparent;
  color: var(--h-text-muted);
  font-family: inherit;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.04em;
  border-radius: 999px;
  cursor: pointer;
  transition: background 0.15s, color 0.15s;
  line-height: 1;
}
.nav__lang-btn:hover {
  background: rgba(0, 0, 0, 0.04);
  color: var(--h-text);
}
.nav__lang-btn--active,
.nav__lang-btn.active {
  background: var(--h-text);
  color: #fff;
}

/* Footer — proper grid layout (template uses __brand/__group classes) */
.footer__inner {
  display: grid;
  grid-template-columns: 1.4fr 2fr;
  gap: 64px;
  max-width: 1280px;
  margin: 0 auto;
  padding: 64px 24px 32px;
}
@media (max-width: 880px) {
  .footer__inner { grid-template-columns: 1fr; gap: 32px; padding: 40px 20px 24px; }
}
.footer__brand h3 {
  font-size: 22px;
  font-weight: 700;
  letter-spacing: -0.015em;
  margin: 0 0 12px;
  color: #fff;
}
.footer__brand p {
  font-size: 14px;
  line-height: 1.6;
  color: rgba(255, 255, 255, 0.6);
  margin: 0;
  max-width: 360px;
}
.footer__links {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 24px;
}
@media (max-width: 600px) { .footer__links { grid-template-columns: repeat(2, 1fr); } }
.footer__group {
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.footer__group h4 {
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: rgba(255, 255, 255, 0.62); /* Wave 18: was 0.45 (4.4:1 on deep navy) → ≥7:1 */
  margin: 0 0 6px;
}
.footer__group a {
  font-size: 14px;
  color: rgba(255, 255, 255, 0.85);
  text-decoration: none;
  transition: color 0.15s;
  line-height: 1.5;
}
.footer__group a:hover { color: #fff; text-decoration: underline; text-underline-offset: 4px; }
.footer__bottom {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 12px;
  padding: 24px;
  max-width: 1280px;
  margin: 0 auto;
  border-top: 1px solid rgba(255, 255, 255, 0.08);
  font-size: 13px;
  color: rgba(255, 255, 255, 0.62); /* Wave 18: was 0.5 (4.3:1 on deep navy) → ≥5.7:1 */
}
.footer__bottom a {
  color: rgba(255, 255, 255, 0.7);
  text-decoration: none;
  transition: color 0.15s;
}
.footer__bottom a:hover { color: #fff; }

/* Article-actions states (article-actions.js targets) */
.article__share-btn.is-active {
  color: var(--h-coral, #e85a3c);
  background: rgba(232, 90, 60, 0.1);
}
.article__share-btn.article__share-btn[data-font].is-active {
  background: var(--h-text) !important;
  color: var(--h-bg, #fff) !important;
}
.article__body[data-font-size="s"] { font-size: 15px; line-height: 1.65; }
.article__body[data-font-size="m"] { font-size: 17px; line-height: 1.7; }
.article__body[data-font-size="l"] { font-size: 19px; line-height: 1.75; }


@media (max-width: 640px) {
  .section-header {
    flex-direction: column;
    align-items: flex-start;
    gap: 8px;
  }
}


/* ============================================================================
   Dark theme — override CSS custom properties on html.h-theme-dark.
   Brand v2 uses var(--h-bg/--h-text/etc) everywhere → flip vars and the
   whole site re-themes automatically. No per-element rules needed.
   ============================================================================ */
html.h-theme-dark {
  color-scheme: dark;
  --h-bg: #0a0a0a;
  --h-bg-soft: #161616;
  --h-bg-warm: #1a1a1a;
  --h-surface: #161616;
  --h-border: #262626;
  --h-border-strong: #383838;
  --h-divider: #1f1f1f;
  --h-text: #f0f0f0;
  --h-text-muted: #b8b8b8;
  --h-text-subtle: #8c8c8c; /* Wave 18: was #808080 (4.4:1 on #1a1a1a) → ≥5.2:1 */
  --h-text-inverse: #0a0a0a;
  /* Wave 18 — accent text flips back to bright values on dark surfaces */
  --h-link: #8a8cff;
  --h-focus-ring: #29a9ff;
  --h-red-text: #f95d51;
  --h-green-text: #62c584;
  --h-cyan-text: #29a9ff;
}
html.h-theme-dark body {
  background: var(--h-bg);
  color: var(--h-text);
}
/* Specific overrides for elements with hardcoded colors */
html.h-theme-dark .article__share-btn {
  background: var(--h-bg-soft);
  border-color: var(--h-border);
  color: var(--h-text-muted);
}
html.h-theme-dark .article__share-btn:hover {
  background: var(--h-bg-warm);
  color: var(--h-text);
}
html.h-theme-dark .article__share-btn[data-font].is-active {
  background: var(--h-text);
  color: var(--h-bg);
}
html.h-theme-dark .nav,
html.h-theme-dark .footer {
  background: #050505;
}
html.h-theme-dark .nav__lang-btn--active,
html.h-theme-dark .nav__lang-btn.active,
html[data-theme="dark"] .nav__lang-btn--active,
html[data-theme="dark"] .nav__lang-btn.active {
  /* Wave 18: also match [data-theme="dark"] alone — base rule's #fff text
     on a near-white --h-text pill was 1.07:1 in dark mode */
  background: var(--h-text);
  color: var(--h-bg);
}
html.h-theme-dark .card,
html.h-theme-dark .featured-card,
html.h-theme-dark .case-card,
html.h-theme-dark .news-card,
html.h-theme-dark .sidebar-card,
html.h-theme-dark .newsletter-card {
  background: var(--h-surface);
  border-color: var(--h-border);
}
html.h-theme-dark .card:hover,
html.h-theme-dark .featured-card:hover,
html.h-theme-dark .case-card:hover {
  border-color: var(--h-border-strong);
}
html.h-theme-dark .chip {
  border-color: var(--h-border);
  color: var(--h-text-muted);
}
html.h-theme-dark .chip:hover { color: var(--h-text); border-color: var(--h-border-strong); }
html.h-theme-dark .chip.active,
html.h-theme-dark .chip--primary {
  background: var(--h-text);
  color: var(--h-bg);
  border-color: var(--h-text);
}

/* === Reactions block (article bottom) === */
.article__reactions .reaction-btn {
  font-family: inherit;
  font-size: 14px;
  line-height: 1;
  cursor: pointer;
  transition: background .15s, border-color .15s, color .15s;
}
.article__reactions .reaction-btn:hover {
  border-color: var(--h-text);
}
.article__reactions .reaction-btn.is-active {
  background: var(--h-text);
  color: var(--h-bg);
  border-color: var(--h-text);
}
.article__reactions .reaction-btn.is-active [data-reaction-count] {
  color: rgba(255,255,255,.7);
}

/* === AI Dialog FAB + Modal (article page) === */
.ai-dialog-fab {
  position: fixed;
  bottom: 24px;
  right: 24px;
  z-index: 90;
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 14px 20px 14px 18px;
  background: var(--h-primary, #2D2FE8);
  color: #fff;
  border: none;
  border-radius: 999px;
  font: inherit;
  font-size: 14px;
  font-weight: 620;
  letter-spacing: -0.005em;
  cursor: pointer;
  box-shadow: 0 12px 32px rgba(45,47,232,.35), 0 4px 12px rgba(0,0,0,.12);
  transition: transform .15s ease, box-shadow .15s ease;
}
.ai-dialog-fab:hover {
  transform: translateY(-2px);
  box-shadow: 0 18px 40px rgba(45,47,232,.45), 0 6px 16px rgba(0,0,0,.16);
}
.ai-dialog-fab svg { flex-shrink: 0; }
@media (max-width: 720px) {
  .ai-dialog-fab { bottom: 16px; right: 16px; padding: 12px; }
  .ai-dialog-fab__label { display: none; }
}
.ai-dialog-overlay {
  position: fixed;
  inset: 0;
  z-index: 100;
  background: rgba(1,3,52,.55);
  -webkit-backdrop-filter: blur(8px);
  backdrop-filter: blur(8px);
  display: flex;
  align-items: center;
  justify-content: flex-end;
  padding: 20px;
}
.ai-dialog-overlay[hidden] { display: none; }
.ai-dialog {
  width: 100%;
  max-width: 440px;
  max-height: 90vh;
  display: flex;
  flex-direction: column;
  background: var(--h-bg, #fff);
  border: 1px solid var(--h-border, #e5e7eb);
  border-radius: 16px;
  box-shadow: 0 24px 60px rgba(0,0,0,.35);
  overflow: hidden;
}
.ai-dialog__head {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 16px 18px;
  background: var(--h-deep, #010334);
  color: #fff;
  border-bottom: 1px solid rgba(255,255,255,.08);
}
.ai-dialog__head-icon {
  width: 32px; height: 32px;
  border-radius: 8px;
  background: linear-gradient(135deg, var(--h-cyan, #29A9FF), var(--h-primary, #2D2FE8));
  display: flex; align-items: center; justify-content: center;
  color: #fff;
  flex-shrink: 0;
}
.ai-dialog__head-text { flex: 1; min-width: 0; }
.ai-dialog__head-title { font-size: 14px; font-weight: 620; line-height: 1.2; }
.ai-dialog__head-sub { font-size: 11px; color: rgba(255,255,255,.6); margin-top: 2px; }
.ai-dialog__close {
  width: 32px; height: 32px;
  border-radius: 8px;
  background: rgba(255,255,255,.08);
  border: none;
  color: #fff;
  font-size: 20px;
  line-height: 1;
  cursor: pointer;
  display: flex; align-items: center; justify-content: center;
}
.ai-dialog__close:hover { background: rgba(255,255,255,.16); }
.ai-dialog__body { flex: 1; overflow-y: auto; padding: 18px; }
.ai-dialog__suggest-label {
  font-size: 11px; letter-spacing: .12em; text-transform: uppercase;
  font-weight: 640; color: var(--h-text-subtle, #8898a6);
  margin-bottom: 8px;
}
.ai-dialog__suggest { display: flex; flex-direction: column; gap: 6px; }
.ai-dialog__suggest-btn {
  text-align: left;
  padding: 10px 14px;
  border: 1px solid var(--h-border, #e5e7eb);
  background: var(--h-bg, #fff);
  border-radius: 10px;
  font: inherit;
  font-size: 13px;
  color: var(--h-text, #010334);
  cursor: pointer;
  transition: background .15s, border-color .15s;
}
.ai-dialog__suggest-btn:hover { background: var(--h-bg-soft, #f7f8fc); border-color: var(--h-primary, #2D2FE8); }
.ai-dialog__messages { display: flex; flex-direction: column; gap: 12px; margin-top: 16px; }
.ai-dialog__msg {
  padding: 12px 14px;
  font-size: 14px;
  line-height: 1.5;
  border-radius: 14px;
  max-width: 92%;
  white-space: pre-wrap;
}
.ai-dialog__msg--user {
  align-self: flex-end;
  background: var(--h-deep, #010334);
  color: #fff;
  border-radius: 14px 14px 4px 14px;
}
.ai-dialog__msg--ai {
  align-self: flex-start;
  background: var(--h-bg-soft, #f7f8fc);
  color: var(--h-text, #010334);
  border-radius: 14px 14px 14px 4px;
}
.ai-dialog__form {
  padding: 14px 16px;
  border-top: 1px solid var(--h-border, #e5e7eb);
  background: var(--h-bg-soft, #f7f8fc);
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 8px;
}
.ai-dialog__input {
  padding: 10px 12px;
  border: 1px solid var(--h-border-strong, #c7d2e9);
  border-radius: 10px;
  font: inherit;
  font-size: 14px;
  background: #fff;
  color: var(--h-text, #010334);
  outline: none;
}
.ai-dialog__input:focus { border-color: var(--h-primary, #2D2FE8); }
.ai-dialog__send {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 10px 16px;
  background: var(--h-primary, #2D2FE8);
  color: #fff;
  border: none;
  border-radius: 10px;
  font: inherit;
  font-size: 13px;
  font-weight: 620;
  cursor: pointer;
}
.ai-dialog__send:hover { background: #4a4cf0; }
.ai-dialog__foot {
  grid-column: 1 / -1;
  font-size: 11px;
  color: var(--h-text-subtle, #8898a6);
  margin-top: 4px;
}

/* === Profile page enhancements === */
.profile-stats4 {
  padding: 32px 0;
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 16px;
  border-bottom: 1px solid var(--h-border);
}
@media (max-width: 720px) {
  .profile-stats4 { grid-template-columns: repeat(2, 1fr); }
}
.profile-stat {
  padding: 24px;
  border: 1px solid var(--h-border);
  border-radius: var(--h-r-lg, 16px);
  background: var(--h-bg);
  position: relative;
  overflow: hidden;
}
.profile-stat--gradient {
  background: linear-gradient(135deg, var(--h-primary, #2D2FE8), #4a4cf0);
  color: #fff;
  border: none;
}
.profile-stat__label {
  font-size: 11px; letter-spacing: .12em; text-transform: uppercase;
  font-weight: 640;
  color: var(--h-text-subtle, #8898a6);
  margin-bottom: 8px;
}
.profile-stat--gradient .profile-stat__label { color: rgba(255,255,255,.8); }
.profile-stat__value {
  font-size: clamp(36px, 5vw, 56px);
  font-weight: 700;
  letter-spacing: -0.03em;
  line-height: 1;
  font-family: var(--h-font-head, var(--h-font-display, Georgia, serif));
}
.profile-stat__sub { margin-top: 4px; font-size: 13px; color: var(--h-text-muted); }
.profile-stat--gradient .profile-stat__sub { color: rgba(255,255,255,.85); }
.profile-donate-card {
  position: relative;
  padding: 24px;
  background: var(--h-deep, #010334);
  color: #fff;
  border-radius: var(--h-r-lg, 16px);
  overflow: hidden;
}
.profile-donate-card::after {
  content: "";
  position: absolute;
  inset: 0;
  background: radial-gradient(circle at 100% 100%, var(--h-cyan, #29A9FF) 0%, transparent 50%);
  opacity: .25;
  pointer-events: none;
}
.profile-donate-card > * { position: relative; z-index: 1; }
.profile-donate-card__badge {
  font-size: 11px; letter-spacing: .12em; text-transform: uppercase;
  font-weight: 640;
  color: var(--h-cyan, #29A9FF);
  margin-bottom: 12px;
}
.profile-donate-card__title {
  font-size: 20px;
  letter-spacing: -.02em;
  margin: 0 0 10px;
  color: #fff;
  font-family: var(--h-font-head, var(--h-font-display, Georgia, serif));
}
.profile-donate-card__lead {
  font-size: 13px;
  color: rgba(255,255,255,.72);
  line-height: 1.55;
  margin: 0 0 16px;
}
.profile-donate-card__btns { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; }
.profile-donate-card__btn {
  padding: 10px 8px;
  border-radius: 8px;
  background: rgba(255,255,255,.1);
  color: #fff;
  border: none;
  cursor: pointer;
  font: inherit;
  font-size: 13px;
  font-weight: 620;
}
.profile-donate-card__btn--accent { background: #fff; color: var(--h-deep, #010334); }
.profile-donate-card__btn:hover { background: rgba(255,255,255,.18); }
.profile-donate-card__btn--accent:hover { background: #f0f0ff; }
.profile-subs {
  padding: 20px;
  border: 1px solid var(--h-border);
  border-radius: var(--h-r-lg, 16px);
}
.profile-subs__label {
  font-size: 11px; letter-spacing: .12em; text-transform: uppercase;
  font-weight: 640;
  color: var(--h-text-subtle);
  margin-bottom: 14px;
}

/* === Archive month calendar === */
.archive-cal__grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 6px;
  max-width: 520px;
}
.archive-cal__dayname {
  font-size: 10px; letter-spacing: .08em;
  color: var(--h-text-subtle);
  text-align: center;
  padding: 4px 0;
  font-weight: 600;
}
.archive-cal__day {
  position: relative;
  aspect-ratio: 1;
  border-radius: 6px;
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  padding: 6px;
  text-decoration: none;
  font-family: var(--h-font-mono, "JetBrains Mono", monospace);
  font-size: 11px;
  transition: transform .12s;
}
.archive-cal__day:hover { transform: scale(1.05); }
.archive-cal__day-n { line-height: 1; }
.archive-cal__day-count {
  font-weight: 700;
  font-size: 13px;
  font-family: var(--h-font-head, var(--h-font-display, Georgia, serif));
}

/* === Branded 404 === */
.not-found-page { min-height: 60vh; }
.not-found-page h1 {
  background: linear-gradient(135deg, var(--h-primary, #2D2FE8), var(--h-cyan, #29A9FF));
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  -webkit-text-fill-color: transparent;
}

/* === Source page redesign (handoff 2026-05-16) === */
.source-hero {
  padding: 40px 0 36px;
  background: var(--h-bg-warm, #f4f0e8);
  border-bottom: 1px solid var(--h-border, #e7e3d8);
  margin: 0 -40px 0;
  padding-left: 40px;
  padding-right: 40px;
}
.source-hero__inner {
  display: grid;
  grid-template-columns: auto 1fr auto;
  gap: 32px;
  align-items: center;
  max-width: 1440px;
}
.source-hero__logo {
  width: 120px;
  height: 120px;
  border-radius: 20px;
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--h-font-head, Georgia, serif);
  font-weight: 800;
  font-size: 52px;
  letter-spacing: -0.04em;
  box-shadow: var(--h-shadow-md, 0 6px 20px rgba(0,0,0,0.08));
  flex-shrink: 0;
}
.source-hero__main { min-width: 0; }
.source-hero__badge {
  font-size: 11px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  font-weight: 640;
  color: var(--h-text-subtle, #8b8579);
  margin-bottom: 10px;
}
.source-hero__title {
  font-size: clamp(40px, 5vw, 56px);
  letter-spacing: -0.03em;
  line-height: 1;
  margin: 0;
}
.source-hero__desc {
  font-size: 16px;
  color: var(--h-text-muted, #5a5347);
  margin-top: 14px;
  max-width: 640px;
  line-height: 1.5;
}
.source-hero__meta {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-top: 18px;
  font-size: 13px;
  color: var(--h-text-muted, #5a5347);
  flex-wrap: wrap;
}
.source-hero__sep { opacity: 0.4; }
.source-hero__status {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}
.source-hero__status-dot {
  width: 6px;
  height: 6px;
  border-radius: 999px;
  background: var(--h-green, #28C26F);
  box-shadow: 0 0 6px var(--h-green, #28C26F);
}
.source-hero__ext {
  color: var(--h-link, #2D2FE8);
  text-decoration: none;
}
.source-hero__ext:hover { text-decoration: underline; }
.source-hero__actions {
  display: flex;
  flex-direction: column;
  gap: 8px;
  min-width: 180px;
}
.source-hero__btn { width: 100%; justify-content: center; }

.source-grid {
  display: grid;
  grid-template-columns: 3fr 1fr;
  gap: 48px;
  margin-top: 32px;
}
.source-grid__main { min-width: 0; }
.source-list__head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  margin-bottom: 16px;
}
.source-list__title {
  font-size: 28px;
  letter-spacing: -0.02em;
  margin: 0;
}
.source-list { display: flex; flex-direction: column; }

.source-sidebar {
  display: flex;
  flex-direction: column;
  gap: 24px;
}
.source-sidebar__card {
  padding: 24px;
  border-radius: var(--h-r-lg, 16px);
}
.source-sidebar__card--warm { background: var(--h-bg-warm, #f4f0e8); }
.source-sidebar__card--outline {
  padding: 20px 24px;
  border: 1px solid var(--h-border, #e7e3d8);
}
.source-sidebar__label {
  font-size: 11px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  font-weight: 640;
  color: var(--h-text-subtle, #8b8579);
  margin-bottom: 16px;
}
.source-topics { display: flex; flex-direction: column; gap: 10px; }
.source-topic {
  display: grid;
  grid-template-columns: 1fr auto 80px;
  align-items: center;
  gap: 12px;
  text-decoration: none;
  color: inherit;
  padding: 4px 0;
}
.source-topic:hover .source-topic__name { color: var(--h-link, #2D2FE8); }
.source-topic__name {
  font-size: 14px;
  font-weight: 560;
  color: var(--h-text, #1a1812);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.source-topic__count {
  font-size: 12px;
  color: var(--h-text-subtle, #8b8579);
  font-family: var(--h-font-mono, 'JetBrains Mono', monospace);
}
.source-topic__bar {
  width: 80px;
  height: 4px;
  background: var(--h-border, #e7e3d8);
  border-radius: 2px;
  overflow: hidden;
  display: block;
}
.source-topic__bar-fill {
  display: block;
  height: 100%;
  background: var(--h-primary, #2D2FE8);
}
.source-trust__score {
  display: flex;
  align-items: baseline;
  gap: 8px;
}
.source-trust__num {
  font-size: 40px;
  font-weight: 700;
  letter-spacing: -0.03em;
  font-family: var(--h-font-head, Georgia, serif);
}
.source-trust__den {
  font-size: 14px;
  color: var(--h-text-muted, #5a5347);
}
.source-trust__basis {
  font-size: 12px;
  color: var(--h-text-subtle, #8b8579);
  margin-top: 8px;
  line-height: 1.5;
}

/* Button variants used by source-hero (fallbacks if base styles miss) */
.btn--dark {
  background: var(--h-deep, #010106);
  color: #fff;
  border-color: var(--h-deep, #010106);
}
.btn--outline {
  background: transparent;
  color: var(--h-text, #1a1812);
  border-color: var(--h-border-strong, #d6d0c1);
}

@media (max-width: 960px) {
  .source-hero__inner {
    grid-template-columns: auto 1fr;
    grid-template-areas: "logo main" "actions actions";
    gap: 20px;
  }
  .source-hero__logo { grid-area: logo; width: 88px; height: 88px; font-size: 40px; border-radius: 16px; }
  .source-hero__main { grid-area: main; }
  .source-hero__actions { grid-area: actions; flex-direction: row; min-width: 0; }
  .source-hero__btn { flex: 1; }
  .source-grid {
    grid-template-columns: 1fr;
    gap: 32px;
  }
}
@media (max-width: 640px) {
  .source-hero__title { font-size: 32px; }
  .source-hero__desc { font-size: 14px; }
  .source-hero__meta { font-size: 12px; gap: 8px; }
}

/* ============================================================
   Profile screen v2 — identity row, tabs, heatmap, bookmarks grid
   ============================================================ */
.profile-identity {
  padding: 32px 0;
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 24px;
  align-items: center;
  border-bottom: 1px solid var(--h-border);
}
.profile-identity__left {
  display: flex;
  align-items: center;
  gap: 24px;
  min-width: 0;
}
.profile-avatar {
  width: 96px;
  height: 96px;
  flex: 0 0 96px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--h-primary, #2D2FE8), var(--h-cyan, #29A9FF));
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--h-font-head);
  font-weight: 700;
  font-size: 36px;
  letter-spacing: -0.02em;
}
.profile-identity__meta { min-width: 0; }
.profile-identity__eyebrow {
  font-size: 11px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  font-weight: 640;
  color: var(--h-text-subtle);
  margin-bottom: 8px;
}
.profile-identity__name {
  font-size: 44px;
  letter-spacing: -0.03em;
  line-height: 1;
  margin: 0;
}
.profile-identity__row {
  display: flex;
  flex-wrap: wrap;
  gap: 10px 12px;
  margin-top: 12px;
  font-size: 13px;
  color: var(--h-text-muted);
  align-items: center;
}
.profile-identity__dot { opacity: 0.4; }
.profile-identity__badge {
  color: var(--h-link);
  font-weight: 620;
}
.profile-identity__actions {
  display: flex;
  gap: 8px;
  flex-shrink: 0;
}
@media (max-width: 760px) {
  .profile-identity { grid-template-columns: 1fr; }
  .profile-identity__name { font-size: 32px; }
  .profile-avatar { width: 72px; height: 72px; flex-basis: 72px; font-size: 28px; }
  .profile-identity__actions { width: 100%; }
  .profile-identity__actions .btn { flex: 1; justify-content: center; }
}

/* Streak heatmap */
.profile-heatmap-section {
  padding: 24px 0 32px;
  border-bottom: 1px solid var(--h-border);
}
.profile-heatmap-label {
  font-size: 11px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  font-weight: 640;
  color: var(--h-text-subtle);
  margin-bottom: 14px;
}
.profile-heatmap {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 6px;
  max-width: 420px;
}
.profile-heatmap__cell {
  aspect-ratio: 1;
  border-radius: 4px;
  background: var(--h-bg-soft, rgba(0,0,0,0.04));
}
.profile-heatmap__cell[data-lvl="1"] { background: rgba(45, 47, 232, 0.25); }
.profile-heatmap__cell[data-lvl="2"] { background: rgba(45, 47, 232, 0.45); }
.profile-heatmap__cell[data-lvl="3"] { background: rgba(45, 47, 232, 0.7); }
.profile-heatmap__cell[data-lvl="4"] { background: var(--h-primary, #2D2FE8); }
.profile-heatmap-hint {
  margin-top: 12px;
  font-size: 12px;
  color: var(--h-text-muted);
  line-height: 1.5;
}

/* Tab bar */
.profile-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  border-bottom: 1px solid var(--h-border);
  margin: 32px 0 32px;
}
.profile-tab {
  padding: 14px 18px;
  font-size: 14px;
  font-weight: 520;
  color: var(--h-text-muted);
  text-decoration: none;
  border-bottom: 2px solid transparent;
  margin-bottom: -1px;
  white-space: nowrap;
}
.profile-tab:hover { color: var(--h-text); }
.profile-tab--active {
  color: var(--h-text);
  font-weight: 640;
  border-bottom-color: var(--h-primary, #2D2FE8);
}
@media (max-width: 760px) {
  .profile-tabs { overflow-x: auto; flex-wrap: nowrap; -webkit-overflow-scrolling: touch; }
  .profile-tab { padding: 12px 14px; font-size: 13px; }
}

/* Tab panel */
.profile-panel { padding: 0 0 24px; }
.profile-panel-title {
  font-size: 28px;
  letter-spacing: -0.02em;
  margin: 0 0 20px;
}
.profile-panel-count {
  color: var(--h-text-subtle);
  font-weight: 500;
}

/* Bookmarks 3-col grid */
.profile-bookmarks-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 24px;
}
@media (max-width: 1024px) {
  .profile-bookmarks-grid { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 640px) {
  .profile-bookmarks-grid { grid-template-columns: 1fr; }
}

/* ============================================================
   Search screen v2 — left filter sidebar + AI banner
   ============================================================ */
.search-layout { padding-top: 40px; }
.search-grid {
  display: grid;
  grid-template-columns: 260px 1fr;
  gap: 48px;
  max-width: 1200px;
  margin: 0 auto;
}
@media (max-width: 880px) {
  .search-grid { grid-template-columns: 1fr; gap: 24px; }
}

.search-filters { min-width: 0; }
.search-filters__eyebrow {
  font-size: 11px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  font-weight: 640;
  color: var(--h-text-subtle);
  margin-bottom: 14px;
}
.search-filter-group { margin-bottom: 28px; }
.search-filter-group__label {
  font-size: 12px;
  font-weight: 640;
  color: var(--h-text);
  margin-bottom: 10px;
  letter-spacing: -0.005em;
}
.search-filter-group__items {
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.search-filter-item {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 13px;
  color: var(--h-text-muted);
  text-decoration: none;
  padding: 4px 0;
}
.search-filter-item:hover { color: var(--h-text); }
.search-filter-item--active { color: var(--h-text); font-weight: 600; }
.search-filter-item__check {
  width: 16px;
  height: 16px;
  flex-shrink: 0;
  border-radius: 4px;
  border: 1.5px solid var(--h-border-strong, var(--h-border));
  background: transparent;
  position: relative;
}
.search-filter-item__check--on {
  background: var(--h-primary, #2D2FE8);
  border-color: var(--h-primary, #2D2FE8);
}
.search-filter-item__check--on::after {
  content: "";
  position: absolute;
  inset: 3px;
  background: #fff;
  clip-path: polygon(14% 44%, 0 65%, 50% 100%, 100% 16%, 80% 0%, 43% 62%);
}
.search-filter-item__radio {
  width: 16px;
  height: 16px;
  flex-shrink: 0;
  border-radius: 50%;
  border: 1.5px solid var(--h-border-strong, var(--h-border));
  background: transparent;
  position: relative;
}
.search-filter-item__radio--on {
  border-color: var(--h-primary, #2D2FE8);
}
.search-filter-item__radio--on::after {
  content: "";
  position: absolute;
  inset: 3px;
  border-radius: 50%;
  background: var(--h-primary, #2D2FE8);
}
.search-filter-item__label { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; }
.search-filter-item__count {
  flex-shrink: 0;
  font-size: 12px;
  color: var(--h-text-subtle);
  font-variant-numeric: tabular-nums;
}

/* Results column */
.search-results { min-width: 0; }

/* AI answer banner */
.search-ai-banner {
  margin-bottom: 32px;
  padding: 24px;
  background: var(--h-deep, #010334);
  color: #fff;
  border-radius: var(--h-r-lg, 14px);
  position: relative;
  overflow: hidden;
}
.search-ai-banner__overlay {
  position: absolute;
  inset: 0;
  background: radial-gradient(circle at 100% 0%, var(--h-cyan, #29A9FF) 0%, transparent 40%);
  opacity: 0.2;
  pointer-events: none;
}
.search-ai-banner__inner { position: relative; z-index: 1; }
.search-ai-banner__label {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 11px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  font-weight: 640;
  color: var(--h-cyan, #29A9FF);
  margin-bottom: 14px;
}
.search-ai-banner__body {
  font-size: 17px;
  line-height: 1.55;
  margin: 0;
  color: rgba(255,255,255,0.92);
}
.search-ai-banner__sources {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 18px;
  font-size: 12px;
  color: rgba(255,255,255,0.6);
  align-items: center;
}
.search-ai-banner__source-chip {
  display: inline-block;
  padding: 3px 8px;
  background: rgba(255,255,255,0.1);
  border-radius: 999px;
  color: rgba(255,255,255,0.85);
}


/* ─── 2026-05-16: Handoff-aligned portal screen polish ────────────────────── */

/* ── TAG screen ───────────────────────────────────────────────────────────── */
.tag-hero--warm {
  background: linear-gradient(180deg, var(--h-bg-warm, #faf7f2) 0%, var(--h-bg, #fff) 100%);
}
.tag-hero__h1 {
  font-family: var(--h-font-head, inherit);
}
.tag-hero__desc {
  font-family: var(--h-font-body, inherit);
}
.tag-hero__related {
  align-items: center;
}
.tag-hero__filters {
  position: sticky;
  top: 64px;
  background: var(--h-bg);
  padding: 12px 0;
  z-index: 5;
  border-bottom: 1px solid var(--h-border-soft, transparent);
}
.tag-grid-layout {
  display: grid;
  grid-template-columns: 1fr 280px;
  gap: 32px;
  margin-top: 32px;
  align-items: start;
}
.tag-grid-layout__main {
  min-width: 0;
}
.tag-grid {
  margin-bottom: 24px;
}
@media (max-width: 1024px) {
  .tag-grid-layout {
    grid-template-columns: 1fr;
  }
  .tag-side-sources {
    order: -1;
  }
}
.tag-side-sources {
  position: sticky;
  top: 88px;
  padding: 22px;
  background: var(--h-bg-soft, #f5f3ee);
  border-radius: var(--h-r-lg, 12px);
}
.tag-aside__head {
  font-size: 11px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  font-weight: 640;
  color: var(--h-link);
  margin-bottom: 14px;
}
.tag-aside__row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 0;
  border-bottom: 1px solid var(--h-border);
}
.tag-aside__row:last-child {
  border-bottom: 0;
}
.source-chip__dot {
  width: 10px;
  height: 10px;
  border-radius: 2px;
  flex-shrink: 0;
}
.tag-aside__name {
  flex: 1;
  font-size: 14px;
  font-weight: 560;
  color: var(--h-text);
  text-decoration: none;
}
.tag-aside__name:hover {
  color: var(--h-link);
}
.tag-aside__count {
  font-size: 12px;
  color: var(--h-text-subtle);
  font-family: var(--h-font-mono, monospace);
}

/* Filter chips */
.chip--xs {
  font-size: 11px;
  padding: 3px 8px;
}
.chip--sm {
  font-size: 12px;
  padding: 5px 10px;
}
.chip--solid {
  background: var(--h-deep, #010306);
  color: #fff;
  border: 1px solid var(--h-deep, #010306);
}
.chip--solid:hover {
  background: var(--h-primary);
  border-color: var(--h-primary);
}

/* ── ARCHIVE screen ───────────────────────────────────────────────────────── */
.archive-hero__head {
  align-items: baseline;
}
.archive-hero__nav .btn {
  text-transform: capitalize;
}
.archive-year-strip {
  display: grid;
  grid-template-columns: repeat(12, 1fr);
  gap: 4px;
  margin: 24px 0;
}
.archive-year-strip__cell {
  display: block;
  padding: 10px 6px;
  text-align: center;
  border-radius: var(--h-r-md, 8px);
  background: var(--h-bg-soft, #f5f3ee);
  color: var(--h-text);
  text-decoration: none;
  transition: background 0.15s;
  border: 1px solid transparent;
}
.archive-year-strip__cell:hover {
  background: var(--h-bg-warm, #faf7f2);
  border-color: var(--h-border);
}
.archive-year-strip__cell.is-current {
  background: var(--h-deep, #010306);
  color: #fff;
  border-color: var(--h-deep, #010306);
}
.archive-year-strip__cell.is-future {
  opacity: 0.4;
  pointer-events: none;
}
.archive-year-strip__name {
  font-size: 12px;
  font-weight: 560;
}
.archive-year-strip__count {
  font-size: 10px;
  margin-top: 2px;
  color: var(--h-text-subtle);
  font-family: var(--h-font-mono, monospace);
}
.archive-year-strip__cell.is-current .archive-year-strip__count {
  color: rgba(255, 255, 255, 0.6);
}

.archive-layout {
  display: grid;
  grid-template-columns: 320px 1fr;
  gap: 48px;
  margin-top: 32px;
  align-items: start;
}
.archive-layout__main {
  min-width: 0;
}
@media (max-width: 1024px) {
  .archive-layout {
    grid-template-columns: 1fr;
    gap: 24px;
  }
  .archive-sidebar {
    order: 2;
  }
}

.archive-sidebar__section {
  margin-bottom: 32px;
}
.archive-sidebar__label {
  font-size: 11px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  font-weight: 640;
  color: var(--h-text-subtle);
  margin-bottom: 16px;
}
.archive-sidebar__row {
  display: grid;
  grid-template-columns: 10px 1fr auto 120px;
  align-items: center;
  gap: 10px;
  margin-bottom: 10px;
  font-size: 13px;
}
.archive-sidebar__section:not(:first-child) .archive-sidebar__row {
  grid-template-columns: 1fr auto 120px;
}
.archive-sidebar__name {
  color: var(--h-text);
  text-decoration: none;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.archive-sidebar__name:hover {
  color: var(--h-link);
}
.archive-sidebar__count {
  font-size: 12px;
  color: var(--h-text-subtle);
  font-family: var(--h-font-mono, monospace);
}
.archive-sidebar__bar {
  width: 120px;
  height: 6px;
  background: var(--h-border);
  border-radius: 3px;
  overflow: hidden;
}
.archive-sidebar__bar-fill {
  height: 100%;
  background: var(--h-primary);
  transition: width 0.3s ease;
}
.archive-sidebar__bar-fill--cyan {
  background: var(--h-cyan, #29A9FF);
}

.archive-day-group {
  margin-bottom: 56px;
}
.archive-day-group__head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  margin-bottom: 20px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--h-border);
}
.archive-day-group__h2 {
  font-size: 28px;
  letter-spacing: -0.02em;
  margin: 0;
  text-transform: capitalize;
}
.archive-day-group__count {
  font-size: 13px;
  color: var(--h-text-muted);
}

/* ── 404 screen — dark theme ──────────────────────────────────────────────── */
.not-found-page--dark {
  background: var(--h-deep, #010306);
  color: #fff;
  position: relative;
  overflow: hidden;
  min-height: 80vh;
  padding: 0;
}
.not-found-page__bg {
  position: absolute;
  inset: 0;
  background:
    radial-gradient(circle at 10% 110%, rgba(41, 169, 255, 0.32) 0%, rgba(41, 169, 255, 0) 45%),
    radial-gradient(circle at 90% -10%, rgba(45, 47, 232, 0.18) 0%, transparent 50%);
  pointer-events: none;
  z-index: 0;
}
.not-found-page__inner {
  position: relative;
  z-index: 1;
  display: grid;
  grid-template-columns: 1.2fr 1fr;
  gap: 80px;
  align-items: center;
  max-width: 1200px;
  margin: 0 auto;
  padding: 80px 40px 100px;
}
@media (max-width: 900px) {
  .not-found-page__inner {
    grid-template-columns: 1fr;
    gap: 48px;
    padding: 48px 24px 64px;
  }
}
.not-found-page__badge {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 6px 12px;
  background: rgba(249, 93, 81, 0.15);
  border: 1px solid rgba(249, 93, 81, 0.3);
  border-radius: 999px;
  font-size: 11px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  font-weight: 640;
  color: var(--h-red, #F95D51);
  margin-bottom: 24px;
}
.not-found-page__h1 {
  font-size: clamp(56px, 9vw, 96px);
  letter-spacing: -0.035em;
  line-height: 0.95;
  font-weight: 700;
  text-wrap: balance;
  margin: 0;
  color: #fff;
}
.not-found-page__h1-accent {
  color: var(--h-cyan, #29A9FF);
}
.not-found-page__lead {
  font-size: 19px;
  line-height: 1.5;
  color: rgba(255, 255, 255, 0.7);
  margin: 24px 0 32px;
  max-width: 500px;
}
.not-found-page__search {
  display: flex;
  gap: 8px;
  max-width: 480px;
  margin-bottom: 24px;
}
.not-found-page__search input {
  flex: 1;
  padding: 14px 18px;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.15);
  border-radius: var(--h-r-md, 8px);
  color: #fff;
  font-size: 15px;
}
.not-found-page__search input::placeholder {
  color: rgba(255, 255, 255, 0.62); /* Wave 18: was 0.4 (3.6:1 on deep navy) → ≥7:1 */
}
.not-found-page__search input:focus {
  outline: none;
  border-color: var(--h-cyan, #29A9FF);
  background: rgba(255, 255, 255, 0.1);
}
.not-found-page__search button {
  width: 48px;
  height: 48px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: var(--h-cyan, #29A9FF);
  border: 0;
  border-radius: var(--h-r-md, 8px);
  color: #fff;
  cursor: pointer;
}
.not-found-page__cta {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}
.not-found-page__btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 12px 22px;
  border-radius: var(--h-r-md, 8px);
  font-size: 15px;
  font-weight: 560;
  text-decoration: none;
  letter-spacing: -0.005em;
}
.not-found-page__btn--white {
  background: #fff;
  color: var(--h-deep, #010306);
}
.not-found-page__btn--white:hover {
  background: var(--h-bg-warm, #faf7f2);
}
.not-found-page__btn--ghost {
  background: transparent;
  border: 1px solid rgba(255, 255, 255, 0.2);
  color: #fff;
}
.not-found-page__btn--ghost:hover {
  border-color: rgba(255, 255, 255, 0.4);
  background: rgba(255, 255, 255, 0.05);
}
.not-found-page__aside-label {
  font-size: 11px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  font-weight: 640;
  color: var(--h-cyan, #29A9FF);
  margin-bottom: 18px;
}
.not-found-page__list {
  display: flex;
  flex-direction: column;
  gap: 0;
}
.not-found-page__link {
  display: grid;
  grid-template-columns: 28px 1fr auto;
  align-items: center;
  gap: 14px;
  padding: 16px 4px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  text-decoration: none;
  color: #fff;
  transition: padding 0.15s;
}
.not-found-page__link:hover {
  padding-left: 8px;
}
.not-found-page__link-num {
  font-family: var(--h-font-mono, monospace);
  font-size: 11px;
  color: rgba(255, 255, 255, 0.62); /* Wave 18: was 0.45 (4.4:1 on deep navy) → ≥7:1 */
}
.not-found-page__link-title {
  font-size: 16px;
  font-weight: 560;
  letter-spacing: -0.015em;
}
.not-found-page__link-url {
  font-size: 12px;
  color: rgba(255, 255, 255, 0.62); /* Wave 18: was 0.5 (4.3:1 on deep navy) → ≥5.7:1 */
  margin-top: 3px;
  font-family: var(--h-font-mono, monospace);
}
.not-found-page__link-arrow {
  color: rgba(255, 255, 255, 0.62); /* Wave 18 contrast */
}
.not-found-page__link:hover .not-found-page__link-arrow {
  color: var(--h-cyan, #29A9FF);
}

/* ── AI dialog right-side panel mode ──────────────────────────────────────── */
.ai-dialog-overlay--right {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: block;
  pointer-events: auto;
  background: transparent;
}
.ai-dialog-overlay--right::before {
  content: "";
  position: absolute;
  inset: 0;
  background: rgba(1, 3, 6, 0.32);
  -webkit-backdrop-filter: blur(2px);
  backdrop-filter: blur(2px);
  opacity: 0;
  transition: opacity 0.3s;
}
.ai-dialog-overlay--right.is-open::before {
  opacity: 1;
}
.ai-dialog-overlay--right .ai-dialog {
  position: fixed;
  left: auto !important;
  right: 0;
  top: 0;
  bottom: 0;
  width: 440px;
  max-width: 100vw;
  max-height: none;
  background: var(--h-bg);
  border-radius: 0;
  border-left: 1px solid var(--h-border);
  box-shadow: -16px 0 48px rgba(1, 3, 6, 0.18);
  transform: translateX(100%);
  transition: transform 0.3s cubic-bezier(0.16, 1, 0.3, 1);
  display: flex;
  flex-direction: column;
  animation: none;
}
.ai-dialog-overlay--right.is-open .ai-dialog {
  transform: translateX(0);
}
@media (max-width: 600px) {
  .ai-dialog-overlay--right .ai-dialog {
    width: 100vw;
  }
}
.ai-dialog-overlay--right .ai-dialog__head {
  padding: 18px 20px;
  background: var(--h-deep, #010306);
  color: #fff;
  border-bottom: 0;
  align-items: center;
}
.ai-dialog-overlay--right .ai-dialog__head-icon {
  width: 32px;
  height: 32px;
  border-radius: 8px;
  background: linear-gradient(135deg, var(--h-cyan, #29A9FF), var(--h-primary, #2D2FE8));
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.ai-dialog-overlay--right .ai-dialog__head-title {
  color: #fff;
  font-weight: 620;
  font-size: 14px;
}
.ai-dialog-overlay--right .ai-dialog__head-sub {
  color: rgba(255, 255, 255, 0.6);
  font-size: 11px;
}
.ai-dialog-overlay--right .ai-dialog__close {
  background: rgba(255, 255, 255, 0.1);
  color: #fff;
  width: 28px;
  height: 28px;
  border-radius: 6px;
  font-size: 18px;
  border: 0;
  cursor: pointer;
}
.ai-dialog-overlay--right .ai-dialog__close:hover {
  background: rgba(255, 255, 255, 0.2);
}
.ai-dialog-overlay--right .ai-dialog__body {
  flex: 1;
  overflow-y: auto;
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}
.ai-dialog-overlay--right .ai-dialog__suggest-label {
  font-size: 10px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  font-weight: 640;
  color: var(--h-text-subtle);
  margin-bottom: 4px;
}
.ai-dialog-overlay--right .ai-dialog__suggest {
  display: flex;
  flex-direction: column;
  gap: 6px;
  overflow: visible;
}
.ai-dialog-overlay--right .ai-dialog__suggest-btn {
  display: flex;
  align-items: center;
  justify-content: space-between;
  text-align: left;
  padding: 11px 14px;
  border: 1px solid var(--h-border);
  background: transparent;
  border-radius: var(--h-r-md, 8px);
  font-size: 13px;
  color: var(--h-text);
  cursor: pointer;
  width: 100%;
  font-family: inherit;
}
.ai-dialog-overlay--right .ai-dialog__suggest-btn:hover {
  background: var(--h-bg-soft, #f5f3ee);
  border-color: var(--h-text-subtle);
}
.ai-dialog-overlay--right .ai-dialog__suggest-btn::after {
  content: "→";
  color: var(--h-text-subtle);
}
.ai-dialog-overlay--right .ai-dialog__messages {
  display: flex;
  flex-direction: column;
  gap: 16px;
}
.ai-dialog__msg-wrap {
  display: flex;
  flex-direction: column;
  max-width: 92%;
}
.ai-dialog__msg-wrap--user {
  align-self: flex-end;
}
.ai-dialog__msg-wrap--ai {
  align-self: flex-start;
}
.ai-dialog__msg-label {
  font-size: 10px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  font-weight: 640;
  color: var(--h-link, #2D2FE8);
  margin-bottom: 6px;
}
.ai-dialog-overlay--right .ai-dialog__msg {
  padding: 12px 14px;
  border-radius: 14px 14px 14px 4px;
  background: var(--h-bg-soft, #f5f3ee);
  color: var(--h-text);
  font-size: 14px;
  line-height: 1.55;
  white-space: pre-wrap;
}
.ai-dialog-overlay--right .ai-dialog__msg--user {
  background: var(--h-deep, #010306);
  color: #fff;
  border-radius: 14px 14px 4px 14px;
}
.ai-dialog__cites {
  display: flex;
  gap: 4px;
  margin-top: 8px;
  flex-wrap: wrap;
}
.ai-dialog__cite {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 8px 3px 4px;
  background: #fff;
  border: 1px solid var(--h-border);
  border-radius: 999px;
  font-size: 11px;
  color: var(--h-text-muted);
}
.ai-dialog__cite-num {
  width: 14px;
  height: 14px;
  border-radius: 3px;
  background: var(--h-primary, #2D2FE8);
  color: #fff;
  font-size: 9px;
  font-weight: 700;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
.ai-dialog__cite-src {
  white-space: nowrap;
}
.ai-dialog-overlay--right .ai-dialog__form {
  padding: 14px 16px 16px;
  border-top: 1px solid var(--h-border);
  background: var(--h-surface-2, #faf7f2);
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.ai-dialog-overlay--right .ai-dialog__input {
  flex: 1;
  padding: 10px 12px;
  border: 1px solid var(--h-border-strong, #d4d0c8);
  border-radius: var(--h-r-md, 8px);
  background: #fff;
  font-size: 14px;
  color: var(--h-text);
}
.ai-dialog-overlay--right .ai-dialog__input:focus {
  outline: none;
  border-color: var(--h-primary, #2D2FE8);
}
.ai-dialog-overlay--right .ai-dialog__send {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 9px 14px;
  background: var(--h-deep, #010306);
  color: #fff;
  border: 0;
  border-radius: var(--h-r-md, 8px);
  font-size: 13px;
  font-weight: 560;
  cursor: pointer;
  align-self: flex-end;
}
.ai-dialog-overlay--right .ai-dialog__send:hover {
  background: var(--h-primary, #2D2FE8);
}
.ai-dialog-overlay--right .ai-dialog__foot {
  font-size: 11px;
  color: var(--h-text-subtle);
  text-align: center;
}
body.ai-dialog-is-open .article,
body.ai-dialog-is-open main.content {
  filter: blur(1px);
  transition: filter 0.2s;
  pointer-events: none;
}
body.ai-dialog-is-open .ai-dialog-overlay--right .ai-dialog,
body.ai-dialog-is-open .ai-dialog-overlay--right * {
  filter: none;
  pointer-events: auto;
}

/* ============================================================
   MOBILE RESPONSIVE v23 — based on handoff mobile.jsx
   Breakpoints: 760 (tablet→phone) + 480 (small phone)
   Goal: no horizontal scroll, no <44px tap targets,
   stack sidebars, collapse 4-col article, fix nav overflow.
   ============================================================ */

/* TABLET / MEDIUM PHONE (≤760px) ----------------------------- */
@media (max-width: 760px) {
  html, body { overflow-x: hidden; }

  /* Nav: logo left, lang switcher (compact pill) right */
  .nav {
    padding: 12px 16px !important;
    flex-wrap: nowrap !important;
    gap: 8px;
  }
  .nav__inner {
    flex-wrap: nowrap;
    gap: 8px;
    width: 100%;
  }
  .nav__links {
    display: none !important;
  }
  .nav__right {
    margin-left: auto;
  }
  .lang-switch {
    gap: 2px;
    overflow-x: auto;
    max-width: 60vw;
    scrollbar-width: none;
  }
  .lang-switch::-webkit-scrollbar { display: none; }
  .nav__lang-btn {
    min-width: 30px;
    padding: 6px 8px;
    font-size: 11px;
  }
  .nav__logo {
    flex-shrink: 0;
  }
  .nav__logo-text {
    font-size: 18px;
  }
  .nav__logo-badge {
    font-size: 10px;
  }

  /* Hero: smaller padding, smaller title, single col, hide brief decor */
  .hero {
    padding: 32px 18px 48px !important;
  }
  .hero__inner {
    grid-template-columns: 1fr !important;
    gap: 28px !important;
    min-height: 0;
  }
  .hero__title {
    font-size: clamp(32px, 9vw, 48px) !important;
    line-height: 1.04;
  }
  .hero__lead {
    font-size: 16px !important;
    margin-top: 16px;
  }
  .hero__badge {
    font-size: 11px;
    padding: 4px 10px 4px 6px;
    margin-bottom: 16px;
    max-width: 100%;
    flex-wrap: wrap;
    line-height: 1.4;
  }
  .hero__cta-row {
    margin-top: 20px;
    gap: 8px;
    flex-wrap: wrap;
  }
  .hero__cta-row .btn {
    min-height: 44px;
    flex: 1 1 auto;
    min-width: 0;
  }
  .hero__brief {
    padding: 16px !important;
    margin-top: 4px;
  }
  .hero__brief-list {
    gap: 12px !important;
  }
  .hero__brief-num {
    font-size: 22px !important;
  }
  .hero__brief-text {
    font-size: 12px !important;
  }
  /* Wave 70: hide both .hero__glow (radial gradients tile on real Android) and .hero__grid.
     Mobile hero is just clean solid #010334 — no overlays, no risk. */
  .hero__glow, .hero__grid { display: none; }

  /* Category rail */
  .category-rail {
    padding: 12px 16px !important;
    gap: 6px;
  }
  .chip {
    min-height: 36px;
    display: inline-flex;
    align-items: center;
    padding: 6px 12px;
    font-size: 13px;
  }

  /* Stories rail */
  .stories-rail {
    padding: 12px 16px !important;
  }
  .stories-rail__scroll {
    gap: 10px !important;
  }
  .story-tile {
    min-width: 130px;
  }

  /* Main content padding */
  .content {
    padding: 16px !important;
  }
  .content > .grid-3,
  .content .grid-3 {
    grid-template-columns: 1fr !important;
    gap: 18px !important;
  }
  .content > .split-2\:1,
  .content .split-2\:1 {
    grid-template-columns: 1fr !important;
    gap: 20px !important;
  }

  /* Section header */
  .section-header {
    flex-wrap: wrap;
    gap: 10px;
    padding: 0 0 12px;
  }
  .section-title {
    font-size: 22px !important;
    letter-spacing: -0.015em;
  }
  .section-label {
    font-size: 10px;
    letter-spacing: 0.1em;
  }

  /* Featured / Big card */
  .featured-card {
    grid-template-columns: 1fr !important;
    gap: 16px !important;
  }
  .featured-card__image {
    aspect-ratio: 16 / 9;
  }
  .featured-card__title {
    font-size: 24px !important;
    line-height: 1.18;
  }
  .featured-card__dek {
    font-size: 15px;
  }
  .featured-card__body {
    padding: 0;
  }

  /* Compact / regular cards */
  .card__title { font-size: 17px; }
  .card__dek { font-size: 14px; }
  .compact-card__title { font-size: 15px; }
  .compact-card__num { font-size: 11px; }

  /* Sidebar cards stack below main */
  .sidebar-card {
    margin-bottom: 16px;
  }
  .newsletter-card__inner {
    padding: 22px 18px !important;
  }
  .newsletter-card__title {
    font-size: 22px !important;
  }
  .newsletter-form {
    flex-direction: column;
    gap: 8px;
  }
  .newsletter-form input,
  .newsletter-form button {
    width: 100%;
    min-height: 44px;
  }

  /* Article: collapse 4-col → 1-col, hide left share rail + TOC */
  .article {
    grid-template-columns: 1fr !important;
    padding: 16px !important;
    gap: 20px !important;
  }
  .article.article--no-toc {
    grid-template-columns: 1fr !important;
  }
  .article__share {
    position: fixed !important;
    left: 0; right: 0; bottom: 0;
    top: auto !important;
    flex-direction: row !important;
    justify-content: space-around;
    background: var(--h-bg);
    border-top: 1px solid var(--h-border);
    padding: 8px 12px !important;
    gap: 4px !important;
    z-index: 50;
    box-shadow: 0 -4px 12px rgba(0,0,0,0.06);
  }
  .article__share-btn {
    width: 44px !important;
    height: 44px !important;
    min-width: 44px;
  }
  .article__share-divider {
    width: 1px;
    height: 28px;
    margin: 6px 4px !important;
    align-self: center;
  }
  .article__toc {
    position: static !important;
    max-height: none !important;
    overflow: visible !important;
    margin-bottom: 16px;
    padding: 12px !important;
    background: var(--h-bg-soft);
    border-radius: 12px;
  }
  .article__body {
    padding-bottom: 80px; /* room for fixed share bar */
  }
  .article__title {
    font-size: clamp(28px, 7vw, 36px) !important;
    line-height: 1.1 !important;
  }
  .article__dek {
    font-size: 17px !important;
  }
  .article__content {
    font-size: 17px;
    line-height: 1.65;
  }
  .article__content h2 { font-size: 24px !important; margin: 32px 0 14px !important; }
  .article__content h3 { font-size: 19px !important; margin: 24px 0 10px !important; }
  .article__content blockquote { font-size: 18px; padding: 14px 16px; }
  .article__sidebar {
    margin-top: 24px;
  }
  .article__byline {
    flex-wrap: wrap;
    gap: 10px;
  }
  .article__hero {
    margin-left: -16px;
    margin-right: -16px;
    border-radius: 0;
  }
  .article__hero img {
    border-radius: 0;
  }
  .article__breadcrumbs {
    font-size: 12px;
    overflow-x: auto;
    white-space: nowrap;
    scrollbar-width: none;
  }
  .article__breadcrumbs::-webkit-scrollbar { display: none; }
  .article__newsletter {
    padding: 20px 18px;
  }
  .article__newsletter form {
    flex-direction: column;
    gap: 8px;
  }
  .article__newsletter input,
  .article__newsletter button {
    width: 100%;
    min-height: 44px;
  }

  /* Search / Archive / Tag / Source / Profile filter chips */
  .filter-row,
  .filter-bar,
  .tag-filters,
  .source-filters,
  .archive-filters,
  .profile-tabs,
  .search-filters {
    display: flex;
    flex-wrap: nowrap;
    overflow-x: auto;
    scrollbar-width: none;
    gap: 6px;
    padding: 8px 16px;
    margin: 0 -16px;
  }
  .filter-row::-webkit-scrollbar,
  .filter-bar::-webkit-scrollbar,
  .tag-filters::-webkit-scrollbar,
  .source-filters::-webkit-scrollbar,
  .archive-filters::-webkit-scrollbar,
  .profile-tabs::-webkit-scrollbar,
  .search-filters::-webkit-scrollbar { display: none; }
  .filter-row .chip,
  .filter-bar .chip,
  .profile-tabs > * {
    flex-shrink: 0;
    white-space: nowrap;
  }

  /* Search box */
  .search-box,
  .search__input {
    width: 100% !important;
    min-height: 44px;
    font-size: 16px; /* iOS no-zoom */
  }

  /* AI dialog: full-screen on mobile */
  .ai-dialog-overlay--right .ai-dialog {
    width: 100vw !important;
    border-left: 0 !important;
  }
  .ai-dialog__head {
    padding: 14px 16px !important;
  }
  .ai-dialog__body {
    padding: 16px !important;
  }
  .ai-dialog__suggest-btn {
    min-height: 44px;
    padding: 10px 14px !important;
  }

  /* Footer: stack 3 cols → 1 */
  .footer__inner {
    grid-template-columns: 1fr !important;
    gap: 28px;
    padding: 32px 20px !important;
  }
  .footer__brand h3 { font-size: 18px; }
  .footer__links {
    grid-template-columns: 1fr 1fr;
    gap: 18px;
  }
  .footer__group h4 { font-size: 12px; }
  .footer__bottom {
    flex-direction: column;
    align-items: flex-start;
    gap: 8px;
    padding: 20px;
  }

  /* Tap targets — anchors, buttons */
  .nav__lang-btn,
  .footer__group a,
  .article__share-btn,
  .btn {
    min-height: 44px;
    display: inline-flex;
    align-items: center;
  }
  .btn--sm { min-height: 38px; }

  /* Brief cartouche on hero — hide decorative parts to save space */
  .hero__brief-foot {
    display: none;
  }

  /* Profile page: stat grid 3→2 cols, then 1 */
  .profile-stats,
  .stats-grid {
    grid-template-columns: repeat(2, 1fr) !important;
    gap: 8px !important;
  }

  /* Source / Tag detail headers */
  .source-page__hero,
  .tag-page__hero,
  .archive__hero {
    padding: 24px 16px !important;
  }

  /* Comments */
  .comment, .comments__item {
    padding: 14px 12px;
  }

  /* 404 */
  .not-found-page {
    padding: 32px 18px !important;
  }
  .not-found-page__title {
    font-size: clamp(40px, 14vw, 64px) !important;
  }
}

/* SMALL PHONE (≤480px) -------------------------------------- */
@media (max-width: 480px) {
  .hero {
    padding: 24px 14px 36px !important;
  }
  .hero__title {
    font-size: clamp(28px, 9.5vw, 40px) !important;
  }
  .hero__lead {
    font-size: 15px !important;
  }
  .hero__badge {
    font-size: 10px;
    padding: 3px 8px 3px 5px;
  }
  .hero__brief {
    padding: 14px !important;
  }
  .hero__brief-num {
    font-size: 20px !important;
  }
  .nav {
    padding: 10px 12px !important;
  }
  .nav__logo-text { font-size: 16px; }
  .nav__logo-badge { font-size: 9px; }
  .lang-switch {
    max-width: 50vw;
  }
  .nav__lang-btn {
    min-width: 28px;
    padding: 6px 6px;
    font-size: 10px;
  }
  .content {
    padding: 12px !important;
  }
  .featured-card__title {
    font-size: 21px !important;
  }
  .section-title {
    font-size: 19px !important;
  }
  .article {
    padding: 12px !important;
  }
  .article__title {
    font-size: clamp(24px, 8vw, 30px) !important;
  }
  .article__content {
    font-size: 16px;
    line-height: 1.6;
  }
  .article__hero {
    margin-left: -12px;
    margin-right: -12px;
  }
  .footer__links {
    grid-template-columns: 1fr !important;
  }
  .footer__inner {
    padding: 24px 16px !important;
  }
  .profile-stats,
  .stats-grid {
    grid-template-columns: 1fr !important;
  }
  .story-tile {
    min-width: 110px;
  }
}

/* Telegram WebApp viewport unit fallback (mini-app embed) */
@supports (height: 100dvh) {
  @media (max-width: 760px) {
    .ai-dialog-overlay--right .ai-dialog {
      height: 100dvh;
    }
  }
}

/* ============================================================
   STORIES VIEWER v3 — multi-slide variants + 3-zone tap areas
   ============================================================ */

/* 3-zone tap layout: prev | pause | next (replaces old .stories-viewer__nav) */
.stories-viewer__zones {
  position: absolute;
  top: 24px;
  left: 0;
  right: 0;
  bottom: 16%; /* leave bottom for CTA on outro slide */
  display: grid;
  grid-template-columns: 30% 40% 30%;
  z-index: 2;
}
.stories-viewer__zone {
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}
.stories-viewer__zone:focus {
  outline: none;
}

/* Slide container fills card */
.stories-viewer__slide {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
}

/* Slide 1: HERO — image + title + dek bottom */
.stories-viewer__hero-bg,
.stories-viewer__kpi-bg,
.stories-viewer__outro-bg {
  position: absolute;
  inset: 0;
  background-size: cover;
  background-position: center;
}
.stories-viewer__hero-gradient {
  position: absolute;
  inset: 0;
  background: linear-gradient(180deg, rgba(0,0,0,0.15) 0%, rgba(0,0,0,0.3) 50%, rgba(0,0,0,0.92) 100%);
}
.stories-viewer__hero-body {
  position: relative;
  margin-top: auto;
  padding: 24px;
  z-index: 2;
  color: #fff;
}
.stories-viewer__dek {
  font-size: 14px;
  line-height: 1.45;
  color: rgba(255,255,255,0.85);
  margin: 12px 0 0;
  text-shadow: 0 2px 12px rgba(0,0,0,0.4);
}

/* Slide 2: KPI — blurred image + huge number/quote center */
.stories-viewer__kpi-bg {
  filter: blur(18px) brightness(0.5);
  transform: scale(1.1);
}
.stories-viewer__kpi-gradient {
  position: absolute;
  inset: 0;
  background: radial-gradient(circle at 50% 50%, rgba(45,47,232,0.2) 0%, rgba(0,0,0,0.6) 60%);
}
.stories-viewer__kpi-body {
  position: relative;
  margin: auto;
  padding: 24px;
  text-align: center;
  z-index: 2;
  color: #fff;
}
.stories-viewer__kpi-num {
  font-family: var(--h-font-head, inherit);
  font-size: clamp(56px, 16vw, 96px);
  font-weight: 700;
  line-height: 1;
  letter-spacing: -0.04em;
  margin: 18px 0 12px;
  text-shadow: 0 4px 24px rgba(0,0,0,0.5);
}
.stories-viewer__kpi-label {
  font-size: 15px;
  line-height: 1.4;
  color: rgba(255,255,255,0.85);
  max-width: 320px;
  margin: 0 auto;
}

/* Slide 3: OUTRO — image dim + title + CTA */
.stories-viewer__outro-gradient {
  position: absolute;
  inset: 0;
  background: linear-gradient(180deg, rgba(0,0,0,0.4) 0%, rgba(0,0,0,0.7) 60%, rgba(0,0,0,0.95) 100%);
}
.stories-viewer__outro-body {
  position: relative;
  margin: auto 0 0;
  padding: 24px;
  z-index: 2;
  color: #fff;
}
.stories-viewer__title--sm {
  font-size: clamp(18px, 3.2vw, 22px) !important;
  margin-bottom: 22px !important;
}

/* Paused state — dim progress, optional pause icon */
.stories-viewer.is-paused .stories-viewer__progress-fill {
  opacity: 0.6;
}
.stories-viewer.is-paused .stories-viewer__zone--pause::after {
  content: "❚❚";
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  color: rgba(255,255,255,0.85);
  font-size: 32px;
  letter-spacing: 4px;
  pointer-events: none;
}
.stories-viewer__zone--pause {
  position: relative;
}

/* Mobile-tighter zones (still big enough to tap) */
@media (max-width: 480px) {
  .stories-viewer {
    padding: 12px;
  }
  .stories-viewer__card {
    max-width: 100%;
    height: min(720px, 92vh);
    margin-top: 24px;
    border-radius: 12px;
  }
  .stories-viewer__hero-body,
  .stories-viewer__outro-body {
    padding: 20px 18px;
  }
  .stories-viewer__kpi-num {
    font-size: clamp(48px, 18vw, 80px);
  }
}

/* ARCHIVE PIXELPERFECT 2026-05-17 */
.archive-hero {
  padding: 56px 40px 40px;
  border-bottom: 1px solid var(--h-border);
  max-width: 1520px;
  margin: 0 auto;
}
.archive-hero__crumbs a:hover { color: var(--h-text); }
.archive-hero__head {
  align-items: end !important;
}
.archive-hero__title {
  text-wrap: balance;
}
.archive-hero__subtitle {
  text-wrap: balance;
}

/* Archive year strip nestled inside hero */
.archive-hero .archive-year-strip {
  display: grid;
  grid-template-columns: repeat(12, 1fr);
  gap: 4px;
  margin-top: 32px;
}
.archive-hero .archive-year-strip__cell {
  padding: 10px 6px;
  text-align: center;
  border-radius: var(--h-r-md, 10px);
  background: var(--h-bg-soft);
  color: var(--h-text);
  font-size: 12px;
  font-weight: 560;
  text-decoration: none;
}
.archive-hero .archive-year-strip__cell.is-current {
  background: var(--h-deep);
  color: #fff;
}
.archive-hero .archive-year-strip__cell.is-future {
  opacity: 0.4;
  pointer-events: none;
}
.archive-hero .archive-year-strip__name {
  font-size: 12px;
}
.archive-hero .archive-year-strip__count {
  font-family: var(--h-font-mono);
  font-size: 10px;
  margin-top: 2px;
  color: var(--h-text-subtle);
}
.archive-hero .archive-year-strip__cell.is-current .archive-year-strip__count {
  color: rgba(255, 255, 255, 0.6);
}

/* Archive layout — 380px aside + 1fr main */
.archive-layout {
  display: grid;
  grid-template-columns: 380px 1fr;
  gap: 48px;
  padding: 48px 40px 80px;
  max-width: 1520px;
  margin: 0 auto;
  align-items: start;
}
.archive-layout__main { min-width: 0; }
@media (max-width: 1024px) {
  .archive-layout {
    grid-template-columns: 1fr;
    gap: 32px;
    padding: 32px 24px 64px;
  }
  .archive-sidebar { order: 2; }
  .archive-hero {
    padding: 32px 24px;
  }
  .archive-hero__title {
    font-size: 48px !important;
  }
  .archive-hero__head {
    grid-template-columns: 1fr !important;
  }
}

.archive-sidebar { min-width: 0; }
.archive-sidebar__section { margin-bottom: 40px; }
.archive-sidebar__label {
  font-size: 11px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  font-weight: 640;
  color: var(--h-text-subtle);
  margin-bottom: 16px;
}
.archive-sidebar__heatmap {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 6px;
}
.archive-sidebar__heatmap-name {
  font-size: 10px;
  color: var(--h-text-subtle);
  text-align: center;
  padding: 4px 0;
  letter-spacing: 0.08em;
  font-weight: 600;
}
.archive-sidebar__heatmap-cell {
  aspect-ratio: 1 / 1;
  border-radius: 6px;
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  padding: 6px;
  font-size: 11px;
  font-family: var(--h-font-mono);
  text-decoration: none;
  transition: transform 0.15s;
}
.archive-sidebar__heatmap-cell:hover {
  transform: scale(1.06);
  z-index: 2;
  position: relative;
}
.archive-sidebar__heatmap-d { line-height: 1; }
.archive-sidebar__heatmap-n {
  font-weight: 700;
  font-size: 13px;
  font-family: var(--h-font-head);
}
.archive-sidebar__legend {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 20px;
  font-size: 11px;
  color: var(--h-text-subtle);
}
.archive-sidebar__legend-cell {
  width: 14px;
  height: 14px;
  border-radius: 3px;
}

/* Categories rows in sidebar */
.archive-sidebar__row {
  display: grid;
  grid-template-columns: 1fr auto 120px;
  align-items: center;
  gap: 12px;
  margin-bottom: 10px;
  font-size: 13px;
}
.archive-sidebar__name {
  color: var(--h-text);
  text-decoration: none;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  flex: 1;
}
.archive-sidebar__name:hover { color: var(--h-link); }
.archive-sidebar__count {
  font-family: var(--h-font-mono);
  font-size: 12px;
  color: var(--h-text-subtle);
}
.archive-sidebar__bar {
  width: 120px;
  height: 6px;
  background: var(--h-border);
  border-radius: 3px;
  overflow: hidden;
}
.archive-sidebar__bar-fill {
  height: 100%;
  background: var(--h-primary);
  transition: width 0.3s ease;
}

/* Day group styling */
.archive-day-group { margin-bottom: 56px; }
.archive-day-group__head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  margin-bottom: 20px;
}
.archive-day-group__h2 {
  font-size: 28px;
  letter-spacing: -0.02em;
  margin: 0;
  text-transform: capitalize;
}
.archive-day-group__count {
  font-size: 13px;
  color: var(--h-text-muted);
}
.archive-day-group__more {
  display: inline-block;
  margin-top: 16px;
  font-size: 13px;
  color: var(--h-link);
  text-decoration: none;
  font-weight: 600;
}
.archive-day-group__more:hover { text-decoration: underline; }

/* RTL: flip year strip arrows + heatmap directions */
[dir="rtl"] .archive-hero__nav .btn { direction: rtl; }
[dir="rtl"] .archive-sidebar__bar { transform: scaleX(-1); }
[dir="rtl"] .archive-hero__crumbs { direction: rtl; }


/* PROFILE PIXELPERFECT 2026-05-17 */
.profile-main2 {
  display: grid;
  grid-template-columns: 3fr 1fr;
  gap: 48px;
  margin-top: 24px;
}
.profile-main2__col { min-width: 0; }
.profile-main2__aside {
  display: flex;
  flex-direction: column;
  gap: 24px;
  min-width: 0;
}
.profile-main2__aside .profile-donate-card { padding: 28px; }
.profile-main2__aside .profile-heatmap-section {
  padding: 24px;
  border: 1px solid var(--h-border);
  border-radius: var(--h-r-lg);
}
.profile-main2__aside .profile-heatmap-label {
  font-size: 11px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  font-weight: 640;
  color: var(--h-text-subtle);
  margin-bottom: 16px;
}
.profile-main2__aside .profile-heatmap {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 4px;
}
.profile-main2__aside .profile-heatmap__cell {
  aspect-ratio: 1 / 1;
  border-radius: 4px;
  background: var(--h-bg-soft);
}
.profile-main2__aside .profile-heatmap-hint {
  font-size: 12px;
  color: var(--h-text-muted);
  margin-top: 12px;
  line-height: 1.5;
}

@media (max-width: 1024px) {
  .profile-main2 {
    grid-template-columns: 1fr;
    gap: 32px;
  }
  .profile-main2__aside { order: 2; }
}

/* Panel header with action chips */
.profile-panel-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
  margin-bottom: 20px;
}
.profile-panel-actions {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}
.profile-panel-head .profile-panel-title { margin: 0; }

/* Smaller chip variant for view toggles */
.chip--sm {
  font-size: 12px !important;
  padding: 4px 10px !important;
}

/* RTL */
[dir="rtl"] .profile-panel-head { flex-direction: row-reverse; }
[dir="rtl"] .profile-main2 { direction: rtl; }

/* ============================================================================
   WAVE 10 — Editorial polish (hero stagger, card micro, artbar, podcasts)
   ============================================================================ */

/* --- Hero headline stagger (SSR wraps words in .stagger-w with inline delay).
   Guarded by no-preference so reduce users get the static headline. --- */
@media (prefers-reduced-motion: no-preference) {
  .hero__title .stagger-w {
    display: inline-block;
    opacity: 0;
    transform: translateY(0.32em);
    animation: h-word-in 0.26s cubic-bezier(0.2, 0.8, 0.2, 1) forwards;
  }
  @keyframes h-word-in {
    to { opacity: 1; transform: none; }
  }
  .hero__badge,
  .hero__lead,
  .hero__cta-row {
    animation: h-fade-up 0.4s ease 0.12s backwards;
  }
  .hero__brief {
    animation: h-fade-up 0.45s ease 0.18s backwards;
  }
  @keyframes h-fade-up {
    from { opacity: 0; transform: translateY(8px); }
  }
}

/* Nav controls (theme + lang) live on the right edge — mirrors critical CSS */
.nav__right {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: 8px;
}
[dir="rtl"] .nav__right {
  margin-left: 0;
  margin-right: auto;
}

/* --- Card hover: image saturates in, underline draws left-to-right.
   Desaturated rest state only where hover exists (never on touch). --- */
.card__image,
.featured-card__image {
  contain: paint;
}
@media (hover: hover) and (pointer: fine) {
  .card__image img {
    filter: saturate(0.25);
    transform: translateZ(0);
    transition:
      transform 0.55s cubic-bezier(0.2, 0.8, 0.2, 1),
      filter 0.2s ease;
  }
  .card:hover .card__image img {
    filter: saturate(1);
  }
}
.card__title {
  position: relative;
}
.card__title::after {
  content: "";
  position: absolute;
  left: 0;
  bottom: -5px;
  width: 100%;
  height: 2px;
  background: var(--h-primary);
  transform: scaleX(0);
  transform-origin: left;
  transition: transform 0.25s cubic-bezier(0.2, 0.8, 0.2, 1);
}
.card:hover .card__title::after {
  transform: scaleX(1);
}
[dir="rtl"] .card__title::after {
  transform-origin: right;
}

/* --- Article hero: settle-in from a gentle 6% zoom when scrolled into view --- */
@media (prefers-reduced-motion: no-preference) {
  .article__hero img {
    transform: scale(1.06) translateZ(0);
    transition: transform 1.2s cubic-bezier(0.16, 0.84, 0.3, 1);
  }
  .article__hero.is-settled img {
    transform: scale(1) translateZ(0);
  }
}

/* --- Sticky article bar: appears after the title scrolls past (fixed, no CLS) --- */
.artbar {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 60;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 8px 16px 10px;
  background: var(--h-bg);
  border-bottom: 1px solid var(--h-border);
  box-shadow: var(--h-shadow-sm);
  transform: translateY(-100%);
  /* Wave 18 a11y: transform alone keeps the bar's buttons focusable while it
     carries aria-hidden="true" (axe aria-hidden-focus). visibility flips after
     the slide-out finishes; animations.js also sets `inert` where supported. */
  visibility: hidden;
  transition:
    transform 0.28s cubic-bezier(0.2, 0.8, 0.2, 1),
    visibility 0s linear 0.28s;
}
.artbar.is-visible {
  transform: translateY(0);
  visibility: visible;
  transition:
    transform 0.28s cubic-bezier(0.2, 0.8, 0.2, 1),
    visibility 0s;
}
.artbar__title {
  flex: 1;
  min-width: 0;
  font-family: var(--h-font-head);
  font-size: 14px;
  font-weight: 640;
  letter-spacing: -0.01em;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  color: var(--h-text);
}
.artbar__actions {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-shrink: 0;
}
.artbar__btn {
  width: 32px;
  height: 32px;
  border-radius: var(--h-r-sm);
  border: 1px solid var(--h-border);
  background: var(--h-bg);
  color: var(--h-text-muted);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  text-decoration: none;
  transition: background 0.15s, color 0.15s;
}
.artbar__btn:hover {
  background: var(--h-bg-soft);
  color: var(--h-text);
}
.artbar__langs {
  display: flex;
  gap: 2px;
  flex-shrink: 0;
}
.artbar__progress {
  position: absolute;
  left: 0;
  bottom: -1px;
  height: 2px;
  width: 100%;
  background: transparent;
}
.artbar__progress-fill {
  height: 100%;
  width: 0;
  background: var(--h-primary);
}
@media (max-width: 640px) {
  .artbar__langs { display: none; }
}

/* --- Reactions: tactile press, active state --- */
.reaction-btn {
  transition: transform 0.12s ease, background 0.15s ease, border-color 0.15s ease;
}
.reaction-btn:active {
  transform: scale(0.96);
}
.reaction-btn.is-active {
  border-color: var(--h-primary) !important;
  color: var(--h-link) !important;
  background: rgba(45, 47, 232, 0.06) !important;
}

/* --- Category rail: gliding indicator under hovered/active chip --- */
.category-rail {
  position: relative;
}
.category-rail__indicator {
  position: absolute;
  bottom: 16px;
  left: 0;
  height: 2px;
  width: 0;
  border-radius: 1px;
  background: var(--h-primary);
  pointer-events: none;
  transition:
    transform 0.25s cubic-bezier(0.2, 0.8, 0.2, 1),
    width 0.25s cubic-bezier(0.2, 0.8, 0.2, 1),
    opacity 0.2s ease;
  opacity: 0;
  will-change: transform;
}
.category-rail__indicator.is-on {
  opacity: 1;
}
@media (max-width: 640px) {
  /* rail padding shrinks to 12px on phones — keep the line below the chips */
  .category-rail__indicator { bottom: 5px; }
}

/* --- Search form focus: brand ring + placeholder recedes --- */
form[action$="/search"] {
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}
form[action$="/search"]:focus-within {
  border-color: var(--h-primary) !important;
  box-shadow: 0 0 0 3px rgba(45, 47, 232, 0.12) !important;
}
form[action$="/search"] input::placeholder {
  transition: opacity 0.2s ease;
}
form[action$="/search"]:focus-within input::placeholder {
  opacity: 0.45;
}
.newsletter-form:focus-within {
  border-color: rgba(255, 255, 255, 0.35);
}

/* --- Footer: subtle gradient divider + social pills --- */
.footer {
  position: relative;
}
.footer::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 1px;
  background: linear-gradient(90deg, transparent 0%, var(--h-cyan) 30%, var(--h-primary) 70%, transparent 100%);
  opacity: 0.55;
}
.footer__pills {
  display: flex;
  align-items: center;
  gap: 8px;
}
.footer__pill {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.08);
  color: rgba(255, 255, 255, 0.85);
  text-decoration: none;
  transition: background 0.15s, color 0.15s;
}
.footer__pill:hover {
  background: rgba(255, 255, 255, 0.16);
  color: #fff;
}

/* --- Podcasts: artwork tiles, hover lift, subscribe row, sticky mini-player --- */
.podcast-card {
  display: flex;
  flex-direction: column;
  overflow: hidden;
  transition: transform 0.25s cubic-bezier(0.2, 0.8, 0.2, 1), box-shadow 0.25s ease;
}
.podcast-card:hover {
  transform: translateY(-3px);
  box-shadow: var(--h-shadow-md);
}
.podcast-card__art {
  aspect-ratio: 16 / 9;
  border-radius: var(--h-r-md);
  overflow: hidden;
  margin-bottom: 16px;
  background: var(--h-deep);
  contain: paint;
}
.podcast-card__art img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}
.podcast-subscribe {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
  padding: 18px 20px;
  margin: 8px 0 24px;
  border: 1px solid var(--h-border);
  border-radius: var(--h-r-lg);
  background: var(--h-bg-warm);
}
.podcast-subscribe__label {
  font-size: 14px;
  font-weight: 640;
  color: var(--h-text);
}
.podcast-miniplayer {
  position: fixed;
  left: 50%;
  bottom: 16px;
  transform: translateX(-50%) translateY(160%);
  width: min(560px, calc(100vw - 32px));
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 14px;
  background: var(--h-bg);
  color: var(--h-text);
  border: 1px solid var(--h-border);
  border-radius: 999px;
  box-shadow: 0 12px 32px rgba(0, 0, 0, 0.14), 0 2px 8px rgba(0, 0, 0, 0.06);
  z-index: 90;
  transition: transform 0.3s cubic-bezier(0.2, 0.8, 0.2, 1);
}
.podcast-miniplayer.is-visible {
  transform: translateX(-50%) translateY(0);
}
.podcast-miniplayer__play {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  border: 0;
  background: var(--h-primary);
  color: #fff;
  font-size: 13px;
  cursor: pointer;
  flex-shrink: 0;
}
.podcast-miniplayer__title {
  flex: 1;
  min-width: 0;
  font-size: 13px;
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.podcast-miniplayer__time {
  font-family: var(--h-font-mono);
  font-size: 11px;
  color: var(--h-text-subtle);
  flex-shrink: 0;
}

/* =================== WAVE 17: PERSONALIZATION =================== */
/* 'For you' + 'Continue reading' rails — slots are empty divs until the
   personalization fetch resolves, so they cost zero layout when unused. */
.rail--standalone {
  max-width: 1520px;
  margin: 0 auto;
  padding: 0 40px;
}
.continue-rail__bar {
  height: 4px;
  border-radius: 999px;
  background: var(--h-border);
  margin-top: 10px;
  overflow: hidden;
}
.continue-rail__fill {
  height: 100%;
  background: var(--h-primary);
  border-radius: 999px;
}

/* Inline newsletter signup — injected by seo.js after the 3rd feed card.
   Light variant of .newsletter-form (the base styles assume a dark card). */
.inline-signup {
  margin: 40px 0 8px;
  border: 1px solid var(--h-border);
  border-radius: var(--h-r-lg);
  background: var(--h-bg-warm);
  padding: 28px 32px;
}
.inline-signup__inner {
  display: flex;
  align-items: center;
  gap: 32px;
  flex-wrap: wrap;
}
.inline-signup__text {
  flex: 1 1 320px;
  min-width: 0;
}
.inline-signup__title {
  font-size: 20px;
  letter-spacing: -0.02em;
  margin-bottom: 6px;
}
.inline-signup__body {
  font-size: 14px;
  color: var(--h-text-muted);
}
.inline-signup__form {
  flex: 1 1 320px;
  background: var(--h-bg);
  border-color: var(--h-border-strong);
}
.inline-signup__form input {
  color: var(--h-text);
}
.inline-signup__form input::placeholder {
  color: var(--h-text-subtle);
}
.inline-signup__thanks {
  display: none;
  flex: 1 1 320px;
  font-size: 15px;
  font-weight: 600;
  color: var(--h-green-text); /* Wave 18: brand green was 2.1:1 on light bg */
  margin: 0;
}
.inline-signup--done .inline-signup__form {
  display: none;
}
.inline-signup--done .inline-signup__thanks {
  display: block;
}

/* Follow-topic hearts on category chips (index.html Wave 17 script) */
.chip__follow {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 18px;
  height: 18px;
  margin: 0 -4px 0 2px;
  padding: 0;
  border: none;
  border-radius: 50%;
  background: transparent;
  color: var(--h-text-subtle);
  cursor: pointer;
}
.chip__follow svg {
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
}
.chip__follow:hover {
  color: var(--h-red-text); /* Wave 18: brand red was 2.6:1 on the light chip (3:1 needed for icons) */
}
.chip__follow[aria-pressed="true"] {
  color: var(--h-red-text); /* Wave 18 contrast — flips back to bright red in dark theme */
}
.chip__follow[aria-pressed="true"] svg {
  fill: currentColor;
  stroke: none;
}

/* ✕ hide-article button — decorated on .card for returning visitors only */
.card {
  position: relative;
}
.card__hide {
  position: absolute;
  top: 10px;
  right: 10px;
  z-index: 2;
  width: 26px;
  height: 26px;
  border-radius: 50%;
  border: none;
  background: rgba(1, 1, 6, 0.45);
  color: #fff;
  font-size: 12px;
  line-height: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  transition: opacity 0.15s;
  cursor: pointer;
}
.card:hover .card__hide,
.card__hide:focus-visible {
  opacity: 1;
}
@media (hover: none) {
  .card__hide {
    opacity: 0.7;
  }
}

/* ===== Wave 18 Track C: semantic search toggle + relevance pill ===== */
.semantic-toggle {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  flex-shrink: 0;
  padding: 8px 13px;
  margin: 2px 0;
  border: 1px solid var(--h-border);
  border-radius: 999px;
  background: transparent;
  /* #4a4a55 on #fff ≈ 8.1:1 (light); #a8aac4 on dark card ≈ 7.9:1 — AA ok */
  color: var(--h-text-muted);
  font-family: inherit;
  font-size: 12px;
  font-weight: 640;
  letter-spacing: 0.02em;
  white-space: nowrap;
  cursor: pointer;
  transition: background 0.15s, color 0.15s, border-color 0.15s;
}
.semantic-toggle:hover {
  border-color: var(--h-primary);
  color: var(--h-link);
}
.semantic-toggle:focus-visible {
  outline: 2px solid var(--h-primary);
  outline-offset: 2px;
}
.semantic-toggle[aria-pressed="true"] {
  /* white on --h-primary #2d2fe8 ≈ 7.8:1 — AA ok */
  background: var(--h-primary);
  border-color: var(--h-primary);
  color: #fff;
}
@media (max-width: 640px) {
  /* icon-only on narrow screens; the accessible name lives in aria-label */
  .semantic-toggle__label {
    display: none;
  }
}

.relevance-pill {
  display: inline-flex;
  align-items: center;
  flex-shrink: 0;
  padding: 3px 9px;
  border: 1px solid var(--h-border);
  border-radius: 999px;
  /* gray pill: #4a4a55 on #f7f6f3 ≈ 7.4:1 (light), #a8aac4 on #0a0c30 ≈ 7.9:1 (dark) */
  background: var(--h-bg-warm);
  color: var(--h-text-muted);
  font-size: 11px;
  font-weight: 640;
  font-variant-numeric: tabular-nums;
  line-height: 1.4;
}

/* fade-in for client-rendered semantic results (staggered via inline delay) */
@keyframes semantic-result-fade {
  from {
    opacity: 0;
    transform: translateY(8px);
  }
  to {
    opacity: 1;
    transform: none;
  }
}
@media (prefers-reduced-motion: no-preference) {
  .search-result-fade {
    animation: semantic-result-fade 0.35s ease both;
  }
}

/* dimmed while /api/search/semantic is in flight */
.search-results[aria-busy="true"] {
  opacity: 0.55;
  transition: opacity 0.2s;
}

/* ============================================================
   Wave 18 — mini-app i18n: minimal RTL overrides (lang=ar).
   Complements the main RTL block (~line 2346). Flex rows mirror
   automatically under dir=rtl; only physical left/right values
   need flipping here.
   ============================================================ */

/* Footer — grid columns + bottom row read right-to-left */
html[dir="rtl"] .footer {
  text-align: right;
}
html[dir="rtl"] .footer__bottom {
  flex-direction: row-reverse;
}

/* Language switcher + lang codes are Latin — keep them LTR inside RTL nav */
html[dir="rtl"] .lang-switch {
  direction: ltr;
}

/* Card ✕ (hide) button — mirrored corner */
html[dir="rtl"] .card__hide {
  right: auto;
  left: 10px;
}

/* Follow-topic heart inside category chips — mirrored spacing */
html[dir="rtl"] .chip__follow {
  margin: 0 2px 0 -4px;
}

/* Drop caps float on the other side in Arabic */
html[dir="rtl"] .article__content .article__lede::first-letter {
  float: right;
  margin: 8px 0 0 14px;
}
html[dir="rtl"] .article__content p:first-child::first-letter {
  float: right;
  margin-right: 0;
  margin-left: 10px;
}

/* Personalization rails inherit RTL text alignment */
html[dir="rtl"] .foryou-rail,
html[dir="rtl"] .continue-rail {
  text-align: right;
}

/* ============================================================
   Wave 18 — WCAG 2.2 AA accessibility layer
   ============================================================ */

/* --- Focus indicators: 2px brand ring on every interactive element.
   !important deliberately overrides legacy `outline: none` declarations
   (newsletter input, 404 search, comment inputs, AI-dialog textarea).
   :focus-visible keeps mouse clicks ring-free on buttons/links while
   text inputs always show the ring when focused (spec behavior). --- */
a:focus-visible,
button:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible,
summary:focus-visible,
[tabindex]:focus-visible,
[role="button"]:focus-visible,
[role="tab"]:focus-visible,
[role="link"]:focus-visible {
  outline: 2px solid var(--h-focus-ring, #2d2fe8) !important;
  outline-offset: 2px;
}
/* On dark sections inside the light theme the primary-blue ring is ~2.5:1 —
   switch to cyan (≥7:1 on deep navy). */
.hero a:focus-visible, .hero button:focus-visible,
.nav--dark a:focus-visible, .nav--dark button:focus-visible,
.footer a:focus-visible, .footer button:focus-visible, .footer input:focus-visible,
.newsletter-card a:focus-visible, .newsletter-card button:focus-visible,
.newsletter a:focus-visible, .newsletter button:focus-visible, .newsletter input:focus-visible,
.newsletter-form input:focus-visible, .newsletter-form button:focus-visible,
.not-found-page a:focus-visible, .not-found-page button:focus-visible, .not-found-page input:focus-visible,
.stories-viewer a:focus-visible, .stories-viewer button:focus-visible,
.search-ai-banner a:focus-visible, .search-ai-banner button:focus-visible,
.profile-donate-card a:focus-visible, .profile-donate-card button:focus-visible {
  outline-color: var(--h-cyan, #29a9ff) !important;
}

/* --- Skip-to-content link (first element in <body>; visible only on focus) --- */
.skip-link {
  position: fixed;
  top: -120px;
  left: 16px;
  z-index: 300;
  padding: 12px 20px;
  background: var(--h-primary);
  color: #fff;
  border-radius: var(--h-r-md, 10px);
  font-family: var(--h-font-body);
  font-size: 14px;
  font-weight: 600;
  text-decoration: none;
  box-shadow: var(--h-shadow-md);
  transition: top 0.15s ease;
}
.skip-link:focus,
.skip-link:focus-visible {
  top: 16px;
}
/* The skip target — no visible ring on the page container itself */
#portal-app:focus {
  outline: none;
}

/* --- Toast notifications: live region + visible style.
   portal.js showToast() renders into #toast-region (aria-live="polite"
   in index.html) so screen readers announce confirmations. --- */
.toast-region {
  position: fixed;
  left: 50%;
  bottom: 24px;
  transform: translateX(-50%);
  z-index: 320;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  pointer-events: none;
  width: max-content;
  max-width: calc(100vw - 32px);
}
.toast {
  background: var(--h-deep, #010334);
  color: #fff;
  padding: 12px 20px;
  border-radius: 999px;
  font-size: 14px;
  font-weight: 560;
  line-height: 1.4;
  box-shadow: var(--h-shadow-md);
  opacity: 0;
  transform: translateY(8px);
  transition: opacity 0.25s ease, transform 0.25s ease;
  max-width: 100%;
}
.toast.show {
  opacity: 1;
  transform: none;
}
html.h-theme-dark .toast,
html[data-theme="dark"] .toast {
  background: var(--h-surface-2, #141748);
  border: 1px solid var(--h-border-strong);
}
/* legacy: toasts appended straight to <body> before the region existed */
body > .toast {
  position: fixed;
  left: 50%;
  bottom: 24px;
  transform: translateX(-50%) translateY(8px);
  z-index: 320;
}
body > .toast.show {
  transform: translateX(-50%);
}

/* --- Touch targets ≥44×44 on touch devices (WCAG 2.5.8 + best practice).
   Visual size grows where harmless; hit-area expands via ::after where a
   bigger visual would break the layout (card ✕, chip hearts). --- */
@media (pointer: coarse) {
  .article__share-btn,
  .artbar__btn,
  .footer__pill,
  .footer__social,
  .stories-viewer__close,
  .ai-dialog__close,
  .nav__theme,
  .not-found-page__search button {
    min-width: 44px;
    min-height: 44px;
  }
  .nav__lang-btn {
    min-height: 32px; /* 6-up switcher: meets 24px AA minimum, taller would wrap the nav */
  }
  .card__hide {
    width: 32px;
    height: 32px;
    font-size: 14px;
  }
  .card__hide::after {
    content: "";
    position: absolute;
    inset: -6px; /* 44×44 hit area, 32px visual */
  }
  .chip__follow {
    position: relative;
  }
  .chip__follow::after {
    content: "";
    position: absolute;
    inset: -4px; /* 26×26 hit area — stays inside the parent chip link */
  }
}

/* ============================================================
   Wave 19 Track C — donate UI (Telegram Stars) + opinion badge
   ============================================================ */

/* --- Amber accent tokens (opinion/donate). AA pairs:
   light: #8a5a00 ≈ 5.9:1 on #fff, ≈ 5.5:1 on the 14% amber tint;
   dark:  #ffc94d ≈ 5.1:1 on #0f1238 with the 12% amber tint. --- */
:root {
  --h-amber: #f5b428;
  --h-amber-text: #8a5a00;
  --h-amber-bg: rgba(245, 180, 40, 0.14);
  --h-amber-border: rgba(138, 90, 0, 0.4);
}
html[data-theme="dark"] {
  --h-amber-text: #ffc94d;
  --h-amber-bg: rgba(255, 201, 77, 0.12);
  --h-amber-border: rgba(255, 201, 77, 0.32);
}
@media (prefers-color-scheme: dark) {
  :root.h-auto-dark,
  html[data-theme="dark"] {
    --h-amber-text: #ffc94d;
    --h-amber-bg: rgba(255, 201, 77, 0.12);
    --h-amber-border: rgba(255, 201, 77, 0.32);
  }
}

/* --- Opinion badge — Track B renders
   <span class="card__badge card__badge--opinion">…</span> on original
   articles (feed cards + /:lang/opinion SSR section). --- */
.card__badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 3px 9px;
  border-radius: var(--h-r-pill, 999px);
  font-family: var(--h-font-body);
  font-size: 10.5px;
  line-height: 1.4;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  font-weight: 640;
  vertical-align: middle;
  white-space: nowrap;
}
.card__badge--opinion {
  background: var(--h-amber-bg);
  color: var(--h-amber-text);
  border: 1px solid var(--h-amber-border);
}
/* Arabic: uppercase is a no-op and tracking breaks letter joining */
html[dir="rtl"] .card__badge {
  letter-spacing: 0;
}

/* --- Nav donate entry (header / mini-app menu) --- */
.nav__donate {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  height: 40px;
  padding: 0 14px;
  border-radius: var(--h-r-pill, 999px);
  background: var(--h-amber-bg);
  color: var(--h-amber-text);
  border: 1px solid var(--h-amber-border);
  font-size: 13px;
  font-weight: 620;
  white-space: nowrap;
  flex-shrink: 0;
  transition: background 0.15s ease, border-color 0.15s ease;
}
.nav__donate:hover {
  background: rgba(245, 180, 40, 0.24);
}
html[data-theme="dark"] .nav__donate:hover {
  background: rgba(255, 201, 77, 0.2);
}
/* Dark navy nav variant — flip to the bright amber pair */
.nav--dark .nav__donate {
  color: #ffc94d;
  background: rgba(255, 201, 77, 0.12);
  border-color: rgba(255, 201, 77, 0.32);
}
@media (max-width: 768px) {
  .nav__donate {
    width: 40px;
    padding: 0;
  }
  .nav__donate-label {
    display: none;
  }
}

/* --- Footer donate entry — button styled to match .footer__group a --- */
.footer__donate-btn {
  background: none;
  border: none;
  padding: 0;
  margin: 0;
  font-family: var(--h-font-body);
  font-size: 14px;
  line-height: 1.5;
  text-align: start;
  color: rgba(255, 255, 255, 0.85);
  cursor: pointer;
  transition: color 0.15s;
}
.footer__donate-btn:hover {
  color: #fff;
  text-decoration: underline;
  text-underline-offset: 4px;
}

/* --- Donate modal --- */
.donate-modal {
  position: fixed;
  inset: 0;
  z-index: 140; /* above reading progress / FABs, below toasts (320) */
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
}
.donate-modal[hidden] {
  display: none !important;
}
.donate-modal__backdrop {
  position: absolute;
  inset: 0;
  background: rgba(1, 3, 52, 0.55);
  backdrop-filter: blur(4px);
}
.donate-modal__panel {
  position: relative;
  width: 100%;
  max-width: 420px;
  max-height: calc(100vh - 40px);
  overflow-y: auto;
  background: var(--h-bg);
  border: 1px solid var(--h-border);
  border-radius: var(--h-r-xl, 24px);
  box-shadow: var(--h-shadow-lg);
  padding: 32px 24px 24px;
  text-align: center;
  animation: donate-pop 0.22s cubic-bezier(0.2, 0.8, 0.2, 1);
}
@keyframes donate-pop {
  from {
    opacity: 0;
    transform: translateY(10px) scale(0.97);
  }
  to {
    opacity: 1;
    transform: none;
  }
}
@media (prefers-reduced-motion: reduce) {
  .donate-modal__panel {
    animation: none;
  }
}
.donate-modal__close {
  position: absolute;
  top: 12px;
  inset-inline-end: 12px; /* mirrors automatically under dir=rtl */
  width: 44px;
  height: 44px;
  border-radius: var(--h-r-md, 10px);
  background: var(--h-bg-soft);
  border: none;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--h-text);
}
.donate-modal__star {
  width: 52px;
  height: 52px;
  margin: 0 auto 14px;
  border-radius: 50%;
  background: var(--h-amber-bg);
  border: 1px solid var(--h-amber-border);
  color: var(--h-amber-text);
  display: flex;
  align-items: center;
  justify-content: center;
}
.donate-modal__title {
  font-size: 22px;
  font-weight: 660;
  letter-spacing: -0.02em;
  margin: 0;
}
.donate-modal__subtitle {
  font-size: 14px;
  line-height: 1.5;
  color: var(--h-text-muted);
  margin: 8px auto 20px;
  max-width: 320px;
}
.donate-modal__tiers {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}
@media (max-width: 380px) {
  .donate-modal__tiers {
    grid-template-columns: 1fr;
  }
}
.donate-tier {
  min-height: 64px; /* ≥44px touch target with room for the label */
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
  padding: 12px 8px;
  background: var(--h-surface);
  border: 1px solid var(--h-border-strong);
  border-radius: var(--h-r-md, 10px);
  text-decoration: none;
  color: inherit;
  transition: border-color 0.15s ease, background 0.15s ease, transform 0.15s ease;
}
.donate-tier:hover {
  border-color: var(--h-amber-border);
  background: var(--h-amber-bg);
  transform: translateY(-1px);
}
.donate-tier__stars {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-family: var(--h-font-head);
  font-size: 20px;
  font-weight: 700;
  letter-spacing: -0.02em;
  color: var(--h-text);
  direction: ltr; /* ⭐ + digits stay LTR inside RTL */
}
.donate-tier__stars svg {
  color: var(--h-amber-text);
  flex-shrink: 0;
}
.donate-tier__label {
  font-size: 12px;
  line-height: 1.35;
  color: var(--h-text-muted);
}
.donate-modal__note {
  margin: 16px 0 0;
  font-size: 12px;
  color: var(--h-text-subtle);
}
/* Scroll lock while the modal is open (toggled by initDonate) */
body.donate-modal-open {
  overflow: hidden;
}

/* ============================================================
   Wave 20 Track B — breaking-news banner
   Sits ABOVE the <nav>, sticky to the top. Deep brand red bg
   with white text (#fff on #c0392b ≈ 5.44:1 — WCAG AA). Light +
   dark + RTL. Dismiss X has a ≥44px hit area on touch devices.
   ============================================================ */
:root {
  --h-breaking-bg: #c0392b;       /* 5.44:1 with #fff text */
  --h-breaking-bg-hover: #a93226;
  --h-breaking-text: #ffffff;
}
html.h-theme-dark,
html[data-theme="dark"] {
  --h-breaking-bg: #b3261e;       /* 6.54:1 with #fff text */
  --h-breaking-bg-hover: #9b211a;
}

.breaking-banner {
  position: sticky;
  top: 0;
  z-index: 60; /* above nav (z-index:5), below modals/toasts */
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 9px 40px;
  background: var(--h-breaking-bg);
  color: var(--h-breaking-text);
  font-family: var(--h-font-body);
  font-size: 14px;
  line-height: 1.35;
}
.breaking-banner[hidden] {
  display: none;
}
.breaking-banner__link {
  display: flex;
  align-items: center;
  gap: 10px;
  flex: 1 1 auto;
  min-width: 0; /* let the title ellipsize */
  color: var(--h-breaking-text);
  text-decoration: none;
}
.breaking-banner__link:hover .breaking-banner__title {
  text-decoration: underline;
  text-underline-offset: 2px;
}
.breaking-banner__tag {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  flex-shrink: 0;
  font-weight: 700;
  font-size: 11px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}
.breaking-banner__dot {
  width: 7px;
  height: 7px;
  border-radius: 999px;
  background: #fff;
  flex-shrink: 0;
}
@media (prefers-reduced-motion: no-preference) {
  .breaking-banner__dot {
    animation: h-breaking-pulse 1.6s ease-in-out infinite;
  }
  @keyframes h-breaking-pulse {
    0%, 100% { opacity: 1; transform: scale(1); }
    50% { opacity: 0.45; transform: scale(0.78); }
  }
  .breaking-banner {
    animation: h-breaking-in 0.32s cubic-bezier(0.2, 0.8, 0.2, 1);
  }
  @keyframes h-breaking-in {
    from { transform: translateY(-100%); }
    to { transform: translateY(0); }
  }
}
.breaking-banner__title {
  font-weight: 560;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  min-width: 0;
}
.breaking-banner__time {
  flex-shrink: 0;
  font-size: 12px;
  font-variant-numeric: tabular-nums;
  opacity: 0.82;
  white-space: nowrap;
}
.breaking-banner__dismiss {
  flex-shrink: 0;
  width: 28px;
  height: 28px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  position: relative;
  border: 0;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.16);
  color: var(--h-breaking-text);
  margin-left: 4px;
}
.breaking-banner__dismiss:hover {
  background: rgba(255, 255, 255, 0.28);
}
/* WCAG 2.5.8: ≥44×44 touch target on coarse pointers (28px visual). */
@media (pointer: coarse) {
  .breaking-banner__dismiss::after {
    content: "";
    position: absolute;
    inset: -8px;
  }
}
/* RTL: dismiss flips to the left, banner content mirrors via flow direction. */
html[dir="rtl"] .breaking-banner {
  direction: rtl;
}
html[dir="rtl"] .breaking-banner__dismiss {
  margin-left: 0;
  margin-right: 4px;
}
@media (max-width: 640px) {
  .breaking-banner {
    padding: 8px 16px;
    font-size: 13px;
    gap: 6px;
  }
  /* Relative time is least essential on a narrow row — drop it. */
  .breaking-banner__time {
    display: none;
  }
  .breaking-banner__tag {
    font-size: 10px;
  }
}

/* =============================================================================
   ===== Wave 26: magazine home + cards =====
   Editorial redesign of the portal home feed + every category/tag/source/archive
   grid. Bloomberg / Stratechery energy: generous whitespace, crisp type, subtle
   shadows, a single category-accent colour used sparingly (top strip + label).

   Pieces:
     1. Category accent custom props  (--cat-accent per [data-cat])
     2. .card             — polished editorial card (container + accent strip)
     3. .card--hero       — magazine cover card (image-fill + scrim + overlay)
     4. .card--sm/.card--lg sizes
     5. .mosaic           — responsive magazine grid (6/4/1 col)
     6. .load-more        — centred "load more" pill + wrapper
     7. dark-mode mirrors for the new surfaces

   These rules intentionally come AFTER the base .card rules (~ln 802) and the
   .grid-3 utility (~ln 1226) so they override where needed without editing the
   originals.
   ============================================================================= */

/* ---------------------------------------------------------------------------
   1. Category accent colours — scoped custom property per [data-cat].
   The render only sets data-cat on the card; the colour comes from here.
   --------------------------------------------------------------------------- */
.card { --cat-accent: #2d2fe8; } /* default (= brand --h-primary) */
.card[data-cat="llm"]        { --cat-accent: #2d2fe8; }
.card[data-cat="robotics"]   { --cat-accent: #0891b2; }
.card[data-cat="startups"]   { --cat-accent: #d97706; }
.card[data-cat="research"]   { --cat-accent: #7c3aed; }
.card[data-cat="ethics"]     { --cat-accent: #db2777; }
.card[data-cat="business"]   { --cat-accent: #059669; }
.card[data-cat="hardware"]   { --cat-accent: #475569; }
.card[data-cat="autonomous"] { --cat-accent: #0d9488; }
.card[data-cat="medicine"]   { --cat-accent: #16a34a; }
.card[data-cat="creative"]   { --cat-accent: #ea580c; }

/* ---------------------------------------------------------------------------
   2. The card itself — upgrade the flat stack into a framed editorial card.
   Keeps the existing inner structure (.card__image / __cat / __title / __dek /
   __meta); we only re-skin the container and tighten the internals.
   The base rule (ln 802) set the card to a column flex with gap:14px; here we
   remove that inter-element gap (the image is flush to the top, the text block
   carries its own padding) and turn the card into a bordered surface.
   --------------------------------------------------------------------------- */
.card {
  position: relative;
  gap: 0;                                /* override base gap:14px — see below */
  background: var(--h-surface);
  border: 1px solid var(--h-border);
  border-radius: var(--h-r-lg);
  overflow: hidden;                      /* clip image + accent strip corners */
  box-shadow: var(--h-shadow-xs);
  transition:
    transform 0.2s cubic-bezier(0.2, 0.8, 0.2, 1),
    box-shadow 0.2s ease,
    border-color 0.2s ease;
  isolation: isolate;
}

/* 3px accent strip pinned to the very top edge, coloured by the category. */
.card::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 3px;
  background: var(--cat-accent);
  z-index: 3;
}

/* Image flush to the top corners (no rounding of its own — the card clips). */
.card .card__image {
  border-radius: 0;
  margin: 0;
}

/* Internal padding for the text block. The base .card is a flex column, so we
   wrap the text in padding by giving each text child horizontal padding via a
   shared block. Simplest robust approach: pad the non-image children. */
.card .card__cat,
.card .card__title,
.card .card__dek,
.card .card__meta {
  padding-left: 18px;
  padding-right: 18px;
}
.card .card__cat   { margin-top: 16px; }    /* first text row gets top padding */
.card .card__title { margin-top: 10px; }
.card .card__dek   { margin-top: 8px; }
.card .card__meta  { margin-top: 12px; padding-bottom: 18px; }
/* When there is no dek (e.g. compact rubric cards), keep the bottom padding
   anchored on the meta row regardless. */
.card .card__meta:last-child { margin-bottom: 0; }

/* Category label takes the accent colour (sparingly = just the label + strip). */
.card .card__cat { color: var(--cat-accent); }

/* Hover lift — translateY + stronger shadow + slightly darker border.
   The base rule keeps the image scale(1.05) + title→link colour. */
.card:hover {
  transform: translateY(-4px);
  box-shadow: 0 12px 30px rgba(1, 1, 6, 0.1);
  border-color: var(--h-border-strong);
}
/* On editorial cards the title turning blue on hover fights the accent strip;
   keep the title in its normal colour and let the lift + image zoom carry it. */
.card:hover .card__title { color: var(--h-text); }

/* Size variants ---------------------------------------------------------- */
.card--sm .card__title { font-size: 16px; line-height: 1.18; }
.card--sm .card__dek   { display: none; }   /* compact = no dek (matches today) */
.card--sm .card__cat   { margin-top: 14px; }
.card--sm .card__meta  { margin-top: 10px; }

.card--lg .card__title { font-size: 25px; }
.card--lg .card__cat,
.card--lg .card__title,
.card--lg .card__dek,
.card--lg .card__meta { padding-left: 22px; padding-right: 22px; }

/* ---------------------------------------------------------------------------
   3. .card--hero — the magazine cover card. The image FILLS the card, a dark
   bottom-to-top scrim makes overlaid white text readable (WCAG AA), and the
   category label + title sit on top of the image at the bottom.
   No accent strip / border needed — the scrim is the frame.
   --------------------------------------------------------------------------- */
.card--hero {
  border: none;
  box-shadow: var(--h-shadow-md);
  min-height: 420px;
  display: block;                         /* override the flex column */
}
.card--hero::before { display: none; }    /* no accent strip on the cover card */

/* Image fills the whole card. */
.card--hero .card__image {
  position: absolute;
  inset: 0;
  aspect-ratio: auto;                     /* override base 16/10 */
  width: 100%;
  height: 100%;
  border-radius: inherit;
  z-index: 0;
}
.card--hero .card__image img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

/* Dark bottom scrim — strong enough for white text at the bottom. */
.card--hero::after {
  content: "";
  position: absolute;
  inset: 0;
  z-index: 1;
  background: linear-gradient(
    to top,
    rgba(1, 1, 6, 0.82) 0%,
    rgba(1, 1, 6, 0.62) 22%,
    rgba(1, 1, 6, 0.25) 48%,
    rgba(1, 1, 6, 0) 72%
  );
  border-radius: inherit;
  pointer-events: none;
}

/* Overlay the text at the bottom, on top of the scrim. */
.card--hero .card__cat,
.card--hero .card__title,
.card--hero .card__meta {
  position: relative;
  z-index: 2;
  padding-left: 28px;
  padding-right: 28px;
}
.card--hero .card__cat {
  position: absolute;
  top: 24px;
  left: 0;
  margin: 0;
  color: #ffffff;
  opacity: 0.92;
}
/* translucent-white pill behind the category label so it reads on busy images */
.card--hero .card__cat::after {
  content: "";
  position: absolute;
  inset: -6px 24px -6px -8px;
  z-index: -1;
  background: rgba(255, 255, 255, 0.14);
  border-radius: var(--h-r-pill);
  backdrop-filter: blur(2px);
}
.card--hero .card__title {
  position: absolute;
  bottom: 64px;
  left: 0;
  right: 0;
  margin: 0;
  color: #ffffff;
  font-size: clamp(26px, 2.6vw, 30px);
  line-height: 1.12;
  text-shadow: 0 1px 24px rgba(0, 0, 0, 0.4);
}
.card--hero .card__meta {
  position: absolute;
  bottom: 24px;
  left: 0;
  right: 0;
  margin: 0;
  color: rgba(255, 255, 255, 0.82);
}
.card--hero .card__meta .meta-sep { opacity: 0.5; }
.card--hero .card__dek { display: none; }  /* hidden on the cover card (cramped) */
.card--hero:hover { transform: translateY(-4px); box-shadow: var(--h-shadow-lg); }
.card--hero:hover .card__title { color: #ffffff; }  /* stay white on hover */

/* ---------------------------------------------------------------------------
   5. .mosaic — the magazine grid. Replaces the flat .grid-3 in the home feed
   and in category / tag / source / archive feeds.
       desktop ≥1025: 6 columns; hero spans 4×2, 2nd/3rd span 2, rest span 2
       tablet ≤1024: 4 columns; hero spans 4 (full, capped), rest span 2
       mobile ≤640:  single column
   grid-auto-rows + the hero spanning 2 rows gives the layout rhythm.
   --------------------------------------------------------------------------- */
.mosaic {
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  grid-auto-rows: minmax(0, auto);
  column-gap: 24px;
  row-gap: 36px;
  align-items: stretch;
}
.mosaic > .card { height: 100%; }          /* equal-height cards within a row */

/* The first card is the hero: 4 columns wide, 2 rows tall. */
.mosaic > .card--hero {
  grid-column: span 4;
  grid-row: span 2;
}
/* 2nd & 3rd cards sit beside the hero — 2 cols each, single row. */
.mosaic > .card:nth-child(2),
.mosaic > .card:nth-child(3) {
  grid-column: span 2;
}
/* Everything after the hero block flows 3-per-row (2 cols each). */
.mosaic > .card { grid-column: span 2; }
.mosaic > .card--hero { grid-column: span 4; }  /* re-assert after the blanket */

/* Tablet — 4-column grid. */
@media (max-width: 1024px) {
  .mosaic {
    grid-template-columns: repeat(4, 1fr);
    column-gap: 20px;
    row-gap: 28px;
  }
  .mosaic > .card { grid-column: span 2; }
  .mosaic > .card--hero {
    grid-column: span 4;                   /* full width */
    grid-row: span 1;                      /* no longer needs 2 rows */
    min-height: 0;
    height: 360px;                         /* capped height */
  }
}

/* Mobile — single column stack. */
@media (max-width: 640px) {
  .mosaic {
    grid-template-columns: 1fr;
    gap: 20px;
  }
  .mosaic > .card,
  .mosaic > .card--hero {
    grid-column: span 1;
    grid-row: auto;
  }
  .mosaic > .card--hero {
    height: auto;
    min-height: 0;
  }
  .mosaic > .card--hero .card__image {
    position: relative;                    /* let the card height follow image */
    height: 220px;
  }
  .mosaic > .card--hero {
    display: flex;
    flex-direction: column;
  }
  /* On mobile the hero overlay text needs explicit room below the 220px image */
  .mosaic > .card--hero .card__cat   { position: absolute; top: 16px; }
  .mosaic > .card--hero .card__title {
    position: absolute;
    bottom: 52px;
    font-size: 22px;
  }
  .mosaic > .card--hero .card__meta  { position: absolute; bottom: 18px; }
  .mosaic > .card--hero::after {
    /* scrim only over the image area on mobile */
    bottom: auto;
    height: 220px;
  }
}

/* ---------------------------------------------------------------------------
   6. Load-more pill — centred control appended after a .mosaic feed.
   --------------------------------------------------------------------------- */
.load-more-wrap {
  display: flex;
  justify-content: center;
  align-items: center;
  margin: 40px 0;
}
.load-more {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 13px 28px;
  font-family: var(--h-font-head);
  font-size: 15px;
  font-weight: 600;
  letter-spacing: -0.01em;
  color: var(--h-text);
  background: transparent;
  border: 1.5px solid var(--h-border);
  border-radius: var(--h-r-pill);
  cursor: pointer;
  transition:
    background 0.18s ease,
    color 0.18s ease,
    border-color 0.18s ease,
    transform 0.18s ease;
}
.load-more svg {
  width: 16px;
  height: 16px;
  transition: transform 0.2s ease;
}
.load-more:hover {
  background: var(--h-text);
  color: var(--h-text-inverse);
  border-color: var(--h-text);
}
.load-more:hover svg { transform: translateY(2px); }
.load-more:focus-visible {
  outline: 2px solid var(--h-focus-ring);
  outline-offset: 3px;
}
/* Loading + exhausted states (toggled by portal.js). */
.load-more.is-loading {
  pointer-events: none;
  opacity: 0.6;
}
.load-more.is-loading svg { animation: load-more-spin 0.7s linear infinite; }
.load-more[disabled],
.load-more.is-done {
  pointer-events: none;
  opacity: 0.5;
}
@keyframes load-more-spin {
  to { transform: rotate(360deg); }
}

/* ---------------------------------------------------------------------------
   7. Dark-mode mirrors for the new surfaces.
   Cards already pull --h-surface / --h-border, which both dark mechanisms flip,
   so they re-theme automatically. We only need: a slightly stronger hover
   shadow on dark, and to make sure the hero scrim/overlay (which use fixed
   white + black, theme-independent by design) keep their contrast. The hero
   stays the same in dark mode (white text on a dark image scrim = correct).
   Covers all three dark hooks the project uses: html.h-theme-dark,
   html[data-theme="dark"], and body.tg-dark.
   --------------------------------------------------------------------------- */
html.h-theme-dark .card,
html[data-theme="dark"] .card,
body.tg-dark .card {
  background: var(--h-surface);
  border-color: var(--h-border);
  box-shadow: none;
}
html.h-theme-dark .card:hover,
html[data-theme="dark"] .card:hover,
body.tg-dark .card:hover {
  border-color: var(--h-border-strong);
  box-shadow: 0 12px 30px rgba(0, 0, 0, 0.45);
}
/* Hero on dark: no surface border anyway; keep the scrim, drop card bg so the
   image fills cleanly. */
html.h-theme-dark .card--hero,
html[data-theme="dark"] .card--hero,
body.tg-dark .card--hero {
  background: transparent;
  border: none;
}
/* Load-more pill on dark — invert hover to the (now light) --h-text. */
html.h-theme-dark .load-more:hover,
html[data-theme="dark"] .load-more:hover,
body.tg-dark .load-more:hover {
  background: var(--h-text);
  color: var(--h-bg);
  border-color: var(--h-text);
}

/* =============================================================================
   ===== Wave 27: pattern engine + rubrics =====
   The INFINITE RUBRIC HOME. The body becomes an endless, magazine-rhythm feed:
   themed RUBRIC sections, each rendering one of six self-contained BLOCK
   PATTERNS. The retention engine = (a) patterns rotate so consecutive blocks
   never look the same, (b) every block is GAP-FREE at every breakpoint (a
   half-empty row breaks the scroll trance), (c) per-rubric accent colours.

   This block REUSES the Wave 26 primitives unchanged:
     • .card base + [data-cat] accent custom props (--cat-accent)
     • .card--hero (image-fill cover with overlaid title + scrim)
   …and SUPERSEDES the v1 .mosaic layout for the home body (the home no longer
   uses .mosaic for the infinite feed — it uses .pblock--* patterns). The old
   .mosaic rules stay for category/tag/source/archive grids; the new .pblock
   patterns are the home/rubric engine and reusable across /news /cases /digest
   /opinion later.

   MARKUP CONTRACT (must match SSR seo.js + client portal.js EXACTLY):

     <section class="rubric" data-cat="{slug}" data-page="{n}">
       <header class="rubric__head">
         <span class="rubric__dot"></span>
         <h2 class="rubric__title">{categoryLabel}</h2>
         <a class="rubric__all" href="/{lang}/tag/{slug}">{Все}</a>
       </header>
       <div class="pblock pblock--{id}"> …N cards… </div>
     </section>

   Card primitives used inside blocks:
     • renderCard(...)            → <a class="card card--{sz}" data-cat>…</a>
     • renderCard(..,{hero:true}) → adds .card--hero (cover)
     • .card--row   compact horizontal card: square thumb left + title/meta right
     • .plist__row  ranked headline row: big accent index + title + meta (list)

   The 6 patterns (fixed card count so a full block has zero holes):
     1. pblock--cover (4)  cover hero + 3 .card--row stacked beside it
     2. pblock--trio  (3)  three equal image-top cards
     3. pblock--list  (6)  one medium card + a ranked list of 5 headline rows
     4. pblock--quad  (4)  four compact image-top cards
     5. pblock--duo   (2)  two large side-by-side feature cards
     6. pblock--wide  (5)  one wide landscape card + a row of 4 compact under it

   Each pattern is gap-free at desktop ≥1025 / tablet ≤1024 / mobile ≤640.
   ============================================================================= */

/* ---------------------------------------------------------------------------
   1. RUBRIC chrome — the themed section wrapper + header.
   The section carries data-cat, so the accent comes from the same custom-prop
   table Wave 26 defines (but that table is scoped to .card[data-cat]); we
   restate it on .rubric[data-cat] so the dot + title + list indices can pull
   var(--cat-accent) too.
   --------------------------------------------------------------------------- */
.rubric { --cat-accent: #2d2fe8; }
.rubric[data-cat="llm"]        { --cat-accent: #2d2fe8; }
.rubric[data-cat="robotics"]   { --cat-accent: #0891b2; }
.rubric[data-cat="startups"]   { --cat-accent: #d97706; }
.rubric[data-cat="research"]   { --cat-accent: #7c3aed; }
.rubric[data-cat="ethics"]     { --cat-accent: #db2777; }
.rubric[data-cat="business"]   { --cat-accent: #059669; }
.rubric[data-cat="hardware"]   { --cat-accent: #475569; }
.rubric[data-cat="autonomous"] { --cat-accent: #0d9488; }
.rubric[data-cat="medicine"]   { --cat-accent: #16a34a; }
.rubric[data-cat="creative"]   { --cat-accent: #ea580c; }

/* Generous vertical rhythm between rubrics — the magazine's "breathing room"
   that makes each themed section feel like its own spread. */
.rubric {
  margin-top: 56px;
  scroll-margin-top: 80px;
}
.rubric:first-of-type { margin-top: 32px; }

/* Header: accent dot + title + "Все →" link on a thin divider rule. */
.rubric__head {
  display: flex;
  align-items: baseline;
  gap: 12px;
  margin-bottom: 24px;
  padding-bottom: 14px;
  border-bottom: 1px solid var(--h-border);
}
.rubric__dot {
  flex: 0 0 auto;
  width: 11px;
  height: 11px;
  border-radius: 50%;
  background: var(--cat-accent);
  /* nudge the dot onto the title's baseline (baseline-aligned flex) */
  align-self: center;
  box-shadow: 0 0 0 4px color-mix(in srgb, var(--cat-accent) 16%, transparent);
}
.rubric__title {
  flex: 1 1 auto;
  margin: 0;
  font-family: var(--h-font-head);
  font-size: clamp(20px, 2.1vw, 26px);
  line-height: 1.1;
  font-weight: 680;
  letter-spacing: -0.02em;
  color: var(--h-text);
}
.rubric__all {
  flex: 0 0 auto;
  align-self: center;
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-family: var(--h-font-head);
  font-size: 13px;
  font-weight: 600;
  letter-spacing: -0.01em;
  text-decoration: none;
  color: var(--cat-accent);
  white-space: nowrap;
  transition: gap 0.18s ease, opacity 0.18s ease;
}
.rubric__all::after {
  content: "→";
  font-size: 13px;
  transition: transform 0.18s ease;
}
.rubric__all:hover { gap: 8px; }
.rubric__all:hover::after { transform: translateX(2px); }
.rubric__all:focus-visible {
  outline: 2px solid var(--h-focus-ring);
  outline-offset: 3px;
  border-radius: 4px;
}
[dir="rtl"] .rubric__all::after { content: "←"; }
[dir="rtl"] .rubric__all:hover::after { transform: translateX(-2px); }

/* ---------------------------------------------------------------------------
   2. .pblock — shared base for every pattern block.
   A pattern is a self-contained grid. The base just sets the grid engine +
   the inter-card gap; each --{id} sets its own columns/areas so a FULL block
   (exactly N cards) tiles with zero holes.
   --------------------------------------------------------------------------- */
.pblock {
  display: grid;
  gap: 24px;
  align-items: stretch;
}
.pblock > .card,
.pblock > .card--row { height: 100%; }      /* equal-height tiles, no short row */

/* Wave 28 — flat PATTERN FEED for section pages (/news, /digest, category, tag,
   search). The same gap-free pattern blocks as the home rubrics, but stacked
   WITHOUT rubric headers → they just need vertical rhythm between blocks. */
.pattern-feed { display: block; }
.pattern-feed > .pblock { margin-bottom: 40px; }
.pattern-feed > .pblock:last-child { margin-bottom: 0; }
.pattern-feed > .pblock.is-appended { animation: pblock-fade-in 0.5s cubic-bezier(0.2, 0.8, 0.2, 1) both; }
@media (max-width: 640px) { .pattern-feed > .pblock { margin-bottom: 28px; } }

/* ---------------------------------------------------------------------------
   2a. .card--row — compact HORIZONTAL card: small square thumb left, title +
   meta right. The scanning workhorse used inside pblock--cover (and reusable).
   It reuses the .card base but turns the column flex into a 2-col grid; the
   accent strip moves to a left rail so it still reads the category colour.
   --------------------------------------------------------------------------- */
.card--row {
  display: grid;
  grid-template-columns: 108px 1fr;
  grid-template-rows: auto;
  align-items: stretch;                       /* thumb fills the row height — no floating */
  padding: 12px 14px 12px 12px;
  gap: 0 16px;                                /* row 0 / column 16px — a plain `gap:0` here NUKES column-gap */
}
.card--row::before {                          /* accent → left rail, not top */
  top: 0;
  bottom: 0;
  right: auto;
  width: 3px;
  height: auto;
}
[dir="rtl"] .card--row::before { left: auto; right: 0; }
.card--row .card__image {
  width: 108px;
  height: 100%;                               /* FILL the card height (was a 84px square floating in the middle) */
  min-height: 84px;
  aspect-ratio: auto;
  border-radius: var(--h-r-md);
  margin: 0;
  align-self: stretch;
  overflow: hidden;
}
.card--row .card__body {
  align-self: center;                         /* text block vertically centred next to the full-height thumb */
  min-width: 0;
}
.card--row .card__cat,
.card--row .card__title,
.card--row .card__meta {
  grid-column: 2;
  padding: 0;                                  /* the card padding handles it */
  margin: 0;
}
.card--row .card__cat   { font-size: 10px; margin-bottom: 5px; }
.card--row .card__title {
  font-size: 15px;
  line-height: 1.22;
  /* clamp to keep every row the same height → no ragged stack */
  display: -webkit-box;
  -webkit-line-clamp: 3;
  line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.card--row .card__dek { display: none; }
.card--row .card__meta { margin-top: 6px; font-size: 11px; }
.card--row:hover { transform: translateY(-2px); }   /* gentler than full cards */

/* ---------------------------------------------------------------------------
   2b. .plist__row + .plist__num — the ranked headline row used by pblock--list.
   Big accent index number, title, meta; an optional 40px thumb. Built to tile
   exactly five-up against the medium card beside it.
   --------------------------------------------------------------------------- */
.plist__row {
  display: grid;
  grid-template-columns: auto 1fr;
  align-items: start;
  column-gap: 14px;
  padding: 14px 0;
  text-decoration: none;
  color: inherit;
  border-top: 1px solid var(--h-border);
  transition: background 0.18s ease;
}
.plist__row:first-child { border-top: none; padding-top: 0; }
.plist__row:last-child { padding-bottom: 0; }
.plist__num {
  font-family: var(--h-font-head);
  font-size: clamp(22px, 2.4vw, 30px);
  font-weight: 720;
  line-height: 1;
  letter-spacing: -0.03em;
  color: var(--cat-accent);
  font-variant-numeric: tabular-nums;
  min-width: 1.6em;
  text-align: right;
  opacity: 0.92;
}
.plist__body { min-width: 0; }                 /* allow title to clamp/ellipsis */
.plist__row .card__title,
.plist__body .plist__title {
  margin: 0;
  font-family: var(--h-font-head);
  font-size: 16px;
  line-height: 1.24;
  font-weight: 620;
  letter-spacing: -0.015em;
  color: var(--h-text);
  text-wrap: balance;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  transition: color 0.18s ease;
}
.plist__row .card__meta,
.plist__body .plist__meta {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 6px;
  font-size: 12px;
  color: var(--h-text-subtle);
  flex-wrap: wrap;
}
.plist__row:hover .card__title,
.plist__row:hover .plist__title { color: var(--cat-accent); }
.plist__row:focus-visible {
  outline: 2px solid var(--h-focus-ring);
  outline-offset: 2px;
  border-radius: 6px;
}

/* ===========================================================================
   PATTERN 1 — pblock--cover (4): magazine LEAD.
   Desktop: cover hero ~62% (2 grid rows) + 3 .card--row stacked in the ~38%
   right column. The right column's 3 rows must equal the cover height (no gap)
   → grid-template-rows: repeat(3,1fr) and the hero spans all three.
   Tablet: cover full width, then the 3 rows stacked below.
   Mobile: full stack.
   =========================================================================== */
/* RENDER STRUCTURE: .pblock--cover > .pblock--cover__lead(>.card--hero)
   + .pblock--cover__rows(> 3 .card--row). Two columns, ONE auto row (no phantom
   tracks). align-items:stretch makes both columns equal-height; the hero's
   min-height drives the row height and the 3 rows flex:1 to fill it → no hole. */
.pblock--cover {
  grid-template-columns: 1.62fr 1fr;
  grid-template-rows: auto;
  align-items: stretch;
}
.pblock--cover__lead { display: flex; min-width: 0; }
.pblock--cover__lead > .card--hero { width: 100%; min-height: 440px; }
.pblock--cover__rows {
  display: flex;
  flex-direction: column;
  gap: 14px;
  min-width: 0;
}
.pblock--cover__rows > .card--row { flex: 1 1 0; min-height: 0; }

@media (max-width: 1024px) {
  .pblock--cover { grid-template-columns: 1fr; grid-template-rows: auto; }
  .pblock--cover__lead > .card--hero { min-height: 340px; }
  /* __rows drops below the hero as a vertical stack. The single-column grid no
     longer stretches __rows to the hero height, so flex:1 (which only fills a
     stretched track) would COLLAPSE the rows to ~25px and clip the 2-line
     titles. Below the breakpoint each row sizes to its own content instead. */
  .pblock--cover__rows > .card--row { flex: 0 0 auto; min-height: 0; }
}

@media (max-width: 640px) {
  .pblock--cover { gap: 16px; }
  .pblock--cover__lead > .card--hero { min-height: 260px; }
}

/* ===========================================================================
   PATTERN 2 — pblock--trio (3): three equal image-top cards in a row.
   =========================================================================== */
.pblock--trio { grid-template-columns: repeat(3, 1fr); }

@media (max-width: 1024px) {
  /* 3→ keep all three but tighten; at very narrow tablet they still fit */
  .pblock--trio { grid-template-columns: repeat(3, 1fr); column-gap: 18px; }
}
@media (max-width: 760px) {
  /* below 760, 3-up gets too thin → stack to 1 col (never a half row) */
  .pblock--trio { grid-template-columns: 1fr; }
}

/* ===========================================================================
   PATTERN 3 — pblock--list (6): TOP-THEMES.
   Desktop: medium image-top card left ~40% + ranked list of 5 rows right ~60%.
   The list is a self-contained .plist wrapper so its rows tile cleanly.
   Tablet/Mobile: stack (card on top, list below).
   =========================================================================== */
/* RENDER STRUCTURE: .pblock--list > .pblock--list__lead(>.card--md)
   + .pblock--list__rail(> [.pblock--list__railhead] + 5 a.prank). */
.pblock--list { grid-template-columns: 0.95fr 1.4fr; align-items: stretch; }
.pblock--list__lead { display: flex; min-width: 0; }
.pblock--list__lead > .card { width: 100%; }
.pblock--list__rail {
  display: flex;
  flex-direction: column;
  justify-content: space-between;             /* spread 5 rows over the lead height */
  padding: 18px 20px;
  background: var(--h-surface);
  border: 1px solid var(--h-border);
  border-radius: var(--h-r-lg);
  box-shadow: var(--h-shadow-xs);
}
.pblock--list__railhead:empty { display: none; }

/* .prank — ranked headline row (big accent index + title + meta). */
.prank {
  display: grid;
  grid-template-columns: auto 1fr;
  align-items: start;
  column-gap: 14px;
  padding: 14px 0;
  text-decoration: none;
  color: inherit;
  border-top: 1px solid var(--h-border);
  transition: background 0.18s ease;
}
.prank:first-of-type { border-top: none; padding-top: 0; }
.prank:last-of-type  { padding-bottom: 0; }
.prank__num {
  font-family: var(--h-font-head);
  font-size: clamp(22px, 2.4vw, 30px);
  font-weight: 720;
  line-height: 1;
  letter-spacing: -0.03em;
  color: var(--cat-accent);
  font-variant-numeric: tabular-nums;
  min-width: 1.6em;
  text-align: right;
  opacity: 0.92;
}
.prank__body { min-width: 0; display: flex; flex-direction: column; }
.prank__title {
  margin: 0;
  font-family: var(--h-font-head);
  font-size: 16px;
  line-height: 1.24;
  font-weight: 620;
  letter-spacing: -0.015em;
  color: var(--h-text);
  text-wrap: balance;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  transition: color 0.18s ease;
}
.prank__meta {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 6px;
  font-size: 12px;
  color: var(--h-text-subtle);
  flex-wrap: wrap;
}
.prank:hover .prank__title { color: var(--cat-accent); }
.prank:focus-visible {
  outline: 2px solid var(--h-focus-ring);
  outline-offset: 2px;
  border-radius: 6px;
}

@media (max-width: 1024px) {
  .pblock--list { grid-template-columns: 1fr; }
  .pblock--list__rail { padding: 16px 18px; }
}
@media (max-width: 640px) {
  .pblock--list__rail { padding: 6px 16px; }
  .prank__num { font-size: 22px; min-width: 1.4em; }
}

/* ===========================================================================
   PATTERN 4 — pblock--quad (4): four compact image-top cards, dek hidden.
   Even fill at every step: 4 → 2 → 1 (never an odd half-row).
   =========================================================================== */
.pblock--quad { grid-template-columns: repeat(4, 1fr); }
.pblock--quad > .card .card__dek { display: none; }      /* compact = no dek */

@media (max-width: 1024px) { .pblock--quad { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 640px)  { .pblock--quad { grid-template-columns: 1fr; } }

/* ===========================================================================
   PATTERN 5 — pblock--duo (2): two large side-by-side feature cards.
   =========================================================================== */
.pblock--duo { grid-template-columns: repeat(2, 1fr); align-items: stretch; }
.pblock--duo > .card { height: 100%; }              /* equal-height feature cards */
.pblock--duo .card__image { aspect-ratio: 16 / 9; } /* tame the tall feature image */
@media (max-width: 640px) { .pblock--duo { grid-template-columns: 1fr; } }

/* ===========================================================================
   PATTERN 6 — pblock--wide (5): one wide landscape card spanning full width on
   top (image left ~45% / text right) + a row of 4 compact cards under it.
   Grid areas keep it gap-free; the bottom 4-row collapses 4→2→1.
   =========================================================================== */
/* RENDER STRUCTURE: .pblock--wide > .pblock--wide__top(>.card--wide)
   + .pblock--wide__row(> 4 .card--sm). Single column / two rows; the bottom
   row is its own 4-up grid (collapses 4→2→1, never a half-empty row). */
.pblock--wide {
  display: grid;
  grid-template-columns: 1fr;
  gap: 24px;
}
.pblock--wide__top { min-width: 0; }
.pblock--wide__top > .card--wide { width: 100%; }
.pblock--wide__row {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 24px;
}
.pblock--wide__row > .card .card__dek { display: none; }

/* .card--wide — the landscape lead: image left ~45%, text right, full-width. */
.card--wide {
  display: grid;
  grid-template-columns: 45% 1fr;
  grid-template-rows: 1fr;
  gap: 0;                                       /* override .card flex gap */
  min-height: 260px;
}
.card--wide::before {                           /* accent rail on the left edge */
  top: 0; bottom: 0; right: auto;
  width: 3px; height: auto;
}
[dir="rtl"] .card--wide::before { left: auto; right: 0; }
.card--wide .card__image {
  grid-row: 1 / -1;
  grid-column: 1;
  width: 100%;
  height: 100%;
  aspect-ratio: auto;
  border-radius: 0;
  margin: 0;
}
.card--wide .card__cat,
.card--wide .card__title,
.card--wide .card__dek,
.card--wide .card__meta {
  grid-column: 2;
  padding-left: 26px;
  padding-right: 26px;
}
.card--wide .card__cat   { margin-top: 24px; }
.card--wide .card__title { font-size: clamp(20px, 2vw, 26px); margin-top: 10px; }
.card--wide .card__dek   { margin-top: 10px; }
.card--wide .card__meta  { margin-top: 14px; padding-bottom: 24px; }

@media (max-width: 1024px) {
  .pblock--wide__row { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 760px) {
  .card--wide { grid-template-columns: 1fr; min-height: 0; }
  .card--wide .card__image {
    grid-column: 1;
    grid-row: 1;
    height: 200px;
    aspect-ratio: auto;
  }
  .card--wide .card__cat,
  .card--wide .card__title,
  .card--wide .card__dek,
  .card--wide .card__meta { grid-column: 1; }
  .card--wide .card__cat { margin-top: 16px; }
}
@media (max-width: 640px) {
  .pblock--wide__row { grid-template-columns: 1fr; }
}

/* ===========================================================================
   3. INFINITE SCROLL — sentinel + skeleton + fade-in.
   The sentinel is a zero-height tripwire the IntersectionObserver watches; it
   carries data-next-index + data-lang for portal.js. The skeleton is a FULL
   placeholder block (a trio-shaped shimmer) so the feed never shows a dead gap
   while the next rubric loads.
   =========================================================================== */
.feed-end-sentinel {
  height: 1px;
  margin: 0;
  padding: 0;
  pointer-events: none;
}

/* Skeleton rubric: a header ghost + a trio of shimmering card ghosts. It looks
   like a real, full block (never an empty row). portal.js swaps it for the
   real rubric on arrival. */
.pblock--skeleton {
  grid-template-columns: repeat(3, 1fr);
  margin-top: 56px;
}
.pblock--skeleton .sk {
  border-radius: var(--h-r-lg);
  background: var(--h-surface);
  border: 1px solid var(--h-border);
  overflow: hidden;
  min-height: 280px;
  position: relative;
}
.pblock--skeleton .sk::before {                 /* image ghost */
  content: "";
  display: block;
  aspect-ratio: 16/10;
  background: var(--h-bg-soft);
}
.pblock--skeleton .sk::after {                  /* text ghosts */
  content: "";
  display: block;
  height: 14px;
  margin: 18px 18px 0;
  border-radius: 6px;
  background: var(--h-bg-soft);
  box-shadow:
    0 28px 0 -2px var(--h-bg-soft),
    0 52px 0 -4px var(--h-bg-soft);
}
/* the moving shimmer band */
.pblock--skeleton .sk {
  background-image: linear-gradient(
    100deg,
    transparent 30%,
    color-mix(in srgb, var(--h-text) 6%, transparent) 50%,
    transparent 70%
  );
  background-size: 200% 100%;
  background-repeat: no-repeat;
  animation: pblock-shimmer 1.25s ease-in-out infinite;
}
@keyframes pblock-shimmer {
  0%   { background-position: 180% 0; }
  100% { background-position: -80% 0; }
}
@media (max-width: 1024px) { .pblock--skeleton { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 640px)  { .pblock--skeleton { grid-template-columns: 1fr; } }

/* A small inline skeleton header above the ghost block (matches .rubric__head). */
.sk-head {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-top: 56px;
  margin-bottom: 24px;
  padding-bottom: 14px;
  border-bottom: 1px solid var(--h-border);
}
.sk-head .sk-dot {
  width: 11px; height: 11px; border-radius: 50%;
  background: var(--h-bg-soft);
}
.sk-head .sk-bar {
  width: 180px; height: 18px; border-radius: 6px;
  background: var(--h-bg-soft);
}

/* Fade-in for appended rubric sections (client adds .is-appended on insert). */
.rubric.is-appended,
.pblock.is-appended {
  animation: pblock-fade-in 0.5s cubic-bezier(0.2, 0.8, 0.2, 1) both;
}
@keyframes pblock-fade-in {
  from { opacity: 0; transform: translateY(14px); }
  to   { opacity: 1; transform: none; }
}

/* ===========================================================================
   4. SPECIAL RUBRIC VARIANTS — Популярное / Свежее accents (retention spice).
   A rubric can carry data-variant to tint the dot/title chrome differently
   (e.g. a "Популярное" rail). Purely additive; falls back to the cat accent.
   =========================================================================== */
.rubric[data-variant="popular"] { --cat-accent: #e11d48; }
.rubric[data-variant="fresh"]   { --cat-accent: #2563eb; }
.rubric[data-variant="popular"] .rubric__title::after,
.rubric[data-variant="fresh"]   .rubric__title::after {
  content: "";
}

/* ===========================================================================
   5. DARK-MODE PARITY for the Wave 27 surfaces.
   Cards/.card--row/.card--wide pull --h-surface/--h-border (flipped by the dark
   hooks) so they re-theme automatically. We only touch: the rubric divider, the
   .plist panel surface, the list dividers, and the skeleton ghosts (which use
   fixed soft colours that need a dark counterpart).
   =========================================================================== */
html.h-theme-dark .rubric__head,
html[data-theme="dark"] .rubric__head,
body.tg-dark .rubric__head { border-bottom-color: var(--h-border); }

html.h-theme-dark .plist__row,
html[data-theme="dark"] .plist__row,
body.tg-dark .plist__row { border-top-color: var(--h-border); }

html.h-theme-dark .pblock--list > .plist,
html[data-theme="dark"] .pblock--list > .plist,
body.tg-dark .pblock--list > .plist {
  background: var(--h-surface);
  border-color: var(--h-border);
  box-shadow: none;
}

html.h-theme-dark .pblock--skeleton .sk,
html[data-theme="dark"] .pblock--skeleton .sk,
body.tg-dark .pblock--skeleton .sk {
  background-color: var(--h-surface);
  border-color: var(--h-border);
}
html.h-theme-dark .pblock--skeleton .sk::before,
html.h-theme-dark .pblock--skeleton .sk::after,
html.h-theme-dark .sk-head .sk-dot,
html.h-theme-dark .sk-head .sk-bar,
html[data-theme="dark"] .pblock--skeleton .sk::before,
html[data-theme="dark"] .pblock--skeleton .sk::after,
html[data-theme="dark"] .sk-head .sk-dot,
html[data-theme="dark"] .sk-head .sk-bar,
body.tg-dark .pblock--skeleton .sk::before,
body.tg-dark .pblock--skeleton .sk::after,
body.tg-dark .sk-head .sk-dot,
body.tg-dark .sk-head .sk-bar { background: var(--h-surface-2); }

/* ===========================================================================
   6. REDUCED MOTION — kill the shimmer + fade so it never distracts.
   =========================================================================== */
@media (prefers-reduced-motion: reduce) {
  .pblock--skeleton .sk { animation: none; }
  .rubric.is-appended,
  .pblock.is-appended { animation: none; }
  .card--row,
  .card--wide,
  .plist__row { transition: none; }
}

/* ===========================================================================
   7. HOME BODY container — the infinite feed needs no max-width cap beyond the
   page shell; rubrics sit inside the existing .content wrapper. A small guard:
   when the feed is the home body, the first .pblock should clear the brand hero
   cleanly (handled by .rubric:first-of-type margin above). Nothing else needed.
   =========================================================================== */
/* end Wave 27 */

/* =============================================================================
   PHOENIX WEALTH INTELLIGENCE — Anton Ionov / Phoenix Partners theme override.
   Appended block: remaps the portal --h-* design tokens to the Phoenix premium
   palette (obsidian navy + champagne gold + cream). Pure colour-swap — no
   selectors restructured. Last-definition-wins for :root / [data-theme] tokens.
   Palette source: phoenix-attention-os/apps/web globals.css ("private-bank calm").
   ============================================================================= */
:root {
  /* Accent → champagne gold */
  --h-primary: #C9A24B;
  --h-primary-hover: #A8823A;
  --h-deep: #0A0B0F;
  --h-black: #07080B;
  --h-cyan: #6E8BC9;
  --h-green: #4FB286;
  --h-red: #D9695E;
  --h-accent-light: #E7DEC6;

  --h-link: #9A7726;          /* gold-deep — AA on cream surfaces */
  --h-focus-ring: #C9A24B;
  --h-red-text: #B5483E;
  --h-green-text: #2E7D58;
  --h-cyan-text: #43618F;

  /* Light theme = warm cream / private-bank paper */
  --h-bg: #ECE9E2;
  --h-bg-soft: #E3DFD5;
  --h-bg-warm: #F1EEE7;
  --h-surface: #F6F4EF;
  --h-surface-2: #FBFAF6;
  --h-border: #DAD5C8;
  --h-border-strong: #C8C2B2;
  --h-divider: #E1DCD0;

  --h-text: #1B1C20;
  --h-text-muted: #34363D;
  --h-text-subtle: #6A6E78;
  --h-text-inverse: #F4F1EA;

  --h-shadow-lg: 0 20px 60px rgba(10, 11, 15, 0.16);

  /* Display serif for a wealth-intel masthead feel; falls back to bundled fonts */
  --h-font-head: "Newsreader", "Inter Tight", "Helvetica Neue", Helvetica, Arial, serif;
}

/* Dark (default visual identity) = obsidian navy + gold */
html[data-theme="dark"],
:root.h-auto-dark {
  --h-primary: #C9A24B;
  --h-primary-hover: #D4A85E;
  --h-bg: #0A0B0F;
  --h-bg-soft: #0C0E13;
  --h-bg-warm: #0B0D12;
  --h-surface: #12141A;
  --h-surface-2: #1A1D26;
  --h-border: rgba(255,255,255,.07);
  --h-border-strong: rgba(201,162,75,.20);
  --h-divider: rgba(255,255,255,.05);
  --h-text: #F4F1EA;
  --h-text-muted: #D7D4CC;
  --h-text-subtle: #9AA0AD;
  --h-text-inverse: #0A0B0F;
  --h-link: #D4A85E;
  --h-focus-ring: #C9A24B;
  --h-red-text: #D9695E;
  --h-green-text: #4FB286;
  --h-cyan-text: #6E8BC9;
  --h-accent-light: #C9A24B;
}
@media (prefers-color-scheme: dark) {
  :root.h-auto-dark,
  html[data-theme="dark"] {
    --h-primary: #C9A24B;
    --h-primary-hover: #D4A85E;
    --h-bg: #0A0B0F;
    --h-bg-soft: #0C0E13;
    --h-bg-warm: #0B0D12;
    --h-surface: #12141A;
    --h-surface-2: #1A1D26;
    --h-border: rgba(255,255,255,.07);
    --h-border-strong: rgba(201,162,75,.20);
    --h-divider: rgba(255,255,255,.05);
    --h-text: #F4F1EA;
    --h-text-muted: #D7D4CC;
    --h-text-subtle: #9AA0AD;
    --h-text-inverse: #0A0B0F;
    --h-link: #D4A85E;
    --h-focus-ring: #C9A24B;
    --h-red-text: #D9695E;
    --h-green-text: #4FB286;
    --h-cyan-text: #6E8BC9;
    --h-accent-light: #C9A24B;
  }
}