/**
 * S. Parthasarathy Author Site — Poem Reading Mode & Print CSS
 * Palette: "Ink & Paper" (Paper, Sepia, Night)
 */

/* Reading progress bar (Very thin reading-progress line on poem pages only) */
#reading-progress-bar {
  position: fixed;
  top: 0;
  left: 0;
  height: 2px;
  background-color: var(--accent);
  width: 0%;
  z-index: 2000;
  transition: width 100ms linear;
}

/* Reading container */
.poem-reading-view {
  min-height: 85svh;
  padding: clamp(3rem, 6vw, 6rem) 0;
  transition: background-color var(--transition-normal), color var(--transition-normal);
}

.poem-reading-container {
  max-width: var(--measure-poem);
  margin: 0 auto;
}

/* Chettinad Arch Ornament at Top of Title Block */
.poem-reading-arch {
  display: block;
  width: 44px;
  height: 24px;
  margin: 0 auto 1.5rem;
  opacity: 0.65;
}
.poem-reading-arch path {
  fill: none;
  stroke: var(--brass);
  stroke-width: 1.5;
}

/* Toolbar */
.reading-toolbar {
  position: sticky;
  top: 76px;
  z-index: 900;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-ui);
  padding: 0.5rem 1rem;
  margin-bottom: 3.5rem;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  box-shadow: var(--shadow-sm);
  backdrop-filter: blur(8px);
}

.toolbar-group {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.btn-toolbar-mode, .btn-toolbar-size {
  background: none;
  border: 1px solid var(--line);
  color: var(--text-main);
  padding: 0.4rem 0.85rem;
  font-size: var(--text-xs);
  border-radius: var(--radius-sm);
  cursor: pointer;
  min-height: 36px;
  transition: all var(--transition-fast);
}

.btn-toolbar-mode.active, .btn-toolbar-mode:hover,
.btn-toolbar-size.active, .btn-toolbar-size:hover {
  background: var(--sand);
  border-color: var(--accent);
  color: var(--accent);
}

/* ==========================================================================
   Reading Modes on .poem-reading-view
   ========================================================================== */

/* 1. Paper Mode (Cool Paper White Default) */
.poem-reading-view[data-reading-mode="paper"] {
  background-color: #F6F7F9;
  color: #0F1B2E;
}

/* 2. Sepia Mode (Warm Parchment & Deep Ink) */
.poem-reading-view[data-reading-mode="sepia"] {
  background-color: #F4EFE6;
  color: #241C14;
}

.poem-reading-view[data-reading-mode="sepia"] .reading-toolbar {
  background-color: #EBE4D5;
  border-color: #DACDB6;
}

/* 3. Night Mode (Deep Navy & Paper Ink) */
.poem-reading-view[data-reading-mode="night"] {
  background-color: #0F1B2E;
  color: #EEF2F8;
}

.poem-reading-view[data-reading-mode="night"] .reading-toolbar {
  background-color: #14233C;
  border-color: rgba(255, 255, 255, 0.14);
}

.poem-reading-view[data-reading-mode="night"] .btn-toolbar-mode,
.poem-reading-view[data-reading-mode="night"] .btn-toolbar-size {
  color: #EEF2F8;
  border-color: rgba(255, 255, 255, 0.14);
}

.poem-reading-view[data-reading-mode="night"] .btn-toolbar-mode.active,
.poem-reading-view[data-reading-mode="night"] .btn-toolbar-size.active {
  background-color: rgba(224, 185, 106, 0.18);
  border-color: var(--lamp);
  color: var(--lamp);
}

/* ==========================================================================
   Poem Typography
   ========================================================================== */
.poem-header {
  text-align: center;
  margin-bottom: 3.5rem;
}

.poem-eyebrow {
  font-family: var(--font-serif);
  font-style: italic;
  font-size: 1.0625rem;
  color: var(--accent);
  margin-bottom: 0.75rem;
}

.poem-title {
  font-family: var(--font-serif);
  font-size: clamp(2.25rem, 4vw, 3.25rem);
  font-weight: 500;
  line-height: 1.15;
  margin-bottom: 0.75rem;
  letter-spacing: -0.01em;
  font-variation-settings: "opsz" 72;
}

.poem-meta {
  font-size: var(--text-xs);
  color: var(--muted);
  letter-spacing: 0.05em;
}

/* The Stanza & Hanging Indent */
.poem-body {
  font-family: var(--font-serif);
  font-size: var(--text-poem);
  line-height: var(--line-height-poem);
  white-space: pre-wrap;
  letter-spacing: 0.01em;
  padding-left: 1.5rem;
  text-indent: -1.5rem;
  hanging-punctuation: first;
  overflow-wrap: anywhere;
  word-break: break-word;
}

/* Font Size Modifiers */
.poem-body.size-sm { font-size: 1.125rem; }
.poem-body.size-md { font-size: 1.25rem; }
.poem-body.size-lg { font-size: 1.45rem; }

/* Tamil Poem Overrides */
.poem-body[lang="ta"],
html[lang="ta"] .poem-body {
  font-family: var(--font-tamil-serif);
  font-size: 1.25rem;
  line-height: 2.0;
}
.poem-body[lang="ta"].size-sm { font-size: 1.18rem; }
.poem-body[lang="ta"].size-md { font-size: 1.35rem; }
.poem-body[lang="ta"].size-lg { font-size: 1.55rem; }

/* Poem Navigation Footer (Prev / Next) */
.poem-nav-footer {
  margin-top: 4.5rem;
  padding-top: 2rem;
  border-top: 1px solid var(--line);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1.5rem;
}

.poem-nav-item {
  display: flex;
  flex-direction: column;
  min-height: 48px;
}

.poem-nav-label {
  font-size: var(--text-xs);
  color: var(--muted);
  font-style: italic;
  font-family: var(--font-serif);
}

.poem-nav-link {
  font-family: var(--font-serif);
  font-size: 1.2rem;
  color: var(--text-main);
  text-decoration: none;
  transition: color var(--transition-fast);
}

.poem-nav-link:hover {
  color: var(--accent);
  text-decoration: underline;
}

/* ==========================================================================
   Print Stylesheet (Clean, distraction-free poem printing)
   ========================================================================== */
@media print {
  body {
    background: #FFFFFF !important;
    color: #1F1A16 !important;
    font-size: 12pt;
  }

  .site-header,
  .site-footer,
  .reading-toolbar,
  .announcement-bar,
  #reading-progress-bar,
  .poem-nav-footer,
  .skip-link,
  .btn-text-literary {
    display: none !important;
  }

  .poem-reading-view {
    background: transparent !important;
    padding: 0 !important;
    min-height: auto !important;
  }

  .poem-header {
    margin-bottom: 2rem;
  }

  .poem-title {
    font-size: 22pt;
    color: #000000 !important;
  }

  .poem-body {
    font-family: "Georgia", "Times New Roman", serif;
    font-size: 12pt;
    line-height: 1.75;
    color: #000000 !important;
    padding-left: 0;
    text-indent: 0;
  }
}
