/* --- Base --- */
* { margin: 0; padding: 0; box-sizing: border-box; }

@font-face {
  font-family: 'Ravi';
  src: url('Ravi-VF.ttf') format('truetype');
}

body {
  font-family: 'Ravi', 'Arial', sans-serif;
  background: #fff;
  color: #000;
  direction: rtl;
  text-align: right;
  line-height: 2;
  padding: 20px;
  max-width: 800px;
  margin: 0 auto;
}

/* --- Header --- */
header { border-bottom: 2px solid #000; padding-bottom: 20px; margin-bottom: 40px; }
header h1 { font-size: 2.5em; margin-bottom: 10px; }
header h1 a { color: #000; text-decoration: none; }
header h1 a:hover { text-decoration: underline; }
.subtitle { font-size: 1.1em; color: #333; }

/* --- Main / breadcrumb --- */
main { min-height: 60vh; }
.breadcrumb { margin-bottom: 30px; font-size: 0.95em; color: #555; }
.breadcrumb a { color: #000; text-decoration: none; }
.breadcrumb a:hover { text-decoration: underline; }
.breadcrumb span { margin: 0 8px; }

/* --- Index page styles --- */
.book { margin-bottom: 50px; }
.book h2 { font-size: 1.8em; margin-bottom: 8px; }
.book .poet { color: #333; margin-bottom: 20px; font-size: 0.95em; }
.section { margin-bottom: 15px; }
.poem-list { list-style: none; margin: 0; padding: 0; }
.poem-list li { margin-bottom: 8px; }
.poem-list a {
  color: #000;
  text-decoration: none;
  display: inline-block;
  padding: 4px 8px;
  margin-right: -8px;
  border-radius: 4px;
  transition: background-color 0.15s ease;
  cursor: pointer;
}
.poem-list a:hover {
  background-color: #f0f0f0;
}

/* --- Poem --- */
.poem { margin-top: 40px; }
.poem h2 { font-size: 2em; margin-bottom: 35px; }

.couplets { max-width: 800px; margin: 0 auto; }

/* ======= REVERTED ALIGNMENT: original two-verse layout ======= */
.couplet {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 2em;
  gap: 30px;
  /* keep full width and natural sizing */
  width: 100%;
  box-sizing: border-box;
}

/* Each verse uses natural flow (no fixed widths), justified text like original */
.verse {
  font-size: 1.3em;
  line-height: 2.5;
  margin: 0;
  text-align: justify;          /* justify the lines */
  text-align-last: center;     /* center last line */
  hyphens: auto;
}

/* explicit directions like the original */
.verse-first { text-align: right; }
.verse-second { text-align: left; }

/* --- Controls (buttons) --- */
.screenshot-controls { display: flex; gap: 10px; margin-bottom: 25px; }
.screenshot-controls button {
  background: #fff;
  border: 1.5px solid #000;
  color: #000;
  padding: 10px 18px;
  font-family: inherit;
  font-size: 0.95em;
  border-radius: 8px;
  cursor: pointer;
  transition: all 0.18s ease;
  min-width: 120px;
}

/* Floating done button */
#finish-selection {
  background: #000;
  color: #fff;
  position: fixed;
  bottom: 25px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 999;
  box-shadow: 0 2px 8px rgba(0,0,0,0.18);
}

/* --- Selection visuals (only on page, not in screenshot) --- */
.couplet.selectable {
  border: 2px dotted #bbb;
  border-radius: 10px;
  padding: 5px;
  outline-offset: 6px;
  transition: border-color 0.18s ease, background 0.18s ease;
  cursor: pointer;
}
.couplet.selectable:hover { border-color: #999; }

.couplet.selected {
  outline: 1px solid rgba(0,0,0,0.08);
  background: #dbdbdb; /* keep white */
  border-radius: 10px;
}

/* --- Hint text --- */
.selection-hint {
  text-align: center;
  color: #555;
  font-size: 0.95em;
  margin-bottom: 20px;
  background: #f7f7f7;
  padding: 8px 15px;
  border-radius: 6px;
  display: inline-block;
  opacity: 0;
  transition: opacity 0.3s ease;
}
.selection-hint.fade-in { opacity: 1; }
.selection-hint.fade-out { opacity: 0; }

/* --- Screenshot container (offscreen, dynamic size) --- */
.screenshot-container {
  position: fixed;
  top: -10000px;    /* offscreen */
  right: 0;
  background: #fff;
  padding: 60px 40px;
  font-family: 'Ravi', sans-serif;
  display: inline-block;            /* shrink to content (dynamic) */
  text-align: center;
  color: #000;
  overflow: visible;
  box-shadow: none;
}

/* Ensure inside screenshot couplets keep the same original layout (no borders, no padding from selection) */
.screenshot-container .couplet {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 30px;
  margin-bottom: 1.5em;
  border: none !important;     /* remove any selection borders */
  background: transparent !important;
  padding: 0 !important;
}

.screenshot-container .verse {
  font-size: 1.3em;
  line-height: 2.5;
  margin: 0;
  text-align: justify;
  text-align-last: center;
  hyphens: auto;
  color: #000;
}

/* Footer in screenshot */
.screenshot-footer {
  margin-top: 40px;
  border-top: 1px solid #eee;
  padding-top: 10px;
  font-size: 0.9em;
  color: #555;
  text-align: left;
}
.screenshot-footer .poet-name {
  font-weight: bold;
  margin-bottom: 4px;
}

/* --- Responsive: on small screens keep readable stacked view on page ---- */
@media (max-width: 600px) {
  body { padding: 15px; }
  header h1 { font-size: 2em; }
  .poem h2 { font-size: 1.5em; }

  /* keep on-page couplets stacked (original behavior) */
  .couplet { flex-direction: column; gap: 0; }
  .verse { text-align: center; }

  .screenshot-container .couplet {
    flex-direction: column;
    margin-bottom: 4em; /* 👈 more space between couplets */
  }

  .screenshot-container .verse {
    text-align: justify;
    text-align-last: center;
    line-height: 2;
  }

  .screenshot-container .verse + .verse {
    margin-top: 0.2em; /* 👈 small gap between the two verses inside each couplet */
  }
}
