/* The Homework block of the start page (index.html, #home-homework, assets/home-homework.js).
   A stack of "dashboard blocks" sits under the course cards: every block is a .dash-block section directly inside .landing
   (a later block, like "Tips & feedback from Rowan", just follows the same way).
   Loaded after academy-home.css and scoped to html.ah: it uses that file's colour variables (--ah-*). */

/* ---------- The block: a glass card, like the course cards, only calmer (no hover movement, it is not a button) ---------- */
html.ah .dash-block {
  position: relative; isolation: isolate; overflow: hidden; color: var(--ah-ink);
  border: 3px solid var(--ah-blue); border-radius: 30px; padding: 24px 28px 28px;
  background: var(--ah-fill);
  box-shadow: var(--ah-refract), 0 3px 8px rgba(20, 60, 110, .35);
}
html.ah .dash-block[hidden] { display: none; }
html.ah .dash-block::before {   /* the white gloss strip along the top */
  content: ''; position: absolute; z-index: -1; pointer-events: none; left: 4%; right: 4%; top: 6px; height: 52px; border-radius: 99px;
  background: linear-gradient(180deg, rgba(255, 255, 255, .98), rgba(255, 255, 255, .5)); filter: blur(1.4px);
}
html.ah .hw-block { min-height: 250px; }   /* room for the loading placeholder, so the page does not jump when the tasks arrive */

html.ah .hw-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 14px; margin-bottom: 18px; }
html.ah .hw-block .hw-title {
  font-family: var(--ah-head); font-weight: 700; font-size: 25px; line-height: 1.15; text-transform: lowercase; color: var(--ah-ink); margin: 5px 0 0;
}
html.ah .hw-block ul { list-style: none; margin: 0; padding: 0; }
html.ah .hw-block li { margin: 0; line-height: 1.4; }
html.ah .hw-block li::marker { content: ''; }
html.ah .hw-block [hidden] { display: none; }
html.ah .hw-sr {   /* read out by screen readers after a tick, not shown */
  position: absolute; width: 1px; height: 1px; margin: -1px; padding: 0; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}

/* ---------- Small pieces: the progress pill, the lesson tag, the time chip ---------- */
html.ah .hw-pill {   /* "2/5 done": the white glossy pill with the blue edge; green when everything is ticked */
  flex: none; display: inline-flex; align-items: center; gap: 8px; min-height: 30px; padding: 0 13px 0 10px; border-radius: 99px;
  font: 600 13px/1.2 var(--ah-font); letter-spacing: .01em; white-space: nowrap; color: var(--ah-ink);
  border: 1.5px solid #35a4dd; background: var(--ah-pill); box-shadow: var(--ah-pill-sh);
}
html.ah .hw-pill.full { color: #14400a; border-color: var(--ah-green); background: var(--ah-pill-green); box-shadow: inset 0 1px 0 #fff, inset 0 -2px 4px rgba(120, 210, 70, .5), 0 0 8px rgba(var(--ah-green-glow), .45); }
html.ah .hw-bar { position: relative; width: 38px; height: 8px; border-radius: 99px; overflow: hidden; background: rgba(13, 51, 88, .18); box-shadow: inset 0 1px 2px rgba(13, 51, 88, .3); }
html.ah .hw-bar i {
  display: block; height: 100%; width: 0; border-radius: 99px; background: linear-gradient(180deg, #b4ee8a, #63cf2e 55%, #4cb91c);
  box-shadow: 0 0 6px rgba(var(--ah-green-glow), .8); transition: width .3s ease;
}
html.ah .hw-total .hw-bar { width: 54px; }
html.ah .hw-tag {   /* L1, L2 ...: a small blue glass pill */
  flex: none; display: inline-flex; align-items: center; justify-content: center; min-width: 34px; height: 24px; padding: 0 9px; border-radius: 99px;
  font: 700 12px/1 var(--ah-font); letter-spacing: .04em; color: #06233f;
  border: 1.5px solid #1778b3; background: var(--ah-pill-a); box-shadow: inset 0 1px 0 rgba(255, 255, 255, .8), inset 0 -2px 4px rgba(20, 110, 170, .3);
}
html.ah .hw-time {   /* "10 MIN" */
  flex: none; display: inline-flex; align-items: center; height: 22px; padding: 0 9px; border-radius: 99px;
  font: 700 11px/1 var(--ah-font); letter-spacing: .08em; color: var(--ah-ink-soft);
  background: rgba(255, 255, 255, .8); border: 1px solid rgba(53, 164, 221, .7); box-shadow: inset 0 1px 0 #fff;
}

/* ---------- The lesson groups ---------- */
html.ah .hw-groups { display: flex; flex-direction: column; gap: 12px; }
html.ah .hw-group {
  border-radius: 20px; background: linear-gradient(180deg, rgba(255, 255, 255, .75), rgba(240, 248, 254, .6));
  border: 1.5px solid rgba(255, 255, 255, .95); box-shadow: 0 0 0 1px rgba(53, 164, 221, .45), inset 0 -6px 12px -8px rgba(70, 105, 140, .3), 0 1px 3px rgba(20, 60, 110, .15);
}
html.ah .hw-group.full { box-shadow: 0 0 0 1px rgba(99, 207, 46, .65), inset 0 -6px 12px -8px rgba(70, 140, 70, .3), 0 1px 3px rgba(20, 60, 110, .15); }
html.ah .hw-gh { margin: 0; font: inherit; }
html.ah .hw-gbtn {
  display: flex; align-items: center; flex-wrap: wrap; gap: 8px 10px; width: 100%; min-height: 52px; padding: 10px 14px; border: 0; border-radius: 20px;
  background: transparent; color: var(--ah-ink); font: inherit; text-align: left; cursor: pointer;
}
html.ah .hw-gbtn:hover { background: rgba(255, 255, 255, .55); }
html.ah .hw-gname { flex: 1 1 120px; min-width: 0; font: 700 16px/1.25 var(--ah-head); color: var(--ah-ink); }
html.ah .hw-chevwrap { flex: none; display: inline-flex; color: var(--ah-ink-soft); }
html.ah .hw-chev { transition: transform .2s ease; }
html.ah .hw-gbtn[aria-expanded="false"] .hw-chev { transform: rotate(-90deg); }
html.ah .hw-tasks { padding: 0 8px 8px; display: flex; flex-direction: column; gap: 2px; }

/* A task: a real checkbox (kept in the page for keyboard and screen readers), drawn as a glossy glass box */
html.ah .hw-row {
  position: relative; display: flex; align-items: center; gap: 12px; min-height: 46px; padding: 6px 10px; border-radius: 14px; cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}
html.ah .hw-row:hover { background: rgba(255, 255, 255, .6); }
html.ah .hw-chk { position: absolute; left: 10px; top: 50%; width: 26px; height: 26px; margin: -13px 0 0; opacity: 0; cursor: pointer; }
html.ah .hw-box {
  position: relative; flex: none; display: inline-flex; align-items: center; justify-content: center; width: 26px; height: 26px; border-radius: 9px; overflow: hidden;
  color: transparent; border: 2px solid #1778b3; background: var(--ah-pill); box-shadow: var(--ah-pill-sh);
  transition: background .15s, border-color .15s, box-shadow .15s, color .15s;
}
html.ah .hw-box::before {   /* the gloss on the top half */
  content: ''; position: absolute; left: 2px; right: 2px; top: 1px; height: 45%; border-radius: 99px; pointer-events: none;
  background: linear-gradient(180deg, rgba(255, 255, 255, .95), rgba(255, 255, 255, .35));
}
html.ah .hw-box svg { position: relative; }
html.ah .hw-row:hover .hw-box { border-color: #0f6aa6; box-shadow: var(--ah-pill-sh-h); }
html.ah .hw-chk:checked + .hw-box {
  color: #0b3d04; border-color: #3f9d17; background: linear-gradient(180deg, #d4f6b8 0%, #9be26b 49%, #6fd236 50%, #94e063 100%);
  box-shadow: inset 0 1px 0 #fff, inset 0 -2px 4px rgba(60, 150, 20, .45), 0 0 8px rgba(var(--ah-green-glow), .6);
}
html.ah .hw-chk:focus-visible + .hw-box { outline: 3px solid var(--ah-focus); outline-offset: 2px; }
html.ah .hw-t { flex: 1 1 auto; min-width: 0; font: 600 15px/1.35 var(--ah-font); color: var(--ah-ink); }
html.ah .hw-task.done .hw-t { color: var(--ah-spn); text-decoration: line-through; text-decoration-color: rgba(13, 51, 88, .45); }

/* ---------- Remaining ---------- */
html.ah .hw-remaining { margin-top: 22px; padding-top: 18px; border-top: 1px solid rgba(13, 51, 88, .16); }
html.ah .hw-rh { margin: 0 0 10px; display: flex; align-items: center; gap: 8px; font: 700 18px/1.2 var(--ah-head); text-transform: lowercase; color: var(--ah-ink); }
html.ah .hw-rc {
  display: inline-flex; align-items: center; justify-content: center; min-width: 26px; height: 24px; padding: 0 8px; border-radius: 99px;
  font: 700 13px/1 var(--ah-font); color: #06233f; border: 1.5px solid #1778b3; background: var(--ah-pill-a);
}
html.ah .hw-rc:empty { display: none; }
html.ah .hw-rem { display: flex; flex-direction: column; gap: 6px; }
html.ah .hw-link {
  display: flex; align-items: center; gap: 10px; min-height: 46px; padding: 6px 12px; border-radius: 14px; text-decoration: none; color: var(--ah-ink);
  background: rgba(255, 255, 255, .62); border: 1px solid rgba(255, 255, 255, .95); box-shadow: 0 0 0 1px rgba(53, 164, 221, .35);
  transition: background .15s, box-shadow .15s;
}
html.ah .hw-link:hover { color: var(--ah-ink); background: rgba(255, 255, 255, .92); box-shadow: 0 0 0 1px rgba(25, 191, 242, .9), 0 0 10px rgba(var(--ah-glow), .55); }
html.ah .hw-go { flex: none; display: inline-flex; color: #0b6bb3; }
html.ah .hw-more {
  margin-top: 10px; height: 34px; padding: 0 18px; border-radius: 99px; cursor: pointer; border: 1.5px solid #35a4dd; color: var(--ah-ink);
  font: 600 14px/1.2 var(--ah-font); background: var(--ah-pill); box-shadow: var(--ah-pill-sh); transition: background .15s, border-color .15s, box-shadow .15s;
}
html.ah .hw-more:hover { border-color: #1f8fcf; background: var(--ah-pill-h); box-shadow: var(--ah-pill-sh-h); }
html.ah .hw-more:active { background: var(--ah-pill-a); border-color: #1778b3; box-shadow: inset 0 2px 4px rgba(0, 60, 110, .35); }
html.ah .hw-alldone {   /* nothing left: a friendly green strip */
  display: flex; align-items: center; gap: 12px; margin: 0; padding: 14px 16px; border-radius: 18px; color: #14400a; font-size: 15px; line-height: 1.45;
  border: 2px solid var(--ah-green); background: var(--ah-fill-green); box-shadow: inset 0 1px 0 #fff, 0 0 10px rgba(var(--ah-green-glow), .4);
}
html.ah .hw-alldone b { font-weight: 700; }
html.ah .hw-fin-ic {
  flex: none; display: inline-flex; align-items: center; justify-content: center; width: 30px; height: 30px; border-radius: 99px; color: #0b3d04;
  border: 2px solid #3f9d17; background: linear-gradient(180deg, #d4f6b8 0%, #9be26b 49%, #6fd236 50%, #94e063 100%);
}

/* ---------- Loading placeholder ---------- */
html.ah .hw-skel { display: flex; flex-direction: column; gap: 12px; }
html.ah .hw-skel i {
  display: block; height: 76px; border-radius: 20px; border: 1.5px solid rgba(255, 255, 255, .9);
  background: linear-gradient(100deg, rgba(255, 255, 255, .45) 30%, rgba(255, 255, 255, .85) 50%, rgba(255, 255, 255, .45) 70%) 0 0 / 220% 100% rgba(220, 236, 248, .7);
  animation: hw-shimmer 1.4s linear infinite;
}
@keyframes hw-shimmer { from { background-position: 120% 0; } to { background-position: -120% 0; } }

@media (max-width: 560px) {
  html.ah .dash-block { padding: 20px 14px 22px; border-radius: 26px; }
  html.ah .hw-block { min-height: 230px; }
  html.ah .hw-head { margin-bottom: 14px; padding: 0 4px; }
  html.ah .hw-block .hw-title { font-size: 22px; }
  html.ah .hw-total .hw-bar, html.ah .hw-pill .hw-bar { display: none; }
  html.ah .hw-pill { padding: 0 12px; }
  html.ah .hw-gbtn { display: grid; grid-template-columns: auto 1fr auto; align-items: center; gap: 6px 10px; padding: 10px 10px; }   /* tag, name, arrow on one line; the pill drops under the name */
  html.ah .hw-gname { grid-column: 2; grid-row: 1; flex: none; }
  html.ah .hw-chevwrap { grid-column: 3; grid-row: 1; }
  html.ah .hw-gbtn .hw-pill { grid-column: 2; grid-row: 2; justify-self: start; min-height: 26px; font-size: 12.5px; }
  html.ah .hw-tasks { padding: 0 4px 6px; }
  html.ah .hw-row { padding: 6px 8px; gap: 10px; }
  html.ah .hw-chk { left: 8px; }
  html.ah .hw-remaining { padding: 16px 4px 0; }
  html.ah .hw-link { padding: 6px 10px; gap: 8px; }
  html.ah .hw-link .hw-go { display: none; }
}

@media (prefers-reduced-motion: reduce) {
  html.ah .hw-chev, html.ah .hw-bar i, html.ah .hw-box, html.ah .hw-link, html.ah .hw-more { transition: none; }
  html.ah .hw-skel i { animation: none; }
}
@media (forced-colors: active) {
  html.ah .hw-box { border-color: CanvasText; background: Canvas; }
  html.ah .hw-chk:checked + .hw-box { color: CanvasText; background: Canvas; }
  html.ah .hw-pill, html.ah .hw-tag, html.ah .hw-time, html.ah .hw-link { border: 1px solid CanvasText; }
}
