/* Pronunciation diagrams (pron-lab.js). Colours come from concept2.css
   tokens so light and dark both follow the site theme. The anatomy is drawn
   in hairlines and ink; only the moving parts (tongue, lips) carry colour. */

.pl-card, .pl-still {
  --pl-tongue: #c45c4a;
  --pl-tongue-line: #a8432f;
  --pl-lip: #c27a6e;
  --pl-lip-line: #a85f53;
  --pl-tooth: #fffdf8;
  --pl-tooth-line: #cfc4b3;
  --pl-cavity: var(--answer-bg, #f1e8dc);
  --pl-skin: #f6e6d6;
  --pl-line: var(--ink-2, #6a5a50);
  --pl-air: var(--gold-ink, #8a6514);
  --pl-voice: var(--teal, #2f6b66);
  --pl-nasal: var(--accent, #a8432f);
}
.pl-card {
  background: var(--card, #fffaf3);
  border: 1px solid var(--rule, #e6dccf);
  border-radius: var(--r, 12px);
  padding: 20px 20px 16px;
  margin: 28px 0;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme=light]) .pl-card, :root:not([data-theme=light]) .pl-still {
    --pl-tongue: #d9786a; --pl-tongue-line: #e58a72;
    --pl-lip: #b0675d; --pl-lip-line: #cf8478;
    --pl-tooth: #efe7dc; --pl-tooth-line: #9c8e80; --pl-skin: #3a2c25;
  }
}
:root[data-theme=dark] .pl-card, :root[data-theme=dark] .pl-still {
  --pl-tongue: #d9786a; --pl-tongue-line: #e58a72;
  --pl-lip: #b0675d; --pl-lip-line: #cf8478;
  --pl-tooth: #efe7dc; --pl-tooth-line: #9c8e80; --pl-skin: #3a2c25;
}

.pl-card h2 { margin: 0 0 2px; }
.pl-card .pl-gloss { margin: 0; color: var(--ink-2); }
.pl-card .pl-ipa-line { margin: 6px 0 14px; font-size: 1.05rem; }
.pl-card .pl-ipa-line span { color: var(--ink-2); font-size: .9rem; }

/* Without JavaScript (or while loading) the card is just its text. */
.pl-card .pl-mount:empty { display: none; }
.pl-card.is-failed .pl-mount { display: none; }

/* syllable strip */
.pl-syll { display: flex; flex-wrap: wrap; gap: 6px; align-items: flex-end; margin: 0 0 14px; }
.pl-syl {
  font: 600 1.35rem/1 var(--f-head);
  color: var(--ink);
  background: transparent;
  border: 1px solid var(--rule);
  border-radius: 8px;
  padding: 10px 14px 12px;
  min-width: 44px; min-height: 44px;
  cursor: pointer;
  position: relative;
}
.pl-syl.is-stressed { border-color: var(--accent); color: var(--accent); }
.pl-syl.is-stressed::after {
  content: ""; position: absolute; left: 50%; top: -9px; width: 7px; height: 7px;
  margin-left: -3.5px; border-radius: 50%; background: var(--accent);
}
.pl-syl.is-now, .pl-phone.is-now { background: var(--answer-bg); box-shadow: inset 0 -3px 0 var(--accent); }
.pl-word-gap { width: 10px; }

/* the drawings */
/* Drawings: side view large on the left, front view and vowel chart stacked
   on the right. Comparing swaps the front view for the learner-habit head. */
.pl-stage { display: grid; grid-template-columns: 3fr 2fr; grid-template-areas: "side face" "side chart"; gap: 8px; align-items: stretch; }
.pl-fig-side { grid-area: side; }
.pl-fig-face, .pl-fig-habit { grid-area: face; }
.pl-fig-chart { grid-area: chart; }
.pl-stage.is-compare { grid-template-columns: 1fr 1fr; grid-template-areas: "side habit" "chart chart"; }
.pl-stage.is-compare .pl-fig-habit { grid-area: habit; }
.pl-stage.is-compare .pl-fig-chart .pl-svg { max-width: 360px; margin: 0 auto; }
.pl-fig[hidden] { display: none; }
.pl-fig { margin: 0; background: var(--paper); border: 1px solid var(--rule); border-radius: 8px; padding: 4px; min-width: 0; display: flex; flex-direction: column; justify-content: center; }
.pl-fig figcaption { font-size: .78rem; color: var(--ink-2); text-align: center; padding: 2px 0 0; }
.pl-svg { display: block; width: 100%; height: auto; }

.pl-svg .pl-head { fill: var(--pl-skin); stroke: var(--pl-line); stroke-width: 1.2; }
.pl-svg .pl-wall { fill: var(--pl-cavity); }
.pl-svg .pl-nose { fill: var(--pl-cavity); stroke: var(--pl-line); stroke-width: 1.2; }
.pl-svg .pl-palate { fill: none; stroke: var(--pl-line); stroke-width: 4; stroke-linecap: round; }
.pl-svg .pl-tooth { fill: var(--pl-tooth); stroke: var(--pl-tooth-line); stroke-width: 1; }
.pl-svg .pl-ridge { fill: var(--pl-air); }
.pl-svg .pl-jaw { fill: var(--pl-skin); stroke: none; }
.pl-svg .pl-velum { fill: none; stroke: var(--pl-line); stroke-width: 7; stroke-linecap: round; }
.pl-svg .pl-velum.is-open { stroke: var(--pl-nasal); }
.pl-svg .pl-nasal-arrow { stroke: var(--pl-nasal); stroke-width: 2.5; }
.pl-svg .pl-mark-red { fill: var(--pl-nasal); }
.pl-svg .pl-tongue { fill: var(--pl-tongue); stroke: var(--pl-tongue-line); stroke-width: 2.5; stroke-linejoin: round; }
.pl-svg .pl-lip { fill: var(--pl-lip); stroke: var(--pl-lip-line); stroke-width: 1.5; }
.pl-svg .pl-larynx { fill: var(--rule); }
.pl-svg .pl-larynx.is-on { fill: var(--pl-voice); }
.pl-svg .pl-air { fill: none; stroke: var(--pl-air); stroke-linecap: round; }
.pl-svg .pl-air-stream { stroke-dasharray: 4 3.5; }
.pl-svg .pl-mark-air { fill: var(--pl-air); }
.pl-svg .pl-lbl { font: 12px var(--f-body); fill: var(--ink-2); }
.pl-svg .pl-lead { stroke: var(--pl-line); stroke-width: .8; fill: none; opacity: .7; }

.pl-svg .pl-face { fill: var(--pl-cavity); stroke: var(--pl-line); stroke-width: 1.5; }
.pl-svg .pl-face-line { fill: none; stroke: var(--pl-line); stroke-width: 1.5; stroke-linecap: round; }
.pl-svg .pl-eye { fill: var(--pl-line); }
.pl-svg .pl-mouth { fill: #2a1d17; }
.pl-svg .pl-tongue-front { fill: var(--pl-tongue-line); }
.pl-svg .pl-tip-front { fill: var(--pl-tongue); }
.pl-svg .pl-teeth rect { fill: var(--pl-tooth); }
.pl-svg .pl-teeth line { stroke: var(--pl-tooth-line); stroke-width: .8; }
.pl-svg .pl-lip-pressed { fill: var(--pl-lip-line); }

/* live caption */
.pl-now { min-height: 2.8em; margin: 12px 0 6px; }
.pl-now-ipa { font: 700 1.1rem var(--f-head); color: var(--accent); }
.pl-now-tech { color: var(--ink-2); font-size: .85rem; }
.pl-now-habit { display: block; margin-top: 4px; font-size: .92rem; }

.pl-scrub { width: 100%; accent-color: var(--accent); margin: 4px 0 10px; }

.pl-controls { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 14px; }
.pl-btn {
  font: 600 .95rem var(--f-ui);
  min-height: 44px; padding: 0 16px;
  border-radius: 999px; border: 1px solid var(--accent);
  background: transparent; color: var(--accent); cursor: pointer;
}
.pl-btn-primary { background: var(--accent); color: var(--accent-ink); }
.pl-btn-quiet { border-color: var(--rule); color: var(--ink); }
.pl-btn[aria-pressed=true].pl-btn-quiet { border-color: var(--accent); background: var(--answer-bg); }
.pl-btn:focus-visible, .pl-syl:focus-visible, .pl-phone:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; }

/* row of sounds */
.pl-phones { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 12px; }
.pl-phone {
  display: inline-flex; flex-direction: column; align-items: center; justify-content: center;
  min-width: 44px; min-height: 52px; padding: 4px 8px;
  border: 1px solid var(--rule); border-radius: 8px; background: transparent; color: var(--ink); cursor: pointer;
}
.pl-phone .pl-ipa { font: 600 1.1rem var(--f-head); }
.pl-phone .pl-graph { font-size: .75rem; color: var(--ink-2); }

.pl-habit-note { border-left: 3px solid var(--accent); padding: 4px 0 4px 12px; }
.pl-note { background: var(--answer-bg); border-radius: 8px; padding: 10px 14px; }
.pl-review { font-size: .85rem; color: var(--ink-2); border-top: 1px dashed var(--rule); padding-top: 8px; }

@media (max-width: 560px) {
  /* One phone screen: word + syllables, side view full width, front view
     and vowel chart side by side underneath, then one row of controls. */
  .pl-card { padding: 12px 10px 10px; margin: 18px 0; }
  .pl-card h2, .pl-card h3 { display: inline; font-size: 1.15rem; margin-right: 6px; }
  .pl-card .pl-gloss { display: inline; font-size: .9rem; }
  .pl-card .pl-ipa-line { margin: 2px 0 8px; font-size: .95rem; }
  .pl-syll { margin: 0 0 8px; gap: 4px; }
  .pl-syl { font-size: 1.05rem; padding: 6px 10px 8px; min-height: 40px; }
  .pl-stage { grid-template-columns: 1fr 1fr; grid-template-areas: "side side" "face chart"; gap: 6px; }
  .pl-stage.is-compare { grid-template-areas: "side habit" "chart chart"; }
  .pl-fig figcaption { font-size: .7rem; line-height: 1.2; }
  .pl-svg .pl-lbl { font-size: 13px; }
  .pl-fig-chart .pl-svg .pl-clbl { font-size: 13px; }
  .pl-stage.is-compare .pl-fig-side .pl-lbl, .pl-stage.is-compare .pl-lead { display: none; }
  .pl-now { min-height: 2.4em; margin: 6px 0 4px; font-size: .92rem; line-height: 1.35; }
  .pl-controls { gap: 6px; margin-bottom: 6px; }
  .pl-btn { padding: 0 12px; font-size: .9rem; min-height: 40px; }
  .pl-scrub { display: none; }
  .pl-controls .pl-btn { padding: 0 10px; }
  .pl-controls .pl-seg-btn { padding: 0 8px; }
  .pl-btn-quiet .pl-long { display: none; }
  .pl-btn-quiet .pl-short { display: inline; }
  .pl-phones { gap: 4px; margin-bottom: 8px; }
  .pl-phone { min-width: 38px; min-height: 44px; padding: 2px 6px; }
}
}

/* ---- section pages (build_pages.py) ---- */
.pl-sound { font-family: var(--f-head); color: var(--accent); margin-right: 4px; }
.pl-card h2, .pl-card h3 { margin: 0 0 2px; }
.pl-pair { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; align-items: start; }
.pl-pair .pl-card { margin: 12px 0; min-width: 0; }
.pl-pair .pl-stage { grid-template-columns: 1fr 1fr; grid-template-areas: "side side" "face chart"; }
.pl-pair .pl-stage.is-compare { grid-template-areas: "side habit" "chart chart"; }
@media (max-width: 860px) { .pl-pair { grid-template-columns: 1fr; } }
.pl-jump { display: flex; flex-wrap: wrap; gap: 8px; margin: 16px 0 8px; }
.pl-jump a { border: 1px solid var(--rule); border-radius: 999px; padding: 6px 14px; text-decoration: none; min-height: 36px; display: inline-flex; align-items: center; }
.pl-jump a:hover, .pl-jump a:focus-visible { border-color: var(--accent); }
.pl-guide li, .pl-related li, .practice-list li { margin-bottom: 8px; }
.pl-practice { font-family: var(--f-head); font-size: 1.1rem; }
.practice-list { list-style: none; padding: 0; display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 12px; }
.practice-list li { background: var(--card); border: 1px solid var(--rule); border-radius: var(--r); padding: 14px 16px; margin: 0; }
.practice-list a { text-decoration: none; }
.practice-list a strong { font-family: var(--f-head); font-size: 1.1rem; }

/* ---- v2: play, speed, words, vowel chart ---- */
.pl-play { display: inline-flex; align-items: center; gap: 6px; }
.pl-seg { display: inline-flex; border: 1px solid var(--rule); border-radius: 999px; overflow: hidden; }
.pl-seg-btn { font: 600 .9rem var(--f-ui); min-height: 44px; padding: 0 14px; border: 0; background: transparent; color: var(--ink); cursor: pointer; }
.pl-seg-btn + .pl-seg-btn { border-left: 1px solid var(--rule); }
.pl-seg-btn[aria-pressed=true] { background: var(--answer-bg); color: var(--accent); }
.pl-seg-btn:focus-visible, .pl-word:focus-visible { outline: 3px solid var(--accent); outline-offset: -3px; }
@media (max-width: 560px) { .pl-seg-btn { min-height: 40px; padding: 0 10px; font-size: .85rem; } }
.pl-words { display: flex; flex-wrap: wrap; gap: 6px; margin: 0 0 8px; }
.pl-word { font: 600 .95rem var(--f-head); border: 1px solid var(--rule); border-radius: 999px; padding: 4px 12px; min-height: 36px; background: transparent; color: var(--ink); cursor: pointer; }
.pl-word.is-on { border-color: var(--accent); color: var(--accent); background: var(--answer-bg); }
.pl-ipa-help { font-size: .82rem; color: var(--ink-2); }
.pl-now-ipa { text-decoration: none; }
a.pl-now-ipa:hover, a.pl-now-ipa:focus-visible { text-decoration: underline; }
.pl-svg .pl-quad { fill: var(--pl-cavity); stroke: var(--pl-line); stroke-width: 1.2; }
.pl-svg .pl-quad-mid { stroke: var(--pl-line); stroke-width: .6; stroke-dasharray: 3 3; opacity: .6; }
.pl-svg .pl-clbl { font: 11px var(--f-body); fill: var(--ink-2); }
.pl-svg .pl-vref { fill: var(--pl-line); opacity: .55; }
.pl-svg .pl-vlbl { font: 600 14px var(--f-head); fill: var(--ink-2); }
.pl-svg .pl-trail { fill: none; stroke: var(--accent); stroke-width: 2; stroke-linejoin: round; stroke-linecap: round; opacity: .55; }
.pl-svg .pl-trail-habit { stroke: var(--pl-voice); stroke-dasharray: 4 3; }
.pl-svg .pl-dot { fill: var(--accent); stroke: var(--paper); stroke-width: 2; }
.pl-svg .pl-dot-habit { fill: var(--pl-voice); }
.pl-sound-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(92px, 1fr)); gap: 8px; list-style: none; padding: 0; margin: 12px 0 20px; }
.pl-sound-grid a { display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 10px 6px; border: 1px solid var(--rule); border-radius: 10px; text-decoration: none; color: var(--ink); background: var(--card); min-height: 44px; }
.pl-sound-grid a:hover, .pl-sound-grid a:focus-visible { border-color: var(--accent); }
.pl-sound-grid .sym { font: 700 1.3rem var(--f-head); color: var(--accent); }
.pl-sound-grid .ex { font-size: .85rem; }
.pl-still { display: grid; grid-template-columns: 3fr 2fr; gap: 6px; max-width: 360px; margin: 6px 0 0; }
.pl-still .pl-svg { background: var(--paper); border: 1px solid var(--rule); border-radius: 8px; }
.ipa-entry { border-top: 1px solid var(--rule); padding: 16px 0; display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 300px); gap: 16px; align-items: start; }
.ipa-entry h3 { margin: 0 0 4px; }
.ipa-entry .ipa-sym { font: 700 1.6rem var(--f-head); color: var(--accent); margin-right: 8px; }
.ipa-entry p { margin: 0 0 6px; }
.ipa-entry .ipa-ex { font-size: .92rem; color: var(--ink-2); }
@media (max-width: 640px) { .ipa-entry { grid-template-columns: 1fr; } }
.ipa-index { display: flex; flex-wrap: wrap; gap: 6px; margin: 8px 0 20px; }
.ipa-index a { font: 700 1.05rem var(--f-head); min-width: 40px; min-height: 40px; display: inline-flex; align-items: center; justify-content: center; border: 1px solid var(--rule); border-radius: 8px; text-decoration: none; }
.ipa-index-sep { flex-basis: 100%; height: 0; }
.ipa-index a:last-child { font: 600 .95rem var(--f-body); padding: 0 12px; }
.ipa-term { grid-template-columns: 1fr; }
.ipa-entry { scroll-margin-top: 80px; }
.pl-short { display: none; }

/* ---- "Hear yourself next to me" (pron-compare.js) ---- */
.pc-box { margin-top: 1rem; padding-top: .8rem; border-top: 1px solid var(--line, #e4d8c8); }
.pc-title { margin: 0 0 .5rem; font-size: 1rem; }
.pc-row, .pc-syl { display: flex; flex-wrap: wrap; gap: .4rem; align-items: center; }
.pc-btn { font: inherit; font-size: .9rem; padding: .35rem .7rem; border-radius: 999px; border: 1px solid var(--pl-line); background: transparent; color: inherit; cursor: pointer; }
.pc-btn[disabled] { opacity: .45; cursor: default; }
.pc-rec.pc-on { background: var(--pl-nasal); color: #fff; border-color: var(--pl-nasal); }
.pc-sylbtn.pc-stress { font-weight: 700; text-decoration: underline; }
.pc-out { min-height: 1.4em; margin: .5rem 0; }
.pc-bars { display: grid; gap: .3rem; margin: .4rem 0; }
.pc-barrow { display: grid; grid-template-columns: 9rem 1fr; gap: .5rem; align-items: center; font-size: .85rem; }
.pc-bar { display: flex; height: 1.3rem; border-radius: 4px; overflow: hidden; }
.pc-bar-mine { background: var(--pl-voice); }
.pc-bar-ref { background: var(--pl-air); }
.pc-seg { color: #fff; font-size: .75rem; text-align: center; line-height: 1.3rem; border-right: 1px solid rgba(255,255,255,.6); overflow: hidden; }
.pc-seg.pc-stress { font-weight: 700; background: rgba(0,0,0,.18); }
.pc-honest { font-size: .8rem; opacity: .8; margin: .4rem 0 0; }
