/* ==========================================================================
   Caribbean Type — guided lesson, keyboard and teaching hands
   Uses the tokens defined in style.css.
   ========================================================================== */

/* ---------- Lesson shell (focus mode: no sidebar) ---------- */
.lesson-shell{max-width:1280px;margin:auto;padding:14px var(--gutter) 48px;min-height:75vh}
.lesson-shell .lesson-screen{max-width:none}
.gentle-trainer{animation:card-arrive .35s ease-out;scroll-margin-top:12px}

.lesson-bar{display:grid;grid-template-columns:minmax(0,1fr) auto;align-items:end;gap:4px 20px;margin-bottom:14px}
.lesson-bar .back-link{grid-column:1/-1;justify-self:start}
.trainer-pill{display:inline-block;border-radius:999px;background:var(--mint);color:var(--forest-deep);font-size:12px;letter-spacing:.1em;text-transform:uppercase;font-weight:650;padding:5px 12px}
.lesson-bar h1{font-size:clamp(26px,3.2vw,36px);margin:10px 0 2px}
.lesson-bar-title p{font-size:16px}
.trainer-lesson-count{text-align:right;line-height:1.1}
.trainer-lesson-count small{display:block;font-size:12px;font-weight:650;letter-spacing:.1em;text-transform:uppercase;color:var(--muted);margin-bottom:4px}
.trainer-lesson-count strong{font-size:38px;font-weight:550;color:var(--forest);font-variant-numeric:tabular-nums}
.trainer-lesson-count strong span{font-size:17px;color:var(--muted);font-weight:500}
.little-steps{display:flex;gap:5px;margin-bottom:18px}
.little-steps span{height:7px;border-radius:4px;flex:1;background:#e0e8dc}
.little-steps .complete{background:var(--forest)}
.little-steps .current{background:var(--gold);box-shadow:0 0 0 3px #f4ba3b33}

/* ---------- Three-part lesson grid ---------- */
.lesson-grid{display:grid;grid-template-columns:minmax(280px,350px) minmax(0,1fr);grid-template-rows:auto 1fr;grid-template-areas:"coach stage" "turn stage";gap:16px;align-items:start}
.coach-card{grid-area:coach}
.hand-stage{grid-area:stage}
.practice-island{grid-area:turn}

.coach-card{background:var(--sand);padding:22px 24px;border:1px solid #ded1bd;border-radius:var(--radius-lg)}
.coach-card .mini-label{color:var(--sun-ink)}
.coach-card h2{font-size:25px;letter-spacing:-.02em;line-height:1.2;margin:8px 0 10px;color:#3f4b50}
.coach-card p{font-size:18px;line-height:1.65;color:#56656d}
.hear-step{font-size:15px;font-weight:550;color:var(--sun-ink);background:#fbf8f0;border:1.5px solid #d2c1a7;border-radius:10px;padding:9px 14px;margin-top:16px;display:inline-flex;align-items:center;gap:8px;min-height:44px}
.hear-step:hover{background:#eee3d0}

.practice-island{background:var(--white);border:1.5px solid var(--line);border-radius:var(--radius-lg);padding:22px 24px}
.practice-island h3{font-size:21px;margin:6px 0 6px}
.practice-island>p{font-size:16px}
.turn-actions{display:grid;gap:12px;margin-top:18px}
.turn-actions .button{width:100%}
.turn-actions #ready-drill{justify-content:space-between}
.drill-input{display:flex;align-items:center;gap:13px;background:#f5efe4;border:2px dashed var(--sun-deep);border-radius:12px;padding:16px;margin-top:16px;min-height:64px;color:var(--ink);font-size:17px;font-weight:600}
.drill-input:focus-visible{outline:3px solid var(--gold);outline-offset:3px;border-style:solid}
.input-pointer{font-size:24px;flex:none}
[data-mode="practice"] .practice-island{border-color:var(--sun-deep)}
[data-mode="done"] .practice-island{border-color:#b9cdc8;background:#f2f5f2}

/* ---------- The stage: keyboard, hands and their controls ---------- */
.hand-stage{background:var(--mint-soft);border:2px solid #c5d3d9;border-radius:var(--radius-lg);padding:14px 16px 0;overflow:hidden;min-width:0;transition:border-color .25s,background .25s}
[data-mode="practice"] .hand-stage{border-color:var(--sun-deep);background:#f5efe4}
[data-mode="done"] .hand-stage{border-color:#b9cdc8;background:#f0f4f2}
.stage-top{display:flex;justify-content:space-between;align-items:center;flex-wrap:wrap;gap:10px}
.mode-switch{display:inline-flex;background:var(--white);border:1.5px solid var(--line);border-radius:999px;padding:4px;gap:4px}
.mode-tab{display:inline-flex;align-items:center;gap:8px;background:none;border-radius:999px;padding:7px 16px 7px 8px;font-size:15px;font-weight:600;color:var(--muted);min-height:40px;white-space:nowrap}
.mode-tab b{width:26px;height:26px;border-radius:50%;display:grid;place-items:center;font-size:13px;background:#e8edef;color:var(--muted)}
.mode-tab[aria-pressed="true"]{background:var(--forest);color:#fff}
.mode-tab[aria-pressed="true"] b{background:#ffffff33;color:#fff}
#mode-practice[aria-pressed="true"]{background:var(--sun);color:var(--ink)}
#mode-practice[aria-pressed="true"] b{background:#ffffff88;color:var(--ink)}
.trainer-tool{font-size:14px;font-weight:550;color:var(--forest-deep);background:var(--white);border:1.5px solid #c7d3d7;border-radius:10px;padding:7px 13px;min-height:40px}
.trainer-tool:hover{background:var(--mint)}

.stage-status{display:flex;align-items:center;gap:12px;margin:12px 0 10px;min-height:48px}
.mode-badge{flex:none;font-size:12px;font-weight:700;letter-spacing:.1em;text-transform:uppercase;padding:5px 11px;border-radius:8px;background:var(--forest);color:#fff}
[data-mode="practice"] .mode-badge{background:var(--sun);color:var(--ink)}
[data-mode="done"] .mode-badge{background:#3b7371}
.drill-feedback{font-size:16px;line-height:1.45;color:var(--ink);font-weight:500}

.token-row{display:flex;justify-content:space-between;align-items:center;gap:12px;margin-bottom:10px}
.drill-tokens{display:flex;gap:6px;flex-wrap:wrap;transition:opacity .25s}
.drill-tokens.tokens-muted{opacity:.35}
.drill-token{width:38px;height:42px;border:1.5px solid #d0d8da;border-bottom-width:3px;border-radius:8px;background:var(--white);display:grid;place-items:center;font:600 18px var(--sans);color:#73848c;transition:background .2s,color .2s,border-color .2s,transform .2s}
.drill-token.demo-next{background:#deebf0;border-color:var(--forest);color:var(--forest-deep);transform:translateY(-2px)}
.drill-token.next{background:#ead8b9;color:var(--ink);border-color:var(--sun-deep);transform:translateY(-2px)}
.drill-token.typed{background:#e2ebe7;border-color:#b9cdc8;color:#3a625a;animation:little-pop .35s ease-out}
.drill-count{font-size:14px;font-weight:550;color:var(--muted);font-variant-numeric:tabular-nums;white-space:nowrap}

.finger-callout{display:flex;align-items:center;gap:16px;background:var(--white);margin:6px -16px 0;padding:14px 20px;border-top:1px solid var(--line)}
.finger-callout>#big-key{display:grid;place-items:center;min-width:60px;min-height:60px;border-radius:12px;background:#f3ead8;border:3px solid var(--finger-colour,var(--forest));box-shadow:0 4px 0 #d9c8aa;font-size:24px;font-weight:650;padding:6px;flex:none}
.finger-callout small{font-size:12px;font-weight:650;letter-spacing:.1em;text-transform:uppercase;color:var(--muted);display:block}
.finger-callout strong{font-size:21px;line-height:1.3;display:block;font-weight:600;color:var(--ink)}
.finger-callout p{font-size:15px;color:var(--muted)}
.watch-controls{display:flex;flex-wrap:wrap;align-items:center;gap:10px 18px;background:var(--white);margin:0 -16px;padding:12px 20px 14px;border-top:1px dashed var(--line)}
.segmented{display:inline-flex;align-items:center}
.segmented>span{font-size:14px;font-weight:550;color:var(--muted);margin-right:8px}
.segmented button{font-size:14px;font-weight:550;background:var(--white);color:var(--forest-deep);border:1.5px solid #c7d3d7;padding:7px 13px;min-height:40px}
.segmented button:first-of-type{border-radius:10px 0 0 10px}
.segmented button:last-of-type{border-radius:0 10px 10px 0;margin-left:-1.5px}
.segmented button[aria-pressed="true"]{background:var(--forest);border-color:var(--forest);color:#fff;position:relative}

/* ---------- Keyboard ---------- */
.hand-keyboard{width:100%;height:auto;display:block;overflow:visible}
.keyboard-base{fill:#e2e7e8;stroke:#b7c5ca;stroke-width:1.5}
[data-mode="practice"] .keyboard-base{fill:#e9dfcd;stroke:#c8b697}
.guide-key{cursor:pointer;outline:none;transform-box:fill-box;transition:transform .12s ease}
.key-cap{fill:#fcfcf9;stroke:#bdcbd0;stroke-width:1.5;transition:fill .15s}
.guide-key text{font-family:var(--sans);font-size:17px;font-weight:650;fill:#2b4e60;text-anchor:middle;pointer-events:none}
.key-stripe{pointer-events:none}
.home-ridge{stroke:#67818c;stroke-width:2.2;stroke-linecap:round}
.guide-key:hover .key-cap{fill:#e5eef2}
.guide-key:focus-visible .key-cap{stroke:var(--clay);stroke-width:4}
.guide-key.key-target .key-cap{fill:#e7d2ae;stroke:var(--finger-colour,#13a08b);stroke-width:3.5}
.guide-key.key-target text{fill:var(--ink)}
.guide-key.key-down{transform:translateY(2.5px)}
.guide-key.key-down .key-cap{fill:#d9bb8b}
.guide-key.key-wrong .key-cap{animation:wrong-key .7s ease-out}
[data-mode="practice"] .key-target .key-cap{animation:target-breathe 2.4s ease-in-out infinite}

/* ---------- See-through teaching hands: crisp outlines, keys readable underneath ---------- */
.teaching-hands{pointer-events:none;transition:opacity .3s}
.hide-hands .teaching-hands{opacity:0}
.hand-palm{fill:#b77e58;fill-opacity:.13;stroke:#8d674e;stroke-opacity:.6;stroke-width:1.7}
.finger-outline{stroke:#8d674e;stroke-width:29;fill:none;stroke-linecap:round;stroke-opacity:.72}
.finger-skin{stroke:#b98058;stroke-width:25;fill:none;stroke-linecap:round;stroke-opacity:.17}
.finger-nail{fill:#efc2a5;fill-opacity:.14;stroke:#997459;stroke-opacity:.4;stroke-width:1}
.finger-cue{fill:var(--finger-colour);fill-opacity:0;stroke-width:2;opacity:0;transition:opacity .2s,stroke-width .14s,fill-opacity .14s}
.finger-dot{opacity:.12;transition:opacity .2s}
.teaching-finger.finger-active .finger-outline{stroke:var(--finger-colour);stroke-opacity:.95;stroke-width:31}
.teaching-finger.finger-active .finger-skin{stroke:var(--finger-colour);stroke-opacity:.2}
.teaching-finger.finger-active .finger-cue{opacity:.8;fill-opacity:.05}
.teaching-finger.finger-active .finger-dot{opacity:.75}
.teaching-finger.is-pressing .finger-cue{stroke-width:4;fill-opacity:.2;opacity:1}
.hand-caption{font-family:var(--sans);font-size:11px;font-weight:600;letter-spacing:2px;fill:#5b8172;text-anchor:middle}

.try-gently{animation:gentle-nudge .4s ease-out}

/* ---------- Finishing a step and a lesson ---------- */
.drill-celebration{padding:4px 0 0;position:relative;animation:card-arrive .4s ease-out;outline:none}
.drill-celebration>span{float:right;font-size:38px;line-height:1;color:var(--gold);animation:little-pop .6s ease-out}
.drill-celebration>strong{font-size:24px;color:#36615a;font-weight:600;display:block}
.drill-celebration p{font-size:16px;color:#5c766f;margin:6px 0 16px}
.drill-celebration .button{width:100%;justify-content:space-between}
.trainer-footer{display:flex;justify-content:space-between;align-items:center;flex-wrap:wrap;gap:8px 16px;margin:22px 0 8px}
.gentle-note{font-size:14px;line-height:1.6;color:var(--muted);text-align:center;max-width:46em;margin:0 auto}
.lesson-finale{background:var(--mint-soft);border:1.5px solid #c8d6d0;border-radius:28px;text-align:center;padding:clamp(32px,6vw,56px) 24px;margin:24px auto 0;max-width:760px;animation:card-arrive .5s ease-out}
.finale-sun{font-size:68px;line-height:1;color:var(--gold);margin-bottom:22px;animation:coach-turn 30s linear infinite}
.lesson-finale .trainer-pill{background:var(--sun);color:var(--ink)}
.lesson-finale h1{font-size:clamp(32px,5vw,46px);line-height:1.15;margin:20px auto;max-width:14em}
.lesson-finale>p{font-size:17px;max-width:30em;margin:auto}
.finale-actions{display:flex;justify-content:center;align-items:center;flex-wrap:wrap;gap:16px 26px;margin:28px 0 14px}

/* ---------- Hands used outside the lesson ---------- */
.home-hands-preview{width:100%;pointer-events:none}
.onboarding-hands.hand-stage{margin-top:18px;padding:16px 16px 0}
.onboarding-hands .hand-keyboard{pointer-events:none}
.onboarding-finger-label{text-align:center;padding:4px 15px 20px}
.onboarding-finger-label b{display:block;color:var(--forest-deep);font-size:16px}
.onboarding-finger-label span{font-size:15px;color:var(--muted)}
.beginner-note{font-size:16px}

@keyframes little-pop{0%{transform:scale(.85)}55%{transform:scale(1.12)}100%{transform:scale(1)}}
@keyframes gentle-nudge{0%,100%{transform:translateX(0)}30%{transform:translateX(-4px)}65%{transform:translateX(4px)}}
@keyframes coach-turn{to{transform:rotate(360deg)}}
@keyframes target-breathe{0%,100%{stroke-width:3}50%{stroke-width:5.5}}
@keyframes wrong-key{0%,60%{fill:#ffc9b8;stroke:#ac7454}100%{fill:#fcfcf9}}

/* ---------- Responsive ---------- */
@media(max-width:1020px){
  .lesson-grid{grid-template-columns:minmax(0,1fr);grid-template-rows:none;grid-template-areas:"coach" "stage" "turn"}
  .coach-card p{font-size:17px}
  .turn-actions{grid-template-columns:repeat(auto-fit,minmax(220px,1fr))}
}
@media(max-width:600px){
  .lesson-shell{padding-inline:12px}
  .trainer-lesson-count strong{font-size:30px}
  .trainer-lesson-count strong span{font-size:15px}
  .lesson-bar-title p{font-size:15px}
  .coach-card,.practice-island{padding:18px}
  .coach-card h2{font-size:22px}
  .hand-stage{padding:10px 8px 0;border-radius:18px}
  .stage-top{gap:8px}
  .mode-tab{padding:6px 12px 6px 6px;font-size:14px}
  .trainer-tool{padding:7px 10px}
  .stage-status{flex-direction:column;align-items:flex-start;gap:6px;min-height:74px}
  .drill-feedback{font-size:15px}
  .token-row{flex-wrap:wrap}
  .drill-tokens{flex:1 1 100%}
  .drill-token{width:32px;height:38px;font-size:16px}
  .finger-callout{margin-inline:-8px;padding:12px;gap:12px}
  .finger-callout>#big-key{min-width:50px;min-height:50px;font-size:20px}
  .finger-callout strong{font-size:18px}
  .finger-callout p{font-size:14px}
  .watch-controls{margin-inline:-8px;padding:12px}
  .guide-key text{font-size:19px}
  .hand-caption{font-size:13px;letter-spacing:1px}
  .trainer-footer{justify-content:center}
  .onboarding-hands.hand-stage{padding:10px 8px 0}
}
@media(prefers-reduced-motion:reduce){
  .gentle-trainer,.teaching-finger,.guide-key,.key-cap,.finger-cue,.drill-token,.drill-celebration,.finale-sun{animation:none!important;transition:none!important}
}
/* Integration QA: keep the step count beneath long lesson titles on phones. */
@media(max-width:600px){
  .lesson-bar{grid-template-columns:minmax(0,1fr);gap:10px}
  .trainer-lesson-count{display:flex;align-items:center;gap:12px;justify-self:start;text-align:left}
  .trainer-lesson-count small{margin:0}
  .trainer-lesson-count strong{font-size:26px}
}
