/* Variables */
:root {
  --bg: #0a0a0a;
  --bg-card: #111111;
  --bg-card-hover: #1a1a1a;
  --red: #cc0000;
  --red-dark: #8b0000;
  --red-dim: rgba(204,0,0,0.15);
  --text: #e8e0d0;
  --text-muted: #888070;
  --text-dim: #554e44;
  --border: #222222;
  --gold: #c9a84c;
  --white: #f0ece4;
}

* { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; }

body {
  background: var(--bg);
  color: var(--text);
  font-family: 'Crimson Text', Georgia, serif;
  font-size: 1.1rem;
  line-height: 1.7;
  min-height: 100vh;
}

/* Grain texture overlay */
body::before {
  content: "";
  position: fixed;
  inset: 0;
  background-image: radial-gradient(circle, rgba(255,255,255,0.012) 1px, transparent 1px);
  background-size: 3px 3px;
  pointer-events: none;
  z-index: 1000;
}

a { color: var(--red); text-decoration: none; }
a:hover { color: var(--text); }

h1,h2,h3,h4 {
  font-family: 'Playfair Display', Georgia, serif;
  line-height: 1.2;
  color: var(--white);
}

/* Header */
.site-header {
  background: #050505;
  border-bottom: 1px solid var(--border);
}

.header-inner {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0;
}

.banner-img {
  width: 100%;
  max-height: 245px;
  object-fit: contain;
  display: block;
}

/* Nav */
.site-nav {
  background: #0d0d0d;
  border-bottom: 2px solid var(--red-dark);
}

.nav-inner {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 1.5rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}

.nav-links {
  list-style: none;
  display: flex;
  flex-wrap: wrap;
  gap: 0;
}

.nav-links a {
  display: block;
  padding: 0.8rem 1rem;
  font-family: 'Outfit', sans-serif;
  font-size: 0.8rem;
  font-weight: 500;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-muted);
  transition: color 0.2s, background 0.2s;
}

.nav-links a:hover, .nav-links a.active {
  color: var(--white);
  background: var(--red-dim);
}

.nav-auth {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex-shrink: 0;
}

.nav-user {
  font-family: 'Outfit', sans-serif;
  font-size: 0.8rem;
  color: var(--text-muted);
}

.btn-nav {
  font-family: 'Outfit', sans-serif;
  font-size: 0.75rem;
  font-weight: 500;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  padding: 0.4rem 0.8rem;
  border: 1px solid var(--border);
  color: var(--text-muted);
  transition: all 0.2s;
  display: inline-block;
}

.btn-nav:hover { color: var(--white); border-color: var(--text-muted); }

.btn-nav-primary {
  background: var(--red-dark);
  border-color: var(--red-dark);
  color: var(--white);
}

.btn-nav-primary:hover { background: var(--red); border-color: var(--red); color: var(--white); }

/* Main content */
.site-main { max-width: 1200px; margin: 0 auto; padding: 2rem 1.5rem; }

/* Section heading */
.section-heading {
  font-size: 1.4rem;
  margin-bottom: 1.5rem;
  padding-bottom: 0.75rem;
  border-bottom: 1px solid var(--border);
}

/* Article cards */
.article-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 1.5rem; }
@media (max-width: 900px) { .article-grid { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 600px) { .article-grid { grid-template-columns: 1fr; } }

.article-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  transition: border-color 0.2s, background 0.2s;
  display: flex;
  flex-direction: column;
}

.article-card:hover { border-color: var(--red-dark); background: var(--bg-card-hover); }

.card-body { padding: 1.25rem; display: flex; flex-direction: column; flex: 1; }

.section-badge {
  display: inline-block;
  font-family: 'Outfit', sans-serif;
  font-size: 0.65rem;
  font-weight: 500;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  padding: 0.2rem 0.5rem;
  background: var(--red-dark);
  color: var(--white);
  margin-bottom: 0.6rem;
}

.section-badge a { color: var(--white); }
.section-badge a:hover { color: var(--white); opacity: 0.8; }

.card-title {
  font-family: 'Playfair Display', serif;
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--white);
  margin-bottom: 0.5rem;
  line-height: 1.3;
}

.card-title a { color: inherit; }
.card-title a:hover { color: var(--red); }

.card-excerpt {
  font-size: 0.92rem;
  color: var(--text-muted);
  flex: 1;
  margin-bottom: 0.75rem;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.card-meta {
  font-family: 'Outfit', sans-serif;
  font-size: 0.72rem;
  color: var(--text-dim);
  letter-spacing: 0.05em;
}

/* Featured hero article */
.featured-hero {
  border: 1px solid var(--red-dark);
  background: var(--bg-card);
  padding: 2rem;
  margin-bottom: 3rem;
}

.featured-hero .section-badge { margin-bottom: 1rem; }
.featured-hero h2 { font-size: clamp(1.8rem, 4vw, 3rem); margin-bottom: 1rem; }
.featured-hero h2 a { color: var(--white); }
.featured-hero h2 a:hover { color: var(--red); }
.featured-hero .excerpt { font-size: 1.1rem; color: var(--text-muted); margin-bottom: 1rem; }
.featured-hero .read-more { color: var(--red); font-family: 'Outfit', sans-serif; font-size: 0.85rem; letter-spacing: 0.06em; text-transform: uppercase; }

/* Empty state */
.empty-state { padding: 3rem 0; color: var(--text-muted); }

/* Section intro */
.section-header { margin-bottom: 2.5rem; border-bottom: 1px solid var(--border); padding-bottom: 1.5rem; }
.section-header h1 { font-size: 2.5rem; margin-bottom: 0.5rem; }
.section-header p { color: var(--text-muted); font-size: 1rem; }

/* Article page */
.article-header { margin-bottom: 2rem; }
.article-header h1 { font-size: clamp(1.8rem, 4vw, 3rem); margin-bottom: 1rem; }
.article-excerpt { font-size: 1.2rem; color: var(--text-muted); margin-bottom: 1rem; }
.article-meta { font-family: 'Outfit', sans-serif; font-size: 0.8rem; color: var(--text-muted); display: flex; gap: 1rem; align-items: center; flex-wrap: wrap; margin-bottom: 1rem; }
.article-body { max-width: 760px; margin-bottom: 3rem; }
.article-body p { margin-bottom: 1.2em; }
.article-body h2 { font-size: 1.6rem; margin: 2em 0 0.5em; border-left: 3px solid var(--red-dark); padding-left: 0.75rem; }
.article-body h3 { font-size: 1.3rem; margin: 1.5em 0 0.4em; color: var(--white); }
.article-body blockquote { border-left: 3px solid var(--red-dark); padding-left: 1rem; color: var(--text-muted); font-style: italic; margin: 1.5em 0; }
.article-body a { border-bottom: 1px solid var(--red-dark); }
.article-body img { max-width: 100%; height: auto; }

/* Tags */
.article-tags { display: flex; flex-wrap: wrap; gap: 0.5rem; margin: 1rem 0; }
.tag-badge {
  font-family: 'Outfit', sans-serif;
  font-size: 0.7rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  padding: 0.2rem 0.6rem;
  border: 1px solid var(--border);
  color: var(--text-muted);
}

/* Comments */
.comments-section { max-width: 760px; margin-top: 3rem; border-top: 2px solid var(--border); padding-top: 2rem; }
.comments-tabs { display: flex; gap: 0; margin-bottom: 1.5rem; border-bottom: 1px solid var(--border); }
.tab-btn { font-family: 'Outfit', sans-serif; font-size: 0.8rem; font-weight: 500; letter-spacing: 0.08em; text-transform: uppercase; padding: 0.6rem 1.2rem; background: none; border: none; border-bottom: 2px solid transparent; color: var(--text-muted); cursor: pointer; margin-bottom: -1px; transition: all 0.2s; }
.tab-btn.active { color: var(--red); border-bottom-color: var(--red); }
.tab-pane { display: none; }
.tab-pane.active { display: block; }

.comment { padding: 1rem 0; border-bottom: 1px solid var(--border); }
.comment-meta { font-family: 'Outfit', sans-serif; font-size: 0.75rem; color: var(--text-dim); margin-bottom: 0.4rem; display: flex; gap: 0.4rem; align-items: center; flex-wrap: wrap; }
.comment-body { font-size: 0.95rem; }
.no-comments { color: var(--text-muted); font-size: 0.95rem; padding: 1rem 0; }
.login-prompt { color: var(--text-muted); font-size: 0.95rem; padding: 1rem 0; margin-bottom: 1rem; }

.comment-form { margin-bottom: 2rem; }
.comment-form textarea { width: 100%; background: var(--bg-card); border: 1px solid var(--border); color: var(--text); padding: 0.75rem; font-family: 'Crimson Text', serif; font-size: 1rem; resize: vertical; min-height: 100px; margin-bottom: 0.75rem; display: block; }
.comment-form textarea:focus { outline: none; border-color: var(--red-dark); }
.btn-submit { font-family: 'Outfit', sans-serif; font-size: 0.8rem; font-weight: 500; letter-spacing: 0.06em; text-transform: uppercase; padding: 0.6rem 1.4rem; background: var(--red-dark); border: none; color: var(--white); cursor: pointer; transition: background 0.2s; }
.btn-submit:hover { background: var(--red); }

/* Badge */
.badge { display: inline-block; padding: 0.15rem 0.5rem; font-size: 0.65rem; font-weight: 500; letter-spacing: 0.08em; text-transform: uppercase; }
.badge-red { background: var(--red-dark); color: #fff; }
.badge-orange { background: #3a2500; color: #c87820; }

/* Auth forms */
.auth-wrap { max-width: 420px; margin: 4rem auto; }
.auth-wrap h1 { margin-bottom: 1.5rem; }
.auth-error { background: var(--red-dim); border: 1px solid var(--red-dark); padding: 0.75rem 1rem; margin-bottom: 1rem; font-size: 0.9rem; color: var(--red); }
.form-group { margin-bottom: 1rem; }
.form-group label { display: block; font-family: 'Outfit', sans-serif; font-size: 0.75rem; letter-spacing: 0.08em; text-transform: uppercase; color: var(--text-muted); margin-bottom: 0.3rem; }
.form-group input { width: 100%; background: var(--bg-card); border: 1px solid var(--border); color: var(--text); padding: 0.65rem 0.75rem; font-size: 1rem; }
.form-group input:focus { outline: none; border-color: var(--red-dark); }

/* Footer */
.site-footer { border-top: 2px solid var(--red-dark); background: #050505; margin-top: 4rem; padding: 2rem 1.5rem; }
.footer-inner { max-width: 1200px; margin: 0 auto; }
.footer-sections { display: flex; flex-wrap: wrap; gap: 1rem; margin-bottom: 1.5rem; }
.footer-sections a { font-family: 'Outfit', sans-serif; font-size: 0.75rem; letter-spacing: 0.08em; text-transform: uppercase; color: var(--text-dim); }
.footer-sections a:hover { color: var(--red); }
.footer-bottom { display: flex; justify-content: space-between; flex-wrap: wrap; gap: 0.5rem; font-family: 'Outfit', sans-serif; font-size: 0.72rem; color: var(--text-dim); }
.footer-bottom a { color: var(--text-dim); }
.footer-bottom a:hover { color: var(--red); }

/* Pagination */
.pagination { display: flex; gap: 0.5rem; margin-top: 2rem; align-items: center; }
.pagination a, .pagination span { font-family: 'Outfit', sans-serif; font-size: 0.8rem; padding: 0.4rem 0.8rem; border: 1px solid var(--border); color: var(--text-muted); }
.pagination a:hover { border-color: var(--red-dark); color: var(--red); }
.pagination .current { background: var(--red-dark); border-color: var(--red-dark); color: var(--white); }

/* Homepage section browser */
.section-browser { margin-top: 3rem; padding-top: 2rem; border-top: 1px solid var(--border); }
.section-browser h2 { font-size: 1.4rem; margin-bottom: 1.5rem; }
.section-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 1rem; }
@media (max-width: 700px) { .section-grid { grid-template-columns: repeat(2, 1fr); } }
.section-card { background: var(--bg-card); border: 1px solid var(--border); padding: 1.25rem; transition: border-color 0.2s; display: block; color: inherit; }
.section-card:hover { border-color: var(--red-dark); color: inherit; }
.section-card h3 { font-size: 1rem; color: var(--red); margin-bottom: 0.3rem; font-family: 'Playfair Display', serif; }
.section-card p { font-size: 0.85rem; color: var(--text-muted); margin-bottom: 0.5rem; }

/* Divider */
.divider { border: none; border-top: 1px solid var(--border); margin: 2rem 0; }

/* Text utils */
.text-muted { color: var(--text-muted); }

/* Featured image */
.article-featured-img { margin-bottom: 2rem; }
.article-featured-img img { width: 100%; max-height: 420px; object-fit: cover; display: block; }
.card-img { width: 100%; height: 180px; object-fit: cover; display: block; }

/* Comment threading */
.comment-author { color: var(--white); font-weight: 600; }
.comment-author:hover { color: var(--red); }
.comment-date { color: var(--text-dim); font-size: 0.78rem; }
.comment-replies { margin-left: 1.5rem; border-left: 2px solid var(--border); padding-left: 1rem; margin-top: 0.75rem; }

/* Upvote button */
.btn-upvote { background: none; border: 1px solid var(--border); color: var(--text-muted); font-size: 0.75rem; padding: 0.2rem 0.5rem; cursor: pointer; transition: all 0.15s; margin-left: 0.5rem; }
.btn-upvote:hover { border-color: var(--red-dark); color: var(--red); }
.btn-upvote.upvoted { border-color: var(--red-dark); color: var(--red); }

/* Reply button */
.btn-reply-toggle { background: none; border: none; color: var(--text-muted); font-size: 0.78rem; cursor: pointer; margin-left: 0.5rem; text-decoration: underline; }
.btn-reply-toggle:hover { color: var(--white); }

/* Login prompt */
.login-prompt { color: var(--text-muted); font-size: 0.95rem; margin-bottom: 1.5rem; }
.no-comments { color: var(--text-muted); font-size: 0.95rem; }

/* Tags */
.article-tags { display: flex; flex-wrap: wrap; gap: 0.4rem; margin: 1.5rem 0; }
.tag-badge { display: inline-block; font-family: 'Outfit', sans-serif; font-size: 0.7rem; font-weight: 500; letter-spacing: 0.08em; text-transform: uppercase; padding: 0.2rem 0.6rem; border: 1px solid var(--border); color: var(--text-muted); transition: all 0.2s; }
.tag-badge:hover { border-color: var(--red-dark); color: var(--red); }

/* Newsletter inline */
.newsletter-inline { background: var(--bg-card); border: 1px solid var(--border); padding: 1.75rem; margin: 2rem 0; max-width: 760px; }
.newsletter-inline h3 { font-size: 1.2rem; margin-bottom: 0.3rem; }
.newsletter-inline p { color: var(--text-muted); font-size: 0.9rem; margin-bottom: 1rem; }
.newsletter-form { display: flex; gap: 0.5rem; flex-wrap: wrap; }
.newsletter-form input[type="email"] { flex: 1; min-width: 200px; background: var(--bg); border: 1px solid var(--border); color: var(--text); padding: 0.6rem 0.75rem; font-size: 0.9rem; }
.newsletter-form input[type="email"]:focus { outline: none; border-color: var(--red-dark); }
.newsletter-form button { font-family: 'Outfit', sans-serif; font-size: 0.78rem; font-weight: 500; letter-spacing: 0.06em; text-transform: uppercase; padding: 0.6rem 1.2rem; background: var(--red-dark); border: none; color: var(--white); cursor: pointer; transition: background 0.2s; flex-shrink: 0; }
.newsletter-form button:hover { background: var(--red); }

/* Footer newsletter */
.footer-newsletter { margin-bottom: 1.5rem; border-bottom: 1px solid var(--border); padding-bottom: 1.5rem; }
.footer-newsletter h4 { font-family: 'Playfair Display', serif; font-size: 1rem; margin-bottom: 0.4rem; color: var(--white); }
.footer-nl-form { display: flex; gap: 0.5rem; flex-wrap: wrap; }
.footer-nl-form input[type="email"] { flex: 1; min-width: 180px; background: var(--bg-card); border: 1px solid var(--border); color: var(--text); padding: 0.5rem 0.65rem; font-size: 0.85rem; }
.footer-nl-form input[type="email"]:focus { outline: none; border-color: var(--red-dark); }
.footer-nl-form button { font-family: 'Outfit', sans-serif; font-size: 0.72rem; font-weight: 500; letter-spacing: 0.06em; text-transform: uppercase; padding: 0.5rem 1rem; background: var(--red-dark); border: none; color: var(--white); cursor: pointer; }
.footer-nl-form button:hover { background: var(--red); }

/* Profile */
.profile-header { display: flex; gap: 1.5rem; align-items: center; margin-bottom: 2rem; flex-wrap: wrap; }
.profile-avatar img { width: 80px; height: 80px; border-radius: 50%; object-fit: cover; border: 2px solid var(--border); }
.avatar-placeholder { width: 80px; height: 80px; border-radius: 50%; background: var(--red-dark); display: flex; align-items: center; justify-content: center; font-family: 'Playfair Display', serif; font-size: 2rem; color: var(--white); }
.profile-info h1 { font-size: 2rem; margin-bottom: 0.5rem; }
.profile-meta { display: flex; gap: 1rem; flex-wrap: wrap; font-family: 'Outfit', sans-serif; font-size: 0.8rem; color: var(--text-muted); align-items: center; }
.profile-comment { padding: 1rem 0; border-bottom: 1px solid var(--border); }
.profile-comment-meta { font-family: 'Outfit', sans-serif; font-size: 0.78rem; color: var(--text-muted); margin-bottom: 0.4rem; }
.profile-comment-body { font-size: 0.95rem; }

/* Article excerpt on article page */
.article-excerpt { font-size: 1.2rem; color: var(--text-muted); font-style: italic; margin-top: 0.5rem; line-height: 1.5; }

/* Quill dark theme */
.ql-toolbar { background: #1a1a1a !important; border-color: #252525 !important; }
.ql-toolbar .ql-stroke { stroke: #9a9080; }
.ql-toolbar .ql-fill { fill: #9a9080; }
.ql-toolbar button:hover .ql-stroke, .ql-toolbar .ql-active .ql-stroke { stroke: #e8e0d0 !important; }
.ql-container { border-color: #252525 !important; font-size: 1rem; }
.ql-editor { min-height: 400px; color: #e8e0d0; background: #161616; }
.ql-editor.ql-blank::before { color: #554e44; }

.flash-message {
  background: #1a2a1a;
  border: 1px solid #4caf50;
  color: #4caf50;
  padding: 0.75rem 1.5rem;
  margin: 1rem auto;
  max-width: 1200px;
  border-radius: 4px;
  font-size: 0.9rem;
}

/* Report & mod-delete buttons */
.btn-report-toggle {
  background: none;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  font-size: 0.85rem;
  padding: 0 0.3rem;
  opacity: 0.5;
  transition: opacity 0.15s;
}
.btn-report-toggle:hover { opacity: 1; color: #e74c3c; }

.btn-mod-delete {
  background: none;
  border: none;
  color: #8b0000;
  cursor: pointer;
  font-size: 0.85rem;
  font-weight: 700;
  padding: 0 0.3rem;
  opacity: 0.6;
  transition: opacity 0.15s;
}
.btn-mod-delete:hover { opacity: 1; }

.report-form select {
  display: block;
  width: 100%;
}

.footer-support { text-align: center; margin-bottom: 1rem; }
.btn-bmac { display: inline-block; background: #FFDD00; color: #000; font-size: 0.82rem; font-weight: 600; padding: 0.45rem 1rem; border-radius: 4px; text-decoration: none; transition: opacity 0.15s; }
.btn-bmac:hover { opacity: 0.85; color: #000; }

.footer-patreon { text-align: center; margin-bottom: 1rem; }
.btn-patreon { display: inline-block; background: #ff424d; color: #fff; padding: 0.5rem 1.2rem; border-radius: 4px; font-weight: 700; font-size: 0.85rem; text-decoration: none; transition: background 0.2s; }
.btn-patreon:hover { background: #e0333d; color: #fff; }
