/* ============================================================================
   Lesson list pages (the hubs: grammar-lessons, prepositions-lessons, ...) in
   the Tech Skills hub design.

   Load order on a hub:  lq-core.css, tech-skills.css, tech-skills-pro.css, this.
   The ts-* components live in the two tech-skills files. Those read be-shell.css
   tokens; a hub loads lq-core.css instead, so the tokens are mapped here (the
   lq-core tokens also carry the dark theme). Each hub takes its accent from its
   module class on <body> (mod-grammar, mod-prep, ...).

   Markup is written by tools/site-chrome/convert_lesson_hubs.py.
   ========================================================================== */
body{ --card:var(--surface); --line:var(--border); --muted:var(--text-muted); --ink:var(--text);
      /* accent for text and outlines: the module colour pulled 32% toward the text colour, so the
         amber (vocabulary) and teal (phonetics) modules stay readable; it lightens in the dark theme */
      --ts-c:color-mix(in srgb,var(--module) 68%,var(--text));
      --ts-grad:linear-gradient(135deg,var(--ts-c),var(--module)); }

/* small labels follow the site type scale (13px minimum) */
.ts-kicker, .ts-counts, .ts-path span, .ts-step b{ font-size:.8125rem; }
.ts-sec p, .ts-learn, .ts-btn{ font-size:.9375rem; }

/* ---- hero --------------------------------------------------------------- */
.lh-lead{ margin:0 0 6px; font-size:1.3125rem; font-weight:600; line-height:1.35; color:var(--ink); }
.lh-prog{ display:flex; align-items:center; gap:10px; max-width:440px; margin-top:14px;
          font-size:.9375rem; font-weight:600; color:var(--muted); }
.lh-prog b{ color:var(--ts-c); font-weight:700; }
.lh-prog .ts-progbar{ height:7px; }
.lh-prog .ts-progbar span{ width:0; background:var(--ts-grad); }

/* ---- "Show" picklist (replaces the old row of filter pills) --------------- */
.lh-filter{ display:flex; align-items:center; gap:10px; margin-top:20px; min-width:0; max-width:100%; }
.lh-filter select{ flex:0 1 auto; min-width:0; }
.lh-filter label{ font-size:.9375rem; font-weight:600; color:var(--muted); }
.lh-filter select{
  -webkit-appearance:none; appearance:none; min-height:44px; max-width:100%;
  padding:10px 40px 10px 14px; border-radius:12px; border:1px solid var(--line);
  background:var(--card) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%236b6786' stroke-width='2.4' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E") no-repeat right 12px center / 16px;
  color:var(--ink); font-family:inherit; font-size:.9375rem; font-weight:600; cursor:pointer;
}
.lh-filter select:hover{ border-color:var(--ts-c); }
.lh-filter select:focus-visible{ outline:2px solid var(--ts-c); outline-offset:2px; }

/* ---- lesson cards: the gradient tile carries the lesson number ----------- */
.lesson-group .ts-grid{ margin-bottom:6px; }
.ts-grid .ts-ico{ font-family:'Inter',system-ui,sans-serif; font-size:1.1875rem; font-weight:700; letter-spacing:-.01em; }
.ts-grid .ts-ico svg{ width:26px; height:26px; fill:none; stroke:currentColor; stroke-width:2;
                      stroke-linecap:round; stroke-linejoin:round; }
.ts-grid .ts-name{ margin:0; font-weight:700; }
.ts-grid .ts-learn{ margin:0; }
.ts-grid .lesson-status{ margin-top:2px; }

/* ---- compact hub (opt-in: <body class="... hub-compact">) -----------------
   For a hub with many lessons. Each group is a panel: a "Step n" label, the name, a one-line
   note and its own done count. Cards are short, four to a row: the number tile sits beside
   the name, the status and "Open" share the last line. */
body.hub-compact #lessonsSection{ display:grid; gap:32px; padding-top:18px; padding-bottom:3rem; }
body.hub-compact .lesson-group{ min-width:0; padding:22px 24px 24px; border-radius:24px; border:1px solid var(--line);
                                background:color-mix(in srgb,var(--card) 55%,transparent); }
body.hub-compact .lesson-group .ts-sec{ margin:0 0 18px; align-items:center; justify-content:flex-start; gap:6px 12px; }
body.hub-compact .lesson-group .ts-sec h2{ margin:0; font-size:1.3125rem; line-height:1.3; }
body.hub-compact .lesson-group .ts-sec p{ flex:none; margin:0 0 0 auto; padding:5px 12px; font-size:.875rem; font-weight:600; white-space:nowrap; }
body.hub-compact .lesson-group .ts-sec p b{ font-weight:700; color:var(--ts-c); }
.lh-stepk{ flex:none; padding:4px 11px; border-radius:999px; background:var(--ts-grad); color:#fff;
           font-size:.8125rem; font-weight:700; line-height:1.4; letter-spacing:.04em; text-transform:uppercase; }
.lh-secnote{ flex:1 1 220px; min-width:0; color:var(--muted); font-size:.9375rem; line-height:1.5; }

body.hub-compact .ts-grid{ gap:16px; margin:0; grid-template-columns:repeat(4,minmax(0,1fr)); }
body.hub-compact .ts-grid .ts-card{
  display:grid; grid-template-columns:40px minmax(0,1fr) auto; grid-template-rows:auto 1fr auto;
  grid-template-areas:var(--areas,"ico name name" "learn learn learn" "status status foot");
  align-items:center; gap:var(--rgap,10px) 12px; padding:18px 18px 16px; border-radius:18px;
}
body.hub-compact .ts-grid .ts-card::before{ width:100px; height:100px; top:-44px; right:-44px; filter:blur(34px); opacity:.2; }
body.hub-compact .ts-grid .ts-card:hover{ transform:translateY(-3px); }
body.hub-compact .ts-grid .ts-cardtop{ grid-area:ico; margin:0; }
body.hub-compact .ts-grid .ts-ico{ width:40px; height:40px; margin:0; border-radius:12px; font-size:1.0625rem; }
body.hub-compact .ts-grid .ts-ico svg{ width:20px; height:20px; }
body.hub-compact .ts-grid .ts-name{ grid-area:name; font-size:1.0625rem; line-height:1.3; }
body.hub-compact .ts-grid .ts-learn{ grid-area:learn; align-self:start; line-height:1.45; }
body.hub-compact .ts-grid .ts-counts{ grid-area:status; margin:0; justify-self:var(--end,start); }
body.hub-compact .ts-grid .ts-cardfoot{ grid-area:foot; margin:0; justify-self:end; }
@media (max-width:1180px){ body.hub-compact .ts-grid{ grid-template-columns:repeat(3,minmax(0,1fr)); } }
@media (max-width:860px){ body.hub-compact .ts-grid{ grid-template-columns:repeat(2,minmax(0,1fr)); } }

/* No holes at the end of a group. When the cards do not fill the last row, the first card (or the
   first two) grows by the missing cells; a card that takes a whole row becomes one flat row.
   ":first-child:nth-last-child(4n+1)" = the first card of a group whose count leaves 1 over 4. */
@media (min-width:1181px){
  body.hub-compact .ts-grid .ts-card:first-child:nth-last-child(4n+2),
  body.hub-compact .ts-grid .ts-card:first-child:nth-last-child(4n+2) + .ts-card,
  body.hub-compact .ts-grid .ts-card:first-child:nth-last-child(4n+3){ grid-column:span 2; }
  body.hub-compact .ts-grid .ts-card:first-child:nth-last-child(4n+1){
    grid-column:1 / -1; grid-template-rows:auto auto; --areas:"ico name status" "ico learn foot"; --rgap:2px; --end:end; }
}
@media (min-width:861px) and (max-width:1180px){
  body.hub-compact .ts-grid .ts-card:first-child:nth-last-child(3n+2){ grid-column:span 2; }
  body.hub-compact .ts-grid .ts-card:first-child:nth-last-child(3n+1){
    grid-column:1 / -1; grid-template-rows:auto auto; --areas:"ico name status" "ico learn foot"; --rgap:2px; --end:end; }
}
@media (min-width:561px) and (max-width:860px){
  body.hub-compact .ts-grid .ts-card:first-child:nth-last-child(2n+1){
    grid-column:1 / -1; grid-template-rows:auto auto; --areas:"ico name status" "ico learn foot"; --rgap:2px; --end:end; }
}
@media (max-width:560px){
  body.hub-compact .ts-grid{ grid-template-columns:minmax(0,1fr); }
  body.hub-compact #lessonsSection{ gap:22px; }
  body.hub-compact .lesson-group{ padding:16px 14px 16px; border-radius:20px; }
  body.hub-compact .ts-grid{ gap:12px; }
  body.hub-compact .lesson-group .ts-sec p{ margin-left:0; }
  .lh-secnote{ flex-basis:100%; }
}

/* ---- practice links ------------------------------------------------------- */
.lh-links{ display:flex; flex-wrap:wrap; gap:8px; }
.lh-links a{ padding:8px 14px; border-radius:999px; background:var(--card); border:1px solid var(--line);
             color:var(--ts-c); font-size:.9375rem; font-weight:600; text-decoration:none;
             transition:border-color .18s, transform .18s; }
.lh-links a:hover{ border-color:var(--ts-c); transform:translateY(-1px); }
.lh-links a:focus-visible{ outline:2px solid var(--ts-c); outline-offset:2px; }

/* ==========================================================================
   Sub-pages of a hub (cheat sheets): same hero and section heads, plus
   compact rows, one-per-row point cards and a wrong/right list.
   Markup is written by hand in those pages.
   ========================================================================== */
.ts-hero .ts-crumb{ margin-bottom:12px; font-size:.9375rem; }
.ts-step small{ display:block; margin-top:6px; color:var(--muted); font-size:.9375rem; font-weight:400; line-height:1.5; }
.lh-actions{ display:flex; flex-wrap:wrap; gap:10px; justify-content:center; margin-top:28px; }
.lh-ic{ width:16px; height:16px; flex:none; fill:none; stroke:currentColor; stroke-width:2.2; stroke-linecap:round; stroke-linejoin:round; }
.lh-sr{ position:absolute; width:1px; height:1px; overflow:hidden; clip:rect(0 0 0 0); white-space:nowrap; }

/* compact rows: a tinted number chip, a name and one line of detail */
.lh-rows{ display:grid; gap:10px; grid-template-columns:repeat(2,minmax(0,1fr)); }
.lh-row{ display:flex; align-items:flex-start; gap:12px; padding:12px 14px; border-radius:14px;
         background:var(--card); border:1px solid var(--line); color:inherit; text-decoration:none;
         transition:border-color .18s, transform .18s, box-shadow .18s; }
a.lh-row:hover{ border-color:var(--ts-c); transform:translateY(-2px); box-shadow:0 12px 26px -20px var(--ts-c); }
a.lh-row:focus-visible{ outline:2px solid var(--ts-c); outline-offset:2px; }
.lh-row .ts-tnum{ width:auto; min-width:34px; height:30px; padding:0 8px; font-size:.8125rem; font-weight:700; }
.lh-row b{ display:block; font-size:1.0625rem; font-weight:700; line-height:1.35; }
.lh-row small{ display:block; margin-top:2px; color:var(--muted); font-size:.9375rem; line-height:1.5; }

/* point cards: one per row, a gradient number tile and labelled rows */
.lh-points{ display:grid; gap:14px; }
.lh-point{ --cc:#7c3aed; --cc2:#a78bfa; padding:1.25rem 1.4rem; border-radius:22px;
           background:color-mix(in srgb,var(--card) 88%,transparent); border:1px solid var(--line);
           box-shadow:0 12px 30px -24px rgba(20,16,50,.55); }
.lh-point:nth-child(5n+2){ --cc:#3b82f6; --cc2:#0ea5e9; }
.lh-point:nth-child(5n+3){ --cc:#f97316; --cc2:#fb923c; }
.lh-point:nth-child(5n+4){ --cc:#10b981; --cc2:#34d399; }
.lh-point:nth-child(5n+5){ --cc:#ec4899; --cc2:#f472b6; }
.lh-point-head{ display:flex; align-items:center; gap:12px; margin-bottom:10px; }
.lh-point-num{ flex:none; display:grid; place-items:center; width:44px; height:44px; border-radius:14px;
               color:#fff; font-size:1.1875rem; font-weight:700; background:linear-gradient(135deg,var(--cc),var(--cc2));
               box-shadow:0 12px 22px -10px color-mix(in srgb,var(--cc) 72%,transparent); }
.lh-point h2{ margin:0; font-size:1.3125rem; font-weight:700; line-height:1.3; }
.lh-point .ts-block{ grid-template-columns:130px minmax(0,1fr); font-size:1.0625rem; }
.lh-point .ts-block b{ padding-top:0; font-size:1.0625rem; font-weight:700; letter-spacing:0; text-transform:none;
                       color:color-mix(in srgb,var(--cc) 70%,var(--text)); }

/* wrong -> right list */
.lh-traps{ list-style:none; margin:0; padding:0; display:grid; gap:8px; grid-template-columns:repeat(2,minmax(0,1fr)); }
.lh-traps li{ display:flex; flex-wrap:wrap; align-items:center; gap:6px 10px; padding:10px 14px; border-radius:12px;
              background:var(--card); border:1px solid var(--line); font-size:1.0625rem; }
.lh-no, .lh-yes{ display:inline-flex; align-items:center; gap:6px; font-weight:600; }
.lh-no{ color:#b91c1c; text-decoration:line-through; text-decoration-color:rgba(185,28,28,.45); }
.lh-yes{ color:#047857; }
.lh-to{ color:var(--muted); }
html[data-theme="dark"] .lh-no{ color:#fca5a5; }
html[data-theme="dark"] .lh-yes{ color:#6ee7b7; }

/* one row per line (schedules, numbered steps) */
.lh-rows.lh-one{ grid-template-columns:minmax(0,1fr); }
.lh-rows.lh-one .ts-tnum{ min-width:64px; }
.lh-rows.lh-num .ts-tnum{ min-width:34px; }

/* reference tables: a white card, tinted header row, the first column as a chip */
.lh-tablewrap{ border-radius:16px; border:1px solid var(--line); background:var(--card); overflow:hidden;
               box-shadow:0 12px 30px -26px rgba(20,16,50,.55); }
.lh-table{ width:100%; border-collapse:collapse; font-size:1.0625rem; line-height:1.5; }
.lh-table th{ text-align:left; padding:11px 16px; font-size:.8125rem; font-weight:700; letter-spacing:.06em;
              text-transform:uppercase; color:var(--ts-c); background:color-mix(in srgb,var(--ts-c) 8%,var(--card)); }
.lh-table td{ padding:11px 16px; border-top:1px solid var(--line); vertical-align:top; }
.lh-table td:first-child{ white-space:nowrap; }
.lh-table code{ display:inline-block; padding:2px 9px; border-radius:8px; font-family:inherit; font-size:.9375rem;
                font-weight:700; color:var(--ts-c); background:color-mix(in srgb,var(--ts-c) 11%,transparent); }
@media (max-width:640px){
  /* each row becomes a small card; the column name is printed above each value */
  .lh-tablewrap{ border:0; border-radius:0; background:none; box-shadow:none; overflow:visible; }
  .lh-table, .lh-table tbody, .lh-table tr, .lh-table td{ display:block; }
  .lh-table thead{ position:absolute; width:1px; height:1px; overflow:hidden; clip:rect(0 0 0 0); }
  .lh-table tr{ margin-bottom:10px; padding:12px 14px; border-radius:14px; border:1px solid var(--line); background:var(--card); }
  .lh-table td{ padding:0; border:0; }
  .lh-table td + td{ margin-top:8px; }
  .lh-table td:first-child{ white-space:normal; }
  .lh-table td + td::before{ content:attr(data-label); display:block; font-size:.8125rem; font-weight:600; color:var(--muted); }
}

@media (max-width:760px){
  .lh-rows, .lh-traps{ grid-template-columns:minmax(0,1fr); }
  .lh-point .ts-block{ grid-template-columns:minmax(0,1fr); }
}

@media (prefers-reduced-motion:reduce){ .lh-links a, .lh-row{ transition:none; } .lh-links a:hover, a.lh-row:hover{ transform:none; } }
