/* NOWZO — Premium mobile-app news UI */
:root {
  --primary: #6366f1;
  --accent: #06b6d4;
  --bg: #f8fafc;
  --bg-elevated: #ffffff;
  --bg-muted: #f1f5f9;
  --text: #0f172a;
  --text-secondary: #64748b;
  --border: rgba(15, 23, 42, 0.08);
  --shadow: 0 4px 24px rgba(15, 23, 42, 0.08);
  --shadow-lg: 0 12px 40px rgba(15, 23, 42, 0.12);
  --radius: 16px;
  --radius-sm: 10px;
  --nav-h: 64px;
  --header-h: 104px;
  --safe-b: env(safe-area-inset-bottom, 0px);
  /* system-ui first so text paints before Inter loads (PageSpeed fonts) */
  --font: system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Inter, sans-serif;
  --max: 720px;
  --ease: cubic-bezier(0.22, 1, 0.36, 1);
}

@media (prefers-color-scheme: dark) {
  html[data-theme="auto"] {
    --bg: #0b1120;
    --bg-elevated: #111827;
    --bg-muted: #1e293b;
    --text: #f1f5f9;
    --text-secondary: #94a3b8;
    --border: rgba(248, 250, 252, 0.08);
    --shadow: 0 4px 24px rgba(0, 0, 0, 0.35);
    --shadow-lg: 0 12px 40px rgba(0, 0, 0, 0.45);
  }
}

html[data-theme="dark"] {
  --bg: #0b1120;
  --bg-elevated: #111827;
  --bg-muted: #1e293b;
  --text: #f1f5f9;
  --text-secondary: #94a3b8;
  --border: rgba(248, 250, 252, 0.08);
  --shadow: 0 4px 24px rgba(0, 0, 0, 0.35);
  --shadow-lg: 0 12px 40px rgba(0, 0, 0, 0.45);
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html {
  -webkit-text-size-adjust: 100%;
  scroll-behavior: smooth;
  overflow-x: hidden;
  max-width: 100%;
}

body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  line-height: 1.55;
  min-height: 100dvh;
  padding-bottom: calc(var(--nav-h) + var(--safe-b) + 1rem);
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
  max-width: 100%;
}

img { max-width: 100%; height: auto; display: block; }
a { color: inherit; text-decoration: none; }
button { font-family: inherit; cursor: pointer; border: none; background: none; color: inherit; }

.skip-link {
  position: absolute; left: -9999px; top: 0; z-index: 9999;
  background: var(--primary); color: #fff; padding: .5rem 1rem;
}
.skip-link:focus { left: 1rem; top: 1rem; }

/* Screen-reader / SEO-only headings (homepage brand H1, microdata helpers) */
.visually-hidden {
  position: absolute !important;
  width: 1px; height: 1px;
  padding: 0; margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

/* Header */
.app-header {
  position: sticky; top: 0; z-index: 100;
  background: color-mix(in srgb, var(--bg-elevated) 85%, transparent);
  backdrop-filter: blur(16px) saturate(1.4);
  -webkit-backdrop-filter: blur(16px) saturate(1.4);
  border-bottom: 1px solid var(--border);
  transition: box-shadow .25s var(--ease);
}
.app-header.scrolled { box-shadow: var(--shadow); }

.header-inner {
  display: flex; align-items: center; justify-content: space-between;
  padding: .75rem 1rem; max-width: 1100px; margin: 0 auto;
}

.logo { display: flex; align-items: center; gap: .6rem; font-weight: 800; font-size: 1.15rem; }
.logo-mark {
  width: 36px; height: 36px; border-radius: 10px;
  background: linear-gradient(135deg, var(--primary), var(--accent));
  color: #fff; display: grid; place-items: center; font-weight: 800;
  box-shadow: 0 4px 12px color-mix(in srgb, var(--primary) 40%, transparent);
}
.logo-text { letter-spacing: -0.02em; }
/*
 * Logo is auto-resized on upload to ~480×160 max (e.g. 1252×475 → ~422×160).
 * Wide wordmarks (NowZo) need a bit more width than a square mark.
 */
.logo--image { gap: 0; max-width: min(200px, 58vw); }
.logo-img {
  display: block;
  height: 30px;
  width: auto;
  max-width: 100%;
  object-fit: contain;
  object-position: left center;
  /* Works on light/dark headers when black bg was stripped to transparency */
  background: transparent;
}
@media (min-width: 480px) {
  .logo-img { height: 34px; }
  .logo--image { max-width: min(240px, 52vw); }
}
@media (min-width: 768px) {
  .logo-img { height: 38px; }
  .logo--image { max-width: 260px; }
}

.header-actions { display: flex; gap: .25rem; }
.icon-btn {
  width: 42px; height: 42px; border-radius: 12px;
  display: grid; place-items: center;
  transition: background .2s;
}
.icon-btn:hover, .icon-btn:active { background: var(--bg-muted); }

html[data-theme="light"] .icon-moon,
html[data-theme="dark"] .icon-sun { display: none; }
@media (prefers-color-scheme: dark) {
  html[data-theme="auto"] .icon-sun { display: none; }
  html[data-theme="auto"] .icon-moon { display: block; }
}
@media (prefers-color-scheme: light) {
  html[data-theme="auto"] .icon-moon { display: none; }
  html[data-theme="auto"] .icon-sun { display: block; }
}

/* Category chips */
.cat-scroll {
  display: flex; gap: .5rem; overflow-x: auto; padding: 0 1rem .75rem;
  max-width: 1100px; margin: 0 auto;
  scrollbar-width: none; -webkit-overflow-scrolling: touch;
}
.cat-scroll::-webkit-scrollbar { display: none; }

.cat-chip {
  flex: 0 0 auto; padding: .4rem .9rem; border-radius: 999px;
  font-size: .8rem; font-weight: 600; color: var(--text-secondary);
  background: var(--bg-muted); transition: all .2s var(--ease);
  white-space: nowrap;
}
.cat-chip:hover, .cat-chip.active {
  background: color-mix(in srgb, var(--chip, var(--primary)) 15%, var(--bg-muted));
  color: var(--chip, var(--primary));
}
.cat-chip.active { box-shadow: inset 0 0 0 1.5px var(--chip, var(--primary)); }

/* Search overlay */
.search-overlay {
  position: fixed; inset: 0; z-index: 200;
  background: rgba(0,0,0,.45); backdrop-filter: blur(6px);
  display: flex; align-items: flex-start; justify-content: center;
  padding: 4rem 1rem 1rem; animation: fadeIn .2s var(--ease);
}
.search-overlay[hidden] { display: none; }
.search-panel {
  width: 100%; max-width: 520px; background: var(--bg-elevated);
  border-radius: var(--radius); box-shadow: var(--shadow-lg); padding: .75rem;
}
.search-form { display: flex; align-items: center; gap: .5rem; }
.search-form input {
  flex: 1; border: none; background: transparent; font-size: 1.05rem;
  color: var(--text); outline: none; padding: .5rem;
}
.search-form-inline {
  display: flex; gap: .5rem; margin-top: 1rem; flex-wrap: wrap;
}
.search-form-inline input {
  flex: 1; min-width: 200px; padding: .75rem 1rem; border-radius: var(--radius-sm);
  border: 1px solid var(--border); background: var(--bg-elevated); color: var(--text); font-size: 1rem;
}

/* Main */
.app-main {
  width: 100%;
  max-width: 1100px;
  margin: 0 auto;
  padding: 0 1rem 2rem;
  box-sizing: border-box;
}

/* Breaking — LIVE ticker (slow marquee) */
.breaking-bar {
  display: flex;
  align-items: center;
  gap: .65rem;
  margin: 1rem 0;
  padding: .55rem .75rem .55rem .65rem;
  background: linear-gradient(90deg, #ef4444, #f97316);
  border-radius: var(--radius-sm);
  color: #fff;
  overflow: hidden;
  width: 100%;
  max-width: 100%;
  box-sizing: border-box;
}
.breaking-label {
  flex-shrink: 0;
  font-size: .68rem;
  font-weight: 800;
  letter-spacing: .08em;
  background: rgba(0, 0, 0, .28);
  padding: .28rem .55rem;
  border-radius: 6px;
  animation: pulse 1.5s infinite;
  z-index: 1;
}
.breaking-viewport {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  mask-image: linear-gradient(90deg, transparent, #000 12px, #000 calc(100% - 12px), transparent);
  -webkit-mask-image: linear-gradient(90deg, transparent, #000 12px, #000 calc(100% - 12px), transparent);
}
.breaking-track {
  display: flex;
  align-items: center;
  gap: 0;
  width: max-content;
  animation: breaking-scroll 55s linear infinite;
  will-change: transform;
}
.breaking-bar:hover .breaking-track,
.breaking-bar:focus-within .breaking-track {
  animation-play-state: paused;
}
.breaking-item {
  flex-shrink: 0;
  white-space: nowrap;
  font-size: .85rem;
  font-weight: 600;
  opacity: .96;
  padding: 0 .15rem;
  color: #fff;
  text-decoration: none;
}
.breaking-item:hover {
  text-decoration: underline;
  opacity: 1;
}
.breaking-dot {
  flex-shrink: 0;
  opacity: .55;
  padding: 0 1rem;
  font-size: .7rem;
  user-select: none;
}

/* Slow continuous leftward scroll */
@keyframes breaking-scroll {
  from { transform: translateX(0); }
  to   { transform: translateX(-50%); } /* half = one full set (content duplicated) */
}

/* Respect reduced motion */
@media (prefers-reduced-motion: reduce) {
  .breaking-track {
    animation: none;
    flex-wrap: nowrap;
    overflow-x: auto;
    width: auto;
    max-width: 100%;
    scrollbar-width: none;
  }
  .breaking-viewport {
    mask-image: none;
    -webkit-mask-image: none;
    overflow-x: auto;
  }
}

@keyframes pulse { 50% { opacity: .7; } }
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }

/* Hero — professional bottom caption, image stays visible */
.hero-section {
  display: grid;
  gap: 1rem;
  margin: 1rem 0 1.5rem;
  width: 100%;
  max-width: 100%;
  box-sizing: border-box;
}
@media (min-width: 860px) {
  .hero-section { grid-template-columns: 1.45fr 1fr; align-items: stretch; }
}

.hero-card {
  position: relative;
  display: block;
  width: 100%;
  max-width: 100%;
  box-sizing: border-box;
  border-radius: calc(var(--radius) + 2px);
  overflow: hidden;
  isolation: isolate;
  /* ~16:9 banner — room for image + bottom text band */
  aspect-ratio: 16 / 9;
  min-height: 200px;
  max-height: 440px;
  box-shadow: var(--shadow-lg);
  background: #0f172a;
}
.hero-media {
  position: absolute;
  inset: 0;
  display: block;
  overflow: hidden;
  z-index: 0;
}
.hero-media img {
  width: 100%;
  height: 100%;
  max-width: none;
  max-height: none;
  object-fit: cover;
  object-position: center center;
  display: block;
}
/* Soft bottom scrim only — top ~55% of photo stays clear */
.hero-gradient {
  position: absolute;
  inset: 0;
  z-index: 1;
  pointer-events: none;
  background: linear-gradient(
    to top,
    rgba(0, 0, 0, 0.88) 0%,
    rgba(0, 0, 0, 0.55) 28%,
    rgba(0, 0, 0, 0.18) 48%,
    transparent 68%
  );
}
/* Title/meta sit on the bottom band — not centered over the image */
.hero-body {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 2;
  padding: 0.85rem 1rem 1rem;
  color: #fff;
  text-align: left;
  max-width: 100%;
  box-sizing: border-box;
  /* keep copy in lower third */
  max-height: 46%;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  align-items: flex-start;
  gap: 0.3rem;
}
.hero-body .badge-cat {
  background: rgba(255, 255, 255, 0.18);
  color: #fff;
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  border: 1px solid rgba(255, 255, 255, 0.22);
  margin-bottom: 0.15rem;
}
.hero-title {
  font-size: clamp(1.05rem, 2.6vw, 1.55rem);
  font-weight: 750;
  line-height: 1.28;
  letter-spacing: -0.025em;
  margin: 0;
  max-width: 100%;
  display: -webkit-box;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
  overflow: hidden;
  word-break: break-word;
  overflow-wrap: anywhere;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.45);
}
.hero-excerpt {
  margin: 0;
  max-width: 100%;
  font-size: 0.875rem;
  line-height: 1.4;
  opacity: 0.92;
  display: -webkit-box;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
  overflow: hidden;
  word-break: break-word;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.4);
}
.hero-body .meta-row {
  color: rgba(255, 255, 255, 0.88);
  font-size: 0.75rem;
  margin-top: 0.15rem;
}

/* Mobile hero — no right clip, less text over photo */
@media (max-width: 640px) {
  .hero-card {
    aspect-ratio: 16 / 10;
    min-height: 210px;
    max-height: 320px;
    border-radius: 14px;
  }
  .hero-body {
    padding: 0.75rem 0.9rem 0.9rem;
    max-height: 42%;
  }
  .hero-title {
    font-size: 1.05rem;
    -webkit-line-clamp: 2;
  }
  .hero-excerpt {
    font-size: 0.8rem;
    -webkit-line-clamp: 1; /* one line on phone — image stays readable */
  }
  .hero-gradient {
    background: linear-gradient(
      to top,
      rgba(0, 0, 0, 0.9) 0%,
      rgba(0, 0, 0, 0.5) 32%,
      rgba(0, 0, 0, 0.12) 52%,
      transparent 70%
    );
  }
}

@media (min-width: 860px) {
  .hero-card {
    aspect-ratio: 16 / 9;
    min-height: 280px;
    max-height: 420px;
  }
  .hero-body {
    padding: 1.15rem 1.35rem 1.25rem;
    max-width: 92%; /* leave right edge of image open */
  }
  .hero-title {
    font-size: 1.45rem;
    -webkit-line-clamp: 2;
  }
  .hero-excerpt {
    -webkit-line-clamp: 2;
    max-width: 36rem;
  }
}

.hero-side {
  display: flex;
  flex-direction: column;
  gap: .75rem;
  min-width: 0;
  width: 100%;
  max-width: 100%;
}
.side-card {
  display: flex; gap: .85rem; padding: .75rem;
  background: var(--bg-elevated); border-radius: var(--radius);
  border: 1px solid var(--border); box-shadow: var(--shadow);
  transition: transform .2s var(--ease), box-shadow .2s;
  flex: 1;
}
.side-card:active { transform: scale(0.98); }
.side-card img {
  width: 106px;
  height: 60px;
  object-fit: cover;
  border-radius: 10px;
  flex-shrink: 0;
  background: transparent;
}
.side-card h3 { font-size: .9rem; font-weight: 700; line-height: 1.3; margin-bottom: .25rem; display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }
.side-card time { font-size: .75rem; color: var(--text-secondary); }

/* Cards */
.section { margin: 2rem 0; }
.section-head {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 1rem;
}
.section-head h2 {
  font-size: 1.25rem; font-weight: 800; letter-spacing: -0.02em;
}

.card-grid {
  display: grid; gap: 1rem;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
}

/* Standard card image: 424×242 — full bleed, no white side gaps */
:root {
  --img-w: 424px;
  --img-h: 242px;
  --img-ratio: 424 / 242;
}

.news-card {
  background: var(--bg-elevated); border-radius: var(--radius);
  border: 1px solid var(--border); overflow: hidden;
  box-shadow: var(--shadow); transition: transform .25s var(--ease), box-shadow .25s;
  width: 100%;
  max-width: 100%;
}
.news-card:active { transform: scale(0.985); }
.news-card-link { display: block; text-decoration: none; color: inherit; }

.news-card-media {
  width: 100%;
  aspect-ratio: var(--img-ratio); /* 424×242 */
  max-width: none;
  max-height: none;
  margin: 0;
  display: block;
  background: transparent;
  overflow: hidden;
  position: relative;
}
.news-card-media img {
  width: 100%;
  height: 100%;
  max-width: none;
  max-height: none;
  object-fit: cover;             /* fill frame — no left/right white bars */
  object-position: center;
  display: block;
  background: transparent;
  transition: transform .35s var(--ease);
}
.news-card:hover .news-card-media img { transform: scale(1.02); }

.news-card-body { padding: 1rem; }
.news-card-title {
  font-size: 1rem; font-weight: 700; line-height: 1.35;
  letter-spacing: -0.01em; margin: .4rem 0;
  display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden;
}
.news-card-excerpt {
  font-size: .875rem; color: var(--text-secondary);
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
  margin-bottom: .5rem;
}

/* Horizontal feed row (category pages etc.) */
.news-card--feed .news-card-link {
  display: grid;
  grid-template-columns: min(42vw, 160px) 1fr;
  gap: 0;
  align-items: stretch;
}
.news-card--feed .news-card-media {
  width: 100%;
  max-width: none;
  max-height: none;
  aspect-ratio: var(--img-ratio);
  margin: 0;
  background: transparent;
}
.news-card--feed .news-card-media img {
  width: 100%;
  height: 100%;
  max-width: none;
  max-height: none;
  object-fit: cover;
  background: transparent;
}
@media (min-width: 600px) {
  .news-card--feed .news-card-link {
    grid-template-columns: 200px 1fr;
  }
  .news-card--feed .news-card-media {
    width: 200px;
    height: calc(200px * 242 / 424);
    max-width: 200px;
    max-height: calc(200px * 242 / 424);
    aspect-ratio: var(--img-ratio);
  }
}
@media (min-width: 900px) {
  .news-card--feed .news-card-link {
    grid-template-columns: var(--img-w) 1fr;
  }
  .news-card--feed .news-card-media {
    width: var(--img-w);
    height: var(--img-h);
    max-width: var(--img-w);
    max-height: var(--img-h);
    aspect-ratio: var(--img-ratio);
  }
}

/* Latest section: single column mobile, 2 columns desktop */
.latest-grid {
  display: grid;
  gap: 1rem;
  grid-template-columns: 1fr;
  width: 100%;
  max-width: 100%;
}
.latest-grid .empty-state {
  grid-column: 1 / -1;
}
.news-card--latest .news-card-link {
  display: flex;
  flex-direction: column;
  height: 100%;
}
.news-card--latest .news-card-media {
  width: 100%;
  max-width: none;
  max-height: none;
  aspect-ratio: var(--img-ratio);
  margin: 0;
  background: transparent;
}
.news-card--latest .news-card-media img {
  width: 100%;
  height: 100%;
  max-width: none;
  max-height: none;
  object-fit: cover;
  background: transparent;
}
.news-card--latest .news-card-body {
  flex: 1;
  display: flex;
  flex-direction: column;
}
@media (min-width: 768px) {
  .latest-grid {
    grid-template-columns: 1fr 1fr; /* two news cards per row */
    gap: 1.25rem;
  }
  .news-card--latest .news-card-media {
    width: 100%;
    max-width: none;
    max-height: none;
    aspect-ratio: var(--img-ratio);
    margin: 0;
  }
}

/* Grid cards (editor picks etc.) full-bleed cover */
.news-card--grid .news-card-media {
  width: 100%;
  max-width: none;
  max-height: none;
  aspect-ratio: var(--img-ratio);
  margin: 0;
  background: transparent;
}
.news-card--grid .news-card-media img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  max-width: none;
  max-height: none;
}
@media (min-width: 768px) {
  .news-card--grid .news-card-media {
    width: 100%;
    max-width: none;
    max-height: none;
    aspect-ratio: var(--img-ratio);
    margin: 0;
  }
}

.badge-cat {
  display: inline-block; font-size: .7rem; font-weight: 700;
  text-transform: uppercase; letter-spacing: .04em;
  color: var(--chip, var(--primary));
  background: color-mix(in srgb, var(--chip, var(--primary)) 12%, transparent);
  padding: .2rem .55rem; border-radius: 6px;
}

.meta-row {
  display: flex; align-items: center; gap: .4rem; flex-wrap: wrap;
  font-size: .75rem; color: var(--text-secondary);
}
.ai-badge {
  font-size: .65rem; font-weight: 800; padding: .1rem .35rem;
  border-radius: 4px; background: color-mix(in srgb, var(--accent) 20%, transparent);
  color: var(--accent);
}

/* Popular */
.popular-list { display: flex; flex-direction: column; gap: .5rem; }
.popular-item {
  display: flex; gap: 1rem; align-items: flex-start;
  padding: .85rem 1rem; background: var(--bg-elevated);
  border-radius: var(--radius); border: 1px solid var(--border);
}
.popular-rank {
  font-size: 1.5rem; font-weight: 800; color: var(--primary);
  opacity: .4; min-width: 1.5rem; line-height: 1;
}
.popular-item h3 { font-size: .95rem; font-weight: 700; margin-bottom: .25rem; }

/* Topics */
.topic-grid {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: .75rem;
}
.topic-card {
  padding: 1rem; border-radius: var(--radius); background: var(--bg-elevated);
  border: 1px solid var(--border); display: flex; flex-direction: column; gap: .25rem;
  transition: transform .2s, border-color .2s;
}
.topic-card:active { transform: scale(0.97); }
.topic-dot {
  width: 10px; height: 10px; border-radius: 50%;
  background: var(--chip, var(--primary)); margin-bottom: .35rem;
  display: inline-block;
}
.topic-card strong { font-size: .9rem; }
.topic-card small { color: var(--text-secondary); font-size: .75rem; }

/* Article page */
.article-page { max-width: var(--max); margin: 0 auto; padding-top: 1rem; }
.article-header h1 {
  font-size: clamp(1.6rem, 5vw, 2.25rem); font-weight: 800;
  letter-spacing: -0.03em; line-height: 1.2; margin: .75rem 0 1rem;
}
.article-meta {
  display: flex; flex-wrap: wrap; gap: .5rem; align-items: center;
  font-size: .85rem; color: var(--text-secondary); margin-bottom: 1.25rem;
}
.author-chip {
  display: inline-flex; align-items: center; gap: .4rem; font-weight: 600; color: var(--text);
}
.avatar {
  width: 28px; height: 28px; border-radius: 50%;
  background: linear-gradient(135deg, var(--primary), var(--accent));
  color: #fff; display: grid; place-items: center; font-size: .75rem; font-weight: 700;
}

.article-hero {
  margin: 0 0 1.5rem;
  border-radius: var(--radius);
  overflow: hidden;
  background: transparent;
  display: block;
  width: 100%;
}
.article-hero img {
  width: 100%;
  height: auto;
  max-width: 100%;
  aspect-ratio: var(--img-ratio, 424 / 242);
  object-fit: cover;
  object-position: center;
  display: block;
  margin: 0;
  background: transparent;
}
.article-hero figcaption {
  font-size: .8rem; color: var(--text-secondary); padding: .5rem 1rem; text-align: center;
  width: 100%;
}

/* Generic feed list (legacy) */
.feed {
  display: flex;
  flex-direction: column;
  gap: .85rem;
}

.share-bar {
  position: sticky; top: calc(var(--header-h) - 20px); z-index: 50;
  display: flex; gap: .5rem; padding: .5rem 0; margin-bottom: 1rem;
  background: color-mix(in srgb, var(--bg) 90%, transparent);
  backdrop-filter: blur(8px);
}
.share-btn {
  width: 40px; height: 40px; border-radius: 12px;
  background: var(--bg-elevated); border: 1px solid var(--border);
  display: grid; place-items: center; font-size: 1rem;
  transition: transform .15s, background .15s;
}
.share-btn:active { transform: scale(0.92); background: var(--bg-muted); }

.toc {
  background: var(--bg-muted); border-radius: var(--radius);
  padding: 1rem 1.25rem; margin-bottom: 1.5rem;
}
.toc strong { display: block; margin-bottom: .5rem; font-size: .85rem; }
.toc ol { padding-left: 1.2rem; }
.toc li { margin: .35rem 0; font-size: .9rem; }
.toc a { color: var(--primary); }

.article-summary {
  background: color-mix(in srgb, var(--accent) 10%, var(--bg-elevated));
  border-left: 3px solid var(--accent); border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
  padding: 1rem 1.25rem; margin-bottom: 1.5rem;
}
.article-summary strong { display: block; margin-bottom: .5rem; }
.article-summary ul { padding-left: 1.2rem; }

.article-body {
  font-size: 1.0625rem; line-height: 1.75; color: var(--text);
}
.article-body p { margin-bottom: 1.15rem; }
.article-body h2 {
  font-size: 1.35rem; font-weight: 800; margin: 2rem 0 .75rem;
  letter-spacing: -0.02em;
}
.article-body h3 { font-size: 1.15rem; font-weight: 700; margin: 1.5rem 0 .5rem; }
.article-body ul, .article-body ol { margin: 0 0 1.15rem 1.25rem; }
.article-body li { margin-bottom: .4rem; }
.article-body blockquote {
  border-left: 3px solid var(--primary); padding: .5rem 1rem;
  margin: 1.25rem 0; color: var(--text-secondary); font-style: italic;
}
.article-body a { color: var(--primary); text-decoration: underline; text-underline-offset: 2px; }
.article-body img { border-radius: var(--radius-sm); margin: 1rem 0; }

.tag-cloud { display: flex; flex-wrap: wrap; gap: .5rem; margin: 2rem 0; }
.tag-pill {
  padding: .35rem .75rem; border-radius: 999px; font-size: .8rem; font-weight: 600;
  background: var(--bg-muted); color: var(--text-secondary);
}

.faq-section { margin: 2rem 0; }
.faq-section h2 { font-size: 1.25rem; margin-bottom: 1rem; }
.faq-item {
  background: var(--bg-elevated); border: 1px solid var(--border);
  border-radius: var(--radius-sm); margin-bottom: .5rem; padding: 0;
}
.faq-item summary {
  padding: 1rem; font-weight: 600; cursor: pointer; list-style: none;
}
.faq-item summary::-webkit-details-marker { display: none; }
.faq-answer { padding: 0 1rem 1rem; color: var(--text-secondary); font-size: .95rem; }

.comments-section { margin: 2.5rem 0; }
.comment-form { display: flex; flex-direction: column; gap: .75rem; }
.form-row { display: grid; gap: .75rem; grid-template-columns: 1fr 1fr; }
.comment-form input, .comment-form textarea {
  padding: .75rem 1rem; border-radius: var(--radius-sm);
  border: 1px solid var(--border); background: var(--bg-elevated);
  color: var(--text); font-family: inherit; font-size: .95rem;
}

/* Bottom nav */
.bottom-nav {
  position: fixed; bottom: 0; left: 0; right: 0; z-index: 100;
  height: calc(var(--nav-h) + var(--safe-b));
  padding-bottom: var(--safe-b);
  display: flex; align-items: center; justify-content: space-around;
  background: color-mix(in srgb, var(--bg-elevated) 90%, transparent);
  backdrop-filter: blur(20px) saturate(1.5);
  -webkit-backdrop-filter: blur(20px) saturate(1.5);
  border-top: 1px solid var(--border);
  box-shadow: 0 -4px 24px rgba(0,0,0,.06);
}
.nav-item {
  flex: 1; display: flex; flex-direction: column; align-items: center;
  gap: .15rem; padding: .4rem; font-size: .65rem; font-weight: 600;
  color: var(--text-secondary); transition: color .2s;
}
.nav-item svg { opacity: .7; }
.nav-item.active, .nav-item:active { color: var(--primary); }
.nav-item.active svg { opacity: 1; stroke-width: 2.5; }
.nav-fab {
  width: 52px; height: 52px; border-radius: 16px; flex: 0 0 auto;
  background: linear-gradient(135deg, var(--primary), var(--accent));
  color: #fff !important; box-shadow: 0 6px 20px color-mix(in srgb, var(--primary) 45%, transparent);
  margin-top: -18px;
}
.nav-fab svg { opacity: 1; stroke: #fff; }

/* Footer */
.app-footer {
  margin-top: 3rem; padding: 2rem 1rem 1rem;
  border-top: 1px solid var(--border); text-align: center;
}
.footer-brand { font-weight: 800; font-size: 1.1rem; }
.footer-tag { color: var(--text-secondary); font-size: .85rem; margin: .25rem 0 1rem; }
.footer-links { display: flex; flex-wrap: wrap; justify-content: center; gap: 1rem; margin-bottom: 1rem; }
.footer-links a { font-size: .85rem; color: var(--text-secondary); font-weight: 500; }
.footer-copy { font-size: .75rem; color: var(--text-secondary); }

/* Page header */
.page-header { padding: 1.5rem 0 1rem; }
.static-page .page-content { max-width: 720px; }
.static-page .page-content h2 { margin: 1.5rem 0 .75rem; font-size: 1.25rem; }
.static-page .page-content h3 { margin: 1.25rem 0 .5rem; font-size: 1.1rem; }
.static-page .page-content p { margin-bottom: 1rem; }
.static-page .page-content ul, .static-page .page-content ol { margin: 0 0 1rem 1.25rem; }
.static-page .page-content table { width: 100%; border-collapse: collapse; margin-bottom: 1rem; }
.static-page .page-content th, .static-page .page-content td { border: 1px solid var(--border); padding: .5rem .65rem; }
.static-page .page-content img { max-width: 100%; height: auto; border-radius: var(--radius-sm); margin: 1rem 0; }
.static-page .page-content blockquote {
  border-left: 3px solid var(--primary); padding: .5rem 1rem; margin: 1rem 0;
  color: var(--text-secondary);
}
.page-header h1 { font-size: 1.75rem; font-weight: 800; letter-spacing: -0.02em; margin: .5rem 0; }
.page-desc { color: var(--text-secondary); }

/* Empty */
.empty-state {
  text-align: center; padding: 3rem 1.5rem;
  background: var(--bg-elevated); border-radius: var(--radius);
  border: 1px dashed var(--border);
}
.empty-icon { font-size: 2.5rem; margin-bottom: .75rem; opacity: .6; }
.empty-state h3 { margin-bottom: .5rem; }
.empty-state p { color: var(--text-secondary); margin-bottom: 1.25rem; max-width: 360px; margin-inline: auto; }

/* Buttons */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: .4rem;
  padding: .7rem 1.25rem; border-radius: 12px; font-weight: 600; font-size: .9rem;
  background: var(--bg-muted); color: var(--text); transition: transform .15s, opacity .15s;
  border: none; cursor: pointer;
}
.btn:active { transform: scale(0.97); }
.btn-primary {
  background: linear-gradient(135deg, var(--primary), color-mix(in srgb, var(--primary) 70%, var(--accent)));
  color: #fff; box-shadow: 0 4px 14px color-mix(in srgb, var(--primary) 35%, transparent);
}
.btn-ghost { background: transparent; border: 1px solid var(--border); }

.pagination {
  display: flex; align-items: center; justify-content: center; gap: .75rem;
  margin: 2rem 0 1rem; font-size: .9rem; color: var(--text-secondary);
  flex-wrap: wrap;
}
.pagination-home { gap: .5rem 1rem; }
.pagination-pages {
  display: flex; align-items: center; gap: .35rem; flex-wrap: wrap; justify-content: center;
}
.pagination-num {
  min-width: 36px; height: 36px; display: grid; place-items: center;
  border-radius: 10px; border: 1px solid var(--border);
  background: var(--bg-elevated, var(--card, #fff));
  color: var(--text-secondary); font-weight: 600; font-size: .875rem;
  text-decoration: none !important; padding: 0 .45rem;
  transition: border-color .15s, color .15s, background .15s;
}
.pagination-num:hover {
  border-color: var(--primary); color: var(--primary);
}
.pagination-num.is-active {
  background: var(--primary); border-color: transparent; color: #fff;
}
.pagination-ellipsis { color: var(--text-secondary); padding: 0 .25rem; opacity: .7; }
.pagination .btn.is-disabled,
.pagination .is-disabled {
  opacity: .4; pointer-events: none; cursor: default;
}
.section-head .muted { font-weight: 500; }

/* Skeleton loading */
.skeleton {
  background: linear-gradient(90deg, var(--bg-muted) 25%, var(--bg-elevated) 50%, var(--bg-muted) 75%);
  background-size: 200% 100%; animation: shimmer 1.2s infinite; border-radius: 8px;
}
@keyframes shimmer { to { background-position: -200% 0; } }

/* Desktop tweaks */
@media (min-width: 900px) {
  .bottom-nav { display: none; }
  body { padding-bottom: 2rem; }
  .app-main { padding: 0 1.5rem 2rem; }
}

/* Ensure card/hero media fill (override global img { height: auto }) */
.news-card-media img,
.hero-media img,
.side-card img {
  height: 100%;
}

/* Print */
@media print {
  .app-header, .bottom-nav, .share-bar, .app-footer { display: none !important; }
  body { padding: 0; background: #fff; color: #000; }
}
