/* The readings panel: the original, the rōmaji, the translation and the
   source, a sheet that fades in from the right (from the foot on phones). */

.trans-panel {
  position: fixed; top: 0; right: 0; bottom: 0; z-index: var(--z-readings);
  width: min(340px, 92vw);
  background: var(--veil-panel);
  backdrop-filter: blur(16px); -webkit-backdrop-filter: blur(16px);
  border-left: 1px solid var(--ink-soft);
  opacity: 0; pointer-events: none;
  /* visibility keeps the closed panel (and its close button) out of the
     tab order and away from screen readers; it flips after the fade-out */
  visibility: hidden;
  transform: translateX(24px);
  transition: opacity var(--dur-panel) var(--ease-breath), transform var(--dur-panel) var(--ease-breath),
              visibility 0s linear 0.9s;
  display: flex; align-items: center;
  overflow-y: auto; scrollbar-width: none;
}
.trans-panel::-webkit-scrollbar { width: 0; }
.trans-panel.open {
  opacity: 1; pointer-events: auto; visibility: visible; transform: none;
  transition: opacity var(--dur-panel) var(--ease-breath), transform var(--dur-panel) var(--ease-breath);
}

.trans-close {
  position: absolute; top: 22px; right: 22px;
  background: none; border: none; cursor: pointer;
  color: var(--paper-dim); font-size: 24px; line-height: 1; padding: 4px 8px;
  transition: color var(--dur-hover) var(--ease-breath), transform var(--dur-hover) var(--ease-breath);
}
.trans-close:hover { color: var(--accent); transform: scale(1.15); }

.trans-inner { width: 100%; padding: 64px 40px; }
.trans-block { margin: 0; }
.trans-label {
  font-family: var(--font-label); font-weight: 300; font-size: var(--type-1);
  letter-spacing: 0.4em; text-transform: uppercase; color: var(--accent-quiet);
  margin-bottom: 18px;
}
.trans-jp {
  font-family: var(--font-glyph); font-size: 1.5rem; line-height: 1.85;
  color: var(--text); white-space: pre-line; letter-spacing: 0.04em;
}
.trans-romaji {
  font-family: var(--font-label); font-weight: 300; font-size: var(--type-3);
  line-height: 1.9; letter-spacing: 0.14em; color: var(--paper-dim);
  white-space: pre-line;
}
.trans-en {
  font-family: var(--font-verse); font-size: 1.12rem; line-height: 1.75;
  color: var(--paper); white-space: pre-line; font-style: italic;
}
.trans-rule { height: 1px; background: var(--ink-soft); margin: 30px 0; }
.trans-source {
  margin-top: 34px;
  font-family: var(--font-label); font-weight: 300; font-size: var(--type-1);
  letter-spacing: 0.16em; line-height: 1.8; color: var(--paper-faint);
  font-style: italic;
}

/* while the panel is open the season nav slides left, clear of it */
body.panel-open .seasons {
  transform: translateY(-50%) translateX(calc(-1 * min(340px, 92vw) + 4px));
  transition: transform var(--dur-panel) var(--ease-breath);
}

@media (max-width: 820px) {
  .trans-panel { width: min(320px, 90vw); }
}

/* phones: a full-width bottom sheet, not a cramped side strip; the season
   nav sits in the top row and stays put */
@media (max-width: 640px) {
  .trans-panel {
    top: auto; left: 0; right: 0; bottom: 0; width: 100%;
    max-height: 72vh;
    border-left: none; border-top: 1px solid var(--ink-soft);
    border-radius: 18px 18px 0 0;
    transform: translateY(28px); align-items: stretch;
  }
  .trans-panel.open { transform: none; }
  .trans-inner { padding: 48px 26px; }
  body.panel-open .seasons { transform: none; }
}

/* landscape phones: the season nav is a top row here too */
@media (max-height: 480px) and (max-width: 900px) {
  body.panel-open .seasons { transform: none; }
}

/* the panel and the nav shift fade only, no slide */
@media (prefers-reduced-motion: reduce) {
  .trans-panel { transition: opacity 0.5s var(--ease-breath), visibility 0s linear 0.5s; transform: none; }
  .trans-panel.open { transform: none; transition: opacity 0.5s var(--ease-breath); }
  body.panel-open .seasons { transition: none; }
}
