/* news.pxlfrg.com — readable body type, mono "chrome" for chips/nav/buttons.
   Visual chassis still matched to nrg.pxlfrg.com. */

:root {
  --font-body: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI",
               Roboto, "Helvetica Neue", Arial, sans-serif;
  --font-mono: "Share Tech Mono", ui-monospace, SFMono-Regular, Menlo, monospace;
  --bg: #0f1115;
  --bg-2: #17191b;
  --bg-card: #0f1113;
  --border: rgba(255,255,255,0.1);
  --border-strong: rgba(255,255,255,0.22);
  --text: #d8d8d8;
  --text-strong: #efefef;
  --text-muted: #9a9a9a;
  --text-dim: #7d7d7d;
  --accent-breaking: #ff6b6b;
}

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

body {
  font-family: var(--font-body);
  background: linear-gradient(135deg, #1a1d21 0%, #0f1115 100%);
  color: var(--text);
  line-height: 1.6;
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

a { color: inherit; text-decoration: none; }
a:hover { color: #fff; }

.container {
  max-width: 1400px;
  margin: 0 auto;
  padding: 20px;
}

/* ---- header ---- */
header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 20px;
  margin-bottom: 40px;
  padding-bottom: 20px;
  border-bottom: 1px solid var(--border);
}

header h1 {
  font-family: var(--font-mono);
  font-size: 1.6em;
  color: var(--text-strong);
  letter-spacing: 1px;
  text-shadow: 0 0 20px rgba(255,255,255,0.1);
}

.topnav { display: flex; gap: 6px; flex-wrap: wrap; }
.nav-link {
  font-family: var(--font-mono);
  padding: 8px 16px;
  background: rgba(255,255,255,0.03);
  border: 1px solid var(--border);
  border-radius: 2px;
  text-transform: uppercase;
  letter-spacing: 1px;
  font-size: 0.85em;
  color: var(--text);
  transition: all 0.2s ease;
}
.nav-link:hover { background: rgba(255,255,255,0.06); color: #fff; }
.nav-link.active {
  background: rgba(255,255,255,0.08);
  color: #fff;
  border-color: var(--border-strong);
}

/* ---- sections ---- */
main { display: flex; flex-direction: column; gap: 40px; }

.section {
  border: 1px solid var(--border);
  background: var(--bg-2);
  padding: 20px;
  border-radius: 2px;
}

.section h2 {
  font-family: var(--font-mono);
  font-size: 1.2em;
  font-weight: 400;
  color: var(--text);
  margin-bottom: 20px;
  text-transform: uppercase;
  letter-spacing: 2px;
  border-bottom: 1px solid rgba(255,255,255,0.05);
  padding-bottom: 10px;
}

.section h2 .count {
  color: var(--text-dim);
  font-size: 0.85em;
  letter-spacing: 1px;
  margin-left: 6px;
}

.section-breaking {
  border-color: rgba(255,107,107,0.35);
  background:
    linear-gradient(180deg, rgba(255,107,107,0.06), rgba(255,107,107,0) 70%),
    var(--bg-2);
}
.section-breaking h2 {
  color: var(--accent-breaking);
  border-bottom-color: rgba(255,107,107,0.2);
}

/* ---- chips / filters ---- */
.filters { display: flex; gap: 8px; flex-wrap: wrap; }
.chip {
  font-family: var(--font-mono);
  padding: 6px 14px;
  background: rgba(255,255,255,0.03);
  border: 1px solid var(--border);
  border-radius: 2px;
  font-size: 0.85em;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: var(--text);
  transition: all 0.2s ease;
}
.chip:hover { background: rgba(255,255,255,0.06); color: #fff; }
.chip-active {
  background: rgba(255,255,255,0.1);
  color: #fff;
  border-color: rgba(255,255,255,0.3);
}

/* ---- card grid ---- */
.cards {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: 20px;
}

.card {
  border: 1px solid var(--border);
  background: var(--bg-card);
  border-radius: 2px;
  display: flex;
  flex-direction: column;
  position: relative;
  overflow: hidden;
  transition: all 0.2s ease;
}

.card::before {
  content: "";
  position: absolute;
  inset: 0;
  background:
    linear-gradient(rgba(255,255,255,0.03) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255,255,255,0.02) 1px, transparent 1px);
  background-size: 20px 20px;
  pointer-events: none;
  opacity: 0.4;
}

.card:hover {
  border-color: var(--border-strong);
  background: #13151a;
  box-shadow: 0 0 20px rgba(255,255,255,0.05);
}

.card-breaking {
  border-color: rgba(255,107,107,0.35);
}
.card-breaking:hover {
  border-color: rgba(255,107,107,0.6);
  box-shadow: 0 0 20px rgba(255,107,107,0.1);
}

/* thumbnails */
.card-thumb {
  display: block;
  width: 100%;
  aspect-ratio: 16 / 9;
  background: #0a0c0f;
  overflow: hidden;
  position: relative;
  z-index: 1;
  border-bottom: 1px solid rgba(255,255,255,0.06);
}
.card-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  transition: transform 0.4s ease;
}
.card:hover .card-thumb img { transform: scale(1.03); }

.card-thumb.thumb-fallback {
  display: flex;
  align-items: center;
  justify-content: center;
  background:
    linear-gradient(rgba(255,255,255,0.03) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255,255,255,0.02) 1px, transparent 1px),
    linear-gradient(135deg, #15181c 0%, #0a0c0f 100%);
  background-size: 20px 20px, 20px 20px, 100% 100%;
}
.thumb-placeholder {
  font-family: var(--font-mono);
  font-size: 3em;
  color: rgba(255,255,255,0.18);
  letter-spacing: 4px;
}

.card-body {
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  position: relative;
  z-index: 1;
  flex: 1;
}

.card-meta {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  font-family: var(--font-mono);
  font-size: 0.72em;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: var(--text-muted);
}
.card-meta .src { color: #a8a8a8; }
.card-meta .dot { opacity: 0.4; }
.card-meta .time { color: var(--text-dim); }

.card-title {
  font-family: var(--font-body);
  font-size: 1.05em;
  font-weight: 600;
  color: var(--text-strong);
  line-height: 1.35;
  letter-spacing: -0.01em;
}
.card-title a { color: var(--text-strong); }
.card-title a:hover { color: #fff; }

.card-summary {
  font-family: var(--font-body);
  color: #b3b3b3;
  font-size: 0.92em;
  line-height: 1.55;
}

.card-actions {
  margin-top: auto;
  display: flex;
  gap: 8px;
  align-items: center;
  padding-top: 8px;
  flex-wrap: wrap;
}

/* tags */
.tag {
  font-family: var(--font-mono);
  padding: 2px 8px;
  border: 1px solid rgba(255,255,255,0.15);
  border-radius: 2px;
  background: rgba(255,255,255,0.04);
  color: #d0d0d0;
  font-size: 0.95em;
  text-transform: uppercase;
  letter-spacing: 1px;
}
.tag-space    { border-color: rgba(120,180,255,0.4); color: #b8d4ff; }
.tag-ai       { border-color: rgba(180,140,255,0.4); color: #d8c8ff; }
.tag-tech     { border-color: rgba(140,220,200,0.4); color: #c0eadc; }
.tag-gaming   { border-color: rgba(255,200,120,0.4); color: #ffdcaa; }
.tag-politics { border-color: rgba(255,160,160,0.4); color: #ffc8c8; }
.tag-breaking {
  border-color: rgba(255,107,107,0.6);
  color: #ffd0d0;
  background: rgba(255,107,107,0.12);
  animation: pulse 2.5s ease-in-out infinite;
}
@keyframes pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.7; }
}

.chip-space { border-color: rgba(120,180,255,0.4); }
.chip-ai { border-color: rgba(180,140,255,0.4); }
.chip-tech { border-color: rgba(140,220,200,0.4); }
.chip-gaming { border-color: rgba(255,200,120,0.4); }
.chip-politics { border-color: rgba(255,160,160,0.4); }

/* buttons */
.btn {
  font-family: var(--font-mono);
  padding: 6px 12px;
  background: rgba(255,255,255,0.04);
  border: 1px solid rgba(255,255,255,0.15);
  color: var(--text);
  font-size: 0.8em;
  text-transform: uppercase;
  letter-spacing: 1px;
  cursor: pointer;
  border-radius: 2px;
  transition: all 0.2s ease;
}
.btn:hover { background: rgba(255,255,255,0.1); color: #fff; }
.btn-link { background: transparent; }
.btn-saved { background: rgba(255,220,140,0.08); color: #ffdcaa; border-color: rgba(255,220,140,0.4); }
.btn-saved:hover { background: rgba(255,220,140,0.16); color: #fff; }

form.inline { display: inline; margin: 0; padding: 0; }

/* article detail page */
.article-detail { max-width: 760px; margin: 0 auto; }
.article-title {
  font-family: var(--font-body);
  font-size: 2em;
  font-weight: 700;
  letter-spacing: -0.02em;
  color: var(--text-strong);
  margin: 14px 0 18px;
  line-height: 1.2;
}
.article-actions {
  display: flex;
  align-items: center;
  gap: 14px;
  flex-wrap: wrap;
  margin-bottom: 24px;
}
.source-link {
  font-family: var(--font-mono);
  font-size: 0.78em;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: var(--text-dim);
}
.source-link:hover { color: #fff; }

.article-image {
  display: block;
  max-width: 100%;
  height: auto;
  margin: 0 0 24px;
  border: 1px solid rgba(255,255,255,0.08);
  border-radius: 2px;
}
.article-summary {
  color: #c4c4c4;
  margin: 16px 0;
  font-size: 1.05em;
  line-height: 1.7;
}

/* The extracted article body. Generous spacing, sans serif, easy to read. */
.article-body {
  font-family: var(--font-body);
  color: #d8d8d8;
  font-size: 1.05em;
  line-height: 1.75;
}
.article-body > * + * { margin-top: 1em; }
.article-body p { margin: 0 0 1em; }
.article-body p:last-child { margin-bottom: 0; }
.article-body h1, .article-body h2, .article-body h3,
.article-body h4, .article-body h5, .article-body h6 {
  font-family: var(--font-body);
  font-weight: 700;
  color: var(--text-strong);
  margin-top: 1.6em;
  margin-bottom: 0.6em;
  line-height: 1.3;
  letter-spacing: -0.01em;
}
.article-body h2 { font-size: 1.4em; }
.article-body h3 { font-size: 1.2em; }
.article-body h4 { font-size: 1.05em; }
.article-body a {
  color: #b8d4ff;
  text-decoration: underline;
  text-decoration-color: rgba(184,212,255,0.4);
  text-underline-offset: 2px;
}
.article-body a:hover { color: #fff; text-decoration-color: #fff; }
.article-body img,
.article-body figure {
  max-width: 100%;
  height: auto;
  margin: 1.5em auto;
  display: block;
  border-radius: 2px;
  border: 1px solid rgba(255,255,255,0.06);
}
.article-body figure { border: none; }
.article-body figure img { margin: 0; }
.article-body figcaption {
  font-size: 0.85em;
  color: var(--text-dim);
  text-align: center;
  margin-top: 0.4em;
  font-style: italic;
}
.article-body blockquote {
  margin: 1.4em 0;
  padding: 0.4em 1.2em;
  border-left: 3px solid rgba(255,255,255,0.2);
  color: #c4c4c4;
  font-style: italic;
}
.article-body ul,
.article-body ol {
  margin: 0 0 1em 1.6em;
  padding: 0;
}
.article-body li { margin: 0.3em 0; }
.article-body pre,
.article-body code {
  font-family: var(--font-mono);
  background: rgba(255,255,255,0.05);
  border: 1px solid rgba(255,255,255,0.08);
  border-radius: 2px;
}
.article-body code { padding: 1px 5px; font-size: 0.92em; }
.article-body pre { padding: 12px 14px; overflow-x: auto; }
.article-body pre code { background: none; border: none; padding: 0; }
.article-body hr {
  border: 0;
  border-top: 1px solid rgba(255,255,255,0.1);
  margin: 2em 0;
}
.article-body table {
  width: 100%;
  border-collapse: collapse;
  margin: 1em 0;
  font-size: 0.95em;
}
.article-body th,
.article-body td {
  border: 1px solid rgba(255,255,255,0.1);
  padding: 8px 10px;
  text-align: left;
}
.article-body th { background: rgba(255,255,255,0.04); }

/* notice */
.info-notice {
  background: rgba(255,255,255,0.03);
  border: 1px solid var(--border);
  padding: 20px;
  border-radius: 2px;
  margin-top: 16px;
}
.info-notice p { color: var(--text-muted); font-size: 0.95em; line-height: 1.7; }
.info-notice p + p { margin-top: 10px; }
.info-notice code {
  font-family: var(--font-mono);
  background: rgba(255,255,255,0.05);
  border: 1px solid rgba(255,255,255,0.08);
  padding: 2px 6px;
  border-radius: 2px;
  font-size: 0.9em;
}

/* footer */
footer {
  text-align: center;
  padding-top: 40px;
  margin-top: 40px;
  border-top: 1px solid var(--border);
  color: var(--text-dim);
  font-size: 0.85em;
  font-family: var(--font-mono);
}
footer p { margin: 5px 0; }

/* --- scroll fade-in ---
   Scoped under html.js so elements stay visible when JavaScript is off.
   The inline script in <head> sets html.js synchronously *before first paint*,
   so the elements start hidden and never flash visible-then-invisible. */
.js .fade-in {
  opacity: 0;
  transform: translateY(16px);
  transition: opacity 0.5s ease, transform 0.5s ease;
  will-change: opacity, transform;
}
.js .fade-in.visible {
  opacity: 1;
  transform: none;
}
@media (prefers-reduced-motion: reduce) {
  .js .fade-in { transition: none; opacity: 1; transform: none; }
}

/* --- responsive --- */
@media (max-width: 768px) {
  header { flex-direction: column; align-items: flex-start; gap: 12px; }
  header h1 { font-size: 1.3em; }
  .topnav { width: 100%; }
  .cards { grid-template-columns: 1fr; }
  .article-detail { max-width: none; }
  .article-title { font-size: 1.45em; line-height: 1.25; }
  .article-body { font-size: 1em; }

  /* tighter article header on phones */
  .article-actions { gap: 10px; row-gap: 10px; margin-bottom: 18px; }
  .source-link { font-size: 0.72em; word-break: break-word; }

  /* keep extracted images and embeds within the viewport */
  .article-body img,
  .article-body figure { margin: 1.2em -8px; max-width: calc(100% + 16px); }
  .article-body table { display: block; overflow-x: auto; }
}
