/* learning/static/learning/appbar.css — the sticky app bar (core/partials/_app_bar.html) and its 📊 Progress panel.
 *
 * The bar sticks right under the fixed nav. Inside an app page (main.page--ab) --nav-h grows by the bar's height, so every
 * app's own sticky header (top: var(--nav-h)) lands under the bar instead of behind it.
 */
:root { --ab-h: 56px; }
main.page--ab { --nav-h: calc(76px + var(--ab-h)); padding-top: 76px; }

.ab { --ab-c: #23271F; position: sticky; top: 76px; z-index: 900; height: var(--ab-h);
  background: rgba(255,255,255,.94); -webkit-backdrop-filter: saturate(180%) blur(12px); backdrop-filter: saturate(180%) blur(12px);
  border-bottom: 1px solid #E8E6DE; font-family: var(--font-body, 'Geist', system-ui, sans-serif); }
.ab__in { max-width: 1180px; height: 100%; margin: 0 auto; padding: 0 16px; display: flex; align-items: center; gap: 12px; }
.ab__app { display: inline-flex; align-items: center; gap: 10px; min-width: 0; min-height: 44px; color: #23271F; text-decoration: none; }
.ab__app:hover .ab__name { color: var(--ab-c); }
.ab__ico { flex: none; display: inline-grid; place-items: center; width: 34px; height: 34px; border-radius: 10px; font-size: 18px;
  background: color-mix(in srgb, var(--ab-c) 10%, #fff); box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--ab-c) 18%, #fff); }
.ab__who { display: grid; min-width: 0; line-height: 1.15; }
.ab__name { font-weight: 700; font-size: 15.5px; letter-spacing: -.01em; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; transition: color .15s; }
.ab__sub { font-size: 12px; font-weight: 600; color: #7A7F72; font-variant-numeric: tabular-nums; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

.ab__tools { margin-left: auto; display: flex; align-items: center; gap: 6px; flex: none; }
.ab__btn { --ab-btn-bg: #fff; position: relative; display: inline-flex; align-items: center; justify-content: center; gap: 7px; height: 40px; padding: 0 14px;
  border-radius: 999px; border: 1px solid #E4E5DD; background: var(--ab-btn-bg); color: #2C3128; text-decoration: none; font: inherit;
  font-weight: 650; font-size: 13.5px; white-space: nowrap; cursor: pointer; transition: border-color .15s, background .15s, color .15s, transform .15s; }
.ab__btn[hidden] { display: none; }
.ab__btn svg { width: 18px; height: 18px; flex: none; fill: none; stroke: currentColor; stroke-width: 1.9; stroke-linecap: round; stroke-linejoin: round; }
.ab__btn:hover { border-color: color-mix(in srgb, var(--ab-c) 45%, #fff); color: var(--ab-c); }
.ab__btn:active { transform: scale(.97); }
.ab__btn:focus-visible { outline: 2px solid var(--ab-c); outline-offset: 2px; }
.ab__btn.is-on { --ab-btn-bg: var(--ab-c); background: var(--ab-c); border-color: var(--ab-c); color: #fff; }
.ab__btn.is-off { color: #8A8F80; background: #FAFAF7; border-style: dashed; cursor: default; }
.ab__btn.is-off small { font-weight: 600; font-size: 11.5px; }
.ab__btn--present { --ab-btn-bg: var(--ab-c); background: var(--ab-c); border-color: var(--ab-c); color: var(--ab-ink, #fff); }
.ab__btn--present:hover { color: var(--ab-ink, #fff); filter: brightness(1.1); border-color: var(--ab-c); }
.ab__btn--present svg { stroke: none; }
.ab__n { min-width: 20px; height: 20px; padding: 0 6px; border-radius: 999px; background: #2E7D4F; color: #fff; font-size: 11.5px; font-weight: 800; display: inline-grid; place-items: center; }
.ab__btn.is-on .ab__n { background: #fff; color: var(--ab-c); }
.ab__line { position: absolute; left: 0; right: 0; bottom: -1px; height: 3px; background: transparent; pointer-events: none; }
.ab__line i { display: block; height: 100%; min-width: 3px; background: var(--ab-c); border-radius: 0 3px 3px 0; transition: width .6s ease; }

@media (max-width: 760px) {
  .ab__btn { width: 42px; padding: 0; }
  .ab__btn .ab__lbl, .ab__btn.is-off small { display: none; }
  .ab__n { position: absolute; top: -5px; right: -5px; min-width: 18px; height: 18px; font-size: 10.5px; box-shadow: 0 0 0 2px #fff; }
  .ab__btn.is-off::after { content: ''; position: absolute; inset: -1px; border-radius: inherit; }
}
@media (max-width: 420px) {
  .ab__in { gap: 8px; padding: 0 12px; }
  .ab__ico { width: 30px; height: 30px; font-size: 16px; }
  .ab__name { font-size: 14.5px; }
  .ab__tools { gap: 4px; }
  .ab__btn { width: 38px; height: 38px; }
}
main.page--ab .ab { transition: transform .22s ease; }
main.page--ab.ab-tucked { --nav-h: 76px; }
main.page--ab.ab-tucked .ab { transform: translateY(-100%); }
@media (prefers-reduced-motion: reduce) { main.page--ab .ab { transition: none; } }
@media print { .ab { display: none; } main.page--ab { --nav-h: 76px; } }

/* ── The 📊 Progress panel: a drawer from the right (a sheet from the bottom on phones) ── */
.abd-shade { position: fixed; inset: 0; z-index: 3000; background: rgba(24,26,22,.38); opacity: 0; transition: opacity .2s ease; }
.abd-shade.is-in { opacity: 1; }
.abd { position: fixed; z-index: 3001; top: 0; right: 0; bottom: 0; width: min(460px, 100vw); display: flex; flex-direction: column;
  background: #FBFAF7; box-shadow: -24px 0 60px -30px rgba(0,0,0,.45); transform: translateX(104%); transition: transform .26s cubic-bezier(.2,.8,.2,1);
  font-family: var(--font-body, 'Geist', system-ui, sans-serif); color: #23271F; }
.abd.is-in { transform: none; }
.abd__top { display: flex; align-items: center; gap: 10px; padding: 14px 16px; border-bottom: 1px solid #E8E6DE; background: #fff; }
.abd__top h2 { margin: 0; font-size: 16px; font-weight: 700; flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.abd__x { width: 40px; height: 40px; border-radius: 50%; border: 1px solid #E4E5DD; background: #fff; font-size: 18px; cursor: pointer; color: #4A4F44; }
.abd__x:hover { background: #F4F3EE; }
.abd__body { flex: 1; overflow-y: auto; overscroll-behavior: contain; padding: 16px; }
.abd__note { color: #6B6E66; font-size: 14px; }
@media (max-width: 640px) {
  .abd { top: auto; left: 0; width: 100vw; max-height: 88vh; border-radius: 20px 20px 0 0; transform: translateY(104%); box-shadow: 0 -24px 60px -30px rgba(0,0,0,.5); }
  .abd__top { border-radius: 20px 20px 0 0; }
  .abd__top::before { content: ''; position: absolute; left: 50%; top: 6px; width: 40px; height: 4px; margin-left: -20px; border-radius: 2px; background: #D9D7CF; }
  .abd__body { padding-bottom: calc(16px + env(safe-area-inset-bottom)); }
}
html.abd-open { overflow: hidden; }
@media (prefers-reduced-motion: reduce) { .abd, .abd-shade, .ab__line i { transition: none; } }

.abp { --lp-accent: #5B2E63; --lp-empty: #E3E0D6; --lp-gold: #B8923A; --lp-amber: #C98A1B; display: grid; gap: 14px; }
.abp__here { display: grid; gap: 2px; padding: 16px; border-radius: 16px; color: #fff;
  background: linear-gradient(135deg, var(--lp-accent), color-mix(in srgb, var(--lp-accent) 70%, #000)); }
.abp__k { margin: 0; font-size: 11px; font-weight: 800; letter-spacing: .12em; text-transform: uppercase; opacity: .8; }
.abp__title { margin: 0 0 8px; font-size: 18px; font-weight: 700; line-height: 1.3; }
.abp__go { display: flex; align-items: center; justify-content: space-between; min-height: 46px; padding: 0 16px; border-radius: 12px;
  background: #fff; color: var(--lp-accent) !important; font-weight: 700; font-size: 15px; text-decoration: none !important; }
.abp__go:hover { filter: brightness(.97); }
.abp__rings { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.abp__fig { margin: 0; display: grid; justify-items: center; gap: 6px; padding: 12px 6px 10px; border-radius: 14px; background: #fff; border: 1px solid #E8E6DE; }
.abp__fig figcaption { font-size: 11px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: #7A7F72; }
.abp__fig svg { max-width: 100%; height: auto; }
.abp__sec { padding: 14px; border-radius: 14px; background: #fff; border: 1px solid #E8E6DE; }
.abp__h { display: flex; justify-content: space-between; align-items: baseline; margin: 0 0 10px; font-size: 12px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: #6B6E66; }
.abp__h span { letter-spacing: 0; font-variant-numeric: tabular-nums; color: #23271F; font-size: 13px; text-transform: none; }
.abp__lv svg { width: 100%; height: auto; }
.abp__lv-labels { display: flex; gap: 4px; margin-top: 6px; }
.abp__lv-labels span { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 11.5px; font-weight: 600; color: #6B6E66; }
.abp__lv-labels .is-locked { color: #A6A89F; }
.abp__lv-labels .is-done { color: var(--lp-accent); }
.abp__map { position: relative; display: grid; gap: 10px; max-height: 46vh; overflow-y: auto; padding-right: 2px; }
.abp__grp { display: grid; gap: 5px; }
.abp__grp-k { font-size: 12px; font-weight: 700; color: #5F6557; }
.abp__grp-k small { font-weight: 600; color: #696D61; font-variant-numeric: tabular-nums; }
.abp__tiles { display: flex; flex-wrap: wrap; gap: 3px; }
.abp__t { display: block; width: 13px; height: 13px; border-radius: 3px; background: #fff; box-shadow: inset 0 0 0 1.5px color-mix(in srgb, var(--lp-accent) 28%, #fff); }
.abp__t--locked { background: #F2F1EC; box-shadow: none; }
.abp__t--open { box-shadow: inset 0 0 0 1.5px color-mix(in srgb, var(--lp-accent) 45%, #fff); }
.abp__t--learning   { background: color-mix(in srgb, var(--lp-accent) 30%, #fff); box-shadow: none; }
.abp__t--practicing { background: color-mix(in srgb, var(--lp-accent) 50%, #fff); box-shadow: none; }
.abp__t--familiar   { background: color-mix(in srgb, var(--lp-accent) 70%, #fff); box-shadow: none; }
.abp__t--strong     { background: var(--lp-accent); box-shadow: none; }
.abp__t--mastered   { background: var(--lp-gold); box-shadow: none; }
.abp__t.is-current { box-shadow: inset 0 0 0 2.5px var(--lp-accent); animation: abp-pulse 1.8s ease-in-out infinite; }
@keyframes abp-pulse { 50% { box-shadow: inset 0 0 0 2.5px var(--lp-accent), 0 0 0 3px color-mix(in srgb, var(--lp-accent) 22%, transparent); } }
.abp__legend { display: flex; flex-wrap: wrap; gap: 6px 12px; margin: 12px 0 0; padding: 0; list-style: none; font-size: 11.5px; color: #5F6557; }
.abp__legend li { display: inline-flex; align-items: center; gap: 5px; }
.abp__legend i { width: 11px; height: 11px; border-radius: 3px; display: block; animation: none !important; }
.abp__more { margin: 0; text-align: center; font-size: 13px; color: #696D61; }
.abp__more a { color: var(--lp-accent); font-weight: 600; }
@media (prefers-reduced-motion: reduce) { .abp__t.is-current { animation: none; } }

/* Per-level rows in the Progress panel: each level its own bar, filled by stage */
.abp__lvls { display: grid; gap: 8px; margin: 0; padding: 0; list-style: none; }
.abp__lvl { display: grid; grid-template-columns: 64px minmax(0, 1fr) auto; align-items: center; gap: 4px 10px; padding: 6px 8px; border-radius: 10px; }
.abp__lvl.is-here { background: color-mix(in srgb, var(--lp-accent) 7%, #fff); box-shadow: inset 0 0 0 1.5px color-mix(in srgb, var(--lp-accent) 35%, #fff); }
.abp__lvl-k { font-size: 13px; font-weight: 750; color: #3B4036; }
.abp__lvl-bar { display: flex; height: 9px; border-radius: 5px; overflow: hidden; background: #EEEDE7; }
.abp__lvl-sw { display: block; height: 100%; }
.abp__lvl-n { font-size: 12px; font-weight: 700; color: #6B6E66; font-variant-numeric: tabular-nums; white-space: nowrap; }
.abp__lvl.is-done .abp__lvl-n { color: #2E7D4F; }
.abp__lvl-here { grid-column: 2 / -1; font-size: 11px; font-weight: 800; letter-spacing: .08em; text-transform: uppercase; color: var(--lp-accent); }
.abp__lvl-next { grid-column: 1 / -1; display: flex; align-items: center; gap: 8px; min-width: 0; padding: 6px 8px; margin: 2px -2px 0; border-radius: 8px;
  font-size: 13px; font-weight: 600; color: #3B4036 !important; text-decoration: none !important; background: #F6F5F1; }
.abp__lvl-next span { flex: none; font-size: 10.5px; font-weight: 800; letter-spacing: .08em; text-transform: uppercase; color: #696D61; }
.abp__lvl-next i { margin-left: auto; font-style: normal; color: var(--lp-accent); font-weight: 800; }
.abp__lvl-next.is-here { background: var(--lp-accent); color: #fff !important; }
.abp__lvl-next.is-here span, .abp__lvl-next.is-here i { color: rgba(255,255,255,.85); }
.abp__lvl-next { overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }

/* The trail (learning.app_bar.set_level): "App › Level" — the app name goes to its first page, the level to its page. */
.ab__app--trail .ab__ico, .ab__app--trail .ab__name { text-decoration: none; color: inherit; }
.ab__app--trail .ab__name:hover { color: var(--ab-c); }
.ab__lvl { display: block; margin-top: 1px; font-size: 12.5px; font-weight: 650; color: var(--ab-c); text-decoration: none;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ab__lvl:hover { text-decoration: underline; text-underline-offset: 2px; }
.ab__lvl[aria-current="page"] { color: #5F6458; }
.ab__lvl span { margin-right: 2px; }
