/* =============================================================
   Punjabia — wordlayer.css
   Styling for the Universal Word Layer: the tappable .wl words and
   the shared .wordcard popover (built by js/wordlayer.js).
   Visual language matches the reader gloss panel and .term popovers
   — a dark indigo card with gold scripts and cream prose.
   ============================================================= */

/* ---------- the tappable word ---------- */
.wl {
  appearance: none; -webkit-appearance: none;
  background: transparent; border: 0; padding: 0 .06em; margin: 0;
  font: inherit; color: inherit; cursor: pointer; border-radius: 6px;
  border-bottom: 1.5px dotted color-mix(in srgb, var(--gold-600) 65%, transparent);
  transition: background .15s ease, color .15s ease, border-color .15s ease;
}
.wl:hover { background: color-mix(in srgb, var(--gold-500) 18%, transparent); }
.wl:focus-visible { outline: 2px solid var(--gold-600); outline-offset: 2px; }
.wl.is-active {
  background: color-mix(in srgb, var(--gold-500) 26%, transparent);
  border-bottom-color: var(--gold-600);
}
.line.shah .wl, .shah .wl { border-bottom-style: dotted; }
/* inline prose terms (e.g. the Music "traditions" section) keep the
   bold emphasis they had as <strong>, plus the tappable underline. */
.trad__body .wl { font-weight: 700; }

/* ---------- the card ---------- */
.wordcard {
  position: absolute; z-index: 9996;
  width: min(360px, calc(100vw - 1.5rem));
  background: var(--indigo-900); color: var(--cream);
  border: 1px solid var(--indigo-600); border-radius: 16px;
  box-shadow: 0 0 0 1px rgba(52,58,114,.4), 0 22px 60px rgba(13,15,34,.55);
  padding: 1.05rem 1.15rem 1.15rem;
  font-family: var(--font-sans); line-height: 1.5;
  opacity: 0; transform: translateY(8px); pointer-events: none;
  transition: opacity .18s ease, transform .18s ease;
}
.wordcard.is-open { opacity: 1; transform: none; pointer-events: auto; }
.wordcard:focus { outline: none; }
@media (prefers-reduced-motion: reduce) { .wordcard { transition: none; } }

.wordcard__x {
  position: absolute; top: .5rem; right: .65rem;
  appearance: none; background: transparent; border: 0; color: var(--cream-muted);
  font-size: 1.15rem; line-height: 1; cursor: pointer; padding: .3rem;
}
.wordcard__x:hover { color: var(--cream); }

.wordcard__scripts { display: flex; align-items: baseline; gap: .8rem; margin: 0 1.4rem .35rem 0; flex-wrap: wrap; }
.wordcard__scripts .gur  { font-family: var(--font-gur);  font-size: 1.95rem; line-height: 1; color: var(--gold-400); }
.wordcard__scripts .shah { font-family: var(--font-shah); font-size: 1.55rem; line-height: 1; color: var(--gold-300); }

.wordcard__roman { margin: 0 0 .25rem; font-family: var(--font-serif); font-style: italic; color: var(--gold-300); }
.wordcard__roman b { font-style: normal; font-weight: 600; color: var(--cream); }

.wordcard__meta {
  margin: 0 0 .5rem; font-size: .72rem; letter-spacing: .04em; text-transform: uppercase;
  color: var(--cream-muted);
}
.wordcard__pron { margin: 0 0 .5rem; font-size: .82rem; color: var(--cream-muted); }
.wordcard__gloss { margin: 0; font-size: .92rem; line-height: 1.55; color: var(--cream-muted); }

/* ---------- cross-links ---------- */
.wordcard__links { margin-top: .85rem; padding-top: .75rem; border-top: 1px dashed var(--line-dark, rgba(241,234,217,.22)); }
.wordcard__links-head {
  margin: 0 0 .45rem; font-size: .72rem; letter-spacing: .04em; text-transform: uppercase;
  color: var(--gold-300);
}
.wordcard__see { margin-top: .7rem; padding-top: .7rem; border-top: 1px dashed var(--line-dark, rgba(241,234,217,.22)); }
.wordcard__see-word { display: flex; align-items: baseline; gap: .55rem; flex-wrap: wrap; margin: 0 0 .5rem; }
.wordcard__see-word .gur  { font-family: var(--font-gur);  font-size: 1.2rem; color: var(--gold-400); }
.wordcard__see-word .shah { font-family: var(--font-shah); font-size: 1.05rem; color: var(--gold-300); }
.wordcard__see-roman { flex: 1 1 100%; font-family: var(--font-serif); font-style: italic; font-size: .86rem; color: var(--cream-muted); }

.wordcard__chip {
  display: block; text-decoration: none; color: var(--cream);
  background: var(--indigo-800); border: 1px solid var(--indigo-600);
  border-radius: 12px; padding: .55rem .7rem; margin-bottom: .4rem;
  transition: transform .14s ease, border-color .14s ease, background .14s ease;
}
.wordcard__chip:last-child { margin-bottom: 0; }
.wordcard__chip:hover { transform: translateY(-1px); border-color: var(--gold-300); background: var(--indigo-700); }
.wordcard__chip-kind {
  display: block; font-size: .66rem; letter-spacing: .06em; text-transform: uppercase;
  color: var(--gold-300); margin-bottom: .12rem;
}
.wordcard__chip-title { display: block; font-weight: 600; font-size: .92rem; line-height: 1.3; }
.wordcard__chip-note { display: block; font-family: var(--font-serif); font-style: italic; font-size: .82rem; color: var(--cream-muted); margin-top: .12rem; }

.wordcard__study {
  display: inline-block; margin-top: .85rem;
  font-size: .85rem; font-weight: 600; color: var(--gold-300); text-decoration: none;
}
.wordcard__study:hover { color: var(--gold-400); text-decoration: underline; }

/* ---------- Kokla Chhapaki rhyme block (Music page) ---------- */
.kokla-rhyme {
  margin: 0; padding: 1.1rem 1.25rem;
  background: color-mix(in srgb, var(--gold-500) 8%, transparent);
  border-left: 3px solid var(--gold-500); border-radius: 8px;
}
.kokla-rhyme .gur  { font-family: var(--font-gur);  font-size: 1.5rem;  line-height: 1.75; margin: 0 0 .1rem; }
.kokla-rhyme .shah { font-family: var(--font-shah); font-size: 1.35rem; line-height: 2;    margin: 0 0 .1rem; }
.kokla-rhyme .kokla-translit { font-family: var(--font-serif); font-style: italic; color: var(--text-3, var(--ink-500)); margin: .75rem 0 .35rem; line-height: 1.6; }
.kokla-rhyme .kokla-natural  { margin: 0; color: var(--text-2, inherit); }

/* ---------- mobile: bottom sheet ---------- */
@media (max-width: 559px) {
  .wordcard {
    position: fixed; left: 0 !important; right: 0; bottom: 0; top: auto !important;
    width: auto; border-radius: 18px 18px 0 0;
    transform: translateY(16px);
    padding-bottom: calc(1.15rem + env(safe-area-inset-bottom, 0));
  }
  .wordcard.is-open { transform: none; }
}
