/* ===================================================
   The drAIgonling Gazette — Victorian Newspaper Theme
   Light + Dark themes, responsive mobile layout

   Typography system:
   - Gothic (UnifrakturCook): masthead title only
   - Display (Playfair Display): headlines, section titles
   - Body (Lora): everything else — text, meta, nav, UI

   Color hierarchy (text):
   - --ink: headings, primary text
   - --ink-mid: body text, annotations
   - --ink-faint: meta (source, date, counts)

   Size scale (rem): 3 → 1.75 → 1.15 → 1 → 0.9 → 0.8 → 0.75
   =================================================== */

:root {
  --paper: #faf8f2;
  --paper-dark: #f0ece2;
  --ink: #1a1611;
  --ink-mid: #4a4035;
  --ink-faint: #706556;
  --rule: #6b604f;
  --rule-light: #c5b99d;
  --rule-heavy: #4a4035;
  --accent: #8b6914;
  --fire: #c44a1a;
  --error-bg: #fdf0ed;
  --max-width: 1240px;
  --font-display: 'Playfair Display', 'Georgia', serif;
  --font-body: 'Lora', 'Georgia', serif;
  --font-gothic: 'UnifrakturCook', cursive;
  --transition: 0.15s ease;
}

/* ---- Dark theme ---- */
[data-theme="dark"] {
  --paper: #1a1814;
  --paper-dark: #141210;
  --ink: #d4cbb8;
  --ink-mid: #a89e8e;
  --ink-faint: #938878;
  --rule: #5a5045;
  --rule-light: #3d362e;
  --rule-heavy: #8a7e6e;
  --accent: #c9a23e;
  --fire: #e06030;
  --error-bg: #2a1a14;
}
[data-theme="dark"] .masthead-dragon { filter: sepia(1) brightness(1.2) invert(1); }
[data-theme="dark"] .art-image-wrap img { filter: brightness(0.9); }
[data-theme="dark"] .headline-image-wrap img { filter: brightness(0.9); }

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
[hidden] { display: none !important; }
html { font-size: 16px; -webkit-font-smoothing: antialiased; scroll-behavior: smooth; }
body {
  font-family: var(--font-body);
  background: var(--paper); color: var(--ink);
  line-height: 1.6; min-height: 100vh;
  transition: background 0.3s ease, color 0.3s ease;
}
a { color: inherit; text-decoration: none; }
img, svg { display: block; max-width: 100%; }

a:focus-visible,
button:focus-visible,
select:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 3px;
}

/* ---- Corner title ---- */
.corner-title {
  position: fixed; top: 0.4rem; left: 0.6rem;
  font-size: 0.6rem; font-weight: 700;
  color: var(--ink-faint); letter-spacing: 0.1em;
  z-index: 100; text-transform: uppercase;
}

/* ===========================================================
   MASTHEAD
   =========================================================== */
.masthead {
  text-align: center;
  padding: 0.8rem 1rem 0.4rem;
  border-bottom: 3px solid var(--rule-heavy);
  max-width: var(--max-width); margin: 0 auto;
}
.masthead::after { content: ''; display: block; height: 1px; background: var(--rule-heavy); margin-top: 2px; }
.masthead-date {
  font-size: 0.8rem; font-style: italic;
  color: var(--ink-faint); letter-spacing: 0.06em;
}
.masthead-title {
  font-family: var(--font-gothic); font-size: 3rem; font-weight: 700;
  color: var(--ink); line-height: 1; margin: 0.15rem 0 0.1rem; letter-spacing: 0.02em;
}
.masthead-sub {
  font-size: 0.8rem; color: var(--ink-faint);
}
.ai-note { font-size: 0.75rem; color: var(--ink-faint); }
.masthead-rule { display: flex; align-items: center; gap: 0.5rem; margin-top: 0.35rem; }
.masthead-rule::before, .masthead-rule::after { content: ''; flex: 1; height: 1px; background: var(--rule); }
.masthead-dragon { width: 22px; height: 22px; opacity: 0.5; filter: sepia(1) brightness(0.4); }

/* ---- Language filter ---- */
.lang-filter {
  display: flex; justify-content: center; gap: 0.3rem;
  margin-top: 0;
}
.lang-filter-btn {
  background: none; border: 1px solid var(--rule-light);
  min-width: 2.75rem; min-height: 2rem;
  font-family: var(--font-body); font-size: 0.8rem;
  color: var(--ink-faint); cursor: pointer;
  padding: 0.3rem 0.7rem; letter-spacing: 0.03em;
  transition: var(--transition);
}
.lang-filter-btn:hover { color: var(--ink); border-color: var(--rule); }
.lang-filter-btn.active {
  color: var(--ink); border-color: var(--rule-heavy);
  font-weight: 700; background: var(--paper-dark);
}

/* ---- Language badge ---- */
.lang-badge {
  display: inline-block; font-weight: 700;
  font-size: 0.6rem; letter-spacing: 0.05em;
  padding: 0.1rem 0.35rem;
  border-radius: 2px; vertical-align: middle;
  line-height: 1.2; text-transform: uppercase;
}
.lang-ru {
  background: rgba(30, 90, 160, 0.1); color: #3a7cc0;
  border: 1px solid rgba(30, 90, 160, 0.2);
}
.lang-en {
  background: rgba(196, 74, 26, 0.08); color: #c44a1a;
  border: 1px solid rgba(196, 74, 26, 0.18);
}
[data-theme="dark"] .lang-ru { background: rgba(60, 130, 210, 0.12); color: #6ab0e8; border-color: rgba(60, 130, 210, 0.25); }
[data-theme="dark"] .lang-en { background: rgba(224, 96, 48, 0.12); color: #e06030; border-color: rgba(224, 96, 48, 0.2); }

/* Lang badge inside titles */
.entry-mid-title .lang-badge,
.headline-main-title .lang-badge,
.headline-sidebar-title .lang-badge,
.latest-entry-title .lang-badge { margin-right: 0.3rem; font-size: 0.55rem; vertical-align: baseline; }

/* ---- Theme toggle ---- */
.theme-toggle {
  background: none; border: 1px solid var(--rule-light);
  color: var(--ink-faint); cursor: pointer;
  width: 2rem; min-height: 2rem;
  font-size: 1rem; padding: 0.25rem;
  border-radius: 2px; transition: var(--transition);
  line-height: 1; display: flex; align-items: center; justify-content: center;
}
.theme-toggle:hover { color: var(--accent); border-color: var(--accent); }

/* ===========================================================
   NAV BAR
   =========================================================== */
.nav-bar {
  border-bottom: 2px solid var(--rule);
  max-width: var(--max-width); margin: 0 auto;
  display: flex; justify-content: center; flex-wrap: wrap;
  padding: 0.25rem 0;
  position: sticky; top: 0; z-index: 90;
  background: var(--paper);
  box-shadow: 0 4px 10px rgba(26, 22, 17, 0.06);
}
.nav-link {
  min-height: 2.25rem;
  display: inline-flex; align-items: center;
  font-size: 0.875rem; font-weight: 400;
  padding: 0.35rem 0.75rem; color: var(--ink-faint);
  cursor: pointer; transition: var(--transition);
  border-right: 1px solid var(--rule-light); white-space: nowrap;
}
.nav-link:last-child { border-right: none; }
.nav-link:hover { color: var(--ink); }
.nav-link.active { color: var(--ink); font-weight: 700; }
.nav-sep {
  color: var(--rule); padding: 0.25rem 0.3rem; font-size: 0.8rem;
  user-select: none; border-right: none;
}
.nav-categories-dropdown {
  display: none;
  min-height: 2.25rem;
  font-family: var(--font-body); font-size: 0.875rem;
  background: var(--paper); color: var(--ink-mid);
  border: 1px solid var(--rule); border-radius: 2px;
  padding: 0.3rem 0.55rem; cursor: pointer;
}
.nav-categories-inline { display: contents; }

/* ===========================================================
   PAGE WRAPPER
   =========================================================== */
.page-wrapper { max-width: var(--max-width); margin: 0 auto; padding: 0 1.25rem; }

/* ===========================================================
   TICKER
   =========================================================== */
.ticker-bar {
  border-bottom: 1px solid var(--rule);
  overflow: hidden; white-space: nowrap;
  padding: 0.3rem 0;
  max-width: var(--max-width); margin: 0 auto;
  background: var(--paper-dark);
}
.ticker-track { display: inline-flex; animation: ticker-scroll 140s linear infinite; gap: 1.2rem; padding-left: 100%; }
.ticker-item {
  display: inline-flex; align-items: center; gap: 0.3rem;
  font-size: 0.8rem; color: var(--ink-faint); flex-shrink: 0;
}
.ticker-item:hover { color: var(--ink-mid); }
.ticker-cat {
  font-weight: 700; text-transform: uppercase;
  font-size: 0.65rem; letter-spacing: 0.05em; color: var(--ink-mid);
}
.ticker-sep { color: var(--rule-light); margin: 0 0.3rem; font-size: 0.5rem; }
@keyframes ticker-scroll { 0% { transform: translateX(0); } 100% { transform: translateX(-50%); } }

/* ===========================================================
   HEADLINES — newspaper front-page layout
   =========================================================== */
.headline-section {
  padding: 0.6rem 0 0.5rem;
  border-bottom: 2px solid var(--rule-heavy);
}
.headline-feature {
  display: grid; grid-template-columns: 3fr 2fr;
}

/* Left column wrapper */
.headline-left {
  padding-right: 0.75rem;
  border-right: 1px solid var(--rule);
}
.headline-left .headline-sidebar-item {
  padding-left: 0;
  border-top: 1px solid var(--rule-light);
}

/* Main story */
.headline-main {
}
.headline-main-cat {
  font-size: 0.75rem; font-weight: 700;
  text-transform: uppercase; letter-spacing: 0.1em; color: var(--fire);
}
.headline-main-title {
  font-family: var(--font-display); font-size: 2.1rem; font-weight: 900;
  line-height: 1.15; color: var(--ink); margin: 0.2rem 0;
}

.headline-main-annotation {
  max-width: 70ch;
  font-size: 1.05rem; color: var(--ink-mid); line-height: 1.65;
  margin-top: 0.4rem;
}
.headline-main-meta {
  font-size: 0.8rem; color: var(--ink-faint); margin-top: 0.4rem;
  display: flex; align-items: center; gap: 0.4rem; flex-wrap: wrap;
}

.headline-image-wrap { border: 1px solid var(--rule-light); overflow: hidden; margin: 0.4rem 0; max-height: 280px; }
.headline-image-wrap img { width: 100%; height: 100%; object-fit: cover; display: block; }

/* Sidebar stories */
.headline-sidebar {
  display: flex; flex-direction: column;
  justify-content: space-between;
}
.headline-sidebar-item {
  padding: 0.5rem 0 0.5rem 0.75rem;
  border-bottom: 1px solid var(--rule-light);
  display: block; cursor: pointer;
  transition: background var(--transition);
  flex: 1;
}
.headline-sidebar-item:last-child { border-bottom: none; }
.headline-sidebar-item:hover { background: var(--paper-dark); }
.headline-sidebar-cat {
  font-size: 0.7rem; font-weight: 700;
  text-transform: uppercase; letter-spacing: 0.08em;
  color: var(--ink-faint); margin-bottom: 0.1rem;
}
.headline-sidebar-title {
  font-family: var(--font-display); font-size: 1.1rem; font-weight: 700;
  line-height: 1.2; color: var(--ink);
}

.headline-sidebar-snippet {
  font-size: 0.925rem; color: var(--ink-mid); line-height: 1.55;
  margin-top: 0.15rem;
}
.headline-sidebar-meta {
  font-size: 0.75rem; color: var(--ink-faint); margin-top: 0.25rem;
  display: flex; align-items: center; gap: 0.4rem; flex-wrap: wrap;
}

/* ===========================================================
   BROADSHEET — sequential full-width category sections
   =========================================================== */
.broadsheet {
  padding-top: 0.5rem;
  border-top: 1px solid var(--rule);
}

/* Internal 3-column grid within each category section */
.cat-entries-grid {
  display: grid; grid-template-columns: repeat(var(--category-columns, 3), minmax(0, 1fr));
  gap: 0;
}
.cat-entries-col {
  min-width: 0;
  padding: 0 0.75rem;
  border-right: 1px solid var(--rule-light);
}
.cat-entries-col:first-child { padding-left: 0; }
.cat-entries-col:last-child { border-right: none; padding-right: 0; }

/* ===========================================================
   CATEGORY SECTION
   =========================================================== */
.cat-section { margin-bottom: 1.25rem; border-bottom: 1px solid var(--rule-light); padding-bottom: 0.75rem; scroll-margin-top: 4rem; }
.cat-section:last-child { border-bottom: none; margin-bottom: 0; }
.cat-header {
  display: flex; align-items: baseline; gap: 0.3rem;
  padding-bottom: 0.25rem; border-bottom: 2px solid var(--rule); margin-bottom: 0.4rem;
}
.cat-icon { font-size: 0.85rem; }
.cat-title {
  font-family: var(--font-display); font-size: 1rem; font-weight: 700;
  text-transform: uppercase; letter-spacing: 0.06em; color: var(--ink);
}
.cat-count { font-size: 0.8rem; color: var(--ink-faint); margin-left: auto; }

/* ===========================================================
   ENTRY (mid-hype news item)
   =========================================================== */
.entry-mid {
  display: block; padding: 0.55rem 0;
  border-bottom: 1px dotted var(--rule-light);
  cursor: pointer; transition: background var(--transition);
}
.entry-mid:last-child { border-bottom: none; }
.entry-mid:hover { background: var(--paper-dark); margin: 0 -0.45rem; padding: 0.55rem 0.45rem; }
.entry-mid-title {
  font-family: var(--font-display); font-weight: 700;
  line-height: 1.25; color: var(--ink);
}


/* Tier sizing — only title size varies */
.entry-mid.tier-hot .entry-mid-title { font-size: 1.1rem; }
.entry-mid.tier-upper .entry-mid-title { font-size: 1.05rem; }
.entry-mid.tier-lower .entry-mid-title { font-size: 1rem; }

/* Snippet (annotation) — uniform style for all tiers */
.entry-mid-snippet {
  font-size: 0.925rem; color: var(--ink-mid); line-height: 1.55;
  margin-top: 0.15rem;
}

/* Meta (source + badge + date) — single uniform style */
.entry-mid-meta {
  font-size: 0.8rem; color: var(--ink-faint);
  margin-top: 0.25rem;
  display: flex; align-items: center; gap: 0.4rem; flex-wrap: wrap;
}

/* ---- Source name ---- */
.source-name { font-weight: 700; }

/* ---- Entry date ---- */
.entry-date {
  font-size: 0.8rem; font-weight: 600;
  color: var(--accent); letter-spacing: 0.02em;
}

/* ===========================================================
   LATEST FEED (chronological view)
   =========================================================== */
.latest-feed { max-width: 840px; margin: 0 auto; padding: 0.75rem 0; }
.latest-day { margin-bottom: 1rem; }
.latest-day-header {
  display: flex; align-items: center; gap: 0.5rem;
  margin-bottom: 0.4rem; padding-top: 0.2rem;
}
.latest-day-label {
  font-family: var(--font-display); font-size: 1rem; font-weight: 700;
  text-transform: capitalize; color: var(--ink); white-space: nowrap;
}
.latest-day-rule { flex: 1; height: 1px; background: var(--rule); }

.latest-entry {
  display: flex; gap: 0.75rem; padding: 0.65rem 0.4rem;
  border-bottom: 1px dotted var(--rule-light);
  cursor: pointer; transition: background var(--transition);
}
.latest-entry:last-child { border-bottom: none; }
.latest-entry:hover { background: var(--paper-dark); margin: 0 -0.4rem; padding: 0.65rem 0.8rem; }
.latest-entry-hot { border-left: 2px solid var(--accent); padding-left: 0.5rem; }

.latest-entry-time {
  font-size: 0.8rem; color: var(--ink-faint);
  white-space: nowrap; padding-top: 0.15rem; min-width: 2.5rem;
}
.latest-entry-body { flex: 1; min-width: 0; }
.latest-entry-title {
  font-family: var(--font-display); font-weight: 700;
  font-size: 1.075rem; line-height: 1.3; color: var(--ink);
}

.latest-entry-annotation {
  font-size: 0.925rem; color: var(--ink-mid); line-height: 1.55;
  margin-top: 0.15rem;
}
.latest-entry-meta {
  font-size: 0.8rem; color: var(--ink-faint);
  margin-top: 0.2rem; display: flex; align-items: center; gap: 0.4rem; flex-wrap: wrap;
}
.latest-entry-cat {
  font-weight: 700; text-transform: uppercase;
  font-size: 0.65rem; letter-spacing: 0.04em;
}
.latest-entry-sep { color: var(--rule-light); }
.latest-entry-score { color: var(--accent); font-weight: 700; }

@media (hover: hover) {
  .headline-main a:hover .headline-main-title,
  .headline-sidebar-item:hover .headline-sidebar-title,
  .entry-mid:hover .entry-mid-title,
  .latest-entry:hover .latest-entry-title {
    text-decoration: underline;
    text-decoration-thickness: 1px;
    text-underline-offset: 0.18em;
  }
}

.editorial-more {
  display: block;
  min-height: 2.5rem;
  margin: 0.75rem auto 0;
  padding: 0.45rem 1.1rem;
  border: 1px solid var(--rule);
  background: var(--paper);
  color: var(--ink);
  font-family: var(--font-body);
  font-size: 0.875rem;
  font-weight: 700;
  letter-spacing: 0.02em;
  cursor: pointer;
  transition: var(--transition);
}
.editorial-more:hover { background: var(--paper-dark); border-color: var(--accent); color: var(--accent); }
.feed-more-btn { margin-top: 1rem; }

/* ===========================================================
   ART OF THE WEEK
   =========================================================== */
.art-section {
  border: 2px solid var(--rule);
  padding: 0.6rem;
  background: var(--paper-dark);
}
.cat-art-col { margin-bottom: 0.5rem; }
.art-image-wrap { width: 100%; margin-bottom: 0.4rem; }
.art-image-wrap img { width: 100%; height: auto; }
.art-placeholder {
  width: 100%; height: 100px;
  display: flex; align-items: center; justify-content: center;
  background: var(--paper); font-size: 2rem; color: var(--ink-faint);
}
.art-label {
  font-size: 0.7rem; font-weight: 700; text-transform: uppercase;
  letter-spacing: 0.1em; color: var(--accent); margin-bottom: 0.15rem;
}
.art-title {
  font-family: var(--font-display); font-size: 1.05rem; font-weight: 700;
  line-height: 1.2; color: var(--ink);
}
.art-artist { font-size: 0.8rem; color: var(--ink-mid); margin-top: 0.1rem; }
.art-artist a { color: var(--accent); text-decoration: underline; text-underline-offset: 2px; }
.art-desc { font-size: 0.8rem; color: var(--ink-faint); margin-top: 0.2rem; line-height: 1.45; font-style: italic; }

/* ===========================================================
   ORNAMENT / FOOTER
   =========================================================== */
.ornament { text-align: center; padding: 0.4rem 0; font-size: 0.85rem; color: var(--rule); letter-spacing: 0.4em; }

.site-footer {
  border-top: 2px solid var(--rule-heavy);
  max-width: var(--max-width); margin: 0.75rem auto 0;
  padding: 0.4rem 1rem; text-align: center;
}
.footer-text { font-size: 0.75rem; color: var(--ink-faint); }
.footer-text a { color: var(--accent); }

/* ===========================================================
   LOADING / EMPTY / ERROR
   =========================================================== */
.loading-state { display: flex; flex-direction: column; align-items: center; justify-content: center; min-height: 200px; gap: 0.5rem; color: var(--ink-faint); font-style: italic; }
.loading-spinner { width: 24px; height: 24px; border: 2px solid var(--rule-light); border-top-color: var(--accent); border-radius: 50%; animation: spin 0.8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.empty-state { text-align: center; padding: 2rem 1rem; color: var(--ink-faint); font-style: italic; }
.empty-state-icon { font-size: 2rem; margin-bottom: 0.3rem; }
.error-banner { background: var(--error-bg); color: var(--fire); padding: 0.4rem 0.75rem; border: 1px solid rgba(196,74,26,0.2); font-size: 0.85rem; margin: 0.5rem 0; }

/* ===========================================================
   RESPONSIVE
   =========================================================== */

/* Laptop/tablet: 3 cols → 2 cols within categories */
@media (max-width: 1120px) {
  .cat-entries-grid { --category-columns: 2; }
  .cat-entries-col:nth-child(2) { border-right: none; }
  .cat-entries-col:nth-child(3) { border-right: none; }
}

@media (max-width: 900px) {
  .nav-categories-inline { display: none; }
  .nav-categories-dropdown { display: inline-block; }
  .nav-sep { display: none; }

  .headline-feature { grid-template-columns: 1fr; }
  .headline-left {
    padding-right: 0; border-right: none;
    border-bottom: 1px solid var(--rule);
    padding-bottom: 0.65rem; margin-bottom: 0.35rem;
  }
  .headline-sidebar-item { padding-left: 0; }
}

/* Mobile */
@media (max-width: 768px) {
  .corner-title { display: none; }

  .masthead { padding: 0.45rem 0.6rem 0.3rem; }
  .masthead-date { font-size: 0.75rem; }
  .masthead-title { font-size: 2rem; }
  .masthead-sub { font-size: 0.8rem; line-height: 1.4; padding: 0 0.4rem; }
  .ai-note, .ai-note-separator { display: none; }
  .masthead-rule { margin-top: 0.25rem; }
  .theme-toggle, .masthead-dragon-link { width: 2.75rem; min-width: 2.75rem; min-height: 2.75rem; }
  .lang-filter { margin-top: 0; }
  .lang-filter-btn { min-width: 3rem; min-height: 2.75rem; font-size: 0.85rem; }

  /* Compact sticky folio navigation with finger-sized targets */
  .nav-bar {
    flex-wrap: wrap; justify-content: center;
    padding: 0.3rem 0.5rem; gap: 0.2rem;
  }
  .nav-link {
    min-height: 2.75rem; padding: 0.5rem 0.65rem;
    font-size: 0.825rem; flex-shrink: 0;
  }
  .nav-categories-dropdown {
    width: 8rem; max-width: 8rem; min-height: 2.75rem;
    font-size: 0.875rem; padding: 0.45rem 0.65rem;
  }

  .ticker-item { font-size: 0.85rem; }
  .ticker-cat { font-size: 0.7rem; }

  .headline-section { padding-top: 0.8rem; }
  .headline-main-title { font-size: 1.75rem; line-height: 1.12; margin-bottom: 0.35rem; }
  .headline-main-annotation { font-size: 1rem; line-height: 1.6; }
  .headline-main-meta { font-size: 0.825rem; }
  .headline-sidebar-item { padding-top: 0.7rem; padding-bottom: 0.7rem; }
  .headline-sidebar-title { font-size: 1.15rem; line-height: 1.3; }
  .headline-sidebar-snippet { font-size: 0.95rem; line-height: 1.6; }
  .headline-sidebar-meta { font-size: 0.825rem; }

  .cat-entries-grid { --category-columns: 1; }
  .cat-entries-col { border-right: none; padding: 0; }
  .cat-section { scroll-margin-top: 7rem; }
  .cat-header { padding-bottom: 0.4rem; margin-bottom: 0.35rem; }
  .cat-title { font-size: 0.95rem; }
  .cat-count { font-size: 0.825rem; }

  .entry-mid { padding: 0.75rem 0; min-height: 2.75rem; }
  .entry-mid-title { font-size: 1.125rem !important; line-height: 1.3; }
  .entry-mid-snippet { font-size: 0.975rem; line-height: 1.6; margin-top: 0.25rem; }
  .entry-mid-meta, .entry-date { font-size: 0.825rem; }
  .cat-section:not([data-expanded="true"]) .entry-mid-snippet {
    display: -webkit-box;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 3;
    overflow: hidden;
  }

  /* Latest feed */
  .latest-feed { padding: 0.5rem 0; }
  .latest-entry { display: block; padding: 0.75rem 0.15rem; min-height: 2.75rem; }
  .latest-entry-time { min-width: 0; padding: 0; margin-bottom: 0.2rem; font-size: 0.825rem; }
  .latest-entry-title { font-size: 1.125rem; line-height: 1.3; }
  .latest-entry-annotation {
    font-size: 0.975rem; line-height: 1.6; margin-top: 0.25rem;
    display: -webkit-box;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 3;
    overflow: hidden;
  }
  .latest-entry-meta { font-size: 0.825rem; margin-top: 0.3rem; }

  /* Art section on mobile */
  .art-section { margin: 0.25rem 0 0.4rem; padding: 0.8rem; border-left: none; border-right: none; }
  .art-image-wrap img { max-height: 22rem; object-fit: contain; }

  .editorial-more { min-height: 2.75rem; width: min(100%, 18rem); font-size: 0.9rem; }

  .page-wrapper { padding: 0 0.75rem; }
  .site-footer { padding: 0.3rem 0.6rem; }
}

/* Small mobile */
@media (max-width: 480px) {
  .masthead { padding: 0.4rem 0.5rem 0.25rem; }
  .masthead-title { font-size: 1.9rem; }
  .masthead-date { font-size: 0.7rem; }
  .headline-main-title { font-size: 1.7rem; }
  .nav-link { font-size: 0.8rem; padding-left: 0.55rem; padding-right: 0.55rem; }
  .page-wrapper { padding: 0 0.65rem; }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .ticker-track { animation: none; padding-left: 0; }
}

/* ===========================================================
   Source Ratings page (/ratings)
   =========================================================== */
.masthead-title.ratings-title {
  font-family: var(--font-display); font-weight: 900;
  font-size: 2.5rem; letter-spacing: 0.01em;
}
.masthead-dragon-link {
  min-width: 2.75rem; min-height: 2.75rem;
  display: inline-flex; align-items: center; justify-content: center;
  text-decoration: none;
  transition: var(--transition);
  border-radius: 2px;
}
.masthead-dragon-link:hover .masthead-dragon {
  opacity: 1; filter: sepia(1) brightness(0.6);
}
[data-theme="dark"] .masthead-dragon-link:hover .masthead-dragon {
  filter: sepia(1) brightness(1.5) invert(1);
}

.week-nav {
  display: flex; align-items: center; justify-content: center;
  gap: 0.75rem; margin: 1rem 0 1.25rem;
  font-family: var(--font-body); font-size: 0.95rem;
}
.week-nav-btn {
  background: none; border: 1px solid var(--rule-light);
  font-family: var(--font-body); font-size: 1rem;
  color: var(--ink); cursor: pointer;
  padding: 0.2rem 0.7rem; border-radius: 2px;
  transition: var(--transition); line-height: 1;
}
.week-nav-btn:hover:not(:disabled) {
  color: var(--accent); border-color: var(--accent);
}
.week-nav-btn:disabled {
  opacity: 0.35; cursor: not-allowed;
}
.week-nav-label {
  color: var(--ink); font-weight: 600;
  letter-spacing: 0.02em; min-width: 14rem; text-align: center;
}

.ratings-table {
  width: 100%; max-width: 880px; margin: 0 auto;
  border-collapse: collapse;
  font-family: var(--font-body); font-size: 0.95rem;
  color: var(--ink-mid);
}
.ratings-table thead th {
  font-family: var(--font-display);
  font-weight: 600; font-size: 0.85rem;
  text-transform: uppercase; letter-spacing: 0.06em;
  color: var(--ink-faint);
  padding: 0.5rem 0.6rem;
  border-bottom: 2px solid var(--rule);
  text-align: left; white-space: nowrap;
}
.ratings-table thead th.sortable {
  cursor: pointer; user-select: none;
}
.ratings-table thead th.sortable:hover {
  color: var(--ink);
}
.ratings-table tbody td {
  padding: 0.55rem 0.6rem;
  border-bottom: 1px solid var(--rule-light);
  vertical-align: middle;
}
.ratings-table tbody tr:hover td {
  background: var(--paper-dark);
}
.ratings-rank {
  width: 2.5rem; color: var(--ink-faint);
  font-weight: 600; text-align: right;
}
.ratings-name a {
  color: var(--ink); text-decoration: none;
  font-weight: 600; border-bottom: 1px dotted var(--rule-light);
}
.ratings-name a:hover {
  color: var(--accent); border-bottom-color: var(--accent);
}
.ratings-name .lang-badge { margin-left: 0.5rem; }
.ratings-num {
  text-align: right; font-variant-numeric: tabular-nums;
  white-space: nowrap;
}
.ratings-sum { color: var(--ink); font-weight: 700; }

@media (max-width: 600px) {
  .ratings-table { font-size: 0.85rem; }
  .ratings-table thead th,
  .ratings-table tbody td { padding: 0.4rem 0.35rem; }
  .week-nav-label { min-width: 0; font-size: 0.85rem; }
}
