/* LAPIS Visual Walkthrough — shared styles
 * POS colors follow the Operation LAPIS static color scheme:
 *   blue   = nouns, adjectives, pronouns, numerals
 *   red    = verbs, participles
 *   green  = prepositions
 *   yellow = adverbs
 *   grey   = conjunctions
 *   black  = interjections, particles/enclitics
 */

.lapis-wt {
  --wt-blue-bg:   #B5D4F4;
  --wt-blue-fg:   #042C53;
  --wt-red-bg:    #F7C1C1;
  --wt-red-fg:    #501313;
  --wt-green-bg:  #C0DD97;
  --wt-green-fg:  #173404;
  --wt-yellow-bg: #FAC775;
  --wt-yellow-fg: #412402;
  --wt-grey-bg:   #D3D1C7;
  --wt-grey-fg:   #2C2C2A;

  font-family: Georgia, "Times New Roman", serif;
  padding: clamp(0.85rem, 3vw, 1.25rem);
  background: #ffffff;
  border: 1px solid rgba(0, 0, 0, 0.12);
  border-radius: 12px;
  min-height: 320px;
  display: flex;
  flex-direction: column;
  color: #1a1a1a;
  box-sizing: border-box;
}

.lapis-wt * { box-sizing: border-box; }

.lapis-wt__title {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-size: 13px;
  color: #666;
  margin: 0 0 0.25rem;
}
.lapis-wt__counter {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-size: 12px;
  color: #999;
  margin: 0 0 1rem;
}

.lapis-wt__latin {
  font-size: clamp(16px, 3.5vw, 22px);
  line-height: 1.9;
  text-align: center;
  margin: 1.25rem 0 0.75rem;
  min-height: 64px;
}

.lapis-wt__english {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-size: clamp(13px, 2.5vw, 15px);
  line-height: 1.6;
  text-align: center;
  margin: 0 0 1rem;
  min-height: 48px;
  display: flex;
  flex-wrap: wrap;
  align-items: flex-start;
  justify-content: center;
  gap: 0 6px;
}

/* Each chunk is its own column so the role label stays glued beneath
 * its gloss text even when the row wraps on narrow screens. */
.lapis-wt .en-chunk {
  opacity: 0;
  transition: opacity 0.35s ease;
  padding: 0 4px;
  text-align: center;
  display: inline-flex;
  flex-direction: column;
  align-items: center;
}
.lapis-wt .en-chunk.lit { opacity: 0.55; }
.lapis-wt .en-chunk.current { opacity: 1; font-weight: 600; color: #1a1a1a; }
.lapis-wt .en-label {
  display: block;
  font-size: 10px;
  color: #999;
  font-weight: 400;
}

/* Latin words start dim; colors apply once .lit or .current is added */
.lapis-wt .w {
  display: inline-block;
  padding: 2px 6px;
  margin: 0 1px;
  border-radius: 4px;
  background: transparent;
  color: #b5b5b5;
  transition: background 0.35s ease, color 0.35s ease, box-shadow 0.35s ease, opacity 0.35s ease;
}
.lapis-wt .w.lit.pos-noun,   .lapis-wt .w.current.pos-noun   { background: var(--wt-blue-bg);   color: var(--wt-blue-fg); }
.lapis-wt .w.lit.pos-verb,   .lapis-wt .w.current.pos-verb   { background: var(--wt-red-bg);    color: var(--wt-red-fg); }
.lapis-wt .w.lit.pos-prep,   .lapis-wt .w.current.pos-prep   { background: var(--wt-green-bg);  color: var(--wt-green-fg); }
.lapis-wt .w.lit.pos-adv,    .lapis-wt .w.current.pos-adv    { background: var(--wt-yellow-bg); color: var(--wt-yellow-fg); }
.lapis-wt .w.lit.pos-conj,   .lapis-wt .w.current.pos-conj   { background: var(--wt-grey-bg);   color: var(--wt-grey-fg); }
.lapis-wt .w.lit.pos-part,   .lapis-wt .w.current.pos-part   { background: transparent;         color: #1a1a1a; }

.lapis-wt .w.lit:not(.current) { opacity: 0.7; }
.lapis-wt .w.current { box-shadow: 0 0 0 2px #1a1a1a; }

.lapis-wt .punct {
  display: inline;
  color: #b5b5b5;
  transition: color 0.35s ease;
}
.lapis-wt.complete .punct { color: #1a1a1a; }

.lapis-wt__controls {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  margin-top: auto;
  padding-top: 1rem;
  border-top: 1px solid rgba(0, 0, 0, 0.08);
  flex-wrap: wrap;
}
.lapis-wt__controls button {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-size: 13px;
  padding: 6px 12px;
  background: #fff;
  border: 1px solid rgba(0, 0, 0, 0.2);
  border-radius: 6px;
  cursor: pointer;
  color: #1a1a1a;
}
.lapis-wt__controls button:hover { background: #f5f5f5; }
.lapis-wt__controls button:disabled { opacity: 0.4; cursor: not-allowed; }

.lapis-wt__speed {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-size: 12px;
  color: #666;
  display: flex;
  align-items: center;
  gap: 6px;
}
.lapis-wt__speed select {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-size: 12px;
  padding: 2px 4px;
}

.lapis-wt__legend {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-size: 11px;
  color: #999;
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 4px 12px;
  margin: 0.5rem 0 0;
}
.lapis-wt__legend > span { display: inline-flex; align-items: center; gap: 4px; }
.lapis-wt__legend .sw { display: inline-block; width: 10px; height: 10px; border-radius: 2px; }

.lapis-wt__error {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-size: 13px;
  color: #a00;
  text-align: center;
  padding: 1rem;
}

.lapis-wt[hidden] { display: none; }

/* Narrow viewports: tighten chrome and reduce the reserved blank space
 * so short sentences don't leave a large gap above the controls. */
@media (max-width: 480px) {
  .lapis-wt { min-height: 0; }
  .lapis-wt__latin { line-height: 1.7; min-height: 52px; }
  .lapis-wt__counter { margin-bottom: 0.75rem; }
  .lapis-wt .w { padding: 2px 4px; }
  .lapis-wt__legend { font-size: 10px; gap: 3px 10px; }
}

/* Touch devices: meet the 44px minimum target size for interactive
 * controls. Hover state is suppressed since it sticks after a tap. */
@media (pointer: coarse) {
  .lapis-wt__controls { gap: 6px; }
  .lapis-wt__controls button {
    min-height: 44px;
    padding: 10px 16px;
    font-size: 14px;
  }
  .lapis-wt__controls button:hover { background: #fff; }
  .lapis-wt__speed select { min-height: 44px; padding: 4px 8px; }
}
