/*
 * permanent-i18n.css — B3 Persistent Trilingual Language Switch (v9)
 *
 * v9: Button styling restored from old-button-reference.css authority.
 *     Round panel, CN/EN/JP buttons, dark mode, mobile, reduced-motion.
 *
 * No-JS safe: show only source language, or Chinese fallback, or all.
 * Before .vtx-i18n-ready (no JS): hide all, show source-lang if marked, else zh.
 * After JS init: hide inactive, show .vtx-active.
 */
/* ── Default: all wrappers hidden ── */
.vtx-lang-content {
  display: none;
}

/* ── Before JS: show source-language wrapper if marked ── */
html:not(.vtx-i18n-ready) .vtx-lang-content[data-vtx-source-lang] {
  display: block;
}

/* ── Before JS: fallback — if no source-lang exists, show Chinese ── */
html:not(.vtx-i18n-ready):not(:has(.vtx-lang-content[data-vtx-source-lang])) .vtx-lang-content[lang="zh"] {
  display: block;
}

/* ── After JS init: hide all, show active ── */
html.vtx-i18n-ready .vtx-lang-content {
  display: none;
}
html.vtx-i18n-ready .vtx-lang-content.vtx-active {
  display: block;
}

/* ── Language switch container (restored old-button-reference.css design) ── */
#vtx-permanent-langswitch {
  position: fixed;
  right: 20px;
  top: 50%;
  transform: translateY(-50%);
  z-index: 900;
  display: flex;
  flex-direction: column;
  gap: 3px;
  padding: 5px;
  border-radius: 16px;
  background: var(--heo-card-bg, #fff);
  border: 1px solid rgba(128, 128, 128, .22);
  box-shadow: 0 4px 16px rgba(0, 0, 0, .13);
}
#vtx-permanent-langswitch button {
  width: 40px;
  height: 32px;
  padding: 0;
  border: none;
  border-radius: 9px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  background: transparent;
  color: #9aa0a6;
  font-size: .74rem;
  font-weight: 600;
  letter-spacing: .02em;
  line-height: 1;
  transition: background .25s, color .25s;
}
#vtx-permanent-langswitch button:hover {
  color: #60a5fa;
  background: rgba(96, 165, 250, .10);
}
#vtx-permanent-langswitch button.vtx-active {
  background: #60a5fa;
  color: #fff;
  box-shadow: 0 3px 10px rgba(96, 165, 250, .35);
}
#vtx-permanent-langswitch button.vtx-active:hover {
  color: #fff;
}
/* Focus-visible for keyboard users */
#vtx-permanent-langswitch button:focus-visible {
  outline: 2px solid #60a5fa;
  outline-offset: 2px;
}

/* ── Dark mode ── */
html[data-theme="dark"] #vtx-permanent-langswitch {
  background: var(--heo-card-bg, rgba(30, 30, 30, .95));
  border-color: rgba(255, 255, 255, .12);
  box-shadow: 0 4px 16px rgba(0, 0, 0, .35);
}
html[data-theme="dark"] #vtx-permanent-langswitch button {
  color: #8b949e;
}
html[data-theme="dark"] #vtx-permanent-langswitch button:hover {
  color: #60a5fa;
  background: rgba(96, 165, 250, .15);
}
html[data-theme="dark"] #vtx-permanent-langswitch button.vtx-active {
  background: #60a5fa;
  color: #fff;
}
@media (prefers-color-scheme: dark) {
  html:not([data-theme]) #vtx-permanent-langswitch {
    background: rgba(30, 30, 30, .95);
    border-color: rgba(255, 255, 255, .12);
    box-shadow: 0 4px 16px rgba(0, 0, 0, .35);
  }
  html:not([data-theme]) #vtx-permanent-langswitch button {
    color: #8b949e;
  }
  html:not([data-theme]) #vtx-permanent-langswitch button:hover {
    color: #60a5fa;
    background: rgba(96, 165, 250, .15);
  }
}

/* ── Mobile ── */
@media screen and (max-width: 768px) {
  #vtx-permanent-langswitch {
    right: 12px;
    padding: 4px;
    border-radius: 14px;
  }
  #vtx-permanent-langswitch button {
    width: 36px;
    height: 28px;
    font-size: .7rem;
  }
}

/* ── Reduced motion ── */
@media (prefers-reduced-motion: reduce) {
  #vtx-permanent-langswitch button {
    transition: none;
  }
}

/* ── Image translated text ── */
.vtx-img-text {
  font-size: 0.85rem;
  color: #555;
  margin-top: 0.25rem;
  font-style: italic;
}

/* ── Accessibility ── */
.vtx-sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}
/*
 * image-transcript.css — Image Translation Viewer Styles
 *
 * No-JS: .vtx-img-text spans remain visible with display:block.
 * JS: details wrapping + dialog for viewing translations.
 */

/* ── View button ── */
.vtx-img-view-btn {
  display: inline-block;
  margin: 8px 0;
  padding: 6px 14px;
  font-size: .82rem;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  color: #60a5fa;
  background: transparent;
  border: 1px solid #60a5fa;
  border-radius: 6px;
  cursor: pointer;
  transition: background .2s, color .2s;
  line-height: 1.4;
}
.vtx-img-view-btn:hover {
  background: #60a5fa;
  color: #fff;
}

/* ── Collapsible details ── */
.vtx-img-details {
  margin: 4px 0 12px;
  padding: 6px 10px;
  border: 1px solid rgba(128, 128, 128, .18);
  border-radius: 6px;
  font-size: .88rem;
}
.vtx-img-details summary {
  cursor: pointer;
  color: #60a5fa;
  font-weight: 500;
  user-select: none;
}
.vtx-img-details .vtx-img-text {
  display: block;
  margin-top: 4px;
}

/* ── Dialog overlay ── */
.vtx-img-dialog-overlay {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 1000000;
  align-items: center;
  justify-content: center;
}
.vtx-img-dialog-overlay.vtx-img-dialog-open {
  display: flex;
}

.vtx-img-dialog-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, .55);
}

.vtx-img-dialog-panel {
  position: relative;
  z-index: 1;
  background: var(--heo-card-bg, #fff);
  border-radius: 12px;
  box-shadow: 0 8px 32px rgba(0, 0, 0, .25);
  max-width: 90vw;
  max-height: 85vh;
  overflow-y: auto;
  padding: 24px;
  margin: 20px;
}

.vtx-img-dialog-close {
  position: sticky;
  top: 0;
  float: right;
  z-index: 2;
  width: 32px;
  height: 32px;
  border: none;
  border-radius: 50%;
  background: rgba(128, 128, 128, .15);
  color: #555;
  font-size: 1.2rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  line-height: 1;
}
.vtx-img-dialog-close:hover {
  background: rgba(128, 128, 128, .25);
  color: #333;
}

/* ── Dialog body: desktop side-by-side ── */
.vtx-img-dialog-body {
  display: flex;
  gap: 24px;
  align-items: flex-start;
  clear: both;
}

.vtx-img-dialog-image {
  flex: 0 0 auto;
  max-width: 55%;
}
.vtx-img-dialog-image img {
  max-width: 100%;
  height: auto;
  border-radius: 6px;
}

.vtx-img-dialog-text {
  flex: 1 1 auto;
  min-width: 0;
  font-size: .92rem;
  line-height: 1.7;
  color: var(--font-color, #333);
}
.vtx-img-dialog-text .vtx-img-text {
  display: block;
  margin-bottom: 8px;
  font-style: italic;
  color: #555;
}

/* ── Mobile: stacked ── */
@media screen and (max-width: 768px) {
  .vtx-img-dialog-panel {
    max-width: 95vw;
    max-height: 90vh;
    padding: 16px;
    margin: 8px;
  }
  .vtx-img-dialog-body {
    flex-direction: column;
    gap: 16px;
  }
  .vtx-img-dialog-image {
    max-width: 100%;
  }
}

/* ── Dark mode ── */
html[data-theme="dark"] .vtx-img-dialog-panel {
  background: var(--heo-card-bg, #1e1e1e);
  box-shadow: 0 8px 32px rgba(0, 0, 0, .5);
}
html[data-theme="dark"] .vtx-img-dialog-close {
  background: rgba(255, 255, 255, .1);
  color: #aaa;
}
html[data-theme="dark"] .vtx-img-dialog-close:hover {
  background: rgba(255, 255, 255, .2);
  color: #ddd;
}
html[data-theme="dark"] .vtx-img-dialog-text {
  color: #ccc;
}
html[data-theme="dark"] .vtx-img-dialog-text .vtx-img-text {
  color: #999;
}
html[data-theme="dark"] .vtx-img-view-btn {
  color: #60a5fa;
  border-color: #60a5fa;
}
html[data-theme="dark"] .vtx-img-view-btn:hover {
  background: #60a5fa;
  color: #fff;
}
html[data-theme="dark"] .vtx-img-details summary {
  color: #60a5fa;
}

@media (prefers-color-scheme: dark) {
  html:not([data-theme]) .vtx-img-dialog-panel {
    background: #1e1e1e;
    box-shadow: 0 8px 32px rgba(0, 0, 0, .5);
  }
  html:not([data-theme]) .vtx-img-dialog-close {
    background: rgba(255, 255, 255, .1);
    color: #aaa;
  }
  html:not([data-theme]) .vtx-img-dialog-text {
    color: #ccc;
  }
}

/* ── Accessibility ── */
.vtx-img-dialog-overlay .vtx-img-dialog-close:focus-visible {
  outline: 2px solid #60a5fa;
  outline-offset: 2px;
}

@media (prefers-reduced-motion: reduce) {
  .vtx-img-view-btn {
    transition: none;
  }
}.vtx-img-dialog-heading { margin: 0 48px 18px 0; font-size: 1.1rem; color: var(--font-color, #333); }
.vtx-img-dialog-panel { width: min(1120px, 90vw); box-sizing: border-box; }
.vtx-img-dialog-image { flex: 1 1 50%; min-width: 0; }
.vtx-img-dialog-text { flex: 1 1 45%; overflow-wrap: anywhere; }
.vtx-img-dialog-text .vtx-img-text { font-style: normal; color: inherit; }
html[data-theme="dark"] .vtx-img-dialog-heading { color: #eee; }
.vtx-img-view-btn:focus-visible { outline: 2px solid currentColor; outline-offset: 3px; }
@media (max-width:768px) { .vtx-img-dialog-panel { width: 95vw; } .vtx-img-dialog-image { width: 100%; } }
