/* Practice-only hard-word highlighting, glass popover, and Vocabulary panel.
   Linked after css/reading.css. Strict Exam never mounts these nodes. */

@font-face {
  font-family: 'Hind Siliguri';
  font-style: normal;
  font-weight: 600;
  font-display: swap;
  src: url(../fonts/hind-siliguri-600.woff2) format('woff2');
}
@font-face {
  font-family: 'Hind Siliguri';
  font-style: normal;
  font-weight: 700;
  font-display: swap;
  src: url(../fonts/hind-siliguri-700.woff2) format('woff2');
}

/* Bundled Bangla face: bolder and larger so conjuncts stay clear on Windows 7. */
.rd-hw-pop-bn,
.rd-vocab-bn,
.rd-vocab-pat-bn,
.rd-help-bn {
  font-family: 'Hind Siliguri', 'Noto Sans Bengali', sans-serif;
  font-weight: 700;
  font-size: 17px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
}
.rd-vocab-pat-bn,
.rd-help-bn { font-size: 16px; font-weight: 600; }

/* ---- passage marks ---- */
.rd-hw {
  color: #b42318;
  text-decoration: underline;
  text-decoration-color: rgba(180, 35, 24, 0.45);
  text-decoration-thickness: 1px;
  text-underline-offset: 2px;
  cursor: pointer;
  border-radius: 2px;
}
.rd-hw:hover, .rd-hw:focus-visible, .rd-hw-open {
  background: rgba(180, 35, 24, 0.08);
  outline: none;
}
.rd-hw:focus-visible { box-shadow: 0 0 0 2px rgba(180, 35, 24, 0.35); }

/* High-contrast exam palettes: keep the mark readable, never muddy yellow/white */
.rd-contrast-wb .rd-hw,
.rd-contrast-yb .rd-hw {
  color: #ff8b80;
  text-decoration-color: rgba(255, 139, 128, 0.7);
  background: transparent;
}
.rd-contrast-wb .rd-hw:hover,
.rd-contrast-wb .rd-hw:focus-visible,
.rd-contrast-wb .rd-hw-open,
.rd-contrast-yb .rd-hw:hover,
.rd-contrast-yb .rd-hw:focus-visible,
.rd-contrast-yb .rd-hw-open {
  background: rgba(255, 139, 128, 0.16);
}

/* Settings: "List only" — marks stay in the DOM for jump-to, but look like body text */
.rd-hw-off .rd-hw {
  color: inherit;
  text-decoration: none;
  background: transparent;
  cursor: inherit;
  box-shadow: none;
}
.rd-hw-off .rd-hw:hover,
.rd-hw-off .rd-hw:focus-visible,
.rd-hw-off .rd-hw-open { background: transparent; }

.rd-hw-flash {
  animation: rd-hw-flash 1.2s ease-out;
}
@keyframes rd-hw-flash {
  0%, 25% { background: rgba(180, 35, 24, 0.28); }
  100% { background: transparent; }
}
html[data-motion=off] .rd-hw-flash { animation: none; background: rgba(180, 35, 24, 0.2); }
@media (prefers-reduced-motion: reduce) {
  .rd-hw-flash { animation: none; background: rgba(180, 35, 24, 0.2); }
}

/* ---- top-bar button (visible on phones too; practice-tools stay hidden there) ---- */
.rd-btn-vocab { flex: none; }
@media (max-width: 799px) {
  .rd-btn-vocab {
    min-height: 36px;
    min-width: 44px;
    padding: 4px 8px;
    font-size: 12px;
  }
}

/* ---- liquid-glass popover: small, anchored, solid frosted fallback ---- */
.rd-hw-pop {
  position: fixed;
  z-index: 80;
  box-sizing: border-box;
  min-width: 180px;
  max-width: 320px;
  padding: 11px 13px 13px;
  border-radius: 14px;
  /* Solid frosted fallback when backdrop-filter is missing (e.g. older Chrome). */
  border: 1px solid rgba(255, 255, 255, 0.72);
  background: #f4f1eb;
  box-shadow:
    0 10px 28px rgba(28, 25, 23, 0.18),
    0 0 0 1px rgba(28, 25, 23, 0.06),
    inset 0 1px 0 rgba(255, 255, 255, 0.9),
    inset 0 -1px 0 rgba(255, 255, 255, 0.25);
  color: #1c1917;
  font-family: inherit;
  font-size: 14px;
  line-height: 1.45;
  pointer-events: auto;
  opacity: 0;
  transform: scale(0.85) translateY(8px);
  transform-origin: 50% 100%;
  transition:
    opacity 200ms cubic-bezier(0.22, 1.18, 0.36, 1),
    transform 200ms cubic-bezier(0.22, 1.18, 0.36, 1);
  will-change: opacity, transform;
}
.rd-hw-pop--below {
  transform: scale(0.85) translateY(-8px);
  transform-origin: 50% 0%;
}
.rd-hw-pop--open {
  opacity: 1;
  transform: scale(1) translateY(0);
}
.rd-hw-pop--close {
  opacity: 0;
  transform: scale(0.85) translateY(8px);
  transition-duration: 120ms;
  transition-timing-function: ease-in;
}
.rd-hw-pop--below.rd-hw-pop--close {
  transform: scale(0.85) translateY(-8px);
}

/* Arrow: a small triangle pointing at the word (not a filled diamond). */
.rd-hw-pop::after {
  content: "";
  position: absolute;
  left: var(--rd-hw-arrow-x, 50%);
  width: 0;
  height: 0;
  border: 7px solid transparent;
  pointer-events: none;
  transform: none;
}
.rd-hw-pop:not(.rd-hw-pop--below)::after {
  bottom: -14px;
  margin-left: -7px;
  border-top-color: #f4f1eb;
  border-bottom-width: 0;
}
.rd-hw-pop--below::after {
  top: -14px;
  margin-left: -7px;
  border-bottom-color: #f4f1eb;
  border-top-width: 0;
}

.rd-hw-pop-head { display: flex; align-items: baseline; gap: 8px; margin: 0 0 6px; }
.rd-hw-pop-word { font-weight: 600; font-size: 15px; color: #1c1917; }
.rd-hw-pop-pos { font-size: 11px; letter-spacing: 0.06em; text-transform: uppercase; color: #7a746c; }
.rd-hw-pop-bn { margin: 0 0 6px; color: #2a2622; }
.rd-hw-pop-ex { margin: 0; font-size: 13px; color: #5c564f; font-style: italic; }

[data-theme=dark] .rd-hw-pop {
  background: #1c1e24;
  border-color: rgba(255, 255, 255, 0.2);
  box-shadow:
    0 12px 32px rgba(0, 0, 0, 0.48),
    0 0 0 1px rgba(0, 0, 0, 0.35),
    inset 0 1px 0 rgba(255, 255, 255, 0.16),
    inset 0 -1px 0 rgba(255, 255, 255, 0.04);
  color: #f3efe8;
}
[data-theme=dark] .rd-hw-pop-word { color: #f3efe8; }
[data-theme=dark] .rd-hw-pop-pos { color: #b0a89e; }
[data-theme=dark] .rd-hw-pop-bn { color: #f3efe8; }
[data-theme=dark] .rd-hw-pop-ex { color: #c9c1b6; }
[data-theme=dark] .rd-hw-pop:not(.rd-hw-pop--below)::after { border-top-color: #1c1e24; }
[data-theme=dark] .rd-hw-pop--below::after { border-bottom-color: #1c1e24; }


@supports ((-webkit-backdrop-filter: blur(1px)) or (backdrop-filter: blur(1px))) {
  .rd-hw-pop {
    background: rgba(255, 252, 247, 0.8);
    -webkit-backdrop-filter: blur(18px) saturate(1.65);
    backdrop-filter: blur(18px) saturate(1.65);
  }
  [data-theme=dark] .rd-hw-pop {
    background: rgba(22, 24, 30, 0.55);
  }
  .rd-hw-pop:not(.rd-hw-pop--below)::after { border-top-color: rgba(255, 252, 247, 0.92); }
  .rd-hw-pop--below::after { border-bottom-color: rgba(255, 252, 247, 0.92); }
  [data-theme=dark] .rd-hw-pop:not(.rd-hw-pop--below)::after { border-top-color: rgba(22, 24, 30, 0.85); }
  [data-theme=dark] .rd-hw-pop--below::after { border-bottom-color: rgba(22, 24, 30, 0.85); }
  }

html[data-motion=off] .rd-hw-pop,
html[data-motion=off] .rd-hw-pop--below,
html[data-motion=off] .rd-hw-pop--close {
  transform: none;
  transition: opacity 120ms ease;
}
@media (prefers-reduced-motion: reduce) {
  .rd-hw-pop,
  .rd-hw-pop--below,
  .rd-hw-pop--close {
    transform: none;
    transition: opacity 120ms ease;
  }
}

/* ---- Vocabulary panel (practice; not full-screen) ---- */
.rd-vocab-panel {
  position: fixed;
  z-index: 70;
  display: flex;
  flex-direction: column;
  box-sizing: border-box;
  width: min(360px, calc(100vw - 24px));
  max-height: min(520px, calc(100vh - 96px));
  right: 16px;
  bottom: 64px;
  border-radius: 14px;
  border: 1px solid rgba(40, 36, 32, 0.12);
  background: #fffcf7;
  box-shadow: 0 16px 40px rgba(28, 25, 23, 0.18);
  color: #1c1917;
  overflow: hidden;
}
.rd-vocab-panel[hidden] { display: none !important; }
.rd-vocab-head {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 8px 10px 14px;
  border-bottom: 1px solid rgba(40, 36, 32, 0.1);
  flex: none;
}
.rd-vocab-titles { min-width: 0; flex: 1; }
.rd-vocab-kicker {
  margin: 0;
  font-size: 10px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: #7a746c;
}
.rd-vocab-ptitle {
  margin: 2px 0 0;
  font-size: 15px;
  font-weight: 600;
  line-height: 1.3;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.rd-vocab-close {
  flex: none;
  width: 44px;
  height: 44px;
  border: 0;
  background: transparent;
  color: inherit;
  font-size: 16px;
  cursor: pointer;
  border-radius: 8px;
}
.rd-vocab-close:hover, .rd-vocab-close:focus-visible { background: rgba(40, 36, 32, 0.06); outline: none; }
.rd-vocab-body { flex: 1 1 auto; overflow: auto; padding: 8px 14px 16px; -webkit-overflow-scrolling: touch; }
.rd-vocab-h {
  margin: 14px 0 8px;
  font-size: 10px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: #7a746c;
  font-weight: 600;
}
.rd-vocab-list, .rd-vocab-patterns { list-style: none; margin: 0; padding: 0; }
.rd-vocab-item, .rd-vocab-pat {
  padding: 10px 0;
  border-bottom: 1px solid rgba(40, 36, 32, 0.08);
}
.rd-vocab-item-top { display: flex; align-items: baseline; gap: 8px; flex-wrap: wrap; }
.rd-vocab-term {
  border: 0;
  background: none;
  padding: 0;
  font: inherit;
  font-weight: 600;
  color: #b42318;
  cursor: pointer;
  text-align: left;
  text-decoration: underline;
  text-decoration-color: rgba(180, 35, 24, 0.35);
  text-underline-offset: 2px;
}
.rd-vocab-term:hover, .rd-vocab-term:focus-visible { color: #8f1b14; outline: none; }
.rd-vocab-item.is-missed .rd-vocab-term {
  color: inherit;
  text-decoration: none;
  cursor: default;
}
.rd-vocab-pos, .rd-vocab-miss {
  font-size: 11px;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: #8a837a;
}
.rd-vocab-miss { letter-spacing: 0.02em; text-transform: none; }
.rd-vocab-bn { margin: 4px 0 0; }
.rd-vocab-ex, .rd-vocab-pat-en { margin: 4px 0 0; font-size: 13px; color: #5c564f; }
.rd-vocab-ex { font-style: italic; }
.rd-vocab-pat-type { font-weight: 600; font-size: 13px; }
.rd-vocab-pat-bn { margin: 2px 0 0; color: #3f3a36; }
.rd-vocab-empty { margin: 12px 0; color: #7a746c; }

[data-theme=dark] .rd-vocab-panel {
  background: #1c1e24;
  border-color: rgba(255, 255, 255, 0.1);
  color: #f3efe8;
  box-shadow: 0 16px 40px rgba(0, 0, 0, 0.45);
}
[data-theme=dark] .rd-vocab-head { border-bottom-color: rgba(255, 255, 255, 0.1); }
[data-theme=dark] .rd-vocab-kicker, [data-theme=dark] .rd-vocab-h, [data-theme=dark] .rd-vocab-pos, [data-theme=dark] .rd-vocab-miss { color: #b0a89e; }
[data-theme=dark] .rd-vocab-item, [data-theme=dark] .rd-vocab-pat { border-bottom-color: rgba(255, 255, 255, 0.08); }
[data-theme=dark] .rd-vocab-term { color: #ff8b80; text-decoration-color: rgba(255, 139, 128, 0.4); }
[data-theme=dark] .rd-vocab-item.is-missed .rd-vocab-term { color: inherit; }
[data-theme=dark] .rd-vocab-ex, [data-theme=dark] .rd-vocab-pat-en { color: #c9c1b6; }
[data-theme=dark] .rd-vocab-pat-bn, [data-theme=dark] .rd-vocab-bn { color: #e6e0d7; }
[data-theme=dark] .rd-vocab-close:hover, [data-theme=dark] .rd-vocab-close:focus-visible { background: rgba(255,255,255,0.06); }

@supports ((-webkit-backdrop-filter: blur(1px)) or (backdrop-filter: blur(1px))) {
  html:not([data-motion=off]) .rd-vocab-panel {
    background: rgba(255, 252, 247, 0.86);
    -webkit-backdrop-filter: blur(10px) saturate(1.1);
    backdrop-filter: blur(10px) saturate(1.1);
  }
  html:not([data-motion=off])[data-theme=dark] .rd-vocab-panel {
    background: rgba(28, 30, 36, 0.88);
  }
}

@media (max-width: 799px) {
  .rd-vocab-panel {
    left: 8px;
    right: 8px;
    bottom: 56px;
    width: auto;
    max-height: min(62vh, 480px);
    border-radius: 14px 14px 10px 10px;
  }
}
