/* The lesson timeline (js/lesson-timeline.js): the progress row is the controls. */

/* the big tiles and the old icon row go; their buttons stay in the page (the timeline clicks them) */
body.has-svtl .sv-panel > .sidebar-section.sidebar-knowledge-check,
body.has-svtl .sv-panel > .sidebar-section.sidebar-flashcard-section,
body.has-svtl .sv-panel > .sidebar-section.tile-practice{ display:none !important; }
body.has-svtl .lesson-progress-item{ display:none !important; }
body.has-svtl .sv-panel{ grid-template-rows:auto auto; }
body.has-svtl .sv-panel > .sidebar-media{ grid-area:2 / 1 / 3 / -1; }   /* the whole row since the tutor went (22 Oct 2026) */
body.has-svtl .lesson-progress-bar{ margin-bottom:0 !important; }

.svtl{ position:relative; margin-top:1.15rem; font-family:var(--font-ui, system-ui, sans-serif); }

/* ---- the row: equal columns, one line through the node centres ---- */
.svtl-row{ list-style:none; margin:0; padding:0; display:grid; grid-template-columns:repeat(var(--n,6), 1fr); }
.svtl-step{ position:relative; min-width:0; }
.svtl-step::before, .svtl-step::after{ content:''; position:absolute; top:21px; height:2px; background:var(--border-light, #e6e4e0); }
.svtl-step::before{ left:0; right:50%; }
.svtl-step::after{ left:50%; right:0; }
.svtl-step:first-child::before, .svtl-step:last-child::after{ display:none; }
/* the core three sit on a heavier line */
.svtl-step.is-core::before, .svtl-step.is-core:has(+ .is-core)::after{ height:3px; top:20.5px; }
/* a segment fills when the step on its right is done */
.svtl-step.is-done::before, .svtl-step:has(+ .svtl-step.is-done)::after{ background:var(--accent); }

.svtl-btn{
  position:relative; z-index:1; width:100%; display:flex; flex-direction:column; align-items:center; gap:.35rem;
  padding:0; border:0; background:none; cursor:pointer; font:inherit; color:inherit; text-align:center;
}
.svtl-node{
  width:44px; height:44px; border-radius:50%; display:grid; place-items:center; flex:none;
  background:var(--bg-card, #fff); border:2px solid var(--border-light, #e6e4e0); color:var(--text-muted, #7f7c75);
  transition:transform .2s cubic-bezier(.16,1,.3,1), border-color .2s, background-color .2s, color .2s, box-shadow .2s;
}
.svtl-node svg{ width:19px; height:19px; }
.svtl-node .svtl-tick{ display:none; }
.svtl-step.is-core .svtl-node{ border-color:color-mix(in srgb, var(--accent) 35%, var(--border-light, #e6e4e0)); color:var(--accent); }
.svtl-btn:hover .svtl-node{ transform:translateY(-3px); border-color:var(--accent); color:var(--accent);
  box-shadow:0 8px 16px -8px color-mix(in srgb, var(--accent) 70%, transparent); }
.svtl-btn:active .svtl-node{ transform:translateY(0); }
.svtl-btn:focus-visible{ outline:none; }
.svtl-btn:focus-visible .svtl-node{ outline:2px solid var(--accent); outline-offset:3px; }
.svtl-name{ font-size:.76rem; font-weight:700; line-height:1.1; text-align:center; }
/* two-word names ('Deep dive') may wrap; every name gets two lines' height so the % row stays level (20 Oct 2026) */
.svtl-name{ min-height:2.2em; display:flex; align-items:center; justify-content:center; }
.svtl-worth{ font-size:.7rem; color:var(--text-muted, #7f7c75); font-variant-numeric:tabular-nums; margin-top:-.2rem; }
.svtl-btn:hover .svtl-name{ color:var(--accent); }

.svtl-step.is-done .svtl-node{ background:var(--accent); border-color:var(--accent); color:#fff; }
body.dark-mode .svtl-step.is-done .svtl-node{ color:#171614; }
.svtl-step.is-done .svtl-ic{ display:none; }
.svtl-step.is-done .svtl-tick{ display:block; stroke-width:3; }
.svtl-step.is-done .svtl-worth{ color:var(--accent); font-weight:600; }
.svtl-step.is-next .svtl-node{ border-color:var(--accent); color:var(--accent); box-shadow:0 0 0 5px color-mix(in srgb, var(--accent) 13%, transparent); }

/* hover names the action (desktop) */
.svtl-btn::after{
  content:attr(data-tip); position:absolute; bottom:calc(100% + 6px); left:50%; transform:translate(-50%, 4px);
  white-space:nowrap; font-size:.72rem; font-weight:600; color:var(--bg-card, #fff); background:var(--text-primary, #2d2a26);
  border-radius:5px; padding:.3rem .5rem; opacity:0; pointer-events:none; transition:opacity .15s, transform .15s; z-index:5;
}
.svtl-btn:hover::after{ opacity:1; transform:translate(-50%, 0); transition-delay:.2s; }
.svtl-step:first-child .svtl-btn::after{ left:0; transform:translate(0, 4px); }
.svtl-step:first-child .svtl-btn:hover::after{ transform:translate(0, 0); }
.svtl-step:last-child .svtl-btn::after{ left:auto; right:0; transform:translate(0, 4px); }
.svtl-step:last-child .svtl-btn:hover::after{ transform:translate(0, 0); }
@media (hover:none){ .svtl-btn::after{ display:none; } }

/* ---- the one button: the quickest road to 50%. Its look is the site's main button (css/buttons.css, job S3-02) ---- */
.svtl-next{ margin:1.05rem 0 0; width:100%; display:flex; }
.svtl-next small{ font-size:.78rem; font-weight:600; opacity:.8; }

/* phones, once: the steps can be tapped */
.svtl.show-hint{ margin-top:2.4rem; }   /* room for the hint above the row, clear of the bar */
.svtl.show-hint::before{
  content:'Tap any step'; position:absolute; top:-1.95rem; left:50%; transform:translateX(-50%); white-space:nowrap;
  font-size:.72rem; font-weight:700; color:#fff; background:var(--accent); border-radius:5px; padding:.25rem .55rem;
  animation:svtl-bob 1.6s ease-in-out infinite; z-index:6;
}
body.dark-mode .svtl.show-hint::before{ color:#171614; }
@keyframes svtl-bob{ 50%{ transform:translate(-50%, -3px); } }

/* phones: two rows of bigger steps (Tom, 15 Oct 2026: six in one row was crowded and small to tap). Three to a row
   (four when there are seven steps); the joining line runs along each row and breaks between rows. */
@media (max-width:600px){
  .svtl-row{ grid-template-columns:repeat(var(--cols,3), 1fr); row-gap:1.1rem; }
  .svtl-node{ width:52px; height:52px; }
  .svtl-node svg{ width:22px; height:22px; }
  .svtl-step::before, .svtl-step::after{ top:25px; }
  .svtl-step.is-core::before, .svtl-step.is-core:has(+ .is-core)::after{ top:24.5px; }
  .svtl-row[style*="--cols:3"] .svtl-step:nth-child(3n+1)::before, .svtl-row[style*="--cols:3"] .svtl-step:nth-child(3n)::after,
  .svtl-row[style*="--cols:4"] .svtl-step:nth-child(4n+1)::before, .svtl-row[style*="--cols:4"] .svtl-step:nth-child(4n)::after{ display:none; }
  .svtl-btn{ gap:.4rem; padding:.15rem 0; }
  /* a two-word name (Deep Dive) takes two lines and a long word (Interactive) overflows evenly about its step, so
     neighbouring names never touch in the four-column row (8 Nov 2026) */
  .svtl-name{ font-size:.86rem; max-width:min(4.4em, 100%); margin-inline:auto; }
  .svtl-worth{ font-size:.78rem; }
  .svtl-next{ white-space:nowrap; }
  .svtl-next small{ display:none; }   /* the worth is already under the step */
}
@media (max-width:380px){ body[data-skin] .svtl-name{ letter-spacing:-.015em; } }   /* the narrowest phones (the text stays 15px, css/reskin.css): Interactive still clears Deep Dive */
@media (prefers-reduced-motion:reduce){ .svtl-node, .svtl-next, .svtl-btn::after{ transition:none; } .svtl.show-hint::before{ animation:none; } }

/* ---- the two done states (Tom, 3 Oct 2026) ---- */
#nav-unit-overview{ display:none !important; }   /* off the lesson header: its space goes to the unit name */

/* 50%: the header turns, the dashed done-line becomes a tick */
.sidebar-progress-section.is-lesson-done .lesson-progress-summary{ color:var(--accent) !important; font-weight:700; }
.sidebar-progress-section.is-lesson-done .lesson-progress-bar::after{
  top:-8px; bottom:auto; width:18px; height:18px; margin-left:-9px; border-radius:50%; opacity:1;
  background:var(--accent) url("data:image/svg+xml;utf8,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='white' stroke-width='4' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='20 6 9 17 4 12'/%3E%3C/svg%3E") center/11px no-repeat;
  box-shadow:0 0 0 3px var(--bg-card, #fff);
}
/* 100%: a filled badge before the words */
.sidebar-progress-section.is-explored .lesson-progress-summary{
  background:var(--accent); color:#fff !important; padding:.15rem .55rem; border-radius:4px; top:.8rem !important;
}
body.dark-mode .sidebar-progress-section.is-explored .lesson-progress-summary{ color:#171614 !important; }

/* the moment, once per lesson */
.sidebar-progress-section.svtl-pulse .lesson-progress-summary{ animation:svtl-pop .9s cubic-bezier(.16,1,.3,1); }
.sidebar-progress-section.svtl-pulse .lesson-progress-bar::after{ animation:svtl-pop .9s cubic-bezier(.16,1,.3,1) .1s; }
@keyframes svtl-pop{ 0%{ transform:scale(1); } 35%{ transform:scale(1.18); } 100%{ transform:scale(1); } }

/* the quiet second choice under "Next lesson": a quiet button (css/buttons.css, job S3-02) */
.svtl-further{ display:flex; margin:.5rem auto 0; }

/* phones: the panel is in a closed drawer, so the news comes up from the bottom, once */
.svtl-toast{
  position:fixed; left:12px; right:12px; bottom:calc(14px + env(safe-area-inset-bottom, 0px)); z-index:9000;
  display:flex; align-items:center; gap:.6rem; padding:.7rem .75rem .7rem .9rem; border-radius:10px;
  background:var(--text-primary, #2d2a26); color:var(--bg-card, #fff); font-family:var(--font-ui, system-ui, sans-serif);
  box-shadow:0 12px 30px rgba(0,0,0,.28); transform:translateY(140%); transition:transform .45s cubic-bezier(.16,1,.3,1);
}
.svtl-toast.is-in{ transform:translateY(0); }
.svtl-toast-tick{ width:24px; height:24px; border-radius:50%; display:grid; place-items:center; background:var(--accent); color:#fff; font-weight:700; font-size:.8rem; flex:none; }
.svtl-toast-text{ font-weight:700; font-size:.9rem; flex:1; }
.svtl-toast-go{ color:var(--bg-card, #fff); font-weight:700; font-size:.88rem; text-decoration:none; white-space:nowrap; padding:.35rem .6rem; border-radius:6px; background:color-mix(in srgb, var(--bg-card, #fff) 14%, transparent); }
.svtl-toast-x{ border:0; background:none; color:inherit; font-size:1.2rem; line-height:1; padding:.2rem .35rem; cursor:pointer; opacity:.7; }
@media (prefers-reduced-motion:reduce){ .svtl-toast{ transition:none; } .sidebar-progress-section.svtl-pulse .lesson-progress-summary, .sidebar-progress-section.svtl-pulse .lesson-progress-bar::after{ animation:none; } }

/* the unit name gets the room Unit Overview left (it was capped at 260 px and cut off) */
@media (min-width:1100px){ body[data-skin="reader"] .header-unit-label{ max-width:min(30vw, 440px); } }
/* the nav keeps its width; the unit name takes what is left and truncates only when it truly runs out */
@media (min-width:981px){
  body[data-skin="reader"] .header-nav{ flex-shrink:0; }
  body[data-skin="reader"] .header-pills{ flex:1 1 auto; min-width:0; display:flex; align-items:center; }
  body[data-skin="reader"] .header-pills .header-unit-label{ flex:0 1 auto; min-width:0; max-width:none; }
  body[data-skin="reader"] .header-pills .header-lesson-label{ flex:none; }
}

/* ---- a narrow panel (Tom, 20 Oct 2026: on a tablet the steps, names and the bottom-row launchers ran into
   each other). The panel's own width decides, not the screen's: the drawer and the in-page column on a 1024 px
   tablet are both about 300-350 px wide, while the screen widths differ. The desktop column is wider and
   keeps its layout. ---- */
body[data-skin="reader"] .sv-panel{ container:svpanel / inline-size; }
@container svpanel (max-width:360px){
  .svtl-row{ grid-template-columns:repeat(var(--cols,3), 1fr); row-gap:1.1rem; }
  .svtl-row[style*="--cols:3"] .svtl-step:nth-child(3n+1)::before, .svtl-row[style*="--cols:3"] .svtl-step:nth-child(3n)::after,
  .svtl-row[style*="--cols:4"] .svtl-step:nth-child(4n+1)::before, .svtl-row[style*="--cols:4"] .svtl-step:nth-child(4n)::after{ display:none; }
  .svtl-next{ white-space:nowrap; padding-inline:.6rem; }
  .svtl-next small{ display:none; }   /* the worth is already under the step */
  body[data-skin="reader"] .sidebar-progress-section{ padding-inline:1rem; }
  body[data-skin="reader"] .sidebar-progress-section .sidebar-section-title{ font-size:.7rem; letter-spacing:.1em; }
  body[data-skin="reader"] .lesson-progress-summary{ right:1rem; font-size:.76rem; }
}
/* (the bottom row used to hold two launchers, Related media and Ask the tutor, and lost its icons below
   400 px; since 22 Oct 2026 Related media has the row to itself and keeps its icon) */

/* a 1024 px tablet: the full nav and the account button leave room for the unit name only, so the
   lesson count goes (it was cut to 'LESS') */
@media (min-width:981px) and (max-width:1099px){
  body[data-skin="reader"] .header-pills .header-lesson-label{ display:none; }
}

/* ---- the full names (job S2-01, 19 Nov 2026: "Quick quiz", "Flashcards", "Exam question", "Lightbulb task", each on
   at most two lines) need room. Six or seven steps never share one row: six are three and three, seven are four
   and three, at every size; on a panel under 300 px (a 360 px phone) three to a row. The joining line breaks where a
   row ends. ---- */
.svtl-row[style*="--n:6"]{ grid-template-columns:repeat(3, 1fr); row-gap:1.1rem; }
.svtl-row[style*="--n:6"] .svtl-step:nth-child(3)::after, .svtl-row[style*="--n:6"] .svtl-step:nth-child(4)::before{ display:none; }
.svtl-row[style*="--n:7"]{ grid-template-columns:repeat(4, 1fr); row-gap:1.1rem; }
.svtl-row[style*="--n:7"] .svtl-step:nth-child(4)::after, .svtl-row[style*="--n:7"] .svtl-step:nth-child(5)::before{ display:none; }
@container svpanel (max-width:300px){
  .svtl-row[style*="--n:7"]{ grid-template-columns:repeat(3, 1fr); }
  .svtl-row[style*="--n:7"] .svtl-step:nth-child(4)::after, .svtl-row[style*="--n:7"] .svtl-step:nth-child(5)::before{ display:block; }
  .svtl-row[style*="--n:7"] .svtl-step:nth-child(3n)::after, .svtl-row[style*="--n:7"] .svtl-step:nth-child(3n+1)::before{ display:none; }
}

/* ---- the lesson's tools (job S5-16, 20 Nov 2026) ----
   "Next lesson" once: while the big button says it, the page links at the foot of the drawer leave theirs out (085.1).
   The page links are centred, a long name too (085.4: "Revision Techniques" wrapped and sat to the left).
   "Report a problem" and "Show me around" share a row only when both fit: on a 360px phone each has its own row (the
   second was cut at the drawer's edge).
   The dot on the menu button (the lesson's quick quiz still to do) pulses three times when the page opens, then rests,
   so the pupil sees that something waits in the tools without a pulse beside the text for the whole lesson (078.3, 109.6). */
/* the statement has its own line under the heading at every size (on a phone since job S1-07): it is longer now */
body[data-skin="reader"] .sidebar-progress-section .lesson-progress-summary{ position:static; order:-2; flex:0 0 auto; width:fit-content; margin:-.3rem 0 .5rem; }
body.svtl-next-lesson .sidebar-panel-nav a[data-for="nav-next-lesson"]{ display:none !important; }
body[data-skin="reader"].sidebar-panel-mode .sidebar-panel-nav a{ text-align:center; }
body[data-skin="reader"] .sv-utility-row{ flex-wrap:wrap; }
body[data-skin="reader"] .sv-utility-row .bugr-fab, body[data-skin="reader"] .sv-utility-row .sv-tour-replay{ flex:1 1 auto; }
body[data-skin="reader"] .mobile-menu-btn.has-unseen::after{ animation:svtl-dot-call 1.6s ease-out .9s 3; }
@keyframes svtl-dot-call{
  0%{ box-shadow:0 0 0 2px var(--bg-body,#f7f6f4), 0 0 0 2px color-mix(in srgb, var(--accent,#5b7c5f) 70%, transparent); }
  100%{ box-shadow:0 0 0 2px var(--bg-body,#f7f6f4), 0 0 0 12px transparent; }
}
@media (prefers-reduced-motion:reduce){ body[data-skin="reader"] .mobile-menu-btn.has-unseen::after{ animation:none; } }

/* ---- the end of the lesson (job S5-21, 20 Nov 2026; points 105.1, 105.4) ----
   A hairline, one line once the lesson is done ("Lesson done", in the tools' colour), and two buttons of one style: the
   site's (css/buttons.css); this only places them. The main one first: side by side on a wider screen, one above the
   other on a phone. js/lesson-timeline.js chooses them; a listening lesson has no end (its cards end it). */
.sv-lesson-end{ margin-top:3rem; padding-top:2rem; border-top:1px solid var(--border-light, #e8e4df); }
.sv-end-done{ display:flex; align-items:center; gap:.45rem; margin:0 0 .9rem; font:700 1rem var(--font-ui, 'Schibsted Grotesk', system-ui, sans-serif); color:var(--accent, #3d5a73); }
.sv-end-done[hidden]{ display:none; }
.sv-end-done svg{ width:18px; height:18px; flex:none; }
.sv-end-row{ display:flex; gap:12px; }
.sv-end-row .sv-btn{ flex:1 1 0; margin:0; }
.sv-end-row .sv-main{ order:-1; }
@media (max-width:600px){ .sv-end-row{ flex-direction:column; } }
body.sv-listening-mode .sv-lesson-end{ display:none; }
