/* ==========================================================================
   Elisha Amusan — Editorial Reading & Writing Sanctuary
   Inspired by James Clear, timeless typography, and pure reading focus.
   Fully auto-responsive across Mobile Phones, Tablets/iPads, and PCs.
   ========================================================================== */

@import url('https://fonts.googleapis.com/css2?family=Instrument+Serif:ital@0;1&family=Plus+Jakarta+Sans:wght@400;500;600;700&family=Newsreader:ital,opsz,wght@0,6..72,400;0,6..72,500;0,6..72,600;1,6..72,400;1,6..72,500&display=swap');

:root {
  /* Warm Book Paper Light Theme */
  --bg-main: #FAF8F5;
  --bg-subtle: #F3EFEA;
  --bg-card: #FFFFFF;
  --bg-hover: #EDE8E1;

  --text-main: #1D1D1F;
  --text-body: #2D2D30;
  --text-muted: #6E6E73;
  --text-light: #9E9EA4;

  --accent: #C84B31; /* Warm vermillion */
  --accent-hover: #A63820;
  --accent-soft: rgba(200, 75, 49, 0.08);

  --border: #E5E0D6;
  --border-light: #EFECE4;

  --font-brand: 'Newsreader', 'Instrument Serif', Georgia, serif;
  --font-sans: 'Plus Jakarta Sans', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  --font-serif: 'Newsreader', 'Iowan Old Style', 'Palatino Linotype', Georgia, serif;

  --measure: 680px;
  --measure-wide: 860px;
  --radius: 12px;
  --radius-sm: 7px;
  --transition: 0.22s cubic-bezier(0.16, 1, 0.3, 1);
}

/* Deep Evening Ink Dark Theme */
[data-theme="dark"] {
  --bg-main: #111113;
  --bg-subtle: #18181C;
  --bg-card: #151518;
  --bg-hover: #222227;

  --text-main: #F5F3EF;
  --text-body: #DBD7D0;
  --text-muted: #9E9C98;
  --text-light: #6E6C68;

  --accent: #E0644D;
  --accent-hover: #F27A64;
  --accent-soft: rgba(224, 100, 77, 0.14);

  --border: #28282F;
  --border-light: #1E1E24;
}

/* Base Reset & Typography */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  -webkit-tap-highlight-color: transparent;
}

::selection {
  background: var(--accent-soft);
  color: var(--accent);
}

html {
  scroll-behavior: smooth;
  text-rendering: optimizeLegibility;
  font-size: 16px;
}

body {
  font-family: var(--font-sans);
  background-color: var(--bg-main);
  color: var(--text-body);
  line-height: 1.65;
  transition: background-color var(--transition), color var(--transition);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  overflow-x: hidden;
}

/* Modern Text Wrapping */
h1, h2, h3, h4, .hero-heading, .article-title, .about-heading {
  text-wrap: balance;
  color: var(--text-main);
  letter-spacing: -0.02em;
}

p, blockquote, li, .hero-bio, .article-excerpt-preview, .about-lead {
  text-wrap: pretty;
}

/* Reading Progress Bar */
#readingProgress {
  position: fixed;
  top: 0;
  left: 0;
  height: 3px;
  background: linear-gradient(90deg, var(--accent), #E57962);
  width: 0%;
  z-index: 1000;
  transition: width 0.08s ease-out;
}

/* Toast Notifications */
.toast {
  position: fixed;
  bottom: 2rem;
  right: 2rem;
  background: var(--text-main);
  color: var(--bg-main);
  padding: 0.75rem 1.4rem;
  border-radius: 50px;
  font-size: 0.88rem;
  font-weight: 500;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.2);
  z-index: 2000;
  animation: slideUpFade 0.3s ease-out;
}

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

/* Site Header */
.site-header {
  border-bottom: 1px solid var(--border-light);
  background: var(--bg-main);
  position: sticky;
  top: 0;
  z-index: 100;
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  transition: border-color var(--transition), background-color var(--transition);
}

.header-inner {
  max-width: var(--measure-wide);
  margin: 0 auto;
  padding: 1.15rem 1.5rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}

.brand-logotype {
  display: flex;
  align-items: center;
  gap: 0.9rem;
  text-decoration: none;
  color: inherit;
  cursor: pointer;
  flex-shrink: 0;
}

/* James Clear Inspired Timeless Monogram */
.brand-symbol {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: var(--bg-subtle);
  border: 1px solid var(--border);
  color: var(--text-main);
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--font-brand);
  font-size: 0.95rem;
  font-weight: 500;
  letter-spacing: 0.04em;
  transition: border-color var(--transition), background-color var(--transition), transform 0.2s ease;
  flex-shrink: 0;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.03);
}

.brand-logotype:hover .brand-symbol {
  border-color: var(--text-muted);
  background: var(--bg-card);
  transform: scale(1.04);
}

.site-title {
  font-family: var(--font-serif);
  font-size: clamp(1.1rem, 2.5vw, 1.25rem);
  font-weight: 600;
  color: var(--text-main);
  letter-spacing: -0.015em;
  display: block;
  line-height: 1.2;
}

.site-subtitle {
  font-size: 0.74rem;
  color: var(--text-muted);
  font-weight: 500;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.site-nav {
  display: flex;
  align-items: center;
  gap: clamp(0.75rem, 2.5vw, 1.5rem);
}

.nav-link {
  font-size: clamp(0.85rem, 2vw, 0.92rem);
  color: var(--text-muted);
  text-decoration: none;
  cursor: pointer;
  padding: 0.4rem 0.2rem;
  transition: color var(--transition);
  position: relative;
  white-space: nowrap;
}

.nav-link:hover, .nav-link.active {
  color: var(--text-main);
}

.nav-link.active::after {
  content: '';
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  height: 2px;
  background: var(--accent);
  border-radius: 2px;
}

.theme-toggle-btn {
  background: var(--bg-subtle);
  border: 1px solid var(--border);
  border-radius: 20px;
  padding: 0.4rem 0.75rem;
  font-size: 0.82rem;
  font-weight: 500;
  color: var(--text-main);
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 0.35rem;
  transition: var(--transition);
  white-space: nowrap;
  min-height: 36px;
}

.theme-toggle-btn:hover {
  background: var(--bg-hover);
  border-color: var(--text-muted);
}

/* Main Container */
.container {
  max-width: var(--measure);
  width: 100%;
  margin: 0 auto;
  padding: clamp(2rem, 5vw, 3.5rem) clamp(1rem, 4vw, 1.5rem) 6rem;
  flex: 1;
}

/* Hero Section */
.hero {
  margin-bottom: clamp(2.5rem, 6vw, 4rem);
  padding-bottom: clamp(2rem, 5vw, 2.75rem);
  border-bottom: 1px solid var(--border);
}

.hero-heading {
  font-family: var(--font-brand);
  font-size: clamp(2.35rem, 6.5vw, 3.25rem);
  font-weight: 400;
  line-height: 1.12;
  margin-bottom: 1.15rem;
  color: var(--text-main);
}

.hero-bio {
  font-family: var(--font-serif);
  font-size: clamp(1.12rem, 2.5vw, 1.28rem);
  color: var(--text-muted);
  line-height: 1.75;
  font-style: normal;
}

/* Writings Stream */
.section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 1.5rem;
  padding-bottom: 0.75rem;
  border-bottom: 1px solid var(--border-light);
}

.section-title {
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  font-weight: 700;
  color: var(--text-light);
}

.articles-list {
  display: flex;
  flex-direction: column;
}

.article-row {
  padding: clamp(1.25rem, 3.5vw, 1.85rem) 0;
  border-bottom: 1px solid var(--border-light);
  cursor: pointer;
  transition: transform 0.2s ease, opacity 0.2s ease;
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 1.5rem;
}

.article-row:last-child {
  border-bottom: none;
}

.article-row:hover .article-row-title {
  color: var(--accent);
}

.article-row:hover {
  transform: translateX(4px);
}

.article-row-content {
  flex: 1;
  min-width: 0;
}

.article-row-title {
  font-family: var(--font-serif);
  font-size: clamp(1.25rem, 3.5vw, 1.5rem);
  font-weight: 600;
  line-height: 1.35;
  color: var(--text-main);
  margin-bottom: 0.45rem;
  transition: color var(--transition);
}

.article-excerpt-preview {
  font-size: clamp(0.88rem, 2vw, 0.95rem);
  color: var(--text-muted);
  line-height: 1.6;
}

.article-row-meta {
  font-size: 0.82rem;
  color: var(--text-light);
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
  font-weight: 500;
  flex-shrink: 0;
}

/* About Section Card */
.about-section {
  margin-top: 3.5rem;
}

.about-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: clamp(1.5rem, 4vw, 2.5rem);
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.02);
}

.about-heading {
  font-family: var(--font-serif);
  font-size: clamp(1.85rem, 5vw, 2.35rem);
  font-weight: 600;
  margin-bottom: 1.5rem;
  color: var(--text-main);
}

.about-card p {
  font-family: var(--font-serif);
  font-size: clamp(1.1rem, 2.2vw, 1.25rem);
  line-height: 1.85;
  color: var(--text-body);
  margin-bottom: 1.5rem;
}

.about-lead {
  font-size: clamp(1.2rem, 2.5vw, 1.35rem) !important;
  color: var(--text-main) !important;
  font-weight: 500;
}

.about-signature {
  display: flex;
  align-items: center;
  gap: 1rem;
  margin-top: 2rem;
  padding-top: 1.5rem;
  border-top: 1px solid var(--border-light);
}

.about-signature-name {
  font-family: var(--font-serif);
  font-weight: 600;
  font-size: 1.15rem;
  color: var(--text-main);
  line-height: 1.2;
}

.about-signature-role {
  font-size: 0.82rem;
  color: var(--text-muted);
  margin-top: 0.2rem;
}

/* ==========================================================================
   Full Article Reader Screen (Deep Focus View)
   ========================================================================== */

.reader-screen {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: var(--bg-main);
  z-index: 500;
  overflow-y: auto;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.28s ease, background-color var(--transition);
  -webkit-overflow-scrolling: touch;
}

.reader-screen.active {
  opacity: 1;
  pointer-events: auto;
}

/* Reader Toolbar */
.reader-toolbar {
  position: sticky;
  top: 0;
  background: var(--bg-main);
  border-bottom: 1px solid var(--border-light);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  z-index: 600;
  transition: transform 0.3s ease, background-color var(--transition);
}

.reader-toolbar-inner {
  max-width: var(--measure);
  margin: 0 auto;
  padding: 0.75rem clamp(1rem, 4vw, 1.5rem);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
}

.reader-screen.zen-mode .reader-toolbar {
  opacity: 0.15;
}

.reader-screen.zen-mode .reader-toolbar:hover {
  opacity: 1;
}

.btn-back {
  background: none;
  border: none;
  color: var(--text-muted);
  font-family: var(--font-sans);
  font-size: clamp(0.85rem, 2vw, 0.9rem);
  font-weight: 500;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.4rem 0;
  transition: color var(--transition);
  white-space: nowrap;
}

.btn-back:hover {
  color: var(--accent);
}

.reader-controls {
  display: flex;
  align-items: center;
  gap: clamp(0.35rem, 1.5vw, 0.65rem);
}

.reader-tool-btn {
  background: var(--bg-subtle);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 0.35rem 0.65rem;
  font-family: var(--font-sans);
  font-size: 0.82rem;
  font-weight: 500;
  color: var(--text-muted);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  transition: var(--transition);
  min-height: 36px;
  white-space: nowrap;
}

.reader-tool-btn:hover {
  background: var(--bg-hover);
  color: var(--text-main);
  border-color: var(--text-muted);
}

.reader-tool-btn.active {
  background: var(--accent-soft);
  color: var(--accent);
  border-color: var(--accent);
}

/* Reader Content Container */
.reader-inner {
  max-width: var(--measure);
  margin: 0 auto;
  padding: clamp(2rem, 5vw, 3rem) clamp(1rem, 4vw, 1.5rem) 7rem;
}

.article-header {
  margin-bottom: clamp(1.75rem, 4vw, 2.75rem);
  padding-bottom: 1.5rem;
  border-bottom: 1px solid var(--border-light);
}

.article-title {
  font-family: var(--font-serif);
  font-size: clamp(2rem, 6.5vw, 2.85rem);
  font-weight: 500;
  line-height: 1.18;
  margin-bottom: 1rem;
}

.article-meta {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.65rem;
  font-size: 0.88rem;
  color: var(--text-light);
  font-weight: 500;
}

.article-meta-bullet {
  color: var(--border);
}

/* Article Body Typography */
.article-body {
  font-family: var(--font-serif);
  font-size: clamp(1.12rem, 2.2vw, 1.25rem);
  line-height: 1.85;
  color: var(--text-body);
}

/* Reader Font Size Modes */
.article-body.font-size-sm {
  font-size: 1.05rem;
  line-height: 1.75;
}

.article-body.font-size-md {
  font-size: clamp(1.12rem, 2.2vw, 1.25rem);
  line-height: 1.85;
}

.article-body.font-size-lg {
  font-size: clamp(1.25rem, 2.8vw, 1.45rem);
  line-height: 1.95;
}

/* Reader Font Family Modes */
.article-body.font-sans {
  font-family: var(--font-sans);
  font-size: clamp(1.05rem, 2vw, 1.14rem);
  letter-spacing: -0.01em;
}

/* First Paragraph Drop Cap (Responsive) */
.article-body > p:first-of-type::first-letter {
  font-family: var(--font-brand);
  font-size: clamp(2.8rem, 8vw, 3.8rem);
  float: left;
  line-height: 0.82;
  margin-right: clamp(0.5rem, 1.5vw, 0.75rem);
  margin-top: 0.2rem;
  color: var(--accent);
}

.article-body p {
  margin-bottom: 1.85rem;
}

.article-body h2 {
  font-family: var(--font-serif);
  font-size: clamp(1.5rem, 4vw, 1.85rem);
  font-weight: 600;
  margin-top: 3.25rem;
  margin-bottom: 1rem;
}

.article-body h3 {
  font-family: var(--font-serif);
  font-size: clamp(1.25rem, 3vw, 1.45rem);
  font-weight: 600;
  margin-top: 2.5rem;
  margin-bottom: 0.85rem;
}

.article-body blockquote {
  border-left: 3px solid var(--accent);
  padding: 0.65rem 0 0.65rem clamp(1rem, 3vw, 1.5rem);
  margin: 2.5rem 0;
  font-style: italic;
  font-size: clamp(1.15rem, 2.8vw, 1.35rem);
  color: var(--text-main);
  background: var(--bg-subtle);
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
}

/* Reader Engagement */
.reader-engagement {
  margin-top: 4rem;
  padding-top: 2.5rem;
  border-top: 1px solid var(--border);
}

/* Claps & Share */
.clap-container {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1.25rem 0;
  margin-bottom: 2.5rem;
  gap: 1rem;
}

.btn-clap {
  background: var(--bg-subtle);
  border: 1px solid var(--border);
  border-radius: 50px;
  padding: 0.65rem 1.25rem;
  display: inline-flex;
  align-items: center;
  gap: 0.65rem;
  font-family: var(--font-sans);
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--text-main);
  cursor: pointer;
  transition: transform 0.15s ease, background-color var(--transition), border-color var(--transition);
  min-height: 48px;
}

.btn-clap:hover {
  background: var(--accent-soft);
  border-color: var(--accent);
  color: var(--accent);
  transform: scale(1.04);
}

.btn-clap.clapped {
  animation: clapBounce 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
  background: var(--accent);
  color: #FFF;
  border-color: var(--accent);
}

@keyframes clapBounce {
  0% { transform: scale(1); }
  50% { transform: scale(1.22); }
  100% { transform: scale(1); }
}

.btn-share {
  background: none;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 0.6rem 1rem;
  font-family: var(--font-sans);
  font-size: 0.85rem;
  color: var(--text-muted);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  transition: var(--transition);
  min-height: 44px;
}

.btn-share:hover {
  border-color: var(--text-main);
  color: var(--text-main);
}

/* Author Signature Card (With Mature Monogram Seal) */
.author-signature-card {
  display: flex;
  gap: 1.25rem;
  align-items: center;
  background: var(--bg-subtle);
  border: 1px solid var(--border-light);
  border-radius: var(--radius);
  padding: clamp(1.25rem, 3vw, 1.65rem);
  margin-bottom: 2.5rem;
}

.author-signature-avatar {
  width: 52px;
  height: 52px;
  border-radius: 50%;
  background: var(--bg-card);
  border: 1px solid var(--border);
  color: var(--text-main);
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--font-brand);
  font-size: 1.35rem;
  font-weight: 500;
  letter-spacing: 0.04em;
  flex-shrink: 0;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.03);
}

.author-signature-name {
  font-family: var(--font-serif);
  font-size: 1.2rem;
  font-weight: 600;
  color: var(--text-main);
  margin-bottom: 0.25rem;
}

.author-signature-bio {
  font-size: 0.9rem;
  color: var(--text-muted);
  line-height: 1.55;
}

/* Up Next Section */
.up-next-section {
  margin-top: 3rem;
}

.up-next-label {
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  font-weight: 700;
  color: var(--text-light);
  margin-bottom: 1rem;
}

.up-next-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: clamp(1.25rem, 3vw, 1.75rem);
  cursor: pointer;
  transition: transform 0.2s ease, border-color 0.2s ease, box-shadow 0.2s ease;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1.25rem;
}

.up-next-card:hover {
  transform: translateY(-2px);
  border-color: var(--accent);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.04);
}

.up-next-title {
  font-family: var(--font-serif);
  font-size: clamp(1.2rem, 3vw, 1.35rem);
  font-weight: 600;
  color: var(--text-main);
  margin-bottom: 0.35rem;
}

.up-next-excerpt {
  font-size: 0.9rem;
  color: var(--text-muted);
  line-height: 1.5;
}

.up-next-arrow {
  font-size: 1.5rem;
  color: var(--text-light);
  flex-shrink: 0;
}

/* Site Footer */
.site-footer {
  border-top: 1px solid var(--border-light);
  background: var(--bg-main);
  padding: 3.5rem 1.5rem;
  text-align: center;
  font-size: 0.85rem;
  color: var(--text-muted);
  margin-top: auto;
}

.footer-tagline {
  margin-top: 0.5rem;
  color: var(--text-light);
}

/* ==========================================================================
   Responsive Breakpoints: Mobile, Tablets, iPads, and PCs
   ========================================================================== */

/* Compact Mobile (iPhone SE, small screens <= 480px) */
@media (max-width: 480px) {
  .header-inner {
    padding: 0.85rem 1rem;
  }
  .brand-text .site-subtitle {
    display: none;
  }
  .hide-on-compact {
    display: none !important;
  }
  .article-row {
    flex-direction: column;
    gap: 0.35rem;
    align-items: flex-start;
  }
  .article-row-meta {
    font-size: 0.78rem;
  }
  .clap-label {
    display: none;
  }
  .author-signature-card {
    flex-direction: column;
    align-items: flex-start;
    gap: 0.85rem;
  }
}

/* Medium Mobile & Phablets (481px to 640px) */
@media (max-width: 640px) {
  .about-card {
    padding: 1.5rem 1.25rem;
  }
}

/* Tablets & iPads (641px to 1024px) */
@media (min-width: 641px) and (max-width: 1024px) {
  .container {
    max-width: 720px;
  }
  .header-inner {
    padding: 1.25rem 2rem;
  }
  .reader-inner {
    max-width: 720px;
    padding: 3.5rem 2rem 8rem;
  }
}

/* Desktop PCs & Large Monitors (1025px+) */
@media (min-width: 1025px) {
  .container {
    max-width: 680px;
  }
  .header-inner {
    max-width: 860px;
  }
}
