/* 2026-11-20: exercise-card contrast + reserved-space sticky language pill.
   Dark mode is the priority. Nothing in the vocab list may slide under the pill or the header.
   The dock unsicks when the story section begins, so it never covers the article. */

:root { --ku-header-h: 74px; --ku-chrome-h: 111px; --ku-lang-h: 64px; }

/* main#app uses overflow:clip on the live site, which stops position:sticky
   from pinning the language menu. Visible overflow lets the dock sit just
   below header.site without covering words, speakers, or the header itself. */
#app { overflow: visible !important; }

/* Light-mode IPA was still #e8730c (3.04:1 on white). #a34a00 is ~5.9:1. */
body .ex .ipa { color: #a34a00; font-weight: 600; }


/* Dock sticks just below the site header and keeps the word list in its own scroll area. */
.ku-vocab-dock {
  position: sticky;
  top: var(--ku-chrome-h);
  z-index: 40;
  display: flex;
  flex-direction: column;
  max-height: calc(100dvh - var(--ku-chrome-h) - 12px);
  min-height: 0;
  margin: 0 0 8px;
  overflow: hidden;
}
/* Constrain sticky to the vocabulary card. When the story card starts,
   .is-unstuck turns off sticky so the dock scrolls away with vocabulary. */
.ku-vocab-ex {
  overflow: clip;
}
.ku-vocab-dock.is-unstuck {
  position: relative;
  top: auto;
}
.ku-lang-pill-wrap {
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  padding: 10px 12px;
  background: #fff;
  border: 1px solid rgba(199, 161, 74, 0.45);
  border-radius: 18px;
  box-shadow: 0 8px 22px -12px rgba(50, 10, 14, 0.35), 0 0 0 1px rgba(125, 20, 24, 0.04);
}
.ku-lang-pill-wrap .ex-h,
.ku-vocab-dock .ex-h {
  margin: 0;
  color: #151c37 !important;
  font-size: 24px;
}
.ku-lang-pill {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  border-radius: 999px;
  padding: 5px 6px 5px 14px;
  background: #fbf8f1;
  border: 1px solid rgba(199, 161, 74, 0.65);
  box-shadow: 0 4px 14px -8px rgba(50, 10, 14, 0.4);
}
.ku-lang-pill label {
  font: 700 11px/1 "Libre Franklin", system-ui, sans-serif;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: #7d1418;
  white-space: nowrap;
}
.ku-lang-pill select {
  appearance: none;
  -webkit-appearance: none;
  border: 0;
  border-radius: 999px;
  background: #7d1418 url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'><path fill='%23fbf8f1' d='M1 1l5 5 5-5'/></svg>") no-repeat right 12px center;
  color: #fbf8f1;
  font: 600 13px/1.2 "Libre Franklin", system-ui, sans-serif;
  padding: 8px 30px 8px 12px;
  min-height: 36px;
  cursor: pointer;
}
.ku-lang-pill select:focus {
  outline: 2px solid #c9a24b;
  outline-offset: 2px;
}
.ku-vocab-scroller {
  flex: 1 1 auto;
  overflow-y: auto;
  min-height: 0;
  -webkit-overflow-scrolling: touch;
  padding: 8px 2px 45vh;
  background: transparent;
}
.ku-vocab-scroller .vrow,
.ku-vocab-scroller .vc {
  scroll-margin-top: 12px;
}

/* Light mode: keep every heading and label dark on the ivory/white exercise card. */
body .ex .ex-h { color: #151c37 !important; }
body .ex .ex-num { color: #7a0019; }
body .ex :is(.vc-lang, .vc-lang label) { color: #1d2233; }

/* Dark mode: exercise cards match other KU dark cards; cream text on #201814. */
html[data-theme="dark"] body .ex {
  background: #201814 !important;
  border-color: rgba(199, 161, 74, 0.22);
  color: #f2ece3;
}
html[data-theme="dark"] body .ex :is(h1, h2, h3, h4, h5, h6, .ex-h) {
  color: #f2ece3 !important;
}
html[data-theme="dark"] body .ex .ex-num { color: #f0a3a8 !important; }
html[data-theme="dark"] body .ex .ex-note {
  background: #2a201b;
  border-color: rgba(242, 236, 227, 0.2);
  color: #e6ddd1;
}
html[data-theme="dark"] .ku-lang-pill-wrap {
  background: #201814;
  border-color: rgba(240, 217, 143, 0.45);
  box-shadow: 0 10px 24px -14px rgba(0, 0, 0, 0.7), 0 0 0 1px rgba(240, 217, 143, 0.12);
}
html[data-theme="dark"] .ku-lang-pill-wrap .ex-h,
html[data-theme="dark"] .ku-vocab-dock .ex-h {
  color: #f2ece3 !important;
}
html[data-theme="dark"] .ku-lang-pill {
  background: #17110f;
  border-color: rgba(240, 217, 143, 0.55);
  box-shadow: 0 6px 16px -8px rgba(0, 0, 0, 0.7);
}
html[data-theme="dark"] .ku-lang-pill label { color: #f0d98f; }
html[data-theme="dark"] .ku-lang-pill select {
  background-color: #9b1c22;
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'><path fill='%23fbf8f1' d='M1 1l5 5 5-5'/></svg>");
  color: #fbf8f1;
}
html[data-theme="dark"] .ku-lang-pill select:focus { outline-color: #f0d98f; }
html[data-theme="dark"] body .ex :is(.vc-lang, .vc-lang label, .vdef, .vmeta, .vtr) { color: #f2ece3; }
html[data-theme="dark"] body .ex .vc-lang label { color: #f2ece3 !important; }
html[data-theme="dark"] body .ex .vword .w { color: #8fbaf0; }
html[data-theme="dark"] body .ex .ipa { color: #f0a35a; font-weight: 600; }
html[data-theme="dark"] body .ex .vpos {
  background: #2a201b;
  color: #e6ddd1;
  border-color: rgba(242, 236, 227, 0.2);
}
html[data-theme="dark"] body .ex .vex { background: #17110f; color: #e6ddd1; }
html[data-theme="dark"] body .ex .vex b { color: #f2ece3; }
html[data-theme="dark"] body .ex .spk {
  background: #2a201b;
  border-color: rgba(242, 236, 227, 0.25);
  color: #8fbaf0;
}
html[data-theme="dark"] body .ex .spk:hover,
html[data-theme="dark"] body .ex .spk.playing {
  background: #8fbaf0;
  color: #120d0b;
  border-color: #8fbaf0;
}

/* Dark-mode playback time was #5b6172 on a dark card (about 2.8:1). */
html[data-theme="dark"] body .ptime { color: #cfc6b8; }

@media (max-width: 600px) {
  .ku-lang-pill-wrap {
    padding: 8px 10px;
    flex-direction: column;
    align-items: stretch;
  }
  .ku-lang-pill {
    width: 100%;
    max-width: 100%;
    box-sizing: border-box;
    flex-wrap: wrap;
    padding: 8px 8px 8px 14px;
  }
  .ku-lang-pill label { letter-spacing: 0.08em; width: 100%; }
  .ku-lang-pill select { flex: 1 0 100%; min-width: 0; width: 100%; }
  .ku-lang-pill-wrap .ex-h { font-size: 22px; }
}
