/* ═══════════════════════════════════════════════════════
   NEWSORAS DESIGN SYSTEM
   Fonts → Tokens → Reset → Layout → Header → Cards →
   Article → Sidebar → Utilities → Responsive
═══════════════════════════════════════════════════════ */


/* ── 1. DESIGN TOKENS ────────────────────────────── */

:root {
  /* Page surface */
  --bg:            #f0f2f5;
  --surface:       #ffffff;
  --surface-2:     #f7f8fa;
  --surface-hover: #eff1f5;
  --border:        rgba(0, 0, 0, 0.09);
  --border-hover:  rgba(26, 86, 219, 0.35);

  /* Text */
  --text-1:     #111827;
  --text-2:     #374151;
  --text-3:     #6b7280;
  --text-muted: #9ca3af;

  /* Accent */
  --accent:     #1a56db;
  --accent-dim: rgba(26, 86, 219, 0.10);

  /* Tokens */
  --radius-sm: 6px;
  --radius:    10px;
  --radius-lg: 16px;
  --shadow-sm: 0 1px 3px rgba(0,0,0,0.07), 0 1px 2px rgba(0,0,0,0.05);
  --shadow:    0 4px 16px rgba(0,0,0,0.08), 0 1px 4px rgba(0,0,0,0.05);
  --shadow-lg: 0 8px 30px rgba(0,0,0,0.12), 0 3px 8px rgba(0,0,0,0.06);

  /* Fonts */
  --font-ui:       var(--font-inter), system-ui, -apple-system, sans-serif;
  --font-editorial: var(--font-merriweather), Georgia, 'Times New Roman', serif;

  /* Header — always dark navy */
  --hdr-bg:       #0c1c2e;
  --hdr-border:   rgba(255,255,255,0.08);
  --hdr-text:     #f3f6ff;
  --hdr-muted:    rgba(243,246,255,0.58);
  --hdr-surface:  rgba(255,255,255,0.06);
  --hdr-surface2: rgba(255,255,255,0.11);
}

html[data-theme="dark"] {
  --bg:            #0d0d0f;
  --surface:       #17171a;
  --surface-2:     #1e1e22;
  --surface-hover: #222227;
  --border:        rgba(255,255,255,0.07);
  --border-hover:  rgba(96,165,250,0.45);

  --text-1:     #f1f5f9;
  --text-2:     #94a3b8;
  --text-3:     #64748b;
  --text-muted: #475569;

  --accent:     #60a5fa;
  --accent-dim: rgba(96,165,250,0.12);

  --shadow-sm: 0 1px 3px rgba(0,0,0,0.3);
  --shadow:    0 4px 16px rgba(0,0,0,0.35);
  --shadow-lg: 0 8px 30px rgba(0,0,0,0.45);
}

@media (prefers-color-scheme: dark) {
  html:not([data-theme]) {
    --bg:            #0d0d0f;
    --surface:       #17171a;
    --surface-2:     #1e1e22;
    --surface-hover: #222227;
    --border:        rgba(255,255,255,0.07);
    --border-hover:  rgba(96,165,250,0.45);
    --text-1:        #f1f5f9;
    --text-2:        #94a3b8;
    --text-3:        #64748b;
    --text-muted:    #475569;
    --accent:        #60a5fa;
    --accent-dim:    rgba(96,165,250,0.12);
    --shadow-sm:     0 1px 3px rgba(0,0,0,0.3);
    --shadow:        0 4px 16px rgba(0,0,0,0.35);
    --shadow-lg:     0 8px 30px rgba(0,0,0,0.45);
  }
}

/* ── 2. RESET ─────────────────────────────────────── */

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

html, body {
  margin: 0; padding: 0;
  background: var(--bg);
  color: var(--text-1);
  font-family: var(--font-ui);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  line-height: 1.6;
}

a  { color: inherit; text-decoration: none; }
p  { margin: 0; }
img { display: block; max-width: 100%; }
button { font-family: inherit; }
h1, h2, h3, h4, h5 { margin: 0; }

/* ── 3. LAYOUT ────────────────────────────────────── */

.container {
  max-width: 1240px;
  margin: 0 auto;
  padding: 0 24px;
}

.grid-main {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 300px;
  gap: 32px;
  margin-top: 28px;
  align-items: start;
}

/* ── 4. HEADER ────────────────────────────────────── */

.site-header {
  position: sticky;
  top: 0;
  z-index: 1000;
  background: var(--hdr-bg);
  border-bottom: 1px solid var(--hdr-border);
  box-shadow: 0 4px 24px rgba(0,0,0,0.25);
}

.topbar {
  height: 58px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-shrink: 0;
  color: var(--hdr-text);
}

.brand-logo { border-radius: 8px; }

.brand-text {
  display: flex;
  flex-direction: column;
  line-height: 1.1;
}

.brand-title {
  font-family: var(--font-editorial);
  font-weight: 700;
  font-size: 1.08rem;
  color: var(--hdr-text);
  letter-spacing: -0.02em;
}

.brand-subtitle {
  font-size: 0.7rem;
  color: var(--hdr-muted);
  letter-spacing: 0.01em;
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.icon-btn {
  width: 38px;
  height: 38px;
  border-radius: 10px;
  border: 1px solid var(--hdr-surface);
  background: var(--hdr-surface);
  color: var(--hdr-text);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s;
  flex-shrink: 0;
}

.icon-btn:hover      { background: var(--hdr-surface2); border-color: var(--hdr-surface2); }
.icon-btn:active     { transform: translateY(1px); }
.icon-btn:focus-visible { outline: 2px solid rgba(96,165,250,0.5); outline-offset: 2px; }

/* Categories bar */
.catbar {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 8px 0 13px;
  overflow-x: auto;
  scrollbar-width: none;
  -webkit-overflow-scrolling: touch;
}
.catbar::-webkit-scrollbar { display: none; }

.catlink {
  white-space: nowrap;
  padding: 6px 13px;
  border-radius: 999px;
  border: 1px solid rgba(255,255,255,0.10);
  background: transparent;
  color: var(--hdr-muted);
  font-size: 0.78rem;
  font-weight: 600;
  letter-spacing: 0.01em;
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s, color 0.15s;
}

.catlink:hover               { background: rgba(255,255,255,0.07); color: var(--hdr-text); border-color: rgba(255,255,255,0.18); }
.catlink[data-active="true"] { background: rgba(96,165,250,0.16); border-color: rgba(96,165,250,0.55); color: #dbeafe; }

/* Language chip */
.lang-wrap {
  position: relative;
  display: inline-flex;
  align-items: center;
}
.lang-wrap::after {
  content: '';
  position: absolute;
  right: 10px;
  pointer-events: none;
  width: 0; height: 0;
  border-left: 4px solid transparent;
  border-right: 4px solid transparent;
  border-top: 5px solid var(--hdr-muted);
}
.lang-chip {
  appearance: none;
  -webkit-appearance: none;
  height: 38px;
  padding: 0 30px 0 11px;
  border-radius: 999px;
  border: 1px solid var(--hdr-surface);
  background: var(--hdr-surface);
  color: var(--hdr-text);
  font-family: var(--font-ui);
  font-weight: 700;
  font-size: 0.8rem;
  cursor: pointer;
  min-width: 62px;
  transition: background 0.15s;
}
.lang-chip:hover { background: var(--hdr-surface2); }
.lang-chip:focus-visible { outline: 2px solid rgba(96,165,250,0.5); outline-offset: 2px; }
.lang-chip option { background: #0c1c2e; color: #fff; }

.lang-select {
  width: 100%;
  padding: 10px 12px;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  background: var(--surface-2);
  color: var(--text-1);
  font-family: var(--font-ui);
  font-weight: 600;
  font-size: 0.9rem;
}

/* Mobile drawer */
.overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.6);
  z-index: 1500;
  backdrop-filter: blur(2px);
}

.menu-drawer {
  position: fixed;
  top: 0; right: 0;
  height: 100dvh;
  width: min(86vw, 340px);
  background: var(--hdr-bg);
  border-left: 1px solid var(--hdr-border);
  z-index: 1600;
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 14px;
  overflow-y: auto;
}
.menu-drawer .menu-title { font-weight: 800; font-size: 1rem; color: var(--hdr-text); }

.menu-close {
  width: 38px; height: 38px;
  border-radius: 10px;
  border: 1px solid var(--hdr-surface);
  background: var(--hdr-surface);
  color: var(--hdr-text);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: background 0.15s;
}
.menu-close:hover { background: var(--hdr-surface2); }

.desktop-only { display: none; }
.mobile-only  { display: inline-flex; }
@media (min-width: 900px) {
  .desktop-only { display: inline-flex; }
  .mobile-only  { display: none; }
}

/* ── 5. CARD BASE ─────────────────────────────────── */

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
  transition: box-shadow 0.2s, border-color 0.2s, transform 0.2s;
}

.card:hover {
  transform: translateY(-1px);
  box-shadow: var(--shadow);
  border-color: var(--border-hover);
}

/* ── 6. ARTICLE CARD ──────────────────────────────── */

.acard {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  transition: transform 0.2s, box-shadow 0.2s, border-color 0.2s;
}

.acard:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-lg);
  border-color: var(--border-hover);
}

.acard-link { display: flex; flex-direction: column; color: var(--text-1); text-decoration: none; height: 100%; }

/* Image */
.acard-img {
  width: 100%;
  overflow: hidden;
  background: var(--surface-2);
  flex-shrink: 0;
}
.acard-img img {
  width: 100%; height: 100%;
  object-fit: cover;
  display: block;
  transition: transform 0.35s ease;
}
.acard:hover .acard-img img { transform: scale(1.035); }

.acard-ph {
  width: 100%; height: 100%;
  background: linear-gradient(135deg, var(--accent-dim) 0%, var(--surface-2) 100%);
}

/* Meta */
.acard-meta {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 8px;
}
.acard-section {
  font-size: 0.72rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  color: var(--accent);
}
.acard-dot   { color: var(--text-muted); font-size: 0.8rem; }
.acard-date, .acard-author { font-size: 0.78rem; color: var(--text-3); }

/* Typography */
.acard-title {
  font-family: var(--font-editorial);
  font-weight: 700;
  color: var(--text-1);
  line-height: 1.22;
  margin: 0;
  display: -webkit-box;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.acard-subtitle {
  color: var(--text-2);
  line-height: 1.5;
  margin-top: 7px;
  font-size: 0.93rem;
  display: -webkit-box;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
  overflow: hidden;
}
.acard-excerpt {
  color: var(--text-3);
  line-height: 1.55;
  margin-top: 7px;
  font-size: 0.88rem;
  display: -webkit-box;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
  overflow: hidden;
}
.acard-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 12px;
  padding-top: 12px;
  border-top: 1px solid var(--border);
}

/* HERO — image with title overlay (editorial style) */
.acard--hero             { border-radius: var(--radius-lg); }
.acard--hero .acard-link { position: relative; }

.acard--hero .acard-img {
  aspect-ratio: 16 / 9;
  max-height: 520px;
  position: relative;
}

/* Gradient overlay: transparent top → dark bottom */
.acard--hero .acard-img::after {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(
    to bottom,
    transparent 30%,
    rgba(0,0,0,0.35) 55%,
    rgba(0,0,0,0.82) 100%
  );
  pointer-events: none;
}

/* Body floats on top of the image at the bottom */
.acard--hero .acard-body {
  position: absolute;
  bottom: 0; left: 0; right: 0;
  padding: 28px 30px 26px;
  z-index: 1;
}

.acard--hero .acard-section { color: #93c5fd; }
.acard--hero .acard-dot,
.acard--hero .acard-date,
.acard--hero .acard-author { color: rgba(255,255,255,0.7); }

.acard--hero .acard-title {
  font-size: 2rem;
  -webkit-line-clamp: 3;
  color: #ffffff;
  text-shadow: 0 1px 4px rgba(0,0,0,0.4);
  margin-top: 6px;
}
.acard--hero .acard-subtitle {
  font-size: 1rem;
  -webkit-line-clamp: 2;
  color: rgba(255,255,255,0.85);
  margin-top: 8px;
}
.acard--hero .acard-excerpt {
  font-size: 0.95rem;
  -webkit-line-clamp: 2;
  color: rgba(255,255,255,0.75);
  margin-top: 8px;
}

/* TEASER */
.acard--teaser .acard-img  { aspect-ratio: 16 / 9; }
.acard--teaser .acard-body { padding: 14px 16px 18px; flex: 1; }
.acard--teaser .acard-title { font-size: 1.06rem; -webkit-line-clamp: 3; }

/* DEFAULT */
.acard--default .acard-img  { aspect-ratio: 16 / 9; }
.acard--default .acard-body { padding: 18px 20px 22px; flex: 1; }
.acard--default .acard-title { font-size: 1.3rem; -webkit-line-clamp: 3; margin-top: 6px; }

/* ── News grids ── */

.news-hero { margin-top: 20px; }

.news-grid {
  display: grid;
  gap: 16px;
  margin-top: 20px;
  grid-template-columns: 1fr;
}

/* ── 7. ARTICLE PAGE ──────────────────────────────── */

.article-shell { margin-top: 20px; padding-bottom: 60px; }

.article-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 300px;
  gap: 40px;
  align-items: start;
}

.article-main { min-width: 0; }

.article-header,
.article-body { max-width: 720px; }

.article-kicker {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  margin-bottom: 12px;
}

.article-title {
  font-family: var(--font-editorial);
  font-weight: 700;
  line-height: 1.12;
  margin: 0;
  color: var(--text-1);
  font-size: clamp(1.9rem, 4.5vw, 2.7rem);
}

.article-subtitle {
  margin: 12px 0 0;
  color: var(--text-2);
  line-height: 1.65;
  font-size: 1.1rem;
  font-family: var(--font-editorial);
  font-weight: 300;
}

.article-summary {
  margin: 10px 0 0;
  color: var(--text-3);
  line-height: 1.65;
  font-size: 0.97rem;
}

.article-actions {
  margin-top: 14px;
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  padding-bottom: 16px;
  border-bottom: 2px solid var(--border);
}

.share-pill {
  display: inline-flex;
  align-items: center;
  padding: 7px 14px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--surface-2);
  color: var(--text-2);
  font-weight: 600;
  font-size: 0.82rem;
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s;
}
.share-pill:hover { background: var(--surface-hover); border-color: var(--border-hover); }

.article-figure { margin: 24px 0; max-width: 780px; }
.article-figure-inline { margin: 22px 0 8px; }

.article-media {
  border-radius: var(--radius-lg);
  overflow: hidden;
  border: 1px solid var(--border);
  background: var(--surface-2);
}
.article-media img { width: 100%; height: auto; display: block; object-fit: cover; }

/* Reading body */
.article-body { margin-top: 8px; }

.article-html {
  font-size: 1.07rem;
  line-height: 1.82;
  color: var(--text-1);
}
.article-html p              { margin: 16px 0; }
.article-html h2             { font-family: var(--font-editorial); font-size: 1.45rem; line-height: 1.2; margin: 30px 0 10px; color: var(--text-1); }
.article-html h3             { font-family: var(--font-editorial); font-size: 1.2rem; line-height: 1.25; margin: 24px 0 8px; color: var(--text-1); }
.article-html a              { color: var(--accent); text-decoration: underline; text-underline-offset: 3px; }
.article-html a:hover        { text-decoration: none; opacity: 0.85; }
.article-html img            { max-width: 100%; border-radius: var(--radius); border: 1px solid var(--border); margin: 16px 0; }
.article-html blockquote     { margin: 22px 0; padding: 14px 20px; border-left: 4px solid var(--accent); background: var(--surface-2); border-radius: 0 var(--radius-sm) var(--radius-sm) 0; font-style: italic; color: var(--text-2); }
.article-html code           { background: var(--surface-2); padding: 2px 6px; border-radius: 4px; font-size: 0.88em; border: 1px solid var(--border); }
.article-html pre            { background: var(--surface-2); padding: 16px 20px; border-radius: var(--radius); border: 1px solid var(--border); overflow-x: auto; margin: 18px 0; }
.article-html pre code       { background: none; border: none; padding: 0; }
.article-html ul, .article-html ol { padding-left: 24px; margin: 14px 0; }
.article-html li             { margin: 6px 0; }
.article-html table          { width: 100%; border-collapse: collapse; margin: 18px 0; font-size: 0.95rem; }
.article-html th, .article-html td { padding: 10px 14px; border: 1px solid var(--border); text-align: left; }
.article-html th             { background: var(--surface-2); font-weight: 700; }
.article-html hr             { border: none; border-top: 1px solid var(--border); margin: 28px 0; }

/* Related */
.article-more { margin-top: 40px; padding-top: 28px; border-top: 2px solid var(--border); }

.article-more-list {
  display: grid;
  gap: 16px;
  margin-top: 18px;
  grid-template-columns: 1fr;
}

/* Article sidebar rail */
.article-rail {
  display: flex;
  flex-direction: column;
  gap: 20px;
  position: sticky;
  top: 80px;
}

/* ── 8. SIDEBAR ───────────────────────────────────── */

.sidebar {
  display: flex;
  flex-direction: column;
  gap: 20px;
  position: sticky;
  top: 80px;
}

.sidebar-section-title {
  font-weight: 800;
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.09em;
  color: var(--text-muted);
  margin-bottom: 14px;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--border);
}

.sidebar-article {
  display: block;
  padding: 10px 0;
  border-bottom: 1px solid var(--border);
  transition: color 0.15s;
}
.sidebar-article:last-child { border-bottom: none; padding-bottom: 2px; }
.sidebar-article:hover .sidebar-article-title { color: var(--accent); }

.sidebar-article-date {
  font-size: 0.73rem;
  color: var(--text-muted);
  margin-bottom: 4px;
}
.sidebar-article-title {
  font-weight: 700;
  font-size: 0.88rem;
  line-height: 1.35;
  color: var(--text-1);
  transition: color 0.15s;
  display: -webkit-box;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
  overflow: hidden;
}

.sidebar-explore {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

/* ── 9. BADGE / PILL ──────────────────────────────── */

.badge {
  display: inline-flex;
  align-items: center;
  padding: 5px 12px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--surface-2);
  color: var(--text-2);
  font-size: 0.78rem;
  font-weight: 600;
  letter-spacing: 0.02em;
  transition: background 0.15s, border-color 0.15s, color 0.15s;
  white-space: nowrap;
}
.badge:hover {
  background: var(--accent-dim);
  border-color: var(--accent);
  color: var(--accent);
  cursor: pointer;
}

.badge-tag { font-size: 0.72rem; padding: 3px 9px; }

/* ── 10. TYPOGRAPHY UTILITIES ─────────────────────── */

.h1 {
  font-family: var(--font-editorial);
  font-weight: 700;
  font-size: clamp(1.75rem, 4vw, 2.4rem);
  line-height: 1.15;
  color: var(--text-1);
  margin: 0 0 8px;
}

.h2 {
  font-family: var(--font-editorial);
  font-weight: 700;
  font-size: 1.35rem;
  line-height: 1.25;
  color: var(--text-1);
  margin: 0 0 8px;
}

.p {
  color: var(--text-2);
  line-height: 1.7;
  font-size: 0.97rem;
  margin: 0;
}

.muted { color: var(--text-3); font-size: 0.85rem; }
.dot   { color: var(--text-muted); }

.hr {
  height: 1px;
  background: var(--border);
  border: none;
  margin: 12px 0;
}

main.container { padding-top: 0; }

/* ── 11. RESPONSIVE ───────────────────────────────── */

@media (min-width: 900px) {
  .news-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 20px;
  }

  .article-more-list {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (min-width: 1100px) {
  .article-more-list {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}

@media (max-width: 900px) {
  .grid-main {
    grid-template-columns: 1fr;
  }

  .article-grid {
    grid-template-columns: 1fr;
  }

  .article-rail { display: none; }

  .acard--hero .acard-title { font-size: 1.55rem; }
  .acard--hero .acard-body  { padding: 20px 20px 22px; }
}

/* Mobile teaser: row layout (text left, thumb right) */
@media (max-width: 640px) {
  .acard--teaser .acard-link {
    flex-direction: row;
    align-items: flex-start;
  }

  .acard--teaser .acard-img {
    order: 2;
    flex: 0 0 110px;
    width: 110px;
    aspect-ratio: 3 / 2;
    border-radius: 0;
  }

  .acard--teaser .acard-body {
    order: 1;
    flex: 1;
  }

  .acard--teaser .acard-excerpt { display: none; }
}

@media (max-width: 480px) {
  .container { padding: 0 16px; }

  .brand-subtitle { display: none; }

  .icon-btn { width: 36px; height: 36px; }
  .lang-chip { min-width: 56px; padding: 0 28px 0 10px; font-size: 0.76rem; }

  .topbar { height: 54px; }

  .acard--hero .acard-title    { font-size: 1.4rem; }
  .acard--hero .acard-subtitle { display: none; }

  .article-title { font-size: 1.6rem; }
}
