/* ============================================================
   DHRUV PATIL — Personal Site
   style.css — Red & White / Deep Crimson Editorial
   ============================================================ */

/* ── CUSTOM PROPERTIES ──────────────────────────────────────── */
:root {
  /* Light mode (default) — warm parchment yellow, deep crimson accent */
  --bg:            #F5E6C8;
  --text:          #2C2116;
  --text-secondary:#7A6B5A;
  --accent:        #C41E3A;
  --accent-light:  #E8334A;
  --accent-muted:  rgba(196, 30, 58, 0.1);
  --border:        rgba(61, 50, 37, 0.08);
  --border-strong: rgba(61, 50, 37, 0.15);

  /* Particle colors — reds and warm browns */
  --particle-1:    #C41E3A;
  --particle-2:    #E8334A;
  --particle-3:    #7A6B5A;

  /* Typography */
  --font-display:  'Playfair Display', Georgia, 'Times New Roman', serif;
  --font-body:     'Source Serif 4', Georgia, 'Times New Roman', serif;
  --font-label:    'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
  --font-pixel:    'Press Start 2P', monospace;

  /* Sizing */
  --prose-width:   680px;
  --section-gap:   clamp(100px, 12vw, 200px);
  --heading-size:  clamp(2rem, 4vw, 3.5rem);

  /* Transitions */
  --ease-golden:   cubic-bezier(0.16, 1, 0.3, 1);
  --transition-theme: background-color 0.5s ease, color 0.5s ease;
}

/* Dark mode — .dark-mode on html (early script) or body (JS toggle) */
.dark-mode {
  --bg:            #1A1508;
  --text:          #ECECEC;
  --text-secondary:#9A8E7E;
  --accent:        #E8334A;
  --accent-light:  #F04D60;
  --accent-muted:  rgba(232, 51, 74, 0.1);
  --border:        rgba(236, 220, 190, 0.08);
  --border-strong: rgba(236, 220, 190, 0.14);
  --particle-1:    #E8334A;
  --particle-2:    #C41E3A;
  --particle-3:    #9A8E7E;
}

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

html {
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
  /* No scroll-behavior: smooth — Lenis handles scrolling */
}

body {
  font-family: var(--font-body);
  font-size: clamp(1rem, 1.05rem + 0.1vw, 1.125rem);
  line-height: 1.75;
  color: var(--text);
  background-color: var(--bg);
  transition: var(--transition-theme);
  overflow-x: hidden;
}

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

.dark-mode ::selection {
  color: #1A1508;
}

img {
  max-width: 100%;
  display: block;
}

button {
  cursor: pointer;
  border: none;
  background: none;
  font: inherit;
  color: inherit;
}

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

a:hover {
  color: var(--accent-light);
}

/* ── LOADING SCREEN ─────────────────────────────────────────── */
#loading-screen {
  position: fixed;
  inset: 0;
  z-index: 10000;
  background: var(--bg);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: opacity 0.7s ease, background-color 0.5s ease;
}

#loading-screen.hidden {
  opacity: 0;
  pointer-events: none;
}

.loader-monogram {
  font-family: var(--font-display);
  font-size: 3rem;
  font-weight: 400;
  color: var(--text);
  animation: loaderPulse 1.8s ease-in-out infinite;
}

@keyframes loaderPulse {
  0%, 100% { opacity: 0.3; }
  50% { opacity: 1; }
}

/* ── LOCK SCREEN (THE GATE) ─────────────────────────────────── */
#lock-screen {
  position: fixed;
  inset: 0;
  z-index: 9000;
  background: var(--bg);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  opacity: 0;
  transition: opacity 0.6s ease, background-color 0.5s ease;
}

#lock-screen.visible {
  opacity: 1;
}

#lock-screen.unlocking {
  opacity: 0;
  transition: opacity 1s ease;
}

.lock-theme-toggle {
  position: fixed;
  top: 20px;
  right: clamp(24px, 5vw, 48px);
  z-index: 9001;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  color: var(--text-secondary);
  transition: color 0.2s ease, background-color 0.2s ease;
}

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

.lock-back {
  position: fixed;
  top: 20px;
  left: clamp(24px, 5vw, 48px);
  z-index: 9001;
  font-family: var(--font-label);
  font-size: 1.1rem;
  color: var(--text-secondary);
  text-decoration: none;
  transition: color 0.2s ease;
}

.lock-back:hover {
  color: var(--text);
}

.lock-inner {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 24px;
  max-width: 480px;
  padding: 0 24px;
  width: 100%;
  position: relative;
}

.lock-title {
  font-family: var(--font-display);
  font-size: clamp(2rem, 3.5vw, 3rem);
  font-weight: 700;
  color: var(--text);
  letter-spacing: 0.04em;
  text-align: center;
  transition: color 0.5s ease;
}

.lock-prompt {
  font-family: var(--font-body);
  font-style: italic;
  font-size: clamp(0.9rem, 1rem + 0.1vw, 1.05rem);
  color: var(--text-secondary);
  text-align: center;
  line-height: 1.6;
  font-weight: 400;
  letter-spacing: 0.01em;
  margin-bottom: 8px;
  transition: color 0.5s ease;
}

.lock-form {
  width: 100%;
  max-width: 320px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 16px;
}

.lock-input-wrap {
  width: 100%;
  position: relative;
}

.lock-input {
  width: 100%;
  padding: 14px 16px;
  font-family: var(--font-label);
  font-size: 0.95rem;
  color: var(--text);
  background: transparent;
  border: 1px solid var(--border-strong);
  border-radius: 4px;
  outline: none;
  transition: border-color 0.3s ease, box-shadow 0.3s ease, color 0.5s ease;
  letter-spacing: 0.04em;
  text-align: center;
}

.lock-input::placeholder {
  color: var(--text-secondary);
  font-style: italic;
}

/* Red accent border on focus — the gate's only color */
.lock-input:focus {
  border-color: rgba(196, 30, 58, 0.6);
  box-shadow: 0 0 0 1px rgba(196, 30, 58, 0.15);
}

/* Hide the submit button visually — Enter key submits */
.lock-submit {
  position: absolute;
  right: 12px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-secondary);
  padding: 4px;
  transition: color 0.2s ease;
}

.lock-submit:hover {
  color: var(--text-secondary);
}

.lock-error {
  font-family: var(--font-label);
  font-size: 0.8rem;
  color: var(--text-secondary);
  min-height: 1.2em;
  opacity: 0;
  transition: opacity 0.3s ease;
}

.lock-error.visible {
  opacity: 1;
}

/* Shake animation for wrong password */
@keyframes shake {
  0%, 100% { transform: translateX(0); }
  20%      { transform: translateX(-8px); }
  40%      { transform: translateX(8px); }
  60%      { transform: translateX(-6px); }
  80%      { transform: translateX(6px); }
}

.lock-input.shake {
  animation: shake 0.5s ease;
  border-color: rgba(196, 30, 58, 0.5);
}

/* Faint red decorative line on the gate */
.gate-line {
  position: absolute;
  bottom: -60px;
  left: 50%;
  transform: translateX(-50%);
  width: 32px;
  height: 1px;
  background: rgba(196, 30, 58, 0.2);
}



.theme-toggle {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  color: var(--text-secondary);
  transition: color 0.2s ease, background-color 0.2s ease;
}

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



/* Prose */
.prose p {
  font-family: var(--font-body);
  font-size: clamp(1rem, 1.05rem + 0.1vw, 1.125rem);
  line-height: 1.78;
  color: var(--text);
  margin-bottom: 1.5em;
}

.prose p:last-child {
  margin-bottom: 0;
}

.prose h2 {
  font-family: var(--font-display);
  font-size: clamp(1.4rem, 2.2vw, 1.9rem);
  font-weight: 700;
  color: var(--text);
  line-height: 1.3;
  margin-top: 0.5em;
  margin-bottom: 1em;
  letter-spacing: -0.01em;
}

.accent-text {
  color: var(--accent);
}

.prose hr {
  border: none;
  height: 1px;
  background: var(--border-strong);
  margin: 2.5em 0;
}

.prose strong {
  font-weight: 600;
  color: var(--text);
}

.prose em {
  font-style: italic;
  color: var(--text-secondary);
}

.footer-text {
  font-family: var(--font-label);
  font-size: 0.75rem;
  color: var(--text-secondary);
  opacity: 0.5;
  letter-spacing: 0.06em;
  cursor: default;
  -webkit-user-select: text;
  user-select: text;
}

/* ── SCROLL REVEAL ──────────────────────────────────────────── */
.reveal {
  opacity: 0;
  transition: opacity 0.8s ease;
}

.reveal.visible {
  opacity: 1;
}

/* ── DECRYPTED CONTAINER ────────────────────────────────────── */
#decrypted-container {
  opacity: 0;
  animation: fadeInContent 1s ease 0.1s forwards;
}

@keyframes fadeInContent {
  to { opacity: 1; }
}

/* ── BODY LOCK (during loading/lock) ────────────────────────── */
body.locked {
  overflow: hidden;
}


/* ════════════════════════════════════════════════════════════════
   RESPONSIVE
   ════════════════════════════════════════════════════════════════ */
@media (max-width: 600px) {


  .lock-inner {
    gap: 24px;
  }

  .lock-prompt {
    font-size: 1.05rem;
  }




}

/* ── SCROLLBAR ──────────────────────────────────────────────── */
::-webkit-scrollbar {
  width: 6px;
}

::-webkit-scrollbar-track {
  background: transparent;
}

::-webkit-scrollbar-thumb {
  background: var(--border-strong);
  border-radius: 3px;
}

::-webkit-scrollbar-thumb:hover {
  background: var(--text-secondary);
}

/* Firefox */
html {
  scrollbar-width: thin;
  scrollbar-color: var(--border-strong) transparent;
}


/* ════════════════════════════════════════════════════════════════
   BLOG LAYER — Public-facing homepage & post pages
   ════════════════════════════════════════════════════════════════ */

/* ── BLOG TOP BAR ──────────────────────────────────────────── */
.blog-bar {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 20px clamp(24px, 5vw, 48px);
  background-color: var(--bg);
  transition: var(--transition-theme), opacity 0.35s ease;
}
.blog-bar.dim {
  opacity: 0.28;
}

.monogram-btn {
  font-family: var(--font-display);
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--accent);
  letter-spacing: -0.02em;
  cursor: pointer;
  transition: opacity 0.2s ease;
}

.monogram-btn:hover {
  opacity: 0.7;
}

/* ── SIDEBAR ───────────────────────────────────────────────── */
.sidebar-overlay {
  position: fixed;
  inset: 0;
  z-index: 1999;
  background: rgba(0, 0, 0, 0.3);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.35s ease;
}

.sidebar-overlay.open {
  opacity: 1;
  pointer-events: all;
}

.dark-mode .sidebar-overlay.open {
  background: rgba(0, 0, 0, 0.5);
}

.sidebar {
  position: fixed;
  top: 0;
  left: 0;
  bottom: 0;
  z-index: 2000;
  width: clamp(280px, 35vw, 380px);
  background: var(--bg);
  border-right: 1px solid var(--border);
  transform: translateX(-100%);
  transition: transform 0.4s var(--ease-golden);
  display: flex;
  flex-direction: column;
  overflow-y: auto;
}

.sidebar.open {
  transform: translateX(0);
}

.sidebar-header {
  padding: 24px clamp(20px, 4vw, 32px);
  border-bottom: 1px solid var(--border);
}

.sidebar-title {
  font-family: var(--font-label);
  font-size: 0.72rem;
  font-weight: 500;
  color: var(--text-secondary);
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.sidebar-posts {
  list-style: none;
  padding: 8px 0;
  flex: 1;
}

.sidebar-post-link {
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 16px clamp(20px, 4vw, 32px);
  text-decoration: none;
  transition: background-color 0.2s ease;
}

.sidebar-post-link:hover {
  background-color: var(--accent-muted);
}

.sidebar-post-title {
  font-family: var(--font-display);
  font-size: 1.05rem;
  font-weight: 700;
  color: var(--text);
  line-height: 1.3;
  transition: color 0.2s ease;
}

.sidebar-post-link:hover .sidebar-post-title {
  color: var(--accent);
}

.sidebar-post-subtitle {
  font-family: var(--font-label);
  font-size: 0.78rem;
  color: var(--text-secondary);
  letter-spacing: 0.02em;
}

.sidebar-empty {
  padding: 24px clamp(20px, 4vw, 32px);
  font-family: var(--font-body);
  font-style: italic;
  font-size: 0.9rem;
  color: var(--text-secondary);
}

body.sidebar-open {
  overflow: hidden;
}

/* ── BLOG HERO ─────────────────────────────────────────────── */
.blog-main {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  padding: clamp(20px, 5vw, 32px);
}

.blog-hero {
  text-align: center;
}

.blog-hero-name {
  font-family: var(--font-display);
  font-size: clamp(2.5rem, 5vw, 4rem);
  font-weight: 700;
  color: var(--text);
  line-height: 1.15;
  letter-spacing: -0.02em;
  margin-bottom: 16px;
  cursor: default;
}

/* Letter-by-letter fade-in on first visit per tab session */
.blog-hero-name .letter {
  display: inline-block;
  opacity: 0;
  animation: heroLetterIn 0.6s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}
.blog-hero-name .letter:nth-child(1)  { animation-delay: 0.05s; }
.blog-hero-name .letter:nth-child(2)  { animation-delay: 0.12s; }
.blog-hero-name .letter:nth-child(3)  { animation-delay: 0.19s; }
.blog-hero-name .letter:nth-child(4)  { animation-delay: 0.26s; }
.blog-hero-name .letter:nth-child(5)  { animation-delay: 0.33s; }
.blog-hero-name .letter:nth-child(6)  { animation-delay: 0.42s; }
.blog-hero-name .letter:nth-child(7)  { animation-delay: 0.49s; }
.blog-hero-name .letter:nth-child(8)  { animation-delay: 0.56s; }
.blog-hero-name .letter:nth-child(9)  { animation-delay: 0.63s; }
.blog-hero-name .letter:nth-child(10) { animation-delay: 0.70s; }
.blog-hero-name .letter:nth-child(11) { animation-delay: 0.77s; }

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

/* Skip the intro on return visits in the same tab */
.hero-intro-done .blog-hero-name .letter {
  opacity: 1;
  animation: none;
  transform: none;
}

.blog-hero-tagline {
  font-family: var(--font-body);
  font-size: clamp(1rem, 1.1rem + 0.1vw, 1.2rem);
  color: var(--text-secondary);
  line-height: 1.6;
  font-style: italic;
}

.blog-hero-line {
  width: 40px;
  height: 1px;
  background: var(--accent);
  margin: 32px auto 0;
  opacity: 0.4;
}

/* ── BLOG FEED ─────────────────────────────────────────────── */
.blog-feed {
  display: flex;
  flex-direction: column;
  gap: 0;
}

.blog-feed-empty {
  font-family: var(--font-body);
  font-style: italic;
  font-size: 1rem;
  color: var(--text-secondary);
  opacity: 0.6;
}

.blog-post-card {
  border-top: 1px solid var(--border);
}

.blog-post-card a {
  display: block;
  padding: clamp(24px, 3vw, 40px) 0;
  text-decoration: none;
  transition: background-color 0.2s ease;
}

.blog-post-card a:hover .blog-post-title {
  color: var(--accent);
}

.blog-post-date {
  font-family: var(--font-label);
  font-size: 0.75rem;
  color: var(--text-secondary);
  letter-spacing: 0.06em;
  display: block;
  margin-bottom: 8px;
}

.blog-post-title {
  font-family: var(--font-display);
  font-size: clamp(1.3rem, 2vw, 1.8rem);
  font-weight: 700;
  color: var(--text);
  line-height: 1.25;
  margin-bottom: 8px;
  transition: color 0.2s ease;
}

.blog-post-excerpt {
  font-family: var(--font-body);
  font-size: 0.95rem;
  color: var(--text-secondary);
  line-height: 1.6;
}

/* ── BLOG FOOTER ───────────────────────────────────────────── */
.blog-footer {
  max-width: var(--prose-width);
  margin: 0 auto;
  padding: 48px clamp(20px, 5vw, 32px);
  text-align: center;
}

/* ── POST PAGE ─────────────────────────────────────────────── */
.post-main {
  max-width: calc(var(--prose-width) + clamp(40px, 10vw, 64px));
  margin: 0 auto;
  padding: clamp(100px, 15vh, 160px) clamp(20px, 5vw, 32px) clamp(80px, 10vw, 160px);
}

.post-header {
  margin-bottom: clamp(40px, 5vw, 64px);
}

.post-back {
  display: inline-block;
  font-family: var(--font-label);
  font-size: 0.8rem;
  color: var(--text-secondary);
  letter-spacing: 0.04em;
  margin-bottom: 32px;
  transition: color 0.2s ease;
}

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

.post-title {
  font-family: var(--font-display);
  font-size: var(--heading-size);
  font-weight: 700;
  color: var(--text);
  line-height: 1.2;
  letter-spacing: -0.01em;
  margin-bottom: 16px;
}

.post-meta {
  display: flex;
  align-items: center;
  gap: 16px;
  font-family: var(--font-label);
  font-size: 0.78rem;
  color: var(--text-secondary);
  letter-spacing: 0.04em;
}

.post-meta-divider {
  width: 3px;
  height: 3px;
  border-radius: 50%;
  background: var(--text-secondary);
  opacity: 0.4;
}

.post-body {
  /* Uses .prose class from base styles */
}


/* ── SECRET DOOR (gate wash) ────────────────────────────────── */
.gate-wash {
  position: fixed;
  inset: 0;
  z-index: 9999;
  background: var(--bg);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.8s ease;
}

.gate-wash.filling {
  opacity: 1;
  pointer-events: all;
}


/* ── GENESIS POST (sidebar) ─────────────────────────────────── */
.sidebar-post-link--genesis {
  background: var(--accent);
}

.sidebar-post-link--genesis .sidebar-post-title {
  color: #F5E6C8;
}

.sidebar-post-link--genesis .sidebar-post-subtitle {
  color: rgba(245, 230, 200, 0.6);
}

.sidebar-post-link--genesis:hover {
  background-color: var(--bg);
}

.sidebar-post-link--genesis:hover .sidebar-post-title {
  color: var(--text);
}

.sidebar-post-link--genesis:hover .sidebar-post-subtitle {
  color: var(--text-secondary);
}

.dark-mode .sidebar-post-link--genesis .sidebar-post-title {
  color: #1A1508;
}

.dark-mode .sidebar-post-link--genesis .sidebar-post-subtitle {
  color: rgba(26, 21, 8, 0.5);
}

.dark-mode .sidebar-post-link--genesis:hover .sidebar-post-title {
  color: var(--text);
}

/* ── GENESIS POST (page) ───────────────────────────────────── */
.post-main--genesis {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  text-align: center;
}

.genesis-body {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0;
}

.genesis-name {
  font-family: var(--font-display);
  font-size: clamp(2rem, 3.5vw, 3rem);
  font-weight: 700;
  color: var(--text);
  letter-spacing: -0.02em;
  margin-bottom: clamp(32px, 5vh, 60px);
}

.genesis-body p {
  text-align: center;
  font-size: clamp(1.1rem, 1.2rem + 0.2vw, 1.35rem);
  line-height: 1.9;
  margin-bottom: 0.8em;
}

.genesis-body .genesis-equation {
  font-family: var(--font-label);
  font-weight: 500;
  font-style: normal;
  letter-spacing: 0.08em;
  color: var(--accent);
  margin-top: 0.5em;
  margin-bottom: 0;
}

/* Typing cursor */
.genesis-body .typing::after {
  content: '|';
  color: var(--accent);
  font-weight: 300;
}

.genesis-timestamp {
  display: block;
  font-family: var(--font-label);
  font-size: 0.72rem;
  color: var(--text-secondary);
  opacity: 0;
  letter-spacing: 0.06em;
  margin-top: 48px;
  transition: opacity 1.5s ease;
}

.genesis-timestamp.gen-time-visible {
  opacity: 0.6;
}

/* ── DRAFT MENU TOGGLE (fixed, visible post-unlock) ────────── */
.draft-menu-toggle {
  position: fixed;
  top: 20px;
  left: clamp(24px, 5vw, 48px);
  z-index: 1001;
  font-family: var(--font-display);
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--accent);
  letter-spacing: -0.02em;
  cursor: pointer;
  transition: opacity 0.2s ease;
  display: none;
}

.draft-menu-toggle:hover {
  opacity: 0.7;
}

.draft-menu-toggle.visible {
  display: block;
}

/* ── DRAFT THEME TOGGLE (fixed top-right, visible post-unlock) ── */
.draft-theme-toggle {
  position: fixed;
  top: 20px;
  right: clamp(24px, 5vw, 48px);
  z-index: 1001;
  display: none;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  color: var(--text-secondary);
  transition: color 0.2s ease, background-color 0.2s ease;
}
.draft-theme-toggle.visible { display: flex; }
.draft-theme-toggle:hover {
  color: var(--text);
  background-color: var(--border);
}

/* ── DRAFT AI DISCLAIMER (hidden until unlock) ────────────── */
.draft-ai-note { display: none; }
.draft-ai-note.visible { display: block; }

/* ── SCROLL TO TOP BUTTON ───────────────────────────────────── */
.scroll-top {
  position: fixed;
  bottom: 56px;
  right: 32px;
  z-index: 900;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: rgba(196, 30, 58, 0.15);
  color: var(--accent);
  font-size: 1.1rem;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s ease, background-color 0.2s ease;
  cursor: pointer;
}

.scroll-top.visible {
  opacity: 1;
  pointer-events: all;
}

.scroll-top:hover {
  background: rgba(196, 30, 58, 0.25);
}

@media (max-width: 600px) {
  .scroll-top {
    bottom: 50px;
    right: 20px;
    width: 40px;
    height: 40px;
  }
}

/* ── AI DISCLOSURE STRIP ───────────────────────────────────── */
.ai-note {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  z-index: 800;
  background: var(--bg);
  border-top: 1px solid var(--border);
  padding: 8px 16px;
  text-align: center;
  font-family: var(--font-body);
  font-style: italic;
  font-size: 0.72rem;
  color: var(--text-secondary);
  letter-spacing: 0.02em;
  opacity: 0.75;
  line-height: 1.4;
}

@media (max-width: 600px) {
  .ai-note {
    font-size: 0.65rem;
    padding: 6px 12px;
  }
}

/* ── HOMEPAGE EPIGRAPH ─────────────────────────────────────── */
.blog-epigraph {
  text-align: center;
  margin-top: clamp(60px, 10vh, 120px);
  opacity: 0.35;
  transition: opacity 0.5s ease;
}

.blog-epigraph:hover {
  opacity: 0.6;
}

.blog-epigraph p {
  font-family: var(--font-body);
  font-style: italic;
  font-size: 0.88rem;
  color: var(--text-secondary);
  line-height: 1.8;
  margin-bottom: 0.4em;
}

.blog-epigraph .epigraph-equation {
  font-family: var(--font-label);
  font-style: normal;
  font-size: 0.78rem;
  font-weight: 500;
  color: var(--accent);
  letter-spacing: 0.06em;
  margin-top: 0.5em;
  margin-bottom: 0;
}

.blog-epigraph .epigraph-time {
  font-family: var(--font-label);
  font-style: normal;
  font-size: 0.65rem;
  color: var(--text-secondary);
  opacity: 0.5;
  letter-spacing: 0.04em;
  margin-top: 16px;
  display: block;
}

/* ── BLOG RESPONSIVE ───────────────────────────────────────── */
@media (max-width: 600px) {
  .blog-bar {
    padding: 16px 20px;
  }

  .sidebar {
    width: 85vw;
  }
}

/* =====================================
   Shard reader — typewriter (universal)
   ===================================== */

.shard-reader {
  --shard-bg: #F5E6C8;         /* matches site parchment */
  --shard-ink: #2A1F10;
  --shard-accent: #C41E3A;
  --shard-muted: rgba(42, 31, 16, 0.55);

  background: var(--shard-bg);
  color: var(--shard-ink);
  font-family: 'Courier Prime', 'Courier New', ui-monospace, monospace;
  font-size: 16px;
  line-height: 1.75;
  padding: 80px 0 120px;
  min-height: 100vh;
}

.shard-reader section {
  max-width: 680px;
  margin: 0 auto 56px;
  padding: 0 24px;
  box-sizing: border-box;
}

.shard-reader h2 {
  font-family: 'Courier Prime', 'Courier New', monospace;
  font-size: 16px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--shard-ink);
  margin: 0 0 24px;
  line-height: 1.35;
}

.shard-reader p {
  font-family: 'Courier Prime', 'Courier New', monospace;
  font-size: 16px;
  line-height: 1.75;
  color: var(--shard-ink);
  margin: 0 0 20px;
}

.shard-reader p:last-child { margin-bottom: 0; }

.shard-reader em { font-style: italic; color: rgba(42, 31, 16, 0.72); }
.shard-reader .accent-text,
.shard-reader .red { color: var(--shard-accent); }

.shard-reader hr {
  border: none;
  border-top: 1px dashed rgba(42, 31, 16, 0.18);
  margin: 40px auto;
  max-width: 680px;
}

.shard-reader p.signature {
  margin-top: 56px;
  color: var(--shard-accent);
  text-transform: uppercase;
  letter-spacing: 0.1em;
}

@media (max-width: 600px) {
  .shard-reader { padding: 56px 0 88px; font-size: 15px; }
  .shard-reader section { margin-bottom: 40px; padding: 0 20px; }
}

/* Dark-mode override: flip shard palette so the reader matches the rest of
   the site when dark mode is on. Without this the shard reader stays
   parchment because its --shard-* vars are hardcoded above. */
.dark-mode .shard-reader {
  --shard-bg:     #1A1508;
  --shard-ink:    #ECECEC;
  --shard-accent: #E8334A;
  --shard-muted:  rgba(236, 220, 190, 0.55);
}
.dark-mode .shard-reader em { color: rgba(236, 220, 190, 0.72); }
.dark-mode .shard-reader hr { border-top-color: rgba(236, 220, 190, 0.18); }

/* =====================================
   Reading progress bar (universal)
   ===================================== */
/* Kill the default sky-blue tap-highlight across the site. */
html {
  -webkit-tap-highlight-color: transparent;
  tap-highlight-color: transparent;
}

#reading-progress {
  position: fixed;
  top: 0;
  left: 0;
  height: 3px;                        /* 3px reads more clearly on high-DPR mobile */
  background: linear-gradient(
    to right,
    rgba(196, 30, 58, 0.35) 0%,
    var(--accent) 100%
  );
  width: 0%;
  z-index: 10001;                     /* above #loading-screen (10000) */
  transition: width 0.08s linear, opacity 0.4s ease;
  pointer-events: none;
  opacity: 0;
  will-change: width;
  transform: translateZ(0);           /* force GPU compositor layer — mobile Safari reliability */
}
#reading-progress.visible { opacity: 1; }

/* =====================================
   Drop menu (D-monogram target)
   ===================================== */

.drop-overlay {
  position: fixed; inset: 0;
  /* Warmer, slightly darker tone than the site's parchment — creates contrast
     against the off-white cards so they actually stand out on small mobile
     screens. Was rgba(245, 230, 200, 0.88) which matched card bg too closely. */
  background: rgba(60, 40, 22, 0.38);
  z-index: 500;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.16s ease-out;
  overflow: visible;
}
.drop-overlay.active { opacity: 1; pointer-events: auto; }
.drop-overlay.deepen { background: rgba(40, 24, 10, 0.62); }

/* Warm vignette. Explicit z-index: 0 + behind cards (z-index: 10) so this
   never obscures them — iOS Safari was floating pseudos over siblings at the
   same default z-index: auto, hiding cards. */
.drop-overlay::before {
  content: '';
  position: absolute; inset: 0;
  pointer-events: none;
  z-index: 0;
  background: radial-gradient(ellipse at center,
    transparent 50%,
    rgba(61, 35, 18, 0.18) 100%);
}
/* Film grain removed entirely — mix-blend-mode: multiply rendered as fully
   opaque on iOS Safari, hiding every card beneath. Re-introduce later with
   a different technique if craft is missed. */

.dark-mode .drop-overlay { background: rgba(26, 21, 8, 0.92); }
.dark-mode .drop-overlay.deepen { background: rgba(26, 21, 8, 0.96); }
.dark-mode .drop-overlay::before {
  background: radial-gradient(ellipse at center, transparent 50%, rgba(0,0,0,0.4) 100%);
}

.drop-card {
  position: absolute;
  left: 0; top: 0;
  width: 180px;
  min-height: 110px;
  padding: 18px 18px 16px;
  /* Pure off-white — was #FBF3DE which blended into the overlay bg on mobile.
     More contrast so papers read as papers regardless of screen calibration. */
  background: #FFFBF0;
  /* Thin warm border so the paper edge is always defined against the overlay,
     even if screen contrast / shadow rendering is weak on a phone. */
  border: 1px solid rgba(44, 33, 22, 0.12);
  border-radius: 2px;
  cursor: grab;
  touch-action: none;
  user-select: none;
  -webkit-user-select: none;
  font-family: 'Playfair Display', Georgia, serif;
  will-change: transform;
  transition: opacity 0.25s ease, filter 0.25s ease;
  /* Heavier shadow — more depth, more separation from the overlay bg. */
  box-shadow: 0 18px 36px rgba(44, 33, 22, 0.28), 0 6px 14px rgba(44, 33, 22, 0.16);
  color: #2C2116;
  text-decoration: none;
  display: block;
  z-index: 10;
  transform-origin: 50% 50%;
  /* Force GPU compositor layer on mobile (Android Chrome + iOS Safari both
     skip painting fast-updating 2D transforms without this hint). */
  -webkit-backface-visibility: hidden;
  backface-visibility: hidden;
  -webkit-transform-style: preserve-3d;
  transform-style: preserve-3d;
}
.drop-card:focus-visible { outline: 2px solid var(--accent); outline-offset: 4px; }
.drop-card:active { cursor: grabbing; }
.drop-card.dragging { cursor: grabbing; }
.drop-card .rule { width: 50%; height: 2px; background: var(--accent); margin-bottom: 12px; }
.drop-card .title { font-size: 15px; line-height: 1.25; font-weight: 500; }
.drop-card .date {
  font-family: 'Inter', sans-serif; font-size: 9px;
  color: rgba(44,33,22,0.6); letter-spacing: 0.14em; text-transform: uppercase;
  margin-top: 10px;
}
.drop-card.genesis { background: var(--accent); }
.drop-card.genesis .rule { background: #F5E6C8; }
.drop-card.genesis .title { color: #F5E6C8; }
.drop-card.genesis .date { color: rgba(245,230,200,0.7); }

.dark-mode .drop-card { background: #2C2416; color: #ECECEC; }
.dark-mode .drop-card .date { color: rgba(236,236,236,0.55); }
/* Genesis stays crimson in dark mode — the generic dark-mode rule above
   was outranking the single-class .drop-card.genesis selector via source
   order (equal specificity, later wins) and painting the card brown. */
.dark-mode .drop-card.genesis { background: var(--accent); }
.dark-mode .drop-card.genesis .title { color: #F5E6C8; }
.dark-mode .drop-card.genesis .date  { color: rgba(245,230,200,0.7); }

/* While a card is being dragged, dim the others */
.drop-overlay.dragging .drop-card:not(.dragging) {
  opacity: 0.55; filter: saturate(0.75);
}

.drop-card.fading { opacity: 0; transition: opacity 0.5s ease, transform 0.5s ease; }
.drop-card.opening { z-index: 40; }

body.drop-menu-open { overflow: hidden; }
