/* Spine — typography and layout refinements */

body {
  font-feature-settings: "kern" 1, "liga" 1, "ss01" 1;
}

.font-display {
  font-feature-settings: "ss01" 1, "ss02" 1;
}

/* Chinese typography needs different treatment.
   When .lang-zh is on the body, switch to CJK-optimized fonts everywhere
   and disable drop caps (which look terrible with Chinese characters). */
body.lang-zh,
body.lang-zh .font-serif,
body.lang-zh .font-display {
  font-family: 'Noto Serif SC', 'Source Han Serif SC', serif;
}

body.lang-zh .font-sans {
  font-family: 'Noto Sans SC', 'Source Han Sans SC', sans-serif;
}

body.lang-zh .prose-spine p:first-of-type::first-letter {
  font-size: inherit !important;
  float: none !important;
  margin: 0 !important;
}

body.lang-zh .prose-spine p {
  text-indent: 2em;  /* Chinese convention: 2 character indent */
}

body.lang-zh .prose-spine {
  font-feature-settings: "palt" 1;  /* Proportional alternate widths for CJK */
  line-height: 1.85;
}

/* Pull-quote */
.pullquote {
  font-family: 'Source Serif 4', 'Noto Serif SC', Georgia, serif;
  font-style: italic;
  font-size: 1.25rem;
  line-height: 1.6;
  color: #44403c;
  border-left: 3px solid #F59E0B;
  padding-left: 1.25rem;
}

body.lang-zh .pullquote {
  font-style: normal; /* Italic Chinese is unconventional */
}

/* Book card glyph cover */
.glyph-cover {
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: 'Fraunces', serif;
  font-weight: 600;
  background: linear-gradient(135deg, #0f172a 0%, #1e293b 50%, #0c0a09 100%);
}

/* Animations */
@keyframes fadein {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: none; }
}
.fadein {
  animation: fadein 0.4s ease-out both;
}

/* Reading prose */
.prose-spine {
  font-family: 'Source Serif 4', 'Noto Serif SC', Georgia, serif;
  font-size: 1.0625rem;
  line-height: 1.75;
  color: #1c1917;
  max-width: 38rem;
}

.prose-spine p {
  margin-bottom: 1.25em;
  text-indent: 1.5em;
}

.prose-spine p:first-child,
.prose-spine p:first-of-type {
  text-indent: 0;
}

.prose-spine p:first-of-type::first-letter {
  font-family: 'Fraunces', serif;
  font-weight: 600;
  font-size: 3.25rem;
  line-height: 1;
  float: left;
  margin: 0.05em 0.08em 0 0;
  color: #1c1917;
}

/* Video embed wrapper — preserves 16:9 aspect ratio */
.video-wrap {
  position: relative;
  padding-bottom: 56.25%; /* 16:9 */
  height: 0;
  overflow: hidden;
  background: #0c0a09;
  border-radius: 1rem;
}

.video-wrap iframe,
.video-wrap video {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  border: 0;
}

/* Countdown badge */
.countdown-pill {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.4rem 0.85rem;
  border-radius: 9999px;
  background: linear-gradient(135deg, #fef3c7, #fee2e2);
  border: 1px solid rgba(245, 158, 11, 0.4);
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: #92400E;
}

/* Reader font size preferences */
.prose-spine.reader-small p { font-size: 14px; line-height: 1.7; }
.prose-spine.reader-medium p { font-size: 17px; line-height: 1.75; }
.prose-spine.reader-large p { font-size: 20px; line-height: 1.8; }

/* Dark mode for the reader prose */
.dark .prose-spine { color: #e7e5e4; }
.dark .prose-spine p { color: #d6d3d1; }
.dark .prose-spine em, .dark .prose-spine i { color: #e7e5e4; }

/* Dark mode for glyph covers (genre symbols on gradient) */
.dark .glyph-cover {
  background: linear-gradient(135deg, #1c1917 0%, #292524 50%, #1c1917 100%);
}
