/* ═══════════════════════════════════════════════════════
   LETTERS TO THE REPUBLIC — Ghost Theme Stylesheet
   Democracy · Reform · Dissent
   ═══════════════════════════════════════════════════════ */

:root {
  --cream: #EEE6D6;
  --cream-dark: #E6DDCB;
  --cream-deeper: #D9CDB8;
  --ink: #1A1714;
  --ink-light: #3D3830;
  --ink-muted: #6B6259;
  --red: #B82A2A;
  --red-bright: #D43333;
  --red-dark: #8C1F1F;
  --red-glow: rgba(184, 42, 42, 0.08);
  --red-line: rgba(184, 42, 42, 0.25);
}

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

body {
  background: var(--cream);
  color: var(--ink);
  font-family: 'Source Serif 4', Georgia, serif;
  font-size: 18px;
  line-height: 1.7;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  overflow-x: hidden;
}

::selection { background: var(--red); color: var(--cream); }
a { color: inherit; text-decoration: none; }
img { max-width: 100%; height: auto; display: block; }

body::after {
  content: '';
  position: fixed;
  top: 0; left: 0;
  width: 100%; height: 100%;
  pointer-events: none;
  z-index: 999;
  opacity: 0.025;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 256 256' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='noise'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23noise)'/%3E%3C/svg%3E");
  background-repeat: repeat;
  background-size: 256px 256px;
}

.reading-progress {
  position: fixed;
  top: 0; left: 0;
  height: 2px;
  background: var(--red);
  z-index: 200;
  transition: width 0.1s linear;
  width: 0%;
}

/* NAV */
.site-nav {
  position: fixed;
  top: 0; left: 0; right: 0;
  z-index: 100;
  padding: 1.2rem 3rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
  background: rgba(238, 230, 214, 0.85);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border-bottom: 1px solid var(--cream-deeper);
  transition: all 0.4s ease;
}

.site-nav.scrolled {
  padding: 0.8rem 3rem;
  box-shadow: 0 2px 30px rgba(26, 23, 20, 0.06);
}

.nav-brand {
  font-family: 'Playfair Display', serif;
  font-weight: 900;
  font-size: 1.2rem;
  letter-spacing: -0.02em;
  color: var(--ink);
  text-decoration: none;
  line-height: 1.1;
}

.nav-brand .emphasis { color: var(--red); }

.nav-links {
  display: flex;
  gap: 2.5rem;
  list-style: none;
  align-items: center;
}

.nav-links a {
  font-family: 'Source Serif 4', serif;
  font-size: 0.9rem;
  font-weight: 400;
  color: var(--ink-muted);
  text-decoration: none;
  letter-spacing: 0.03em;
  transition: color 0.3s;
  position: relative;
}

.nav-links a::after {
  content: '';
  position: absolute;
  bottom: -4px; left: 0;
  width: 0; height: 1.5px;
  background: var(--red);
  transition: width 0.3s ease;
}

.nav-links a:hover { color: var(--ink); }
.nav-links a:hover::after { width: 100%; }

.nav-subscribe {
  font-family: 'Source Serif 4', serif;
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--cream) !important;
  background: var(--red);
  padding: 0.5rem 1.4rem;
  border-radius: 2px;
  transition: background 0.3s, transform 0.2s !important;
}

.nav-subscribe::after { display: none !important; }
.nav-subscribe:hover {
  background: var(--red-dark) !important;
  color: var(--cream) !important;
  transform: translateY(-1px);
}

/* HERO */
.hero {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  text-align: center;
  padding: 8rem 2rem 6rem;
  position: relative;
  overflow: hidden;
}

.hero::before {
  content: '';
  position: absolute;
  top: -200px; right: -200px;
  width: 600px; height: 600px;
  background: radial-gradient(circle, var(--red-glow) 0%, transparent 70%);
  pointer-events: none;
  animation: heroGlow 8s ease-in-out infinite alternate;
}

.hero::after {
  content: '';
  position: absolute;
  bottom: 0; left: 0; right: 0;
  height: 1px;
  background: linear-gradient(90deg, transparent, var(--red-line), var(--cream-deeper), var(--red-line), transparent);
}

@keyframes heroGlow {
  0% { opacity: 0.5; transform: translate(0, 0); }
  100% { opacity: 1; transform: translate(-50px, 50px); }
}

.hero-overline {
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.7rem;
  letter-spacing: 0.25em;
  text-transform: uppercase;
  color: var(--red);
  margin-bottom: 2rem;
  opacity: 0;
  animation: fadeUp 0.8s ease forwards 0.2s;
}

.hero h1 {
  font-family: 'Playfair Display', serif;
  font-weight: 900;
  font-size: clamp(2.6rem, 6vw, 4.8rem);
  line-height: 1.08;
  letter-spacing: -0.03em;
  color: var(--ink);
  margin-bottom: 0.4em;
  opacity: 0;
  animation: fadeUp 0.8s ease forwards 0.4s;
}

.hero h1 em { font-style: italic; color: var(--red); }

.hero-tagline {
  font-family: 'Source Serif 4', serif;
  font-size: 1.15rem;
  font-weight: 300;
  color: var(--ink-muted);
  max-width: 580px;
  line-height: 1.8;
  margin-bottom: 3rem;
  opacity: 0;
  animation: fadeUp 0.8s ease forwards 0.6s;
}

.hero-cta {
  display: flex;
  gap: 1rem;
  opacity: 0;
  animation: fadeUp 0.8s ease forwards 0.8s;
}

@keyframes fadeUp {
  from { opacity: 0; transform: translateY(20px); }
  to { opacity: 1; transform: translateY(0); }
}

/* BUTTONS */
.btn-primary {
  font-family: 'Source Serif 4', serif;
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--cream);
  background: var(--red);
  border: none;
  padding: 0.85rem 2.2rem;
  cursor: pointer;
  letter-spacing: 0.02em;
  transition: all 0.3s;
  text-decoration: none;
  display: inline-block;
}

.btn-primary:hover {
  background: var(--red-dark);
  transform: translateY(-2px);
  box-shadow: 0 8px 25px rgba(184, 42, 42, 0.2);
}

.btn-ghost {
  font-family: 'Source Serif 4', serif;
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--ink);
  background: transparent;
  border: 1.5px solid var(--cream-deeper);
  padding: 0.85rem 2.2rem;
  cursor: pointer;
  letter-spacing: 0.02em;
  transition: all 0.3s;
  text-decoration: none;
  display: inline-block;
}

.btn-ghost:hover {
  border-color: var(--red-line);
  color: var(--red);
  transform: translateY(-2px);
}

/* SECTION LABELS */
.section-label {
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.65rem;
  letter-spacing: 0.3em;
  text-transform: uppercase;
  color: var(--red);
  padding: 5rem 3rem 2rem;
  max-width: 900px;
  margin: 0 auto;
}

/* FEATURED POST */
.featured-wrap {
  max-width: 900px;
  margin: 0 auto;
  padding: 0 3rem 4rem;
}

.featured-card {
  background: var(--cream-dark);
  border: 1px solid var(--cream-deeper);
  padding: 3.5rem;
  position: relative;
  transition: all 0.4s ease;
  cursor: pointer;
  display: block;
  color: inherit;
  text-decoration: none;
}

.featured-card::before {
  content: '';
  position: absolute;
  top: 0; left: 0;
  width: 4px; height: 100%;
  background: var(--red);
  transform: scaleY(0);
  transform-origin: top;
  transition: transform 0.4s ease;
}

.featured-card:hover::before { transform: scaleY(1); }
.featured-card:hover {
  box-shadow: 0 12px 40px rgba(26, 23, 20, 0.06);
  transform: translateY(-2px);
}

.featured-meta {
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.7rem;
  letter-spacing: 0.15em;
  text-transform: uppercase;
  color: var(--ink-muted);
  margin-bottom: 1rem;
  display: flex;
  align-items: center;
  gap: 0.8rem;
  flex-wrap: wrap;
}

.featured-meta .tag { color: var(--red); font-weight: 400; }
.featured-meta .dot { width: 3px; height: 3px; border-radius: 50%; background: var(--cream-deeper); }

.featured-card h2 {
  font-family: 'Playfair Display', serif;
  font-weight: 700;
  font-size: 2rem;
  line-height: 1.2;
  letter-spacing: -0.02em;
  margin-bottom: 1rem;
  color: var(--ink);
}

.featured-excerpt {
  font-size: 1.05rem;
  font-weight: 300;
  color: var(--ink-muted);
  line-height: 1.8;
  max-width: 680px;
}

/* POST LIST */
.post-feed {
  max-width: 900px;
  margin: 0 auto;
  padding: 0 3rem 6rem;
  display: flex;
  flex-direction: column;
}

.post-item {
  padding: 2.2rem 0;
  border-top: 1px solid var(--cream-deeper);
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 2rem;
  cursor: pointer;
  transition: all 0.3s;
  position: relative;
  color: inherit;
  text-decoration: none;
}

.post-item:last-child { border-bottom: 1px solid var(--cream-deeper); }

.post-item::before {
  content: '';
  position: absolute;
  left: -3rem; top: 0;
  width: 3px; height: 100%;
  background: var(--red);
  opacity: 0;
  transition: opacity 0.3s;
}

.post-item:hover::before { opacity: 1; }
.post-item:hover { padding-left: 0.5rem; }

.post-item h3 {
  font-family: 'Playfair Display', serif;
  font-weight: 700;
  font-size: 1.3rem;
  line-height: 1.3;
  letter-spacing: -0.01em;
  margin-bottom: 0.4rem;
  transition: color 0.3s;
}

.post-item:hover h3 { color: var(--red-dark); }

.post-item-meta {
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.65rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--ink-muted);
  display: flex;
  align-items: center;
  gap: 0.6rem;
}

.post-item-meta .tag { color: var(--red); }
.post-item-meta .dot { width: 3px; height: 3px; border-radius: 50%; background: var(--cream-deeper); display: inline-block; }

.post-date {
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.7rem;
  color: var(--ink-muted);
  letter-spacing: 0.05em;
  white-space: nowrap;
  margin-top: 0.4rem;
}

/* PAGINATION */
.pagination {
  max-width: 900px;
  margin: 0 auto;
  padding: 0 3rem 4rem;
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 2rem;
}

.pagination a {
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.7rem;
  letter-spacing: 0.15em;
  text-transform: uppercase;
  color: var(--red);
  text-decoration: none;
  transition: color 0.3s;
}

.pagination a:hover { color: var(--red-dark); }

.pagination .page-number {
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.65rem;
  color: var(--ink-muted);
  letter-spacing: 0.1em;
}

/* ARTICLE */
.article-header {
  max-width: 740px;
  margin: 0 auto;
  padding: 10rem 2rem 3rem;
  text-align: center;
}

.article-header h1 {
  font-family: 'Playfair Display', serif;
  font-weight: 900;
  font-size: clamp(2.2rem, 5vw, 3.2rem);
  line-height: 1.15;
  letter-spacing: -0.02em;
  margin-bottom: 1.5rem;
}

.article-meta {
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.7rem;
  letter-spacing: 0.15em;
  text-transform: uppercase;
  color: var(--ink-muted);
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 1rem;
  flex-wrap: wrap;
}

.article-meta .red { color: var(--red); }
.article-meta a { color: var(--ink-muted); text-decoration: none; transition: color 0.3s; }
.article-meta a:hover { color: var(--red); }

.article-feature-image {
  max-width: 900px;
  margin: 2rem auto 0;
  padding: 0 2rem;
}

.article-feature-image img { width: 100%; border: 1px solid var(--cream-deeper); }

.article-feature-image figcaption {
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.6rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--ink-muted);
  text-align: center;
  margin-top: 0.8rem;
}

.article-body {
  max-width: 680px;
  margin: 0 auto;
  padding: 2rem 2rem 4rem;
}

.article-body > p:first-of-type::first-letter {
  font-family: 'Playfair Display', serif;
  font-weight: 900;
  font-size: 3.8em;
  float: left;
  line-height: 0.8;
  margin: 0.05em 0.12em 0 0;
  color: var(--red);
}

/* Ghost content */
.gh-content p, .article-body p {
  margin-bottom: 2.2rem;
  font-size: 1.08rem;
  line-height: 1.85;
}

/* Handle Ghost editor line breaks within single p tags */
.gh-content p br, .article-body p br {
  display: block;
  content: "";
  margin-top: 1.4rem;
  color: var(--ink-light);
  font-weight: 300;
}

.gh-content h2, .article-body h2 {
  font-family: 'Playfair Display', serif;
  font-weight: 700;
  font-size: 1.8rem;
  line-height: 1.2;
  letter-spacing: -0.02em;
  margin: 3rem 0 1.2rem;
  color: var(--ink);
}

.gh-content h3, .article-body h3 {
  font-family: 'Playfair Display', serif;
  font-weight: 700;
  font-size: 1.4rem;
  line-height: 1.3;
  margin: 2.5rem 0 1rem;
  color: var(--ink);
}

.gh-content h4, .article-body h4 {
  font-family: 'Source Serif 4', serif;
  font-weight: 600;
  font-size: 1.15rem;
  margin: 2rem 0 0.8rem;
  color: var(--ink);
}

.gh-content blockquote, .article-body blockquote {
  margin: 2.5rem 0;
  padding: 1.8rem 2rem;
  border-left: 3px solid var(--red);
  background: var(--red-glow);
  font-style: italic;
  color: var(--ink);
  font-size: 1.05rem;
  line-height: 1.7;
}

.gh-content blockquote p, .article-body blockquote p { margin-bottom: 0; color: var(--ink); font-weight: 400; }

.gh-content a, .article-body a {
  color: var(--red);
  text-decoration: none;
  border-bottom: 1px solid var(--red-line);
  transition: border-color 0.3s;
}

.gh-content a:hover, .article-body a:hover { border-color: var(--red); }

.gh-content ul, .gh-content ol, .article-body ul, .article-body ol {
  margin: 0 0 1.6rem 1.5rem;
  font-size: 1.08rem;
  line-height: 1.85;
  color: var(--ink-light);
  font-weight: 300;
}

.gh-content li, .article-body li { margin-bottom: 0.5rem; }

.gh-content hr, .article-body hr {
  border: none;
  border-top: 1px solid var(--red-line);
  margin: 3rem auto;
  max-width: 60px;
}

.gh-content figcaption, .article-body figcaption {
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.6rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--ink-muted);
  text-align: center;
  margin-top: 0.8rem;
}

.gh-content pre, .article-body pre {
  background: var(--ink);
  color: var(--cream);
  padding: 1.5rem;
  margin: 2rem 0;
  overflow-x: auto;
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.85rem;
  line-height: 1.6;
  border-radius: 2px;
}

.gh-content code, .article-body code {
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.88em;
  background: var(--cream-dark);
  padding: 0.15em 0.4em;
  border-radius: 2px;
}

.gh-content pre code, .article-body pre code { background: none; padding: 0; }

.gh-content .kg-width-wide, .article-body .kg-width-wide {
  max-width: 900px;
  margin-left: calc((680px - 900px) / 2);
}

.gh-content .kg-width-full, .article-body .kg-width-full {
  max-width: 100vw;
  margin-left: calc(50% - 50vw);
  margin-right: calc(50% - 50vw);
}

.gh-content .kg-image, .article-body .kg-image { width: 100%; }

/* TAG / AUTHOR HEADER */
.tag-header, .author-header {
  max-width: 740px;
  margin: 0 auto;
  padding: 10rem 2rem 2rem;
  text-align: center;
}

.tag-header h1, .author-header h1 {
  font-family: 'Playfair Display', serif;
  font-weight: 900;
  font-size: clamp(2rem, 4vw, 3rem);
  line-height: 1.15;
  letter-spacing: -0.02em;
  margin-bottom: 1rem;
}

.tag-header p, .author-header p {
  font-size: 1.05rem;
  font-weight: 300;
  color: var(--ink-muted);
  line-height: 1.8;
  max-width: 540px;
  margin: 0 auto;
}

/* PAGE */
.page-header {
  max-width: 740px;
  margin: 0 auto;
  padding: 10rem 2rem 3rem;
  text-align: center;
}

.page-header h1 {
  font-family: 'Playfair Display', serif;
  font-weight: 900;
  font-size: clamp(2.2rem, 5vw, 3.2rem);
  line-height: 1.15;
  letter-spacing: -0.02em;
}

.page-body {
  max-width: 680px;
  margin: 0 auto;
  padding: 2rem 2rem 6rem;
}

/* NEWSLETTER */
.newsletter-section {
  max-width: 600px;
  margin: 0 auto;
  padding: 5rem 2rem;
  text-align: center;
}

.newsletter-rule {
  width: 60px;
  height: 2px;
  background: var(--red);
  margin: 0 auto 2.5rem;
}

.newsletter-section h3 {
  font-family: 'Playfair Display', serif;
  font-weight: 700;
  font-size: 1.8rem;
  margin-bottom: 0.8rem;
  letter-spacing: -0.02em;
}

.newsletter-section p {
  font-size: 1rem;
  font-weight: 300;
  color: var(--ink-muted);
  margin-bottom: 2rem;
  line-height: 1.7;
}

.newsletter-form {
  display: flex;
  gap: 0;
  max-width: 440px;
  margin: 0 auto;
}

.newsletter-form input[type="email"] {
  flex: 1;
  font-family: 'Source Serif 4', serif;
  font-size: 0.9rem;
  padding: 0.9rem 1.2rem;
  border: 1.5px solid var(--cream-deeper);
  background: white;
  color: var(--ink);
  outline: none;
  transition: border-color 0.3s;
}

.newsletter-form input[type="email"]:focus { border-color: var(--red-line); }
.newsletter-form input[type="email"]::placeholder { color: var(--ink-muted); font-style: italic; }

.newsletter-form button {
  font-family: 'Source Serif 4', serif;
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--cream);
  background: var(--red);
  border: none;
  padding: 0.9rem 1.8rem;
  cursor: pointer;
  transition: background 0.3s;
  letter-spacing: 0.02em;
}

.newsletter-form button:hover { background: var(--red-dark); }

/* FOOTER */
.site-footer {
  border-top: 1px solid var(--cream-deeper);
  padding: 3rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
  max-width: 900px;
  margin: 0 auto;
}

.footer-left {
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.65rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--ink-muted);
}

.footer-right { display: flex; gap: 2rem; }

.footer-right a {
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.65rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--ink-muted);
  text-decoration: none;
  transition: color 0.3s;
}

.footer-right a:hover { color: var(--red); }

/* RESPONSIVE */
@media (max-width: 768px) {
  .site-nav { padding: 1rem 1.5rem; }
  .site-nav.scrolled { padding: 0.8rem 1.5rem; }
  .nav-links .hide-mobile { display: none; }
  .hero { padding: 7rem 1.5rem 4rem; }
  .hero-cta { flex-direction: column; width: 100%; max-width: 300px; }
  .btn-primary, .btn-ghost { text-align: center; }
  .section-label { padding: 4rem 1.5rem 1.5rem; }
  .featured-wrap { padding: 0 1.5rem 3rem; }
  .featured-card { padding: 2rem; }
  .featured-card h2 { font-size: 1.6rem; }
  .post-feed { padding: 0 1.5rem 4rem; }
  .post-item { flex-direction: column; gap: 0.5rem; }
  .post-item::before { left: -1.5rem; }
  .article-header { padding: 8rem 1.5rem 2rem; }
  .article-body, .page-body { padding: 2rem 1.5rem 4rem; }
  .gh-content .kg-width-wide, .article-body .kg-width-wide { max-width: 100%; margin-left: 0; }
  .newsletter-form { flex-direction: column; }
  .newsletter-form input[type="email"], .newsletter-form button { width: 100%; }
  .site-footer { flex-direction: column; gap: 1.5rem; padding: 2rem 1.5rem; }
}
