:root {
  --bg: #070b14;
  --bg2: #0d1424;
  --panel: #111a2e;
  --line: rgba(148, 163, 184, 0.14);
  --text: #f1f5f9;
  --dim: #8b9bb4;
  --accent: #ef4444;
  --accent-dark: #b91c1c;
  --blue: #60a5fa;
}

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

html, body {
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  min-height: 100%;
}

body { padding-bottom: 32px; }

/* --- Masthead ---------------------------------------------------------- */
.masthead {
  background: linear-gradient(180deg, #0b1120 0%, #070b14 100%);
  border-bottom: 3px solid var(--accent);
  padding: 18px 16px 12px;
}

.masthead-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.brand { display: flex; align-items: center; gap: 12px; }

.brand-mark {
  width: 46px;
  height: 46px;
  display: grid;
  place-items: center;
  background: var(--accent);
  color: #fff;
  font-family: Georgia, "Times New Roman", serif;
  font-weight: 900;
  font-size: 20px;
  letter-spacing: -0.5px;
  border-radius: 4px;
  box-shadow: 0 0 24px rgba(239, 68, 68, 0.45);
}

.brand-text h1 {
  font-family: Georgia, "Times New Roman", serif;
  font-size: 21px;
  font-weight: 900;
  text-transform: uppercase;
  letter-spacing: 0.4px;
  line-height: 1.05;
}

.tagline {
  color: var(--dim);
  font-size: 11.5px;
  margin-top: 3px;
  letter-spacing: 0.3px;
}

.dateline {
  margin-top: 10px;
  color: var(--dim);
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 1.2px;
}

/* --- Categories -------------------------------------------------------- */
.nav-wrap {
  position: sticky;
  top: 0;
  z-index: 5;
  background: rgba(7, 11, 20, 0.92);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--line);
}

.categories {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  padding: 12px 16px 14px;
  scrollbar-width: thin;
  scrollbar-color: var(--accent) transparent;
  cursor: grab;
  user-select: none;
  -webkit-overflow-scrolling: touch;
  touch-action: pan-x;
}

.categories:active { cursor: grabbing; }

.categories::-webkit-scrollbar { height: 5px; }
.categories::-webkit-scrollbar-thumb { background: var(--accent); border-radius: 3px; }
.categories::-webkit-scrollbar-track { background: rgba(148, 163, 184, 0.15); }

.edge {
  position: absolute;
  top: 0;
  bottom: 6px;
  width: 36px;
  border: none;
  color: #fff;
  font-size: 20px;
  font-weight: 800;
  display: grid;
  place-items: center;
  cursor: pointer;
  z-index: 2;
  padding: 0;
}

.edge-l { left: 0; background: linear-gradient(90deg, var(--bg) 60%, transparent); }
.edge-r { right: 0; background: linear-gradient(270deg, var(--bg) 60%, transparent); }
.edge[hidden] { display: none; }

.chip {
  flex: 0 0 auto;
  background: var(--panel);
  color: var(--dim);
  border: 1px solid var(--line);
  font-size: 12.5px;
  font-weight: 700;
  padding: 7px 14px;
  border-radius: 999px;
  cursor: pointer;
  transition: all 0.15s ease;
}

.chip.active {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
}

/* --- Hero -------------------------------------------------------------- */
.hero { padding: 16px 16px 4px; }

.hero-card {
  position: relative;
  border-radius: 10px;
  overflow: hidden;
  cursor: pointer;
  border: 1px solid var(--line);
  min-height: 240px;
  display: flex;
  align-items: flex-end;
}

.hero-card img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.hero-card::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(180deg, rgba(7, 11, 20, 0) 30%, rgba(7, 11, 20, 0.92) 85%);
}

.hero-content {
  position: relative;
  z-index: 1;
  padding: 18px;
}

.kicker {
  display: inline-block;
  background: var(--accent);
  color: #fff;
  font-size: 10.5px;
  font-weight: 900;
  letter-spacing: 1.4px;
  text-transform: uppercase;
  padding: 4px 9px;
  border-radius: 3px;
  margin-bottom: 10px;
}

.hero-content h2 {
  font-family: Georgia, "Times New Roman", serif;
  font-size: 23px;
  font-weight: 800;
  line-height: 1.18;
}

.hero-content .meta { margin-top: 8px; }

.meta { color: var(--dim); font-size: 12px; display: flex; gap: 8px; align-items: center; }
.meta .dot { width: 3px; height: 3px; border-radius: 50%; background: var(--dim); }

/* --- Grid -------------------------------------------------------------- */
.grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  padding: 12px 16px;
}

.card {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 10px;
  overflow: hidden;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  transition: transform 0.15s ease, border-color 0.15s ease;
}

.card:active { transform: scale(0.98); border-color: rgba(239, 68, 68, 0.5); }

.card:nth-child(4n + 1) { grid-column: span 2; flex-direction: row; }
.card:nth-child(4n + 1) .card-media { width: 42%; height: auto; }

.card-media { width: 100%; height: 110px; overflow: hidden; flex: 0 0 auto; }

.card-media img { width: 100%; height: 100%; object-fit: cover; display: block; }

.card-body { padding: 12px; display: flex; flex-direction: column; gap: 8px; }

.card-cat {
  color: var(--accent);
  font-size: 10px;
  font-weight: 900;
  letter-spacing: 1.2px;
  text-transform: uppercase;
}

.card h3 {
  font-size: 14.5px;
  font-weight: 700;
  line-height: 1.3;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

/* --- Load state -------------------------------------------------------- */
.loadstate {
  text-align: center;
  color: var(--dim);
  padding: 48px 16px;
  font-size: 14px;
}

/* --- Article overlay --------------------------------------------------- */
.article-overlay {
  position: fixed;
  inset: 0;
  background: var(--bg);
  z-index: 50;
  overflow-y: auto;
  transform: translateX(100%);
  transition: transform 0.22s ease;
}

.article-overlay.open { transform: translateX(0); }

.article-close {
  position: sticky;
  top: 0;
  z-index: 2;
  background: rgba(7, 11, 20, 0.9);
  backdrop-filter: blur(8px);
  color: var(--text);
  border: none;
  border-bottom: 1px solid var(--line);
  width: 100%;
  text-align: left;
  font-size: 15px;
  font-weight: 700;
  padding: 14px 16px;
  cursor: pointer;
}

.article-media { width: 100%; height: 230px; }
.article-media img { width: 100%; height: 100%; object-fit: cover; }

.article-body { padding: 20px 18px 40px; }

.article-kicker {
  color: var(--accent);
  font-size: 11px;
  font-weight: 900;
  letter-spacing: 1.4px;
  text-transform: uppercase;
  margin-bottom: 10px;
}

.article-body h2 {
  font-family: Georgia, "Times New Roman", serif;
  font-size: 25px;
  line-height: 1.2;
  font-weight: 800;
}

.article-meta { color: var(--dim); font-size: 12.5px; margin: 12px 0 16px; }

.article-body p { color: #cbd5e1; font-size: 15.5px; line-height: 1.65; }

.article-actions { display: flex; gap: 10px; margin-top: 24px; }

.btn {
  flex: 1;
  text-align: center;
  text-decoration: none;
  font-size: 14.5px;
  font-weight: 800;
  padding: 14px;
  border-radius: 8px;
  border: none;
  cursor: pointer;
}

.btn-primary { background: var(--accent); color: #fff; }
.btn-ghost { background: var(--panel); color: var(--text); border: 1px solid var(--line); }
