/* ═══════════════════════════════════════════════════
   BLOG READING PAGE
   ═══════════════════════════════════════════════════ */

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

:root {
  --font-serif: 'Lora', Georgia, serif;
  --font-sans: 'Inter', sans-serif;
  --font-mono: 'JetBrains Mono', monospace;
  --ease-out: cubic-bezier(0.16, 1, 0.3, 1);
}

html {
  scroll-behavior: smooth;
  -webkit-font-smoothing: antialiased;
}

/* ── Themes ── */
body {
  min-height: 100vh;
  transition: background 0.4s ease, color 0.4s ease, filter 0.4s ease;
  font-family: var(--font-serif);
  position: relative;
}

/* Paper texture overlay */
body::before {
  content: '';
  position: fixed;
  inset: 0;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='300' height='300'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.75' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='300' height='300' filter='url(%23n)' opacity='0.04'/%3E%3C/svg%3E");
  pointer-events: none;
  z-index: 0;
  opacity: 0.6;
}

/* Light theme */
.theme-light {
  background: #f9f7f4;
  color: #2c2c2c;
}
.theme-light.tone-warm { background: #faf6ee; filter: sepia(0.08); }
.theme-light.tone-cool { background: #f4f7fa; filter: hue-rotate(5deg) saturate(0.9); }

/* Dark theme */
.theme-dark {
  background: #181818;
  color: #e0ddd8;
}
.theme-dark.tone-warm { background: #1e1810; filter: sepia(0.15); }
.theme-dark.tone-cool { background: #141820; }

/* ── Back Button ── */
.back-btn {
  position: fixed;
  top: 1.5rem;
  left: 1.5rem;
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.6rem 1.2rem;
  border-radius: 2rem;
  font-family: var(--font-sans);
  font-size: 0.9rem;
  font-weight: 500;
  text-decoration: none;
  z-index: 100;
  transition: all 0.3s ease;
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
}

.theme-light .back-btn {
  background: rgba(255, 255, 255, 0.85);
  color: #2c2c2c;
  border: 1px solid rgba(0, 0, 0, 0.1);
  box-shadow: 0 2px 12px rgba(0, 0, 0, 0.08);
}

.theme-dark .back-btn {
  background: rgba(30, 30, 30, 0.85);
  color: #e0ddd8;
  border: 1px solid rgba(255, 255, 255, 0.1);
  box-shadow: 0 2px 12px rgba(0, 0, 0, 0.3);
}

.back-btn:hover {
  transform: translateX(-3px);
}

/* ── Reading Controls ── */
.reading-controls {
  position: fixed;
  top: 1.5rem;
  right: 1.5rem;
  z-index: 100;
}

.controls-toggle {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.3s ease;
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  margin-left: auto;
}

.theme-light .controls-toggle {
  background: rgba(255, 255, 255, 0.85);
  color: #2c2c2c;
  border: 1px solid rgba(0, 0, 0, 0.1);
  box-shadow: 0 2px 12px rgba(0, 0, 0, 0.08);
}

.theme-dark .controls-toggle {
  background: rgba(30, 30, 30, 0.85);
  color: #e0ddd8;
  border: 1px solid rgba(255, 255, 255, 0.1);
}

.controls-toggle:hover {
  transform: rotate(30deg);
}

.controls-panel {
  display: none;
  flex-direction: column;
  gap: 1rem;
  margin-top: 0.5rem;
  padding: 1.25rem;
  border-radius: 1rem;
  min-width: 220px;
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
}

.reading-controls.open .controls-panel {
  display: flex;
}

.theme-light .controls-panel {
  background: rgba(255, 255, 255, 0.92);
  border: 1px solid rgba(0, 0, 0, 0.1);
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.12);
}

.theme-dark .controls-panel {
  background: rgba(25, 25, 25, 0.92);
  border: 1px solid rgba(255, 255, 255, 0.1);
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.4);
}

.control-group {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.control-label {
  font-family: var(--font-sans);
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 1px;
  opacity: 0.6;
}

.control-row {
  display: flex;
  gap: 0.4rem;
  flex-wrap: wrap;
}

.ctrl-btn {
  padding: 0.35rem 0.75rem;
  border-radius: 1rem;
  border: 1px solid transparent;
  font-family: var(--font-sans);
  font-size: 0.78rem;
  cursor: pointer;
  transition: all 0.2s ease;
}

.theme-light .ctrl-btn {
  background: rgba(0, 0, 0, 0.06);
  color: #2c2c2c;
}

.theme-dark .ctrl-btn {
  background: rgba(255, 255, 255, 0.08);
  color: #e0ddd8;
}

.ctrl-btn.active {
  background: #a68868;
  color: #fff;
  border-color: #a68868;
}

.ctrl-slider {
  width: 100%;
  accent-color: #a68868;
  cursor: pointer;
}

/* ── Reading Wrapper ── */
.reading-wrapper {
  position: relative;
  z-index: 1;
  transition: opacity 0.3s ease;
}

.reading-inner {
  max-width: 760px;
  margin: 0 auto;
  padding: 0 1.5rem 6rem;
}

/* ── Hero Image ── */
.blog-hero {
  width: 100%;
  height: clamp(240px, 40vw, 420px);
  overflow: hidden;
  border-radius: 0 0 1.5rem 1.5rem;
  margin-bottom: 3rem;
}

.blog-hero img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

/* ── Article ── */
.article-content {
  padding: 0 0.5rem;
}

.article-meta {
  margin-bottom: 1rem;
}

.meta-tag {
  font-family: var(--font-mono);
  font-size: 0.72rem;
  letter-spacing: 2px;
  text-transform: uppercase;
  color: #a68868;
  background: rgba(166, 136, 104, 0.12);
  padding: 0.25rem 0.75rem;
  border-radius: 1rem;
  border: 1px solid rgba(166, 136, 104, 0.2);
}

.article-title {
  font-family: var(--font-serif);
  font-size: clamp(1.8rem, 5vw, 2.8rem);
  font-weight: 700;
  line-height: 1.2;
  margin-bottom: 1rem;
}

.article-byline {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-family: var(--font-sans);
  font-size: 0.85rem;
  opacity: 0.55;
  margin-bottom: 2.5rem;
  padding-bottom: 2rem;
  flex-wrap: wrap;
}

.theme-light .article-byline {
  border-bottom: 1px solid rgba(0, 0, 0, 0.1);
}

.theme-dark .article-byline {
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.byline-dot {
  opacity: 0.4;
}

/* ── Article Body Typography ── */
.article-body {
  font-family: var(--font-serif);
  font-size: clamp(1rem, 2.5vw, 1.2rem);
  line-height: 1.85;
}

.article-body p {
  margin-bottom: 1.5rem;
  max-width: none;
  text-align: justify;
}

.article-body h2 {
  font-size: clamp(1.3rem, 3vw, 1.7rem);
  font-weight: 700;
  margin: 2.5rem 0 1rem;
  line-height: 1.3;
}

.article-body h3 {
  font-size: clamp(1.1rem, 2.5vw, 1.4rem);
  font-weight: 600;
  margin: 2rem 0 0.75rem;
}

.article-body blockquote {
  border-left: 3px solid #a68868;
  padding: 0.75rem 1.5rem;
  margin: 2rem 0;
  font-style: italic;
  opacity: 0.75;
  font-size: 1.1em;
}

.article-body code {
  font-family: var(--font-mono);
  font-size: 0.85em;
  padding: 0.15em 0.4em;
  border-radius: 0.3rem;
}

.theme-light .article-body code {
  background: rgba(0, 0, 0, 0.07);
}

.theme-dark .article-body code {
  background: rgba(255, 255, 255, 0.1);
}

.article-body a {
  color: #a68868;
  text-decoration: underline;
  text-underline-offset: 3px;
}

/* ── Responsive ── */
@media (max-width: 768px) {
  .back-btn {
    top: 1rem;
    left: 1rem;
    padding: 0.5rem 1rem;
    font-size: 0.82rem;
  }

  .reading-controls {
    top: 1rem;
    right: 1rem;
  }

  .reading-inner {
    padding: 0 1rem 5rem;
  }

  .blog-hero {
    border-radius: 0 0 1rem 1rem;
    margin-bottom: 2rem;
  }

  .article-byline {
    font-size: 0.78rem;
  }
}
