/* ── Reset & Base ─────────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --black: #0a0a0a;
  --ink: #1a1a1a;
  --mid: #555;
  --light: #888;
  --rule: #ddd;
  --bg: #f8f7f4;
  --white: #fff;
  --red: #c41230;
  --blue: #0057a8;
  --orange: #e67e00;
  --green: #2e8b57;
  --purple: #7c3aed;
  --serif: Georgia, 'Times New Roman', serif;
  --sans: -apple-system, BlinkMacSystemFont, 'Segoe UI', Helvetica, Arial, sans-serif;
  --max: 1240px;
}

body {
  font-family: var(--sans);
  background: var(--bg);
  color: var(--ink);
  line-height: 1.5;
  font-size: 15px;
}

a { color: inherit; text-decoration: none; }
a:hover { color: var(--red); }
img { max-width: 100%; display: block; }

/* ── Masthead ─────────────────────────────────────────────────────────── */
.site-header {
  background: var(--black);
  border-bottom: 3px solid var(--red);
}

.masthead {
  max-width: var(--max);
  margin: 0 auto;
  padding: 20px 24px 16px;
  text-align: center;
  border-bottom: 1px solid #2a2a2a;
}

.site-title-link { text-decoration: none; }

.site-title {
  font-family: var(--serif);
  font-size: clamp(28px, 5vw, 52px);
  font-weight: 700;
  letter-spacing: 0.06em;
  color: var(--white);
  line-height: 1;
}

.site-tagline {
  font-size: 12px;
  color: #999;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  margin-top: 6px;
}

/* ── Category Nav ─────────────────────────────────────────────────────── */
.category-nav {
  max-width: var(--max);
  margin: 0 auto;
  padding: 0 24px;
  display: flex;
  gap: 0;
  overflow-x: auto;
  scrollbar-width: none;
}
.category-nav::-webkit-scrollbar { display: none; }

.cat-btn {
  background: none;
  border: none;
  color: #bbb;
  font-family: var(--sans);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  padding: 12px 16px;
  cursor: pointer;
  border-bottom: 2px solid transparent;
  white-space: nowrap;
  transition: color 0.15s, border-color 0.15s;
}
.cat-btn:hover { color: var(--white); }
.cat-btn.active { color: var(--white); border-bottom-color: var(--red); }

/* ── Breaking bar ─────────────────────────────────────────────────────── */
.breaking-bar {
  background: var(--red);
  color: var(--white);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  padding: 6px 24px;
  display: flex;
  gap: 16px;
  overflow: hidden;
}
.breaking-label { white-space: nowrap; }

/* ── Main Layout ──────────────────────────────────────────────────────── */
.page-wrap {
  max-width: var(--max);
  margin: 0 auto;
  padding: 0 24px;
}

.date-rule {
  border-top: 3px solid var(--ink);
  border-bottom: 1px solid var(--rule);
  padding: 8px 0;
  font-size: 12px;
  color: var(--light);
  letter-spacing: 0.05em;
  margin-top: 24px;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

/* ── Article Grid ─────────────────────────────────────────────────────── */
.article-grid {
  display: grid;
  grid-template-columns: 2fr 1fr 1fr;
  gap: 0;
  border-top: 1px solid var(--rule);
  margin-top: 0;
}

.art-card {
  padding: 20px;
  border-right: 1px solid var(--rule);
  border-bottom: 1px solid var(--rule);
  cursor: pointer;
  transition: background 0.1s;
}
.art-card:hover { background: rgba(196,18,48,0.03); }
.art-card:last-child, .art-card:nth-child(3n) { border-right: none; }

.art-card.featured {
  grid-column: 1;
  grid-row: 1 / 3;
  border-right: 1px solid var(--rule);
}

.art-card.medium {
  grid-column: 2;
}

.art-card.small {
  padding: 16px 20px;
}

/* ── Card internals ───────────────────────────────────────────────────── */
.cat-badge {
  display: inline-block;
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--white);
  padding: 2px 7px;
  border-radius: 2px;
  margin-bottom: 8px;
}

.art-img {
  width: 100%;
  aspect-ratio: 16/9;
  object-fit: cover;
  margin-bottom: 12px;
  display: block;
}

.art-img-placeholder {
  width: 100%;
  aspect-ratio: 16/9;
  background: linear-gradient(135deg, #e8e6e1 0%, #d4d0c8 100%);
  margin-bottom: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 36px;
  color: #bbb;
}

.art-title {
  font-family: var(--serif);
  font-weight: 700;
  line-height: 1.25;
  margin-bottom: 8px;
  color: var(--ink);
}

.featured .art-title { font-size: clamp(20px, 2.5vw, 28px); }
.medium .art-title { font-size: 18px; }
.small .art-title { font-size: 15px; }

.art-lead {
  font-size: 14px;
  color: var(--mid);
  line-height: 1.5;
  margin-bottom: 10px;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.featured .art-lead { -webkit-line-clamp: 4; font-size: 15px; }
.small .art-lead { -webkit-line-clamp: 2; }

.art-meta {
  font-size: 11px;
  color: var(--light);
  display: flex;
  gap: 12px;
  align-items: center;
}

.art-views::before { content: '👁 '; }

/* ── Section Header ───────────────────────────────────────────────────── */
.section-header {
  grid-column: 1 / -1;
  border-top: 3px solid var(--ink);
  border-bottom: 1px solid var(--rule);
  padding: 8px 20px;
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.15em;
  text-transform: uppercase;
  background: var(--white);
}

/* ── Modal ────────────────────────────────────────────────────────────── */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.75);
  z-index: 1000;
  overflow-y: auto;
  display: flex;
  align-items: flex-start;
  justify-content: center;
  padding: 40px 16px;
  backdrop-filter: blur(2px);
}
.modal-overlay[hidden] { display: none; }

.modal-box {
  background: var(--white);
  max-width: 760px;
  width: 100%;
  position: relative;
  border-top: 4px solid var(--red);
}

.modal-close-btn {
  position: absolute;
  top: 12px;
  right: 16px;
  background: none;
  border: none;
  font-size: 28px;
  cursor: pointer;
  color: var(--mid);
  line-height: 1;
  z-index: 10;
}
.modal-close-btn:hover { color: var(--ink); }

.modal-body { padding: 40px 48px 32px; }

/* ── Article Full (modal + page) ──────────────────────────────────────── */
.article-meta-top {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 16px;
  flex-wrap: wrap;
}

.art-date, .art-author {
  font-size: 12px;
  color: var(--light);
}

.article-full-title {
  font-family: var(--serif);
  font-size: clamp(22px, 3vw, 32px);
  font-weight: 700;
  line-height: 1.2;
  margin-bottom: 16px;
}

.article-full-lead {
  font-size: 17px;
  color: var(--mid);
  line-height: 1.6;
  border-left: 3px solid var(--red);
  padding-left: 16px;
  margin-bottom: 24px;
  font-style: italic;
}

.article-hero-img {
  width: 100%;
  max-height: 420px;
  object-fit: cover;
  margin-bottom: 28px;
}

.article-body {
  font-size: 16px;
  line-height: 1.75;
  color: var(--ink);
}

.article-body h2 {
  font-family: var(--serif);
  font-size: 20px;
  font-weight: 700;
  margin: 32px 0 12px;
  border-bottom: 1px solid var(--rule);
  padding-bottom: 8px;
}

.article-body h3 {
  font-family: var(--serif);
  font-size: 17px;
  font-weight: 700;
  margin: 24px 0 8px;
}

.article-body p { margin-bottom: 16px; }

.article-body blockquote {
  border-left: 4px solid var(--red);
  margin: 24px 0;
  padding: 12px 20px;
  background: #fafaf8;
  font-style: italic;
  font-size: 17px;
  color: var(--mid);
}

.article-body table {
  width: 100%;
  border-collapse: collapse;
  margin: 24px 0;
  font-size: 14px;
}
.article-body th {
  background: var(--ink);
  color: var(--white);
  padding: 10px 14px;
  text-align: left;
  font-weight: 700;
  font-size: 12px;
  letter-spacing: 0.05em;
  text-transform: uppercase;
}
.article-body td {
  padding: 10px 14px;
  border-bottom: 1px solid var(--rule);
}
.article-body tr:nth-child(even) td { background: #f8f7f4; }
.article-body tr:hover td { background: #f0eee8; }

.article-body ul, .article-body ol {
  margin: 0 0 16px 24px;
}
.article-body li { margin-bottom: 6px; }

.article-body strong { font-weight: 700; }
.article-body em { font-style: italic; }

.article-body a { color: var(--red); text-decoration: underline; }

.article-tags {
  margin-top: 28px;
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}
.tag {
  background: #f0eee8;
  border: 1px solid var(--rule);
  font-size: 11px;
  padding: 3px 10px;
  border-radius: 2px;
  color: var(--mid);
  text-transform: lowercase;
}

.article-author-box {
  display: flex;
  gap: 16px;
  align-items: flex-start;
  margin-top: 32px;
  padding-top: 24px;
  border-top: 1px solid var(--rule);
}
.author-avatar {
  width: 48px;
  height: 48px;
  border-radius: 50%;
  background: var(--ink);
  color: var(--white);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 800;
  font-size: 16px;
  flex-shrink: 0;
}
.article-author-box p { font-size: 13px; color: var(--mid); margin: 4px 0 0; }

/* ── Comments ─────────────────────────────────────────────────────────── */
.comments-wrap {
  padding: 32px 48px;
  border-top: 2px solid var(--ink);
  background: #fafaf8;
}

.comments-title {
  font-family: var(--serif);
  font-size: 18px;
  font-weight: 700;
  margin-bottom: 20px;
}

.comment {
  padding: 14px 0;
  border-bottom: 1px solid var(--rule);
}
.comment strong { font-size: 14px; }
.comment-date {
  font-size: 11px;
  color: var(--light);
  margin-left: 10px;
}
.comment p { margin-top: 6px; font-size: 14px; color: var(--mid); }

.no-comments { color: var(--light); font-size: 14px; font-style: italic; }

.comment-form { margin-top: 24px; display: flex; flex-direction: column; gap: 12px; }
.comment-form input, .comment-form textarea {
  border: 1px solid var(--rule);
  padding: 10px 14px;
  font-family: var(--sans);
  font-size: 14px;
  background: var(--white);
  width: 100%;
  outline: none;
  transition: border-color 0.15s;
}
.comment-form input:focus, .comment-form textarea:focus { border-color: var(--ink); }
.comment-form button {
  background: var(--ink);
  color: var(--white);
  border: none;
  padding: 11px 24px;
  font-weight: 700;
  font-size: 13px;
  letter-spacing: 0.05em;
  cursor: pointer;
  align-self: flex-start;
  text-transform: uppercase;
  transition: background 0.15s;
}
.comment-form button:hover { background: var(--red); }
.comment-form button:disabled { opacity: 0.5; cursor: default; }

/* ── Footer ───────────────────────────────────────────────────────────── */
.site-footer {
  background: var(--black);
  color: #888;
  padding: 32px 24px 24px;
  margin-top: 48px;
}
.footer-inner {
  max-width: var(--max);
  margin: 0 auto;
  font-size: 13px;
  text-align: center;
  padding-bottom: 20px;
  border-bottom: 1px solid #2a2a2a;
}
.footer-inner a { color: #999; }
.footer-inner strong { color: var(--white); }

.trending-footer-links {
  max-width: var(--max);
  margin: 20px auto 0;
  font-size: 12px;
  line-height: 2;
}
.trending-footer-links .trending-label {
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 0.15em;
  text-transform: uppercase;
  color: var(--red);
  margin-bottom: 8px;
}
.trending-footer-links a {
  color: #666;
  margin-right: 12px;
  display: inline-block;
}
.trending-footer-links a:hover { color: #999; }

/* ── Article standalone page ──────────────────────────────────────────── */
body.article-page .article-full-wrap {
  max-width: var(--max);
  margin: 0 auto;
  padding: 0 24px;
}
body.article-page .article-full {
  max-width: 760px;
  margin: 40px auto 0;
  padding-bottom: 32px;
}
body.article-page .comments-wrap {
  max-width: 760px;
  margin: 0 auto;
  padding: 32px 0;
}

.back-link {
  font-size: 13px;
  color: var(--mid);
  text-decoration: underline;
}
.back-link:hover { color: var(--red); }

/* ── Loading ──────────────────────────────────────────────────────────── */
.loading-grid {
  grid-column: 1/-1;
  padding: 60px;
  text-align: center;
  color: var(--light);
  font-size: 14px;
}

/* ── Responsive ───────────────────────────────────────────────────────── */
@media (max-width: 900px) {
  .article-grid { grid-template-columns: 1fr 1fr; }
  .art-card.featured { grid-column: 1 / -1; grid-row: auto; }
}
@media (max-width: 600px) {
  .article-grid { grid-template-columns: 1fr; }
  .art-card.featured { grid-column: 1; }
  .modal-body, .comments-wrap { padding: 24px 20px; }
  .masthead { padding: 16px; }
}
