/* Atalk.TV unified editorial UI system.
   Loaded after the core styles so every current and future renderer inherits one
   compact, readable, mobile-first typography and spacing scale. */

:root {
  --max: 1220px;
  --wide: 1100px;
  --article: 720px;
  --header-h: 68px;
  --ui-space-1: 6px;
  --ui-space-2: 10px;
  --ui-space-3: 16px;
  --ui-space-4: 24px;
  --ui-space-5: 36px;
  --ui-space-6: 52px;
  --ui-space-7: 68px;
}

html { scroll-padding-top: 84px; }
body { font-size: 16.5px; line-height: 1.66; }
main section[id] { scroll-margin-top: 84px; }

.shell { width: min(calc(100% - 40px), var(--max)); }
.article-width { width: min(calc(100% - 40px), var(--article)); }
.wide-article { width: min(calc(100% - 40px), var(--wide)); }

.eyebrow {
  font-size: .66rem;
  letter-spacing: .115em;
}

.small { font-size: .8rem; }
.button { min-height: 44px; }
.header-action { min-width: 44px; height: 44px; }

/* Header */
.header-main { min-height: var(--header-h); }
.brand-link,
.brand-logo { width: 112px; }
.desktop-nav a { padding-block: 21px 19px; }
.desktop-nav a::after { bottom: 14px; }

/* Homepage compact identity block: brand first, news immediately after. */
main > .section:first-child {
  padding: 38px 0 32px;
  min-height: 0;
}
main > .section:first-child .article-width { width: min(calc(100% - 40px), 820px); }
main > .section:first-child h1 {
  margin: 0;
  font-family: var(--font-serif);
  font-size: clamp(2.55rem, 5vw, 4.35rem);
  line-height: .98;
  letter-spacing: -.045em;
}
main > .section:first-child h1 .eyebrow {
  margin-bottom: 10px;
  font-family: var(--font-sans);
  letter-spacing: .13em;
}

/* Global section rhythm */
.section { padding: clamp(42px, 5vw, 62px) 0; }
.section-heading {
  gap: 22px;
  margin-bottom: 24px;
}
.section-heading h2 {
  margin-top: 5px;
  font-size: clamp(1.82rem, 2.65vw, 2.65rem);
  line-height: 1.02;
}
.section-heading > p {
  max-width: 470px;
  font-size: .84rem;
  line-height: 1.55;
}

/* Trending: useful signal without turning each row into a page. */
.trend-row {
  grid-template-columns: 42px minmax(0, 1fr) 28px;
  gap: 15px;
  padding: 18px 3px;
}
.trend-main p {
  margin: 6px 0 0;
  max-width: 820px;
  font-size: .86rem;
  line-height: 1.5;
}
.trend-facts { margin-top: 7px; gap: 6px 12px; }
.trend-rank,
.trend-facts,
.story-foot { font-size: .67rem; }
.trend-title-line strong { font-size: clamp(1.05rem, 1.55vw, 1.25rem); line-height: 1.25; }

/* Cards and feeds */
.story-grid { gap: 26px 24px; }
.story-card { min-width: 0; }
.story-media img,
.top-story-media img {
  width: 100%;
  aspect-ratio: 16 / 9;
  object-fit: cover;
}
.story-copy { padding-top: 15px; }
.story-copy h3 {
  margin: 8px 0 7px;
  font-size: clamp(1.22rem, 1.8vw, 1.55rem);
  line-height: 1.13;
  letter-spacing: -.025em;
}
.story-copy > p {
  margin: 0;
  color: var(--muted);
  font-size: .88rem;
  line-height: 1.52;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.story-foot { margin-top: 11px; gap: 8px 14px; flex-wrap: wrap; }
.story-meta { gap: 6px 9px; font-size: .65rem; }

.compact-stack { border-top-width: 2px; }
.compact-story { padding: 16px 0; }
.compact-story h3 {
  margin: 7px 0 6px;
  font-size: clamp(1.08rem, 1.55vw, 1.3rem);
  line-height: 1.18;
}

.latest-layout { gap: 32px; }

.top-story {
  gap: clamp(28px, 4vw, 48px);
  align-items: start;
}
.top-story-copy h3 {
  margin: 9px 0 10px;
  font-size: clamp(1.85rem, 3.25vw, 3.15rem);
  line-height: 1.04;
  letter-spacing: -.04em;
}
.top-dek {
  font-size: clamp(.98rem, 1.2vw, 1.08rem);
  line-height: 1.55;
}
.why-matters {
  margin-top: 19px;
  padding-top: 16px;
}
.why-matters p {
  margin: 5px 0 0;
  font-size: .87rem;
  line-height: 1.55;
  display: -webkit-box;
  -webkit-line-clamp: 4;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

/* Topic cards and entity cards: dense knowledge navigation. */
.topic-grid,
.entity-grid { gap: 20px; }
.topic-card,
.entity-card { padding: 21px; min-height: 0; }
.topic-card h3,
.entity-card h3 {
  margin: 10px 0 7px;
  font-size: clamp(1.2rem, 1.7vw, 1.48rem);
  line-height: 1.15;
}
.topic-card p,
.entity-card p {
  margin: 0;
  font-size: .84rem;
  line-height: 1.5;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.topic-link,
.entity-card > span:last-child { margin-top: 14px; font-size: .78rem; }

/* Page / category / entity / policy headers */
.page-hero,
.topic-hero {
  padding: clamp(38px, 5vw, 60px) 0 clamp(30px, 4vw, 44px);
}
.page-hero h1,
.topic-hero h1 {
  max-width: 920px;
  margin: 10px 0 12px;
  font-size: clamp(2.45rem, 4.6vw, 4.2rem);
  line-height: .98;
  letter-spacing: -.045em;
}
.page-hero p,
.topic-hero p {
  max-width: 720px;
  font-size: clamp(.98rem, 1.15vw, 1.08rem);
  line-height: 1.58;
}
.breadcrumbs { margin-bottom: 20px; font-size: .68rem; }

/* Topic pages */
.topic-title-row { gap: 24px; align-items: end; }
.topic-layout {
  grid-template-columns: minmax(0, 1fr) minmax(235px, 285px);
  gap: clamp(36px, 5vw, 60px);
}
.topic-summary h2,
.topic-facts h2 {
  margin-bottom: 10px;
  font-size: clamp(1.55rem, 2.2vw, 2rem);
}
.topic-summary p,
.large-copy {
  font-size: 1.02rem;
  line-height: 1.68;
}
.topic-facts { margin-top: 30px; padding-top: 22px; }
.topic-facts li { padding: 10px 0 10px 23px; line-height: 1.52; }
.topic-meta {
  top: 84px;
  padding: 16px 17px 3px;
}
.topic-meta dl { margin-top: 13px; }
.topic-meta dl div,
.definition-list div { padding: 9px 0; }

.timeline article {
  grid-template-columns: 118px minmax(0, 1fr);
  gap: 24px;
  padding: 20px 0;
}
.timeline h3 {
  margin: 7px 0 5px;
  font-size: clamp(1.18rem, 1.65vw, 1.45rem);
}
.timeline p {
  font-size: .84rem;
  line-height: 1.5;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

/* Article pages */
.article-hero { padding: clamp(38px, 5vw, 58px) 0 28px; }
.article-hero h1 {
  max-width: 940px;
  margin: 13px 0 15px;
  font-size: clamp(2.6rem, 4.7vw, 4.05rem);
  line-height: 1;
  letter-spacing: -.045em;
}
.article-subtitle {
  max-width: 790px;
  font-size: clamp(1rem, 1.2vw, 1.12rem);
  line-height: 1.58;
}
.article-byline { margin-top: 22px; padding-top: 13px; font-size: .69rem; }
.article-figure { margin-top: 8px; }
.article-figure figcaption { margin-top: 7px; font-size: .66rem; }
.article-layout {
  grid-template-columns: minmax(0, var(--article)) minmax(230px, 270px);
  gap: clamp(38px, 5vw, 58px);
  padding: 40px 0 68px;
}
.in-brief {
  margin-bottom: 36px;
  padding: 21px 23px 22px;
}
.in-brief h2 { margin: 5px 0 9px; font-size: 1.65rem; }
.in-brief li { padding: 3px 0; line-height: 1.5; }
.article-section { margin-bottom: 38px; }
.article-section h2 {
  margin-bottom: 11px;
  font-size: clamp(1.55rem, 2.25vw, 1.95rem);
}
.article-section > p {
  font-size: 1.03rem;
  line-height: 1.72;
}
.source-section { padding-top: 22px; }
.source-list { margin-top: 17px; }
.source-list li { padding: 13px 0; }
.article-aside { top: 84px; gap: 17px; }
.aside-card { padding-top: 14px; }
.aside-card h2 { font-size: 1.17rem; }
.aside-card p { margin-block: 6px 8px; }
.link-stack a { padding: 7px 0; }

/* Archive */
.archive-layout {
  grid-template-columns: 180px minmax(0, 1fr);
  gap: clamp(32px, 4vw, 52px);
}
.archive-filters { top: 84px; }
.archive-filters a { padding: 7px 0; font-size: .78rem; }
.archive-month { margin-bottom: 38px; }
.archive-month > h2 { font-size: clamp(1.55rem, 2.2vw, 2rem); }

/* Search */
.search-shell { max-width: 920px; }
.search-form label { font-size: .72rem; }
.search-form > div { gap: 9px; }
.search-form input {
  min-height: 48px;
  padding: 10px 13px;
  font-size: 1rem;
}
.search-results { margin-top: 26px; }
.search-results article,
.search-result { padding: 16px 0; }
.search-results h2,
.search-results h3 { font-size: 1.18rem; line-height: 1.22; }

/* Trust / policy / sources */
.policy { width: min(calc(100% - 40px), 760px); }
.policy > section { padding-bottom: 30px; margin-bottom: 30px; }
.policy h2 { margin-bottom: 9px; font-size: clamp(1.48rem, 2vw, 1.78rem); }
.policy p { font-size: 1rem; line-height: 1.7; }
.source-registry { margin-top: 20px; }
.source-registry article { padding: 15px 0; column-gap: 22px; }
.source-registry h3 { font-size: .96rem; }

/* Promotions should never dominate editorial content. */
.ecosystem-promo { padding: clamp(22px, 3vw, 34px); }
.ecosystem-promo h2,
.watch-strip h2 { font-size: clamp(1.55rem, 2.3vw, 2.05rem); }
.watch-strip { padding: clamp(32px, 4vw, 48px) 0; }

/* Footer: compact on every viewport. */
.site-footer .footer-grid {
  grid-template-columns: minmax(220px, 1.25fr) repeat(3, minmax(135px, 1fr));
  gap: 25px 30px;
  padding-block: 36px 22px;
  align-items: start;
}
.site-footer .footer-brand .brand-logo { width: 108px; }
.site-footer .footer-brand > p { margin: 7px 0 0; }
.site-footer .footer-brand .small {
  max-width: 280px;
  margin-top: 2px;
  font-size: .72rem;
  line-height: 1.4;
}
.site-footer .footer-grid > div:not(.footer-brand) {
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.site-footer .footer-grid h2 {
  margin: 0 0 4px;
  font-size: .62rem;
  line-height: 1.3;
}
.site-footer .footer-grid a {
  padding: 1px 0;
  font-size: .78rem;
  line-height: 1.34;
}
.site-footer .footer-bottom {
  min-height: 0;
  padding-block: 12px 16px;
  gap: 9px 16px;
  font-size: .66rem;
  line-height: 1.35;
}

@media (max-width: 1024px) {
  :root { --max: 1180px; --wide: 1040px; }
  .shell,
  .article-width,
  .wide-article { width: min(calc(100% - 48px), var(--max)); }
  .article-width { max-width: var(--article); }
  .wide-article { max-width: var(--wide); }
  .story-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .latest-layout { grid-template-columns: minmax(0, 1.2fr) minmax(260px, .8fr); gap: 26px; }
  .article-layout { grid-template-columns: minmax(0, 1fr) 245px; }
  .site-footer .footer-grid { grid-template-columns: 1.2fr 1fr 1fr; }
  .site-footer .footer-grid > div:last-child { grid-column: 2 / -1; }
}

@media (max-width: 820px) {
  :root { --header-h: 66px; }
  body { font-size: 16px; }
  .shell,
  .article-width,
  .wide-article,
  .policy { width: min(calc(100% - 36px), var(--max)); }
  .article-width { max-width: var(--article); }
  .wide-article { max-width: var(--wide); }

  .section { padding: 38px 0; }
  .section-heading { align-items: flex-start; margin-bottom: 20px; }
  .section-heading h2 { font-size: clamp(1.72rem, 5vw, 2.15rem); }

  .page-hero,
  .topic-hero { padding: 34px 0 28px; }
  .page-hero h1,
  .topic-hero h1 { font-size: clamp(2.25rem, 8vw, 3.35rem); }

  .topic-layout,
  .article-layout,
  .archive-layout { grid-template-columns: 1fr; }
  .topic-meta,
  .article-aside,
  .archive-filters { position: static; }
  .topic-meta dl {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 0 16px;
  }
  .topic-meta dl div { display: block; }
  .topic-meta dd { margin-top: 4px; text-align: left; }
  .article-layout { padding: 34px 0 52px; }
  .article-aside { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .archive-filters { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 0 14px; }
  .archive-filters h2 { grid-column: 1 / -1; }

  .top-story { grid-template-columns: 1fr; }
  .top-story-copy h3 { font-size: clamp(1.75rem, 5vw, 2.35rem); }
  .latest-layout { grid-template-columns: 1fr; }

  .site-footer .footer-grid {
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
    gap: 20px 24px;
    padding-block: 30px 18px;
  }
  .site-footer .footer-brand { grid-column: 1 / -1; }
  .site-footer .footer-grid > div:last-child {
    grid-column: 1 / -1;
    display: flex;
    flex-direction: row;
    flex-wrap: wrap;
    align-items: center;
    gap: 6px 14px;
  }
  .site-footer .footer-grid > div:last-child h2 { flex: 0 0 100%; margin-bottom: 0; }
}

@media (max-width: 650px) {
  :root { --header-h: 64px; }
  html { scroll-padding-top: 76px; }
  main section[id] { scroll-margin-top: 76px; }

  .shell,
  .article-width,
  .wide-article,
  .policy { width: min(calc(100% - 32px), var(--max)); }

  .brand-link,
  .brand-logo { width: 106px; }
  .header-main { gap: 8px; }
  .header-action { min-width: 44px; height: 44px; padding-inline: 7px; }

  main > .section:first-child { padding: 28px 0 24px; }
  main > .section:first-child h1 { font-size: clamp(2.18rem, 11vw, 2.85rem); }
  main > .section:first-child h1 .eyebrow { margin-bottom: 7px; }

  .section { padding: 32px 0; }
  .section-heading {
    display: grid;
    grid-template-columns: 1fr auto;
    gap: 8px 14px;
    margin-bottom: 18px;
  }
  .section-heading > p { grid-column: 1 / -1; font-size: .8rem; }
  .section-heading h2 { font-size: clamp(1.62rem, 8vw, 1.95rem); }
  .section-heading .text-link { align-self: end; }

  .trend-row {
    grid-template-columns: 30px minmax(0, 1fr) 22px;
    gap: 10px;
    padding: 14px 0;
  }
  .trend-main p { font-size: .8rem; -webkit-line-clamp: 2; display: -webkit-box; -webkit-box-orient: vertical; overflow: hidden; }
  .trend-facts span:nth-child(n+4) { display: none; }
  .trend-title-line { gap: 7px; }
  .trend-title-line strong { font-size: 1rem; }

  .story-grid { grid-template-columns: 1fr; gap: 25px; }
  .story-copy { padding-top: 12px; }
  .story-copy h3 { font-size: 1.28rem; }
  .story-copy > p { font-size: .84rem; -webkit-line-clamp: 2; }
  .compact-story { padding: 13px 0; }
  .compact-story h3 { font-size: 1.08rem; }

  .top-story-copy h3 { font-size: clamp(1.65rem, 8vw, 2.05rem); }
  .top-dek { font-size: .94rem; }
  .why-matters { margin-top: 15px; padding-top: 13px; }
  .why-matters p { font-size: .82rem; -webkit-line-clamp: 3; }

  .page-hero,
  .topic-hero { padding: 28px 0 24px; }
  .page-hero h1,
  .topic-hero h1 {
    margin: 8px 0 10px;
    font-size: clamp(2.12rem, 11vw, 2.85rem);
    line-height: 1;
  }
  .page-hero p,
  .topic-hero p { font-size: .94rem; line-height: 1.52; }
  .breadcrumbs { margin-bottom: 16px; }
  .topic-title-row { display: block; }
  .topic-title-row > .status { margin-top: 13px; }

  .topic-summary h2,
  .topic-facts h2 { font-size: 1.48rem; }
  .topic-summary p,
  .large-copy { font-size: .98rem; line-height: 1.6; }
  .topic-facts { margin-top: 24px; padding-top: 18px; }
  .topic-meta { padding: 14px 15px 3px; }
  .topic-meta dl { gap: 0 10px; }
  .topic-meta dt { font-size: .64rem; }
  .topic-meta dd { font-size: .9rem; }

  .timeline article {
    grid-template-columns: 1fr;
    gap: 8px;
    padding: 16px 0;
  }
  .timeline h3 { font-size: 1.16rem; }
  .timeline p { font-size: .8rem; }

  .article-hero { padding: 28px 0 22px; }
  .article-hero h1 {
    margin: 11px 0 12px;
    font-size: clamp(2.12rem, 10.5vw, 2.75rem);
    line-height: 1.02;
  }
  .article-subtitle { font-size: .96rem; line-height: 1.52; }
  .article-byline { margin-top: 17px; padding-top: 11px; gap: 6px 12px; }
  .article-layout { padding: 28px 0 44px; }
  .in-brief { margin-bottom: 30px; padding: 18px 19px; }
  .in-brief h2 { font-size: 1.45rem; }
  .in-brief li { font-size: .92rem; }
  .article-section { margin-bottom: 31px; }
  .article-section h2 { font-size: 1.48rem; }
  .article-section > p { font-size: 1rem; line-height: 1.66; }
  .article-aside { grid-template-columns: 1fr; }
  .aside-card { padding-top: 12px; }

  .topic-grid,
  .entity-grid { grid-template-columns: 1fr; gap: 15px; }
  .topic-card,
  .entity-card { padding: 18px; }
  .topic-card h3,
  .entity-card h3 { font-size: 1.2rem; }

  .archive-filters { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .archive-month { margin-bottom: 30px; }

  .search-form > div { display: grid; grid-template-columns: 1fr auto; }
  .search-form input { min-width: 0; }
  .search-results { margin-top: 20px; }

  .policy > section { padding-bottom: 24px; margin-bottom: 24px; }
  .policy h2 { font-size: 1.42rem; }
  .policy p { font-size: .96rem; line-height: 1.64; }
  .source-registry article { grid-template-columns: 1fr; gap: 4px; }
  .source-registry .source-type { grid-column: 1; grid-row: auto; }

  .ecosystem-promo,
  .watch-inner { display: grid; gap: 18px; }
  .watch-strip { padding: 30px 0; }

  .site-footer .footer-grid {
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
    gap: 18px 18px;
    padding-block: 26px 16px;
  }
  .site-footer .footer-brand { grid-column: 1 / -1; }
  .site-footer .footer-brand .small { max-width: none; }
  .site-footer .footer-grid > div:last-child {
    grid-column: 1 / -1;
    gap: 5px 13px;
  }
  .site-footer .footer-grid a { font-size: .76rem; }
  .site-footer .footer-bottom {
    flex-direction: row;
    flex-wrap: wrap;
    justify-content: flex-start;
    padding-block: 10px 13px;
    gap: 3px 7px;
  }
  .site-footer .footer-bottom span + span::before { content: "·"; margin-right: 7px; }
}

@media (max-width: 360px) {
  .shell,
  .article-width,
  .wide-article,
  .policy { width: min(calc(100% - 28px), var(--max)); }
  .site-footer .footer-grid { gap-inline: 13px; }
  .site-footer .footer-grid a { font-size: .73rem; }
  .topic-meta dl { grid-template-columns: 1fr 1fr; }
  .topic-meta dl div:last-child { grid-column: 1 / -1; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; transition-duration: .001ms !important; animation-duration: .001ms !important; animation-iteration-count: 1 !important; }
}
