/*
 * Panda Crypto News — Public Frontend Design System (Phase 2)
 * Premium dark editorial theme. No framework dependency (Bootstrap removed
 * from public pages — admin panel keeps its own assets/css/admin.css untouched).
 * Fonts (Inter/Poppins) are loaded via the Google Fonts <link> already present
 * in includes/header.php — no new font/library requests added here.
 */

/* ============================== 1. TOKENS ============================== */
:root {
  /* Surfaces */
  --bg: #0a0b0d;
  --surface: #121317;
  --surface-2: #191b21;
  --surface-hover: #202229;

  /* Text */
  --text: #f3f4f6;
  --text-muted: #9aa0ae;
  --text-faint: #6b7180;

  /* Structure */
  --border: #26282f;
  --border-strong: #34363f;

  /* Brand + market semantics */
  --accent: #e7b93e;
  --accent-hover: #f2c655;
  --accent-ink: #17130a; /* text color when sitting on --accent */
  --positive: #2fbf71;
  --negative: #f0554c;

  /* Elevation */
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.35);
  --shadow-md: 0 8px 24px rgba(0, 0, 0, 0.45);

  /* Radii */
  --radius-sm: 6px;
  --radius: 10px;
  --radius-lg: 16px;
  --radius-pill: 999px;

  /* Type */
  --font-body: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  --font-display: 'Poppins', 'Inter', sans-serif;

  /* Layout */
  --container-width: 1240px;
  --article-width: 720px;
  --header-h: 68px;
}

/* ============================== 2. RESET ============================== */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-body);
  font-size: 16px;
  line-height: 1.55;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  overflow-x: hidden;
}
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { animation-duration: 0.01ms !important; animation-iteration-count: 1 !important; transition-duration: 0.01ms !important; }
}
img { max-width: 100%; display: block; }
a { color: inherit; text-decoration: none; }
button { font-family: inherit; cursor: pointer; }
ul, ol { list-style: none; margin: 0; padding: 0; }
h1, h2, h3, h4, h5, h6 {
  font-family: var(--font-display);
  font-weight: 600;
  color: var(--text);
  margin: 0;
  line-height: 1.25;
}
p { margin: 0 0 1em; }
input, textarea, select {
  font-family: inherit;
  font-size: 1rem;
  color: var(--text);
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
}

/* Accessible focus ring everywhere, mouse users don't see it thanks to
   :focus-visible (keyboard nav explicitly required by spec). */
a:focus-visible, button:focus-visible, input:focus-visible, textarea:focus-visible,
[tabindex]:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
  border-radius: var(--radius-sm);
}

.skip-link {
  position: absolute;
  left: -9999px;
  top: 0;
  background: var(--accent);
  color: var(--accent-ink);
  padding: 0.75rem 1.25rem;
  z-index: 200;
  font-weight: 600;
  border-radius: 0 0 var(--radius-sm) 0;
}
.skip-link:focus {
  left: 0;
}

.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;
}

/* ============================== 3. LAYOUT ============================== */
.container {
  width: 100%;
  max-width: var(--container-width);
  margin: 0 auto;
  padding: 0 20px;
}
main { flex: 1 0 auto; min-width: 0; }

.grid { display: grid; gap: 24px; }
.layout-main-side { grid-template-columns: minmax(0, 1fr) 340px; align-items: start; }
@media (max-width: 1023.98px) {
  .layout-main-side { grid-template-columns: 1fr; }
}

/* Sticky reading sidebar on article pages (stops at the end of its own row,
   never overflows past the article/related content it sits next to). */
.sticky-sidebar { position: sticky; top: calc(var(--header-h) + 16px); align-self: start; }
@media (max-width: 1023.98px) {
  .sticky-sidebar { position: static; }
}

.news-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 24px; }
@media (max-width: 1023.98px) { .news-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 599.98px) { .news-grid { grid-template-columns: 1fr; } }

.section {
  padding: 40px 0;
  border-top: 1px solid var(--border);
}
.section:first-child { border-top: none; }
.section-heading {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 20px;
}
.section-heading__title {
  font-size: 1.35rem;
  display: flex;
  align-items: center;
  gap: 10px;
}
.section-heading__title .icon { color: var(--accent); }
.section-heading__link {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text-muted);
  display: inline-flex;
  align-items: center;
  gap: 4px;
  white-space: nowrap;
}
.section-heading__link:hover { color: var(--accent); }
.section-eyebrow {
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--accent);
  margin-bottom: 6px;
  display: block;
}

/* ============================== 4. SKIP / A11Y HELPERS ============================== */
.icon { width: 1em; height: 1em; display: inline-block; vertical-align: -0.15em; flex-shrink: 0; }

/* ============================== 5. TOPBAR (price ticker) ============================== */
.topbar {
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  overflow: hidden;
  flex-shrink: 0;
}
.ticker-wrap { overflow: hidden; width: 100%; }
.ticker-track {
  display: inline-flex;
  align-items: center;
  white-space: nowrap;
  animation: ticker-scroll 45s linear infinite;
  will-change: transform;
}
.ticker-wrap:hover .ticker-track { animation-play-state: paused; }
.ticker-item {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  padding: 0.5rem 1.35rem;
  border-right: 1px solid var(--border);
  font-size: 0.8rem;
}
.ticker-symbol { font-weight: 700; color: var(--text); }
.ticker-price { color: var(--text-muted); font-variant-numeric: tabular-nums; }
.ticker-change { font-variant-numeric: tabular-nums; font-weight: 600; }
.ticker-change.up { color: var(--positive); }
.ticker-change.down { color: var(--negative); }
.ticker-fallback { padding: 0.5rem 0; color: var(--text-faint); font-size: 0.8rem; text-align: center; }
@keyframes ticker-scroll { 0% { transform: translateX(0); } 100% { transform: translateX(-50%); } }

/* ============================== 6. HEADER ============================== */
.site-header {
  background: rgba(10, 11, 13, 0.92);
  backdrop-filter: saturate(140%) blur(8px);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 100;
}
.header-bar {
  display: flex;
  align-items: center;
  gap: 24px;
  height: var(--header-h);
}
.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-shrink: 0;
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 1.15rem;
  letter-spacing: -0.01em;
  color: var(--text);
}
.brand img { height: 30px; width: auto; }
.brand-mark {
  width: 32px; height: 32px;
  display: inline-flex; align-items: center; justify-content: center;
  background: var(--accent);
  color: var(--accent-ink);
  border-radius: var(--radius-sm);
  flex-shrink: 0;
}
.brand-mark .icon { width: 18px; height: 18px; }
.brand-name .brand-accent { color: var(--accent); }

.primary-nav { flex: 1 1 auto; min-width: 0; }
.primary-nav__list {
  display: flex;
  align-items: center;
  gap: 4px;
  overflow-x: auto;
  scrollbar-width: none;
}
.primary-nav__list::-webkit-scrollbar { display: none; }
.primary-nav__link {
  display: block;
  padding: 8px 12px;
  font-size: 0.88rem;
  font-weight: 500;
  color: var(--text-muted);
  border-radius: var(--radius-sm);
  white-space: nowrap;
  position: relative;
}
.primary-nav__link:hover { color: var(--text); background: var(--surface-2); }
.primary-nav__link.is-active { color: var(--text); font-weight: 600; }
.primary-nav__link.is-active::after {
  content: "";
  position: absolute;
  left: 12px; right: 12px; bottom: 2px;
  height: 2px;
  background: var(--accent);
  border-radius: 2px;
}

.nav-more { position: relative; }
.nav-more__list {
  display: none;
  position: absolute;
  top: calc(100% + 6px);
  left: 0;
  min-width: 190px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-md);
  padding: 6px;
  z-index: 50;
}
.nav-more:hover .nav-more__list,
.nav-more:focus-within .nav-more__list,
.nav-more.is-open .nav-more__list { display: block; }
.nav-more__list .primary-nav__link { display: block; width: 100%; }

.header-actions { display: flex; align-items: center; gap: 8px; flex-shrink: 0; }
.icon-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 38px;
  height: 38px;
  border-radius: 50%;
  background: transparent;
  color: var(--text-muted);
  border: none;
}
.icon-btn:hover { background: var(--surface-2); color: var(--text); }
.icon-btn .icon { width: 19px; height: 19px; }

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 9px 18px;
  border-radius: var(--radius-pill);
  font-size: 0.88rem;
  font-weight: 600;
  border: 1px solid transparent;
  white-space: nowrap;
}
.btn-sm { padding: 7px 14px; font-size: 0.82rem; }
.btn-accent { background: var(--accent); color: var(--accent-ink); }
.btn-accent:hover { background: var(--accent-hover); }
.btn-outline { background: transparent; border-color: var(--border-strong); color: var(--text); }
.btn-outline:hover { border-color: var(--accent); color: var(--accent); }
.btn-ghost { background: transparent; color: var(--text-muted); }
.btn-ghost:hover { color: var(--text); }
.btn-block { width: 100%; }
.btn[disabled] { opacity: 0.5; cursor: not-allowed; }

.menu-toggle {
  display: none;
  width: 38px; height: 38px;
  border-radius: var(--radius-sm);
  background: transparent;
  border: none;
  color: var(--text);
  align-items: center;
  justify-content: center;
}
.menu-toggle .icon { width: 22px; height: 22px; }

@media (max-width: 1023.98px) {
  .primary-nav { display: none; }
  .menu-toggle { display: inline-flex; }
}

/* Mobile slide-down menu */
.mobile-nav {
  display: none;
  border-top: 1px solid var(--border);
  background: var(--bg);
}
.mobile-nav.is-open { display: block; }
.mobile-nav__list { padding: 8px 0; }
.mobile-nav__link {
  display: block;
  padding: 12px 20px;
  font-size: 0.98rem;
  font-weight: 500;
  color: var(--text);
  border-bottom: 1px solid var(--border);
}
.mobile-nav__link.is-active { color: var(--accent); font-weight: 700; }
.mobile-nav__actions { padding: 16px 20px; display: flex; gap: 10px; }

/* ============================== 7. BREAKING BAR ============================== */
.breaking-bar {
  background: var(--surface);
  border-bottom: 1px solid var(--border);
}
.breaking-bar__inner {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 10px 0;
}
.breaking-bar__label {
  flex-shrink: 0;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 0.7rem;
  font-weight: 800;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--accent-ink);
  background: var(--accent);
  padding: 4px 10px;
  border-radius: var(--radius-sm);
}
.breaking-bar__dot {
  width: 6px; height: 6px; border-radius: 50%;
  background: var(--accent-ink);
  animation: pulse-dot 1.8s ease-in-out infinite;
}
@keyframes pulse-dot { 0%, 100% { opacity: 1; } 50% { opacity: 0.25; } }
.breaking-bar__track-wrap { overflow: hidden; flex: 1 1 auto; min-width: 0; }
.breaking-bar__list {
  display: flex;
  gap: 32px;
  white-space: nowrap;
}
.breaking-bar__item {
  font-size: 0.85rem;
  color: var(--text-muted);
  font-weight: 500;
}
.breaking-bar__item:hover { color: var(--text); }

/* ============================== 8. PILLS / META ============================== */
.pill {
  display: inline-flex;
  align-items: center;
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  padding: 4px 10px;
  border-radius: var(--radius-pill);
  background: var(--accent);
  color: var(--accent-ink);
}
.pill-muted { background: var(--surface-2); color: var(--text-muted); }
.pill-outline { background: transparent; border: 1px solid var(--border-strong); color: var(--text-muted); }

.meta-row {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 6px 12px;
  font-size: 0.78rem;
  color: var(--text-faint);
}
.meta-row .icon { width: 14px; height: 14px; }
.meta-item { display: inline-flex; align-items: center; gap: 4px; }

/* ============================== 9. MEDIA / FALLBACK ============================== */
.media {
  position: relative;
  aspect-ratio: 16 / 9;
  overflow: hidden;
  border-radius: var(--radius);
  background: var(--surface-2);
}
.media img {
  position: absolute;
  inset: 0;
  width: 100%; height: 100%;
  object-fit: cover;
  transition: transform 0.4s ease;
}
.media-fallback {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%; height: 100%;
  background: linear-gradient(135deg, var(--surface-2), var(--surface));
  color: var(--border-strong);
}
.media-fallback .icon { width: 30%; height: 30%; max-width: 56px; max-height: 56px; }

/* ============================== 10. CARDS ============================== */
.card {
  display: flex;
  flex-direction: column;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  overflow: hidden;
  height: 100%;
}
.card:hover { border-color: var(--border-strong); }
.card:hover .media img { transform: scale(1.04); }
.card__body { padding: 16px; display: flex; flex-direction: column; gap: 8px; flex: 1 1 auto; }
.card__title {
  font-size: 1.02rem;
  line-height: 1.35;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.card__excerpt {
  font-size: 0.86rem;
  color: var(--text-muted);
  line-height: 1.5;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  margin: 0;
}
.card__meta { margin-top: auto; }

/* Hero card (homepage lead story) */
.card--hero { border: none; border-radius: var(--radius-lg); position: relative; min-height: 420px; }
.card--hero .media { position: absolute; inset: 0; aspect-ratio: auto; border-radius: var(--radius-lg); }
.card--hero__scrim {
  position: absolute; inset: 0;
  background: linear-gradient(0deg, rgba(6,7,9,0.94) 0%, rgba(6,7,9,0.55) 45%, rgba(6,7,9,0.08) 100%);
  border-radius: var(--radius-lg);
}
.card--hero__content { position: relative; z-index: 2; padding: 28px; margin-top: auto; }
.card--hero__title {
  font-size: clamp(1.5rem, 2.6vw, 2.15rem);
  color: #fff;
  margin: 10px 0 12px;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.card--hero__excerpt { color: #d7d9e0; font-size: 0.95rem; max-width: 640px; margin-bottom: 10px; }
.card--hero .meta-row { color: #c7c9d3; }
@media (max-width: 767.98px) { .card--hero { min-height: 320px; } .card--hero__content { padding: 20px; } }

/* Large card (secondary hero stories) */
.card--large .card__title { font-size: 1.1rem; -webkit-line-clamp: 2; }

/* Horizontal card (list-style, featured list / related) */
.card--horizontal { flex-direction: row; height: auto; }
.card--horizontal .media { width: 152px; aspect-ratio: 1 / 1; border-radius: 0; flex-shrink: 0; }
.card--horizontal .card__body { padding: 12px 16px; justify-content: center; }
.card--horizontal .card__title { font-size: 0.95rem; -webkit-line-clamp: 3; }
@media (max-width: 479.98px) {
  .card--horizontal .media { width: 96px; }
  .card--horizontal .card__body { padding: 10px 12px; }
}

/* Compact card (mini list item — sidebar / trending) */
.card--compact { flex-direction: row; background: transparent; border: none; border-radius: 0; border-bottom: 1px solid var(--border); padding: 14px 0; }
.card--compact:last-child { border-bottom: none; }
.card--compact .media { width: 76px; aspect-ratio: 1 / 1; flex-shrink: 0; }
.card--compact .card__body { padding: 0 0 0 14px; gap: 4px; justify-content: center; }
.card--compact .card__title { font-size: 0.88rem; -webkit-line-clamp: 2; }

/* Sidebar card (dark panel item, e.g. Most Read) */
.card--sidebar { flex-direction: row; background: transparent; border: none; border-radius: 0; padding: 12px 0; border-bottom: 1px solid var(--border-strong); align-items: flex-start; gap: 12px; }
.card--sidebar:last-child { border-bottom: none; }
.card--sidebar__rank {
  font-family: var(--font-display);
  font-size: 1.4rem;
  font-weight: 700;
  color: var(--border-strong);
  width: 28px;
  flex-shrink: 0;
  line-height: 1.2;
}
.card--sidebar .card__title { font-size: 0.9rem; -webkit-line-clamp: 3; }

/* Standard card = base `.card` used directly in .news-grid */

/* ============================== 11. HOME LAYOUT SPECIFICS ============================== */
.hero-grid { display: grid; grid-template-columns: minmax(0, 1.6fr) minmax(0, 1fr); gap: 24px; margin-bottom: 8px; }
.hero-secondary { display: flex; flex-direction: column; gap: 16px; }
@media (max-width: 1023.98px) { .hero-grid { grid-template-columns: 1fr; } }

.spotlight-panel {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 20px;
}
.spotlight-panel .section-heading { margin-bottom: 8px; }

.newsletter-cta {
  background: linear-gradient(135deg, var(--surface), var(--surface-2));
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 40px;
  text-align: center;
}
.newsletter-cta h2 { font-size: 1.5rem; margin-bottom: 8px; }
.newsletter-cta p { color: var(--text-muted); max-width: 520px; margin: 0 auto 20px; }
.newsletter-cta form { display: flex; gap: 10px; max-width: 420px; margin: 0 auto; }
.newsletter-cta input { flex: 1 1 auto; padding: 11px 16px; }
@media (max-width: 479.98px) { .newsletter-cta form { flex-direction: column; } }

.empty-state { color: var(--text-faint); padding: 32px 0; text-align: center; }

/* ============================== 12. AD SLOTS ============================== */
.cn-panel {
  border: 1px dashed var(--border-strong);
  border-radius: var(--radius);
  background: var(--surface);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
  color: var(--text-faint);
  text-align: center;
  width: 100%;
}
.cn-panel-filled { border: none; background: transparent; display: block; }
.cn-panel-media { max-width: 100%; height: auto; border-radius: var(--radius-sm); }
.cn-panel-label { font-weight: 700; font-size: 0.7rem; text-transform: uppercase; letter-spacing: 0.05em; color: var(--text-muted); }
.cn-panel-meta { font-size: 0.68rem; }
.cn-panel-top { min-height: 90px; margin: 20px 0; }
.cn-panel-bottom { min-height: 90px; margin: 32px 0; }
.cn-panel-square { min-height: 250px; margin-bottom: 24px; }

/* ============================== 13. ARTICLE PAGE ============================== */
.breadcrumb { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; font-size: 0.8rem; color: var(--text-faint); margin-bottom: 20px; }
.breadcrumb a:hover { color: var(--accent); }
.breadcrumb__sep { color: var(--border-strong); }
.breadcrumb__current { color: var(--text-muted); }

.article-header { max-width: var(--article-width); margin: 0 auto 24px; }
.article-header__cats { display: flex; gap: 8px; margin-bottom: 14px; flex-wrap: wrap; }
.article-title { font-size: clamp(1.6rem, 4vw, 2.4rem); line-height: 1.2; margin-bottom: 14px; }
.article-excerpt { font-size: 1.1rem; color: var(--text-muted); line-height: 1.55; margin-bottom: 16px; }

.article-hero-media { max-width: var(--article-width); margin: 0 auto 28px; aspect-ratio: 16/9; }

.article-body { max-width: var(--article-width); margin: 0 auto; }

.article-content { font-size: 1.08rem; line-height: 1.8; color: var(--text); }
.article-content h1, .article-content h2, .article-content h3,
.article-content h4, .article-content h5, .article-content h6 {
  font-family: var(--font-display);
  font-weight: 600;
  margin: 1.9rem 0 0.8rem;
}
.article-content p { margin-bottom: 1.2rem; }
.article-content img { max-width: 100%; height: auto; border-radius: var(--radius); margin: 1.2rem 0; }
.article-content a { color: var(--accent); text-decoration: underline; text-decoration-color: rgba(231, 185, 62, 0.4); text-underline-offset: 2px; }
.article-content a:hover { text-decoration-color: var(--accent); }
.article-content blockquote {
  border-left: 3px solid var(--accent);
  background: var(--surface);
  padding: 0.9rem 1.4rem;
  margin: 1.5rem 0;
  border-radius: 0 var(--radius) var(--radius) 0;
  font-style: italic;
  color: var(--text-muted);
}
.article-content ul, .article-content ol { margin: 0 0 1.2rem; padding-left: 1.4rem; }
.article-content li { margin-bottom: 0.4rem; }
.article-content table { width: 100%; border-collapse: collapse; margin-bottom: 1.4rem; display: block; overflow-x: auto; }
.article-content th, .article-content td { border: 1px solid var(--border); padding: 0.6rem 0.85rem; text-align: left; }
.article-content pre, .article-content code { background: var(--surface); border-radius: var(--radius-sm); }
.article-content pre { padding: 1rem; overflow-x: auto; }
.article-content code { padding: 0.15rem 0.4rem; font-size: 0.9em; }
.article-content iframe { max-width: 100%; border-radius: var(--radius); aspect-ratio: 16/9; width: 100%; height: auto; }
.article-content hr { border: none; border-top: 1px solid var(--border); margin: 2rem 0; }

.article-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 12px;
  margin: 32px 0;
  padding: 20px 0;
  border-top: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
}
.share-row { display: flex; align-items: center; gap: 8px; margin-left: auto; }
.share-row__label { font-size: 0.78rem; color: var(--text-faint); margin-right: 4px; }

.tag-row { display: flex; flex-wrap: wrap; gap: 8px; margin: 24px 0; }

.comments-section { max-width: var(--article-width); margin: 0 auto; }
.comment-form textarea { width: 100%; padding: 12px 14px; min-height: 96px; resize: vertical; margin-bottom: 10px; }
.comment-item { display: flex; gap: 12px; padding: 16px 0; border-bottom: 1px solid var(--border); }
.comment-item:last-child { border-bottom: none; }
.comment-item img { width: 40px; height: 40px; border-radius: 50%; object-fit: cover; flex-shrink: 0; }
.comment-item__head { display: flex; justify-content: space-between; gap: 10px; font-size: 0.88rem; margin-bottom: 4px; }
.comment-item__name { font-weight: 600; }
.comment-item__time { color: var(--text-faint); font-size: 0.78rem; }
.comment-item__body { color: var(--text-muted); font-size: 0.92rem; line-height: 1.5; }

/* ============================== 14. CATEGORY / LATEST PAGE ============================== */
.page-header { margin-bottom: 28px; }
.page-header__title { font-size: clamp(1.6rem, 3.6vw, 2.1rem); margin-bottom: 8px; }
.page-header__desc { color: var(--text-muted); max-width: 640px; }
.page-header__count { color: var(--text-faint); font-size: 0.85rem; }

.category-filter-row { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 28px; }
.category-filter {
  padding: 8px 16px;
  border-radius: var(--radius-pill);
  font-size: 0.84rem;
  font-weight: 600;
  border: 1px solid var(--border-strong);
  color: var(--text-muted);
}
.category-filter:hover { border-color: var(--accent); color: var(--text); }
.category-filter.is-active { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }

.pagination { display: flex; justify-content: center; align-items: center; gap: 16px; margin-top: 40px; }
.pager-arrow {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 40px; height: 40px;
  border-radius: 50%;
  border: 1px solid var(--border-strong);
  color: var(--text);
}
.pager-arrow:hover { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.pager-arrow.is-disabled { opacity: 0.3; pointer-events: none; }
.pagination__status { font-size: 0.82rem; color: var(--text-faint); }

/* ============================== 15. SEARCH ============================== */
.search-overlay {
  position: fixed;
  inset: 0;
  z-index: 200;
  background: rgba(6, 7, 9, 0.85);
  backdrop-filter: blur(4px);
  display: none;
  align-items: flex-start;
  justify-content: center;
  padding: 12vh 20px 0;
}
.search-overlay.is-open { display: flex; }
.search-overlay__box { width: 100%; max-width: 640px; }
.search-overlay__form { display: flex; align-items: center; gap: 10px; background: var(--surface); border: 1px solid var(--border-strong); border-radius: var(--radius); padding: 6px 6px 6px 18px; }
.search-overlay__form input { flex: 1 1 auto; border: none; background: transparent; font-size: 1.1rem; padding: 10px 0; }
.search-overlay__form input:focus-visible { outline: none; }
.search-overlay__close { margin-top: 16px; text-align: center; }
.search-overlay__hint { color: var(--text-faint); font-size: 0.8rem; margin-top: 12px; text-align: center; }

.search-results-list { display: flex; flex-direction: column; gap: 16px; }

/* ============================== 16. AUTH / PROFILE ============================== */
.auth-shell { max-width: 440px; margin: 40px auto; }
.auth-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 32px;
}
.auth-card h1 { font-size: 1.5rem; margin-bottom: 24px; }
.form-group { margin-bottom: 16px; }
.form-label { display: block; font-size: 0.85rem; font-weight: 600; color: var(--text-muted); margin-bottom: 6px; }
.form-input { width: 100%; padding: 11px 14px; }
.form-hint { font-size: 0.78rem; color: var(--text-faint); margin-top: 6px; }
.form-divider { display: flex; align-items: center; gap: 12px; margin: 20px 0; color: var(--text-faint); font-size: 0.8rem; }
.form-divider::before, .form-divider::after { content: ""; flex: 1; height: 1px; background: var(--border); }
.alert { padding: 12px 16px; border-radius: var(--radius-sm); font-size: 0.88rem; margin-bottom: 14px; }
.alert-error { background: rgba(240, 85, 76, 0.12); color: #ff8a83; border: 1px solid rgba(240, 85, 76, 0.3); }
.alert-success { background: rgba(47, 191, 113, 0.12); color: #6fe3a2; border: 1px solid rgba(47, 191, 113, 0.3); }
.alert-warning { background: rgba(231, 185, 62, 0.1); color: var(--accent-hover); border: 1px solid rgba(231, 185, 62, 0.3); }

.wide-article-content .article-content { max-width: none; }

/* Long-form legal pages reuse .auth-card + .article-content */
.legal-shell { max-width: 760px; margin: 0 auto; }
.legal-shell .auth-card { padding: 40px; }
.legal-updated { color: var(--text-faint); font-size: 0.85rem; margin-bottom: 24px; }

/* Profile */
.profile-hero {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  gap: 12px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 28px 20px;
}
.profile-hero img { width: 96px; height: 96px; border-radius: 50%; object-fit: cover; border: 3px solid var(--surface-2); }
.profile-hero__bio { color: var(--text-muted); font-size: 0.9rem; max-width: 320px; }
.profile-stats { display: flex; gap: 28px; }
.profile-stats strong { display: block; font-size: 1.2rem; font-family: var(--font-display); }
.profile-stats span { font-size: 0.75rem; color: var(--text-faint); text-transform: uppercase; letter-spacing: 0.04em; }

/* File input (avatar upload) */
input[type="file"] { padding: 8px; font-size: 0.85rem; color: var(--text-muted); }

/* ============================== 17. 404 ============================== */
.error-page { text-align: center; padding: 100px 20px; }
.error-page__code { font-family: var(--font-display); font-size: 5rem; font-weight: 700; color: var(--accent); line-height: 1; }
.error-page__title { margin: 12px 0 8px; }
.error-page__desc { color: var(--text-muted); margin-bottom: 28px; }

/* ============================== 18. FOOTER ============================== */
.site-footer { background: var(--surface); border-top: 1px solid var(--border); color: var(--text-muted); margin-top: 48px; flex-shrink: 0; }
.footer-top { padding: 56px 0 32px; display: grid; grid-template-columns: 1.6fr 1fr 1fr; gap: 40px; }
@media (max-width: 767.98px) { .footer-top { grid-template-columns: 1fr; gap: 28px; padding: 40px 0 24px; } }
.footer-brand .brand { margin-bottom: 12px; }
.footer-desc { font-size: 0.88rem; line-height: 1.6; max-width: 320px; }
.footer-heading { font-size: 0.78rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.05em; color: var(--text); margin-bottom: 16px; }
.footer-links { display: flex; flex-direction: column; gap: 10px; font-size: 0.88rem; }
.footer-links a:hover { color: var(--accent); }
.footer-bottom {
  border-top: 1px solid var(--border);
  padding: 20px 0;
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 10px;
  font-size: 0.8rem;
  color: var(--text-faint);
}

/* ============================== 19. COOKIE BANNER ============================== */
.cookie-banner {
  position: fixed;
  left: 16px; right: 16px; bottom: 16px;
  z-index: 150;
  background: var(--surface);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius);
  box-shadow: var(--shadow-md);
  max-width: 640px;
  margin: 0 auto;
}
.cookie-banner.is-hidden { display: none; }
.cookie-banner__inner { display: flex; flex-wrap: wrap; align-items: center; gap: 14px; padding: 16px 20px; }
.cookie-banner__text { flex: 1 1 260px; font-size: 0.85rem; color: var(--text-muted); }
.cookie-banner__text a { color: var(--accent); text-decoration: underline; }

/* ============================== 20. RESPONSIVE FINE-TUNING ============================== */
@media (max-width: 429.98px) {
  .container { padding: 0 16px; }
  .card--hero__title { font-size: 1.35rem; }
}

/* ============================== 21. V3 — PRIORITY BADGE SYSTEM ============================== */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 0.62rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  padding: 3px 8px;
  border-radius: var(--radius-sm);
  flex-shrink: 0;
}
.badge--breaking {
  background: #dc2626;
  color: #fff;
}
.badge--important {
  background: #d97706;
  color: #fff;
}
.badge__dot {
  width: 5px; height: 5px;
  border-radius: 50%;
  background: rgba(255,255,255,0.75);
  animation: pulse-dot 1.6s ease-in-out infinite;
  flex-shrink: 0;
}

/* Cards with priority — subtle top accent border */
.card.has-priority-breaking { border-top: 3px solid #dc2626; }
.card.has-priority-important { border-top: 3px solid #d97706; }

/* Hero card breaking overlay pill (replaces inline badge via CSS) */
.card--hero.has-priority-breaking .article-header__cats::before {
  content: '● BREAKING';
  display: inline-flex;
  align-items: center;
  font-size: 0.62rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  background: #dc2626;
  color: #fff;
  padding: 3px 9px;
  border-radius: var(--radius-sm);
  order: -1;
}
.card--hero.has-priority-important .article-header__cats::before {
  content: '● IMPORTANT';
  display: inline-flex;
  align-items: center;
  font-size: 0.62rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  background: #d97706;
  color: #fff;
  padding: 3px 9px;
  border-radius: var(--radius-sm);
  order: -1;
}

/* ============================== 22. V3 — BREAKING BAR ACTIVE STATE ============================== */
/* When the bar actually shows breaking-priority articles it gets a red accent */
.breaking-bar--active {
  background: linear-gradient(90deg, rgba(220,38,38,0.1) 0%, var(--surface) 40%);
  border-bottom-color: rgba(220,38,38,0.25);
}
.breaking-bar--active .breaking-bar__label {
  background: #dc2626;
}
.breaking-bar--active .breaking-bar__dot {
  background: rgba(255,255,255,0.8);
}

/* ============================== 23. V3 — AUTHOR BOX ============================== */
.author-box {
  margin: 32px 0;
  padding: 20px 24px;
  background: var(--surface);
  border-radius: var(--radius);
  border: 1px solid var(--border);
}
.author-box__inner {
  display: flex;
  align-items: flex-start;
  gap: 14px;
}
.author-box__label {
  font-size: 0.72rem;
  color: var(--text-faint);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  margin-bottom: 4px;
  display: block;
}
.author-box__name {
  font-weight: 600;
  font-size: 1rem;
  color: var(--text);
}
.author-box__name:hover { color: var(--accent); }
.author-box__role {
  color: var(--text-muted);
  font-size: 0.875rem;
}
.author-box__bio {
  margin: 6px 0 0;
  font-size: 0.875rem;
  color: var(--text-muted);
  line-height: 1.55;
}
@media (max-width: 479.98px) {
  .author-box { padding: 16px; }
}

/* ============================== 24. V3 — CARD LARGE ENHANCEMENTS ============================== */
.card--large .card__body { padding: 20px 24px; }
.card--large .card__title { font-size: 1.25rem; -webkit-line-clamp: 3; }

/* ============================== 25. V3 — NAVIGATION CARET ============================== */
.nav-more__caret { display: inline-block; transition: transform 0.2s ease; }
.nav-more.is-open .nav-more__caret { transform: rotate(90deg); }

/* ============================== 26. V3 — ARTICLE PAGE IMPROVEMENTS ============================== */
/* Reading progress bar */
.reading-progress {
  position: fixed;
  top: 0; left: 0;
  width: 0;
  height: 3px;
  background: var(--accent);
  z-index: 300;
  transition: width 0.08s linear;
  pointer-events: none;
}

/* Source attribution line below article meta */
.article-source-line {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 0.82rem;
  color: var(--text-faint);
  margin-top: 4px;
  flex-wrap: wrap;
}
.article-source-line a { color: var(--accent); text-decoration: underline; text-underline-offset: 2px; }
.article-source-line .icon { width: 13px; height: 13px; }

/* Article priority banner (above header) */
.article-priority-banner {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  font-size: 0.72rem;
  font-weight: 800;
  letter-spacing: 0.07em;
  text-transform: uppercase;
  padding: 5px 12px;
  border-radius: var(--radius-sm);
  margin-bottom: 14px;
}
.article-priority-banner--breaking { background: rgba(220,38,38,0.12); color: #f87171; border: 1px solid rgba(220,38,38,0.25); }
.article-priority-banner--important { background: rgba(217,119,6,0.12); color: #fbbf24; border: 1px solid rgba(217,119,6,0.25); }
.article-priority-banner__dot { width: 6px; height: 6px; border-radius: 50%; background: currentColor; animation: pulse-dot 1.6s ease-in-out infinite; }

/* ============================== 27. V3 — RELATED NEWS SECTION ============================== */
.related-section { margin-top: 0; }

/* ============================== 28. V3 — SEARCH PAGE ============================== */
.search-form-wrap {
  max-width: 600px;
  margin-bottom: 36px;
}
.search-form-wrap .search-overlay__form { border-color: var(--border-strong); }
.search-results-count {
  font-size: 0.85rem;
  color: var(--text-faint);
  margin-bottom: 24px;
}

/* ============================== 29. V3 — PRINT STYLES ============================== */
@media print {
  .topbar, .site-header, .breaking-bar, .search-overlay, .cookie-banner,
  .article-actions, .comments-section, .spotlight-panel,
  .site-footer, .cn-panel, .btn, aside, .reading-progress { display: none !important; }
  body { background: #fff; color: #111; font-size: 12pt; line-height: 1.6; }
  .article-content { max-width: none; font-size: 11pt; }
  .article-content a { color: #111; text-decoration: underline; }
  .article-title { font-size: 20pt; color: #000; }
  .article-header { max-width: none; }
  .article-body { max-width: none; }
}

/* ============================== 30. V3 — MOBILE IMPROVEMENTS ============================== */
@media (max-width: 479.98px) {
  .article-actions { flex-wrap: wrap; }
  .share-row { margin-left: 0; width: 100%; justify-content: flex-start; }
  .category-filter-row { gap: 6px; }
  .category-filter { padding: 6px 12px; font-size: 0.8rem; }
  .hero-grid { gap: 16px; }
  .news-grid { gap: 16px; }
  .newsletter-cta { padding: 28px 20px; }
  .newsletter-cta h2 { font-size: 1.2rem; }
}
@media (max-width: 374.98px) {
  .breaking-bar__label { font-size: 0.6rem; padding: 3px 7px; }
  .ticker-item { padding: 0.5rem 0.85rem; }
}
