/* ==========================================================================
   themes/default/local.css - the public design's content: the article listings (home, a category, a tag), the article
   page, pagination (#35 Phase 5, D18; the approved look: design/foundation/features/35-public-site.html). Requires
   public-tokens.css and base.css.
   1 listings · 2 home layouts (list, magazine) · 3 the article · 4 the reading font · 5 pagination, empty state
   ========================================================================== */

/* --------------------------------------------------------------------------
   1. Listings: the featured article, then the cards
   -------------------------------------------------------------------------- */

.article-feature {
  display: grid;
  min-width: 0;
  overflow: hidden;
}

.article-feature .pf-media {
  display: block;
  min-width: 0;
}

.article-feature .pf-img {
  width: 100%;
  aspect-ratio: 16 / 9;
  object-fit: cover;
}

@media (min-width: 1024px) {
  .article-feature {
    grid-template-columns: 7fr 5fr;
  }

  .article-feature:not(:has(.pf-img)) {
    grid-template-columns: 1fr;
  }

  .article-feature .pf-img {
    height: 100%;
    min-height: 320px;
    aspect-ratio: auto;
  }
}

.article-feature .pf-body {
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 10px;
  min-width: 0;
  padding: clamp(24px, 3.5vw, 40px);
}

.article-feature h2 {
  margin: 0;
  font-size: clamp(1.5rem, 2.6vw, 2rem);
  line-height: 1.2;
  letter-spacing: -0.025em;
  text-wrap: balance;
  overflow-wrap: anywhere;
}

.pf-excerpt {
  margin: 0;
  line-height: 1.6;
  color: var(--ink-2);
}

/* The cards fill their row (the site's card grid: 3 across on a laptop, 2 on a tablet, 1 on a phone). */
.article-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 18rem), 1fr));
  gap: 16px;
}

.article-feature + .article-grid {
  margin-top: 16px;
}

.article-card {
  display: flex;
  flex-direction: column;
  min-width: 0;
  overflow: hidden;
  transition: border-color var(--fast) var(--ease);
}

.article-card:hover {
  border-color: color-mix(in srgb, var(--accent-ink) 40%, var(--border));
}

.article-card .pc-img {
  width: 100%;
  aspect-ratio: 16 / 9;
  object-fit: cover;
}

/* A card without a picture: the picture area in the Local's tint with an article icon (the rows stay even). */
.article-card .pc-thumb {
  display: grid;
  place-items: center;
  aspect-ratio: 16 / 9;
  background-color: color-mix(in srgb, var(--accent-ink) 10%, var(--bg-muted));
  color: color-mix(in srgb, var(--accent-ink) 55%, var(--ink-3));
}

.article-card .pc-thumb .icon {
  width: 2rem;
  height: 2rem;
  opacity: 0.75;
}

.article-card .pc-body {
  display: flex;
  flex: 1;
  flex-direction: column;
  gap: 8px;
  min-width: 0;
  padding: var(--card-pad);
}

.article-card h3 {
  margin: 0;
  font-size: 1.125rem;
  line-height: 1.35;
  letter-spacing: -0.015em;
  overflow-wrap: anywhere;
}

.article-card p {
  margin: 0;
  font-size: 0.9375rem;
  line-height: 1.6;
  color: var(--ink-2);
}

.article-feature h2 a:hover,
.article-card h3 a:hover {
  text-decoration: underline;
  text-underline-offset: 3px;
}

/* The date and the reading time (and an article's byline and share). */
.article-meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 4px 8px;
  margin-top: auto;
  padding-top: 4px;
  font-size: 0.8125rem;
  line-height: 1.5;
  color: var(--ink-3);
}

/* --------------------------------------------------------------------------
   2. Home layouts (Settings → Interface → Public site → Home layout). "cards" is the design above; these restyle the
   SAME markup through a class on <body>.
   -------------------------------------------------------------------------- */

/* list: one reading column of plain rows - a small picture beside the text, no card chrome. */
.layout-list .article-feature,
.layout-list .article-card {
  display: flex;
  flex-direction: row;
  align-items: center;
  gap: clamp(14px, 2.4vw, 24px);
  overflow: visible;
  border: 0;
  border-bottom: 1px solid var(--border);
  border-radius: 0;
  background-color: transparent;
  box-shadow: none;
}

.layout-list .article-feature,
.layout-list .article-grid {
  max-width: calc(820px * var(--pub-w-scale, 1));
  margin-inline: auto;
}

.layout-list .article-grid {
  grid-template-columns: 1fr;
  gap: 0;
  margin-top: 0;
}

.layout-list .article-feature > a,
.layout-list .article-card > a {
  flex: none;
  width: clamp(104px, 28%, 220px);
}

.layout-list .article-feature .pf-img,
.layout-list .article-card .pc-img {
  width: 100%;
  height: auto;
  min-height: 0;
  aspect-ratio: 4 / 3;
  border-radius: var(--radius-lg);
}

.layout-list .article-card .pc-thumb {
  aspect-ratio: 4 / 3;
  border-radius: var(--radius-lg);
}

.layout-list .article-feature .pf-body,
.layout-list .article-card .pc-body {
  flex: 1;
  gap: 6px;
  min-width: 0;
  padding: 20px 0;
}

.layout-list .article-feature h2 {
  font-size: clamp(1.25rem, 2.2vw, 1.5rem);
}

.layout-list .pf-excerpt,
.layout-list .article-card p {
  display: -webkit-box;
  overflow: hidden;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
}

.layout-list .article-card:hover {
  border-color: var(--border);
}

/* magazine: a denser grid - more and smaller cards, the headline instead of the summary, a taller lead. */
.layout-magazine .article-grid {
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

@media (min-width: 768px) {
  .layout-magazine .article-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 16px;
  }
}

@media (min-width: 1100px) {
  .layout-magazine .article-grid {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }

  .layout-magazine .article-feature .pf-img {
    min-height: 380px;
  }

  .layout-magazine .article-feature h2 {
    font-size: clamp(1.875rem, 3vw, 2.5rem);
  }
}

.layout-magazine .article-card :is(.pc-img, .pc-thumb) {
  aspect-ratio: 4 / 3;
}

.layout-magazine .article-card .pc-body {
  gap: 6px;
  padding: 14px 16px 16px;
}

.layout-magazine .article-card h3 {
  font-size: 1rem;
  line-height: 1.3;
}

.layout-magazine .article-card p {
  display: none;
}

/* In the narrow two-column grid the date and the reading time stack: no separator left hanging. */
@media (max-width: 767px) {
  .layout-magazine .article-card .article-meta > span:first-of-type {
    display: none;
  }

  .layout-magazine .article-card .article-meta {
    flex-direction: column;
    align-items: flex-start;
    gap: 2px;
  }
}

/* --------------------------------------------------------------------------
   3. The article
   -------------------------------------------------------------------------- */

/* The head: the category, the title, the byline line, the translations - centred. */
.article-head {
  padding-block: clamp(32px, 6vw, 56px) 24px;
  text-align: center;
}

.article-head > .container-narrow {
  display: grid;
  justify-items: center;
  gap: 14px;
}

.article-title {
  margin: 0;
  font-size: clamp(2rem, 5vw, 2.875rem);
  line-height: 1.12;
  letter-spacing: -0.03em;
  text-wrap: balance;
  overflow-wrap: anywhere;
}

.article-head .article-meta {
  justify-content: center;
  gap: 6px 10px;
  margin: 0;
  padding: 0;
  font-size: 0.875rem;
}

/* The writer: a neutral person (as in the app) and the name in bold. */
.byline-av {
  display: inline-flex;
  flex: none;
  align-items: center;
  justify-content: center;
  width: 24px;
  height: 24px;
  border-radius: 999px;
  background-color: var(--bg-soft);
  color: var(--ink-3);
}

.byline-av .icon {
  width: 14px;
  height: 14px;
}

.byline-name {
  font-weight: 600;
  color: var(--ink-1);
}

.article-head .lang-row {
  margin-top: 4px;
}

.article-hero {
  margin: 0 0 8px;
}

.article-hero-img {
  width: 100%;
  aspect-ratio: 21 / 9;
  object-fit: cover;
  border: 1px solid var(--border);
  border-radius: var(--radius-xl);
}

/* The text: the content size (18px), 1.75 line height, a 42rem column. */
.article-prose.container-narrow {
  max-width: calc(42rem * var(--pub-w-scale, 1) + 2 * var(--pad));
}

.article-prose {
  padding-block: 24px clamp(40px, 6vw, 56px);
  font-size: var(--content-text-size, 18px);
  line-height: 1.75;
  color: var(--ink-2);
  overflow-wrap: break-word;
}

.article-prose :where(p, ul, ol, blockquote, pre, figure, table) {
  margin: 0;
}

.article-prose > * + * {
  margin-top: 1.1em;
}

.article-prose h2,
.article-prose h3,
.article-prose h4 {
  margin: 1.6em 0 0;
  line-height: 1.35;
  letter-spacing: -0.015em;
  color: var(--ink-1);
}

.article-prose h2 {
  font-size: 1.375rem;
}

.article-prose h3 {
  font-size: 1.1875rem;
}

.article-prose h4 {
  font-size: 1.0625rem;
}

.article-prose > :is(h2, h3, h4) + * {
  margin-top: 0.6em;
}

.article-prose > :first-child {
  margin-top: 0;
}

.article-prose strong {
  color: var(--ink-1);
}

.article-prose a {
  font-weight: 500;
  color: var(--accent-ink);
  text-decoration: underline;
  text-decoration-thickness: 1px;
  text-underline-offset: 3px;
}

.article-prose a:hover {
  text-decoration-thickness: 2px;
}

.article-prose ul,
.article-prose ol {
  padding-inline-start: 1.4em;
}

.article-prose ul {
  list-style: disc;
}

.article-prose li + li {
  margin-top: 0.35em;
}

.article-prose blockquote {
  padding-inline-start: 1rem;
  border-inline-start: 3px solid var(--accent-ink);
  color: var(--ink-3);
}

.article-prose code {
  font-family: var(--font-mono);
  font-size: 0.9em;
}

.article-prose pre {
  overflow-x: auto;
  padding: 14px 16px;
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  background-color: var(--bg-muted);
  font-size: 0.875rem;
  line-height: 1.6;
}

.article-prose img {
  height: auto;
  border: 1px solid var(--border);
  border-radius: var(--radius-xl);
}

.article-prose figcaption {
  margin-top: 0.5em;
  font-size: 0.875rem;
  line-height: 1.5;
  color: var(--ink-3);
}

.article-prose hr {
  margin-block: 2em;
  border: 0;
  border-top: 1px solid var(--border);
}

.article-prose table {
  display: block;
  max-width: 100%;
  overflow-x: auto;
  border-collapse: collapse;
  font-size: 0.9375rem;
}

.article-prose :is(th, td) {
  padding: 8px 12px;
  border: 1px solid var(--border);
  text-align: start;
}

/* #34 2d: the verified badges beside an author's name - the blue tick and the single-colour LocalCen mark, fixed
   colours (never the Local's), each opening a small card: a native popover (click / tap; Esc or a tap outside closes).
   Without popover support the card stays hidden and the badges still show. */
:root { --verified: #1877F2; --localcen-mark: #247100; }
[data-theme="dark"] { --localcen-mark: #2a8200; }
.vbadges { display: inline-flex; align-items: center; gap: 0.2em; margin-inline-start: 0.35em; vertical-align: -0.18em; }
.vb { display: inline-flex; flex: none; width: 1.1em; height: 1.1em; padding: 0; border: 0; border-radius: 4px; background: none; color: var(--localcen-mark); cursor: pointer; }
.vb svg { width: 100%; height: 100%; }
.vb-mark { width: 1em; }
.vb:focus-visible { outline: 2px solid currentColor; outline-offset: 2px; }
.vb-tick .vt-seal { fill: var(--verified); stroke: var(--verified); stroke-width: 2; stroke-linejoin: round; }
.vb-tick .vt-check { fill: none; stroke: #fff; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.vb-card { display: none; max-width: min(17rem, calc(100vw - 2rem)); margin: auto; padding: 14px 16px; border: 1px solid var(--border); border-radius: var(--radius-lg); background: var(--surface); color: var(--ink-2); box-shadow: var(--shadow-pop); font-family: var(--font-sans); font-size: 0.875rem; line-height: 1.5; }
.vb-card:popover-open { display: block; }
.vb-card::backdrop { background: rgb(0 0 0 / 0.15); }
.vb-card p { margin: 0.4rem 0 0; }
.vb-card .vb-title { display: flex; align-items: center; gap: 0.45rem; margin: 0; font-weight: 600; color: var(--ink-1); }
.vb-card .vb-title .vb { cursor: default; }

/* The author box: a card - a neutral person, the name, the role. */
.article-prose > .author-card {
  margin-top: 2.4em;
}

.author-card {
  display: flex;
  align-items: flex-start;
  gap: 16px;
  padding: var(--card-pad);
  border: 1px solid var(--border);
  border-radius: var(--radius-xl);
  background-color: var(--surface);
  box-shadow: var(--shadow-card);
  font-family: var(--font-sans);
  font-size: 1rem;
  line-height: 1.5;
  color: var(--ink-1);
}

.author-card .av {
  display: inline-flex;
  flex: none;
  align-items: center;
  justify-content: center;
  width: 48px;
  height: 48px;
  border-radius: 999px;
  background-color: var(--bg-soft);
  color: var(--ink-3);
}

.author-card .av .icon {
  width: 24px;
  height: 24px;
}

.author-text {
  display: grid;
  gap: 4px;
  min-width: 0;
  padding-top: 2px;
}

.author-card .an {
  font-weight: 700;
  overflow-wrap: anywhere;
}

.author-card .ar {
  font-size: 0.875rem;
  color: var(--ink-3);
}

/* The tags: white pills. */
.tag-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  font-family: var(--font-sans);
}

.tag {
  display: inline-flex;
  align-items: center;
  height: 32px;
  padding: 0 14px;
  border: 1px solid var(--line-strong);
  border-radius: 999px;
  background-color: var(--surface);
  font-size: 0.875rem;
  font-weight: 500;
  line-height: 1;
  color: var(--ink-2);
  transition: border-color var(--fast) var(--ease), color var(--fast) var(--ease);
}

a.tag:hover {
  border-color: var(--field);
  color: var(--ink-1);
}

/* Read next: a quiet band of cards that runs into the footer. */
.read-next {
  padding-block: clamp(40px, 6vw, 64px);
}

.read-next .eyebrow {
  margin-bottom: 16px;
}

main:has(> .read-next) {
  padding-bottom: 0;
}

/* --------------------------------------------------------------------------
   4. The reading font (Settings → Interface → Public site → Reading font: serif) - the article's title and text.
   -------------------------------------------------------------------------- */

.font-serif .article-title {
  font-family: var(--font-serif);
  font-weight: 600;
  letter-spacing: -0.01em;
}

.font-serif .article-prose {
  font-family: var(--font-serif);
}

/* --------------------------------------------------------------------------
   5. Pagination, the empty state
   -------------------------------------------------------------------------- */

.pagination {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 8px;
  margin-top: 40px;
}

.page-pill {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 36px;
  height: 36px;
  padding-inline: 14px;
  border: 1px solid var(--line-strong);
  border-radius: 999px;
  background-color: var(--surface);
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--ink-1);
  transition: border-color var(--fast) var(--ease), background-color var(--fast) var(--ease);
}

a.page-pill:hover {
  border-color: var(--field);
  background-color: var(--bg-muted);
}

.page-pill.active {
  border-color: transparent;
  background-color: var(--bg-soft);
  font-weight: 600;
}

.page-pill.disabled {
  opacity: 0.45;
  pointer-events: none;
}

.empty-state {
  margin: 0;
  padding: 48px 0;
  color: var(--ink-3);
  text-align: center;
}

/* Hindi / Telugu / Gujarati: no negative tracking, taller headline lines. */
:lang(hi) :is(.article-title, .article-feature h2, .article-card h3, .article-prose :is(h2, h3, h4)),
:lang(te) :is(.article-title, .article-feature h2, .article-card h3, .article-prose :is(h2, h3, h4)),
:lang(gu) :is(.article-title, .article-feature h2, .article-card h3, .article-prose :is(h2, h3, h4)) {
  letter-spacing: 0;
  line-height: 1.35;
}
