/* ── Reset ── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
body { font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif; font-size: 15px; line-height: 1.5; }
a { text-decoration: none; color: inherit; }
img { display: block; max-width: 100%; }

/* ── Colour tokens ── */
:root {
  --red: #c0392b;
  --red-dark: #962d22;
  --img-size: 160px;
  --text-scale: 1;
}
body.dark {
  --bg:      #111111;
  --bg2:     #1c1c1e;
  --bg3:     #2a2a2c;
  --text:    #f0f0f0;
  --text2:   #999999;
  --border:  rgba(255,255,255,0.1);
  --nav-bg:  #0a0a0a;
}
body.light {
  --bg:      #ffffff;
  --bg2:     #f5f5f7;
  --bg3:     #e8e8ea;
  --text:    #111111;
  --text2:   #666666;
  --border:  rgba(0,0,0,0.1);
  --nav-bg:  #fafafa;
}

/* ── Layout shell ── */
body { background: var(--bg); color: var(--text); min-height: 100vh; }

/* ── Nav ── */
.nav {
  background: var(--nav-bg);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 100;
}

/* Top row: logo + search */
.nav-top {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 10px 20px 8px;
  border-bottom: 1px solid var(--border);
}
.nav-logo {
  font-size: 17px;
  font-weight: 700;
  color: var(--text);
  white-space: nowrap;
  letter-spacing: -0.3px;
}
.nav-logo em { color: var(--red); font-style: normal; }

.nav-search {
  display: flex;
  align-items: center;
  gap: 8px;
  background: var(--bg2);
  border: 1px solid var(--border);
  border-radius: 22px;
  padding: 7px 6px 7px 14px;
  flex: 1;
  max-width: 480px;
}
.nav-search input {
  background: none;
  border: none;
  outline: none;
  font-size: 13px;
  color: var(--text);
  width: 100%;
}
.nav-search input::placeholder { color: var(--text2); }
.nav-search > svg { flex-shrink: 0; color: var(--text2); width: 15px; height: 15px; }
.nav-search-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  background: var(--red);
  border: none;
  border-radius: 50%;
  color: #fff;
  cursor: pointer;
  flex-shrink: 0;
}
.nav-search-btn:hover { background: var(--red-dark); }

/* Bottom row: controls */
.nav-bottom {
  display: flex;
  align-items: center;
  gap: 20px;
  padding: 6px 20px;
}
.nav-group {
  display: flex;
  align-items: center;
  gap: 8px;
}
.nav-label {
  font-size: 11px;
  color: var(--text2);
  font-weight: 500;
  white-space: nowrap;
}
.nav-slider-wrap {
  display: flex;
  align-items: center;
  gap: 6px;
  color: var(--text2);
}
.nav-slider-wrap input[type=range] {
  width: 100px;
  accent-color: var(--red);
  cursor: pointer;
}

/* layout pills */
.layout-pills {
  display: flex;
  border: 1px solid var(--border);
  border-radius: 20px;
  overflow: hidden;
}
.lp {
  display: flex;
  align-items: center;
  gap: 5px;
  padding: 5px 12px;
  font-size: 12px;
  color: var(--text2);
  cursor: pointer;
  user-select: none;
  transition: background 0.15s;
}
.lp svg { width: 14px; height: 14px; }
.lp.active { background: var(--bg3); color: var(--text); }
.lp:hover:not(.active) { background: var(--bg2); }

/* theme button */
.theme-wrap { position: relative; }
.theme-btn {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 5px 12px;
  font-size: 12px;
  color: var(--text2);
  border: 1px solid var(--border);
  border-radius: 20px;
  background: var(--bg2);
  cursor: pointer;
  user-select: none;
}
.theme-btn svg { width: 14px; height: 14px; }
.theme-drop {
  display: none;
  position: absolute;
  right: 0;
  top: calc(100% + 6px);
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 10px;
  overflow: hidden;
  min-width: 120px;
  z-index: 200;
}
.theme-drop.open { display: block; }
.theme-opt {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 9px 14px;
  font-size: 13px;
  color: var(--text);
  cursor: pointer;
}
.theme-opt:hover { background: var(--bg2); }
.theme-opt.selected { color: var(--red); }
.theme-opt svg { width: 15px; height: 15px; color: var(--text2); }
.theme-opt.selected svg { color: var(--red); }

/* ── Ticker ── */
.ticker {
  background: var(--red);
  padding: 5px 20px;
  font-size: 11px;
  color: rgba(255,255,255,0.92);
  white-space: nowrap;
  overflow: hidden;
  letter-spacing: 0.2px;
}
.ticker-inner {
  display: inline-block;
  animation: scroll 40s linear infinite;
}
@keyframes scroll {
  0%   { transform: translateX(0); }
  100% { transform: translateX(-50%); }
}

/* ════════════════════════════════════════
   SIDEBAR LAYOUT
════════════════════════════════════════ */
.sidebar-view { display: none; }
.sidebar-view.active { display: grid; grid-template-columns: 210px 1fr; min-height: calc(100vh - 96px); }

.sb-nav {
  border-right: 1px solid var(--border);
  padding: 18px 14px;
  position: sticky;
  top: 96px;
  height: calc(100vh - 96px);
  overflow-y: auto;
}
.sb-nav h5 {
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.8px;
  color: var(--text2);
  font-weight: 600;
  margin-bottom: 8px;
}
.sb-item {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 7px 9px;
  border-radius: 8px;
  font-size: 13px;
  color: var(--text2);
  margin-bottom: 2px;
  cursor: pointer;
  transition: background 0.12s;
}
.sb-item svg { width: 15px; height: 15px; flex-shrink: 0; }
.sb-item:hover { background: var(--bg2); color: var(--text); }
.sb-item.active { background: var(--bg2); color: var(--text); font-weight: 500; }

.sb-sources { margin-top: 18px; }
.sb-source {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 12px;
  color: var(--text2);
  padding: 5px 0;
  border-bottom: 1px solid var(--border);
  cursor: pointer;
}
.sb-source:hover { color: var(--text); }
.sb-source .ct {
  font-size: 10px;
  background: var(--bg3);
  padding: 1px 7px;
  border-radius: 10px;
}

/* Article list */
.sb-main { padding: 20px 24px; }
.date-header {
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.6px;
  color: var(--text2);
  padding-bottom: 10px;
  border-bottom: 1px solid var(--border);
  margin-bottom: 14px;
  margin-top: 6px;
}

/* Card with image */
.article-card {
  display: flex;
  gap: 14px;
  margin-bottom: 14px;
  padding-bottom: 14px;
  border-bottom: 1px solid var(--border);
}
.article-card:last-child { border: none; }

.article-thumb {
  width: var(--img-size, 160px);
  height: calc(var(--img-size, 160px) * 0.65);
  border-radius: 6px;
  flex-shrink: 0;
  object-fit: cover;
  background: var(--bg3);
}
.article-thumb-ph {
  width: var(--img-size, 160px);
  height: calc(var(--img-size, 160px) * 0.65);
  border-radius: 6px;
  background: var(--bg3);
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--border);
}

/* Card text-only (no image) */
.article-card-text {
  margin-bottom: 14px;
  padding-bottom: 14px;
  border-bottom: 1px solid var(--border);
  padding-left: 10px;
  border-left: 3px solid var(--border);
}
.article-card-text:last-child { border-bottom: none; }

.article-body { flex: 1; min-width: 0; }
.article-body h3 {
  font-size: calc(14px * var(--text-scale));
  font-weight: 500;
  color: var(--text);
  line-height: 1.4;
  margin-bottom: 5px;
}
.article-body h3 a:hover { color: var(--red); }
.article-card-text h3 {
  font-size: calc(14px * var(--text-scale));
  font-weight: 500;
  color: var(--text);
  line-height: 1.4;
  margin-bottom: 5px;
}
.article-card-text h3 a:hover { color: var(--red); }

.article-excerpt {
  font-size: calc(12px * var(--text-scale));
  color: var(--text2);
  line-height: 1.5;
  margin-bottom: 6px;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.article-meta {
  font-size: 11px;
  color: var(--text2);
  display: flex;
  gap: 6px;
  align-items: center;
  flex-wrap: wrap;
}
.article-meta .src { color: var(--red); font-weight: 600; }
.cat-badge {
  font-size: 10px;
  padding: 2px 7px;
  border-radius: 10px;
  background: var(--bg3);
  color: var(--text2);
}

/* ════════════════════════════════════════
   MAGAZINE LAYOUT
════════════════════════════════════════ */
.mag-view { display: none; }
.mag-view.active { display: block; }

/* Hero band — full-width, image fills left panel */
.mag-hero {
  display: grid;
  grid-template-columns: 1fr 340px;
  min-height: 340px;
  border-bottom: 1px solid var(--border);
}

/* Left hero panel */
.mag-main {
  position: relative;
  overflow: hidden;
  background: var(--bg2);
  min-height: 340px;
}
.mag-hero-img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
}
.mag-hero-overlay {
  position: absolute;
  inset: 0;
  background: linear-gradient(to top, rgba(0,0,0,0.88) 0%, rgba(0,0,0,0.35) 50%, rgba(0,0,0,0.08) 100%);
}
/* no-image hero: subtle gradient brand */
.mag-hero-no-img {
  position: absolute;
  inset: 0;
  background: linear-gradient(135deg, #1a0000 0%, #2d0a0a 40%, #1c1c1e 100%);
}
.mag-hero-no-img::after {
  content: '';
  position: absolute;
  inset: 0;
  background: repeating-linear-gradient(
    45deg,
    transparent,
    transparent 40px,
    rgba(192,57,43,0.04) 40px,
    rgba(192,57,43,0.04) 80px
  );
}
.mag-hero-text {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  padding: 28px 28px 24px;
}
.mag-tag {
  display: inline-block;
  font-size: 10px;
  font-weight: 700;
  color: #fff;
  background: var(--red);
  text-transform: uppercase;
  letter-spacing: 1px;
  padding: 3px 9px;
  border-radius: 4px;
  margin-bottom: 10px;
}
.mag-main h2 {
  font-size: 22px;
  font-weight: 700;
  color: #fff;
  line-height: 1.3;
  margin-bottom: 10px;
  text-shadow: 0 1px 4px rgba(0,0,0,0.5);
}
.mag-main h2 a:hover { color: rgba(255,255,255,0.8); }

/* Right panel: stacked recent articles */
.mag-side {
  border-left: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  background: var(--bg);
}
.mag-side-header {
  padding: 14px 16px 10px;
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.8px;
  color: var(--text2);
  border-bottom: 1px solid var(--border);
}
.mag-si {
  display: flex;
  gap: 12px;
  padding: 14px 16px;
  border-bottom: 1px solid var(--border);
  align-items: flex-start;
  flex: 1;
}
.mag-si:last-child { border-bottom: none; }
.mag-si-img {
  width: 72px;
  height: 52px;
  border-radius: 5px;
  object-fit: cover;
  flex-shrink: 0;
  background: var(--bg3);
}
.mag-si-img-ph {
  width: 72px;
  height: 52px;
  border-radius: 5px;
  background: var(--bg3);
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--border);
}
.mag-si h4 {
  font-size: calc(13px * var(--text-scale));
  font-weight: 500;
  color: var(--text);
  line-height: 1.35;
  margin-bottom: 5px;
}
.mag-si h4 a:hover { color: var(--red); }

/* Grid of cards below hero */
.mag-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1px;
  background: var(--border);
  border-top: 1px solid var(--border);
}
.mag-card {
  background: var(--bg);
  padding: 18px 16px;
}
.mag-card-img {
  height: var(--img-size, 160px);
  border-radius: 6px;
  object-fit: cover;
  width: 100%;
  background: var(--bg3);
  margin-bottom: 12px;
}
.mag-card-img-ph {
  height: 140px;
  border-radius: 6px;
  background: var(--bg3);
  margin-bottom: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--border);
}
.mag-card h4 {
  font-size: calc(14px * var(--text-scale));
  font-weight: 600;
  color: var(--text);
  line-height: 1.4;
  margin-bottom: 6px;
}
.mag-card h4 a:hover { color: var(--red); }
.mag-card-tag {
  font-size: 10px;
  font-weight: 700;
  color: var(--red);
  text-transform: uppercase;
  letter-spacing: 0.8px;
  margin-bottom: 6px;
}

/* More articles list below grid */
.mag-more {
  padding: 20px 24px;
  border-top: 1px solid var(--border);
}
.mag-more-header {
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.8px;
  color: var(--text2);
  margin-bottom: 14px;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--border);
}
.mag-more-item {
  display: flex;
  gap: 12px;
  padding: 10px 0;
  border-bottom: 1px solid var(--border);
  align-items: center;
}
.mag-more-item:last-child { border: none; }
.mag-more-img {
  width: 80px;
  height: 54px;
  border-radius: 5px;
  object-fit: cover;
  flex-shrink: 0;
  background: var(--bg3);
}
.mag-more-img-ph {
  width: 80px;
  height: 54px;
  border-radius: 5px;
  background: var(--bg3);
  flex-shrink: 0;
}
.mag-more-item h5 {
  font-size: calc(13px * var(--text-scale));
  font-weight: 500;
  color: var(--text);
  line-height: 1.35;
  margin-bottom: 4px;
}
.mag-more-item h5 a:hover { color: var(--red); }

/* ── Shared meta ── */
.meta-line {
  font-size: 11px;
  color: var(--text2);
  display: flex;
  gap: 6px;
  align-items: center;
  flex-wrap: wrap;
}
.meta-line .src { color: var(--red); font-weight: 600; }
body.dark .meta-line .src { color: #e06050; }

/* hero meta: white on dark overlay */
.mag-hero-text .meta-line { color: rgba(255,255,255,0.65); }
.mag-hero-text .meta-line .src { color: rgba(255,255,255,0.85); }

/* ── Empty / pagination ── */
.empty {
  padding: 60px 20px;
  text-align: center;
  color: var(--text2);
}
.pagination {
  display: flex;
  gap: 6px;
  align-items: center;
  justify-content: center;
  padding: 24px;
}
.page-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 34px;
  height: 34px;
  border-radius: 8px;
  font-size: 13px;
  border: 1px solid var(--border);
  color: var(--text2);
  background: var(--bg2);
  cursor: pointer;
}
.page-btn:hover { background: var(--bg3); color: var(--text); }
.page-btn.active { background: var(--red); color: #fff; border-color: var(--red); }
.page-btn.disabled { opacity: 0.4; pointer-events: none; }

/* ── Scrollbar ── */
::-webkit-scrollbar { width: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--bg3); border-radius: 3px; }
