/*
 * The learn shell (PageShell::learn(): /learn, lessons, quizzes, challenges, programs, errors, sign-in, account): its
 * colours, type and the pieces every one of those pages has: the navbar (templates/learn_nav.php), the footer
 * (templates/_site_footer.php), the search boxes and dialog (learn/_search*.php) and the feedback dialog. A page's own
 * layout is in its stylesheet (the map in templates/learn_header.php). No Bootstrap, ide.css or Font Awesome: the
 * shared views keep one markup, which ide.css styles for the IDE pages and this for the learn pages.
 * Design: docs/superpowers/specs/2026-11-30-learn-redesign-design.md (direction C).
 */

/* ========== Fonts (self-hosted, preloaded by templates/learn_header.php) ========== */
/* Google Sans Flex is a variable font: the whole weight range, the browser keeps to the file's own. optional: it is
   preloaded, so it is nearly always there for the first paint; when it isn't, the page keeps the fallback (Arial at its
   metrics) for that visit rather than swapping and moving the text */
@font-face {
    font-family: "Google Sans Flex";
    font-style: normal;
    font-weight: 100 1000;
    font-display: optional;
    src: url("../fonts/google-sans-flex-latin.woff2") format("woff2");
    unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

@font-face {
    font-family: "Google Sans Flex";
    font-style: normal;
    font-weight: 100 1000;
    font-display: optional;
    src: url("../fonts/google-sans-flex-latin-ext.woff2") format("woff2");
    unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C4, U+2113, U+2C60-2C7F, U+A720-A7FF;
}

/* Arial at Google Sans Flex's metrics until the font arrives, so the swap barely moves the text */
@font-face {
    font-family: "Google Sans Flex Fallback";
    src: local("Arial"), local("ArialMT");
    size-adjust: 100.8%;
    ascent-override: 95.8%;
    descent-override: 28.4%;
    line-gap-override: 0%;
}

@font-face {
    font-family: "Fira Mono";
    font-style: normal;
    font-weight: 400;
    font-display: swap;
    src: url("../fonts/fira-mono-latin-400.woff2") format("woff2");
    unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

@font-face {
    font-family: "Fira Mono";
    font-style: normal;
    font-weight: 400;
    font-display: swap;
    src: url("../fonts/fira-mono-latin-ext-400.woff2") format("woff2");
    unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
}

@font-face {
    font-family: "Fira Mono";
    font-style: normal;
    font-weight: 700;
    font-display: swap;
    src: url("../fonts/fira-mono-latin-700.woff2") format("woff2");
    unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

/* ========== Colours (direction C), switched by body.dark (localStorage "theme") ========== */
:root {
    --font: "Google Sans Flex", "Google Sans Flex Fallback", system-ui, -apple-system, "Segoe UI", Roboto, Arial, sans-serif;
    --mono: "Fira Mono", ui-monospace, Consolas, monospace;
    --r-sm: 6px;
    --r-md: 10px;
    --r-lg: 16px;
    --nav-h: 56px;

    --page: #FFFFFF; /* white, not a grey canvas: the owner's call */
    --surface: #FFFFFF;
    --surface-2: #F6F8FB;
    --ink: #0D1B33;
    --ink-2: #4F5C75;
    --ink-3: #8590A6;
    --line: #E1E6EE;
    --brand: #1A5CCF;
    --brand-ink: #FFFFFF;
    --brand-soft: #E8F0FD;
    --hi: #FFD43B;
    --hi-soft: #FFF4C2;
    --hi-mark: #FFD43B;
    --done: #0E9F62;
    --done-soft: #E3F6EC;
    --go: #16A34A;
    --bad: #D2325A;
    --bad-soft: #FDECEF;
    --lv1: #0E9F62;
    --lv2: #B98000;
    --lv3: #E0621B;
    --lv4: #D2325A;
    --p1: #2F7DE1;
    --p2: #16A34A;
    --p3: #D9631E;
    --p4: #9B3FE0;
    --p5: #0E96B3;
    --p6: #D63384;
    --code-bg: #FFFFFF; /* GitHub's code colours (ace-theme-github.js), the owner's call */
    --code-head: #F6F8FA;
    --code-ink: #1F2328;
    --shadow: 0 1px 2px rgba(13, 27, 51, .05), 0 4px 14px rgba(13, 27, 51, .06);
    --shadow-pop: 0 18px 50px rgba(20, 20, 60, .16);
    /* The cards that stand out: the day's challenge, the sign-in panel (the same in both themes) */
    --deep-bg:
        radial-gradient(80% 110% at 100% 0%, rgba(139, 108, 255, .55), transparent 60%),
        radial-gradient(60% 90% at 0% 100%, rgba(18, 170, 200, .3), transparent 65%),
        linear-gradient(140deg, #12215A, #2B2C8C);
}

body.dark {
    --page: #0E131D;
    --surface: #151C29;
    --surface-2: #1A2232;
    --ink: #E7ECF5;
    --ink-2: #A2ADC2;
    --ink-3: #6E7A91;
    --line: #253044;
    --brand: #6AA4FF;
    --brand-ink: #0B1222;
    --brand-soft: #1A2A45;
    --hi-soft: rgba(255, 212, 59, .16);
    --hi-mark: rgba(255, 212, 59, .32);
    --done: #38D39A;
    --done-soft: rgba(56, 211, 154, .14);
    --go: #2EA043;
    --bad: #FF6B8B;
    --bad-soft: rgba(255, 107, 139, .14);
    --lv1: #38D39A;
    --lv2: #F4C04E;
    --lv3: #FF8A4C;
    --lv4: #FF6B8B;
    --p1: #61AFEF;
    --p2: #98C379;
    --p3: #D19A66;
    --p4: #C678DD;
    --p5: #56B6C2;
    --p6: #E06C75;
    --code-bg: #0D1117;
    --code-head: #161B22;
    --code-ink: #E6EDF3;
    --shadow: none;
    --shadow-pop: 0 18px 50px rgba(0, 0, 0, .5);
    color-scheme: dark;
}

/* Visualize's dialog (visualize.css) and the shared views read /learn's older names */
body.learn-page {
    --lr-bg: var(--page);
    --lr-card: var(--surface);
    --lr-panel: var(--surface-2);
    --lr-surface: var(--surface);
    --lr-surface-2: var(--surface-2);
    --lr-code-bg: var(--code-bg);
    --lr-border: var(--line);
    --lr-text: var(--ink);
    --lr-heading: var(--ink);
    --lr-muted: var(--ink-2);
    --lr-accent: var(--brand);
    --lr-accent-soft: var(--brand-soft);
    --lr-run: var(--go);
    --lr-run-hover: var(--done);
    --lr-stop: var(--bad);
    --lr-err: var(--bad);
    --lr-in: var(--brand);
    --lr-info: var(--ink-3);
    --lr-shadow: var(--shadow);
    --lr-card-border: var(--line);
    --lr-inline-code: color-mix(in srgb, var(--ink) 7%, var(--surface));
    --lr-inline-code-text: var(--ink);
}

/* The states every learn page colours alike: right and wrong answers, hints and alerts (lessons, quizzes, the account),
   and the callouts and level badges (lessons, programs, errors) */
body.learn-page {
    --lr-hint-bg: #fff8e1;
    --lr-hint-border: #f3d98b;
    --lr-ok-bg: #e9f7ef;
    --lr-ok-border: #a7dcba;
    --lr-bad-bg: #fdf0ef;
    --lr-bad-border: #f2c0bb;
    --lr-co-info: #0b6bcb;
    --lr-co-info-bg: #e8f1fe;
    --lr-co-success: #1a7f45;
    --lr-co-success-bg: #e9f7ef;
    --lr-co-warning: #a8650a;
    --lr-co-warning-bg: #fff6e0;
    --lr-co-danger: #c62828;
    --lr-co-danger-bg: #fdeeed;
}

body.learn-page.dark {
    --lr-hint-bg: #2c2a1f;
    --lr-hint-border: #5a5030;
    --lr-ok-bg: #1d2b22;
    --lr-ok-border: #2f5a3c;
    --lr-bad-bg: #2f2020;
    --lr-bad-border: #5c3431;
    --lr-co-info: #79b8ff;
    --lr-co-info-bg: #1b2735;
    --lr-co-success: #56d68b;
    --lr-co-success-bg: #1a2a21;
    --lr-co-warning: #f0b955;
    --lr-co-warning-bg: #2c2717;
    --lr-co-danger: #ff8a80;
    --lr-co-danger-bg: #331f1f;
}

/* ========== Base ========== */
*,
*::before,
*::after {
    box-sizing: border-box;
}

[hidden] {
    display: none !important;
}

html {
    -webkit-text-size-adjust: 100%;
    scroll-padding-top: calc(var(--nav-h) + 16px);
    scrollbar-gutter: stable; /* the page growing past the window doesn't nudge everything sideways */
}

/* The saved dark theme before the body exists (templates/learn_header.php), so nothing flashes white */
html.dark-pre {
    background: #0E131D;
    color-scheme: dark;
}

body {
    margin: 0;
    background: var(--page);
    color: var(--ink);
    font: 16px/1.55 var(--font);
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

/* Light theme: a soft glow of the parts' colours at the top of the window that stays put while the page scrolls (the
   owner's call). A fixed layer behind the content rather than background-attachment: fixed, which iOS ignores and makes
   Chrome repaint on every scroll. Not on a challenge's workspace, which fills the window */
body.learn-page:not(.dark):not(.is-workspace)::before {
    content: "";
    position: fixed;
    inset: 0 0 auto;
    z-index: -1;
    height: 460px;
    pointer-events: none;
    background:
        radial-gradient(55% 100% at 8% 0%, color-mix(in srgb, var(--brand) 11%, transparent), transparent 70%),
        radial-gradient(45% 85% at 92% 0%, color-mix(in srgb, var(--p4) 8%, transparent), transparent 70%),
        radial-gradient(40% 70% at 55% 0%, color-mix(in srgb, var(--p5) 7%, transparent), transparent 72%);
}

a {
    color: var(--brand);
    text-decoration: none;
}

a:hover {
    text-decoration: underline;
}

h1, h2, h3, h4 {
    margin: 0 0 .5em;
    color: var(--ink);
    line-height: 1.2;
    font-weight: 720;
    letter-spacing: -.01em;
}

h1 {
    font-size: clamp(34px, 4.6vw, 44px);
    font-weight: 760;
    letter-spacing: -.025em;
    line-height: 1.1;
}

h2 {
    font-size: clamp(22px, 2.4vw, 27px);
}

h3 {
    font-size: 19px;
}

p {
    margin: 0 0 1em;
}

img,
svg {
    max-width: 100%;
}

code,
kbd,
pre,
samp {
    font-family: var(--mono);
    font-size: .9em;
}

input:-webkit-autofill::first-line {
    font: inherit;
}

button,
input,
select,
textarea {
    font: inherit;
    color: inherit;
}

button {
    cursor: pointer;
}

:focus-visible {
    outline: 2px solid var(--brand);
    outline-offset: 2px;
}

::selection {
    background: color-mix(in srgb, var(--brand) 22%, transparent);
}

/* Thin, light scrollbars: the page's and every pane's */
* {
    scrollbar-width: thin;
    scrollbar-color: color-mix(in srgb, var(--ink-3) 45%, transparent) transparent;
}

::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

::-webkit-scrollbar-track {
    background: transparent;
}

::-webkit-scrollbar-thumb {
    border: 2px solid transparent;
    border-radius: 8px;
    background: color-mix(in srgb, var(--ink-3) 40%, transparent) padding-box;
}

::-webkit-scrollbar-thumb:hover {
    background-color: color-mix(in srgb, var(--ink-3) 65%, transparent);
}

@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: .01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: .01ms !important;
        scroll-behavior: auto !important;
    }
}

.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    margin: -1px;
    padding: 0;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

/* Icons (ide/_icons.php and learn/_icons.php: ide_icon()) */
.ic {
    flex: none;
    width: 16px;
    height: 16px;
    vertical-align: -3px;
    fill: none;
    stroke: currentColor;
    stroke-width: 1.6;
    stroke-linecap: round;
    stroke-linejoin: round;
}

.ic-tint {
    fill: currentColor;
    stroke: none;
    opacity: var(--ic-tint, 0);
}

/* A busy button's spinner (feedback.js, the quiz, the challenges) */
.spin {
    display: inline-block;
    flex: none;
    width: 14px;
    height: 14px;
    border: 2px solid currentColor;
    border-right-color: transparent;
    border-radius: 50%;
    vertical-align: -2px;
    animation: spin .7s linear infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* ========== Shared pieces ========== */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    min-height: 40px;
    padding: 0 16px;
    border: 1px solid var(--line);
    border-radius: var(--r-md);
    background: var(--surface);
    color: var(--ink);
    font: 620 15px/1.2 var(--font);
    text-decoration: none;
    white-space: nowrap;
    cursor: pointer;
    transition: background-color .15s, border-color .15s, color .15s;
}

.btn:hover {
    border-color: var(--ink-3);
    text-decoration: none;
}

.btn:disabled,
.btn[aria-disabled="true"] {
    opacity: .55;
    cursor: default;
}

.btn-primary {
    border-color: var(--brand);
    background: var(--brand);
    color: var(--brand-ink);
}

.btn-primary:hover {
    border-color: var(--brand);
    background: color-mix(in srgb, var(--brand) 88%, var(--ink));
}

.btn-go {
    border-color: var(--go);
    background: var(--go);
    color: #FFFFFF;
}

.btn-go:hover {
    border-color: var(--go);
    background: color-mix(in srgb, var(--go) 88%, #000000);
}

.btn-quiet {
    border-color: transparent;
    background: transparent;
    color: var(--ink-2);
}

.btn-quiet:hover {
    border-color: transparent;
    background: var(--surface-2);
    color: var(--ink);
}

.btn-sm {
    min-height: 32px;
    padding: 0 12px;
    border-radius: var(--r-sm);
    font-size: 13.5px;
}

.chip {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 2px 10px;
    border: 1px solid var(--line);
    border-radius: 999px;
    background: var(--surface-2);
    color: var(--ink-2);
    font-size: 13px;
    font-weight: 560;
    white-space: nowrap;
}

button.chip {
    cursor: pointer;
}

.chip.is-on {
    border-color: var(--brand);
    background: var(--brand-soft);
    color: var(--brand);
}

/* The day's challenge (/dashboard, /challenges): a deep blue card that stands out among the white ones */
.daily-card {
    position: relative;
    display: grid;
    align-content: start;
    gap: 12px;
    overflow: hidden;
    padding: 20px 22px;
    border-radius: 18px;
    background: var(--deep-bg);
    color: #FFFFFF;
    box-shadow: 0 14px 34px rgba(24, 36, 110, .22);
}

a.daily-card:hover {
    text-decoration: none;
}

.daily-top {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
}

.daily-label {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    margin: 0;
    color: #C9D4FF;
    font-size: 14px;
    font-weight: 650;
}

.daily-label .ic {
    width: 16px;
    height: 16px;
}

.daily-left,
.daily-note {
    margin: 0;
    color: #A9B5E6;
    font-size: 13px;
    font-variant-numeric: tabular-nums;
}

.daily-title {
    color: #FFFFFF;
    font-size: 22px;
    font-weight: 750;
    line-height: 1.2;
    letter-spacing: -.01em;
}

.daily-about {
    margin-top: -6px;
    color: #D5DCFA;
    font-size: 14.5px;
    line-height: 1.45;
}

.daily-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}

.daily-pill {
    padding: 2px 10px;
    border-radius: 999px;
    background: rgba(255, 255, 255, .14);
    color: #FFFFFF;
    font-size: 12.5px;
    font-weight: 620;
}

.daily-go {
    display: inline-flex;
    align-items: center;
    justify-self: start;
    gap: 6px;
    min-height: 38px;
    padding: 0 16px;
    border-radius: 10px;
    background: #FFFFFF;
    color: #1B2766;
    font-size: 14.5px;
    font-weight: 700;
    transition: box-shadow .15s;
}

.daily-go .ic {
    width: 16px;
    height: 16px;
}

.daily-card:hover .daily-go {
    box-shadow: 0 0 0 4px rgba(255, 255, 255, .2);
}

.daily-done {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    color: #FFE27A;
    font-size: 15px;
    font-weight: 700;
}

.daily-done .stars {
    font-size: 18px;
}

/* How was it? (templates/_quick_rating.php, learn-progress.js): five faces, then an optional note. A lesson's end, a
   quiz's results, a challenge's Solved */
.quick-rate[hidden] {
    display: none;
}

.quick-rate {
    margin: 28px 0 0;
    padding: 22px;
    border: 1px solid var(--line);
    border-radius: 16px;
    background: var(--surface);
    text-align: center;
}

.quick-rate h2 {
    margin: 0 0 12px;
    font-size: 19px;
}

.quick-rate-faces {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 6px;
}

.quick-rate-faces button {
    display: grid;
    justify-items: center;
    gap: 5px;
    width: 76px;
    padding: 9px 4px 7px;
    border: 1px solid transparent;
    border-radius: 12px;
    background: none;
    cursor: pointer;
}

.quick-rate-faces button span {
    font-size: 30px;
    line-height: 1;
    transition: transform .15s;
}

.quick-rate-faces button small {
    color: var(--ink-3);
    font-size: 12px;
    font-weight: 560;
}

.quick-rate-faces button:hover {
    background: var(--surface-2);
}

.quick-rate-faces button:hover span {
    transform: scale(1.15);
}

.quick-rate-faces button[aria-pressed="true"] {
    border-color: var(--brand);
    background: var(--brand-soft);
}

.quick-rate-faces button[aria-pressed="true"] small {
    color: var(--brand);
    font-weight: 680;
}

/* Once one is picked, the others step back */
.quick-rate-faces:has([aria-pressed="true"]) button:not([aria-pressed="true"]) span {
    opacity: .55;
    filter: grayscale(1);
}

.quick-rate-note {
    display: grid;
    gap: 8px;
    max-width: 520px;
    margin: 16px auto 0;
    text-align: left;
}

.quick-rate-note[hidden] {
    display: none;
}

.quick-rate-note > label {
    font-weight: 650;
}

.quick-rate-topics {
    margin: 0;
    padding: 0;
    border: 0;
}

.quick-rate-note > label small {
    color: var(--ink-3);
    font-weight: 500;
}

.quick-rate-note textarea {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid var(--line);
    border-radius: 10px;
    background: var(--surface);
    color: var(--ink);
    font: inherit;
    resize: vertical;
}

.quick-rate-note textarea:focus {
    border-color: var(--brand);
    outline: none;
    box-shadow: 0 0 0 3px color-mix(in srgb, var(--brand) 20%, transparent);
}

.quick-rate-note .btn {
    justify-self: end;
}

.quick-rate-thanks {
    margin: 12px 0 0;
    color: var(--done);
    font-weight: 620;
}

@media (prefers-reduced-motion: reduce) {
    .quick-rate-faces button span {
        transition: none;
    }
}

/* A row of pills that filter a list (ListFilter, learn-search.js): /challenges' topics, /programs' categories */
.filter-chips {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 16px;
}

.filter-chips .chip {
    padding: 4px 12px;
    background: var(--surface);
    font-size: 13.5px;
}

.filter-chips .chip:hover {
    border-color: var(--ink-3);
    color: var(--ink);
}

.filter-chips .chip span {
    color: var(--ink-3);
    font-size: 12px;
}

.filter-chips .chip.is-on {
    border-color: var(--brand);
    background: var(--brand-soft);
    color: var(--brand);
}

.filter-chips .chip.is-on span {
    color: inherit;
}

.chip.is-pass {
    border-color: transparent;
    background: var(--done-soft);
    color: var(--done);
}

.badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 1px 8px;
    border-radius: 6px;
    background: color-mix(in srgb, var(--badge, var(--ink-3)) 14%, transparent);
    color: var(--badge, var(--ink-2));
    font-size: 12.5px;
    font-weight: 650;
    white-space: nowrap;
}

.is-beginner { --badge: var(--lv1); }
.is-intermediate { --badge: var(--lv2); }
.is-advanced { --badge: var(--lv3); }
.is-expert { --badge: var(--lv4); }

.card {
    padding: 20px;
    border: 1px solid var(--line);
    border-radius: var(--r-lg);
    background: var(--surface);
    box-shadow: var(--shadow);
}

/* A progress ring: --p from 0 to 100, set on it or on a parent */
.ring {
    display: grid;
    flex: none;
    place-items: center;
    width: 76px;
    height: 76px;
    border-radius: 50%;
    background: conic-gradient(var(--ring, var(--done)) calc(var(--p, 0) * 1%), var(--line) 0);
}

.ring > span {
    display: grid;
    place-items: center;
    width: calc(100% - 16px);
    height: calc(100% - 16px);
    border-radius: 50%;
    background: var(--surface);
    font-size: 15px;
    font-weight: 750;
    line-height: 1.1;
    text-align: center;
}

/* A progress bar: --p from 0 to 100 (set on it or on a parent), in the part's colour where there is one */
.bar {
    display: block;
    height: 6px;
    overflow: hidden;
    border-radius: 99px;
    background: var(--line);
}

.bar::before {
    content: "";
    display: block;
    width: calc(var(--p, 0) * 1%);
    height: 100%;
    border-radius: inherit;
    background: var(--part, var(--brand));
}

/* Each part of the course has its colour (Config\Learn::$curriculum's order; a seventh reuses the first) */
[data-part="1"] { --part: var(--p1); }
[data-part="2"] { --part: var(--p2); }
[data-part="3"] { --part: var(--p3); }
[data-part="4"] { --part: var(--p4); }
[data-part="5"] { --part: var(--p5); }
[data-part="6"] { --part: var(--p6); }

/* A button that reads as a link (Back up, Import, Reset ...) */
.lp-link {
    padding: 0;
    border: 0;
    background: none;
    color: var(--brand);
    font: inherit;
    cursor: pointer;
}

.lp-link:hover {
    text-decoration: underline;
}

/* A challenge's status (lpMark(): is-solved, is-tried on its [data-ch] row or link) and its stars */
.ch-mark {
    display: inline-grid;
    flex: none;
    place-items: center;
    width: 22px;
    height: 22px;
    border: 1.5px solid var(--line);
    border-radius: 50%;
    color: transparent;
}

.ch-mark .ic {
    width: 13px;
    height: 13px;
    stroke-width: 2.4;
}

.is-tried > * > .ch-mark,
.is-tried > .ch-mark {
    border-color: var(--lv2);
    border-style: dashed;
}

.is-solved > * > .ch-mark,
.is-solved > .ch-mark {
    border-color: var(--done);
    background: var(--done);
    color: #FFFFFF;
}

body.dark .is-solved > * > .ch-mark,
body.dark .is-solved > .ch-mark {
    color: #0B1222;
}

/* A challenge's stars (1 to 3), drawn: gold for those earned, grey for the rest. <span class="stars" style="--n: 2">,
   by lpMark() (learn/_progress_mark.php), challenge.js and dashboard.js; sized by the text around it */
.stars {
    position: relative;
    display: inline-block;
    flex: none;
    width: 3.3em;
    height: 1.1em;
    vertical-align: -.2em;
    background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 26 24'%3E%3Cpath d='M12 2.5l2.9 6.1 6.6.8-4.9 4.6 1.3 6.6L12 17.3l-5.9 3.3 1.3-6.6L2.5 9.4l6.6-.8z' fill='%23DCE1EA' stroke='%23C9D0DC' stroke-width='1.2' stroke-linejoin='round'/%3E%3C/svg%3E") 0 0 / 1.1em 1.1em repeat-x;
}

.stars::before {
    content: "";
    position: absolute;
    inset: 0 auto 0 0;
    width: calc(var(--n, 0) * 1.1em);
    background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 26 24'%3E%3Cdefs%3E%3ClinearGradient id='g' x1='0' y1='0' x2='0' y2='1'%3E%3Cstop offset='0' stop-color='%23FFD84D'/%3E%3Cstop offset='1' stop-color='%23F5A000'/%3E%3C/linearGradient%3E%3C/defs%3E%3Cpath d='M12 2.5l2.9 6.1 6.6.8-4.9 4.6 1.3 6.6L12 17.3l-5.9 3.3 1.3-6.6L2.5 9.4l6.6-.8z' fill='url(%23g)' stroke='%23E39400' stroke-width='1.2' stroke-linejoin='round'/%3E%3C/svg%3E") 0 0 / 1.1em 1.1em repeat-x;
}

body.dark .stars {
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 26 24'%3E%3Cpath d='M12 2.5l2.9 6.1 6.6.8-4.9 4.6 1.3 6.6L12 17.3l-5.9 3.3 1.3-6.6L2.5 9.4l6.6-.8z' fill='%23334055' stroke='%233D4B63' stroke-width='1.2' stroke-linejoin='round'/%3E%3C/svg%3E");
}

.ch-stars {
    font-size: 13px;
}

/* The highlighter: "you are here" */
.hi-mark {
    padding: 0 .15em;
    border-radius: 3px;
    background: linear-gradient(transparent 12%, var(--hi-mark) 12%, var(--hi-mark) 88%, transparent 88%);
    -webkit-box-decoration-break: clone;
    box-decoration-break: clone;
}

/* ---------- Row lists: /learn's lessons, /programs, /errors ---------- */
.learn-rows {
    margin: 0;
    padding: 0;
    overflow: hidden;
    border: 1px solid var(--line);
    border-radius: var(--r-lg);
    background: var(--surface);
    list-style: none;
}

.learn-row {
    position: relative;
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 14px 60px 14px 18px;
    transition: background-color .12s;
}

.learn-row + .learn-row {
    border-top: 1px solid var(--line);
}

.learn-row:hover {
    background: var(--surface-2);
}

/* Goes deeper: a round arrow, filled with the brand colour on hover */
.learn-row::after {
    content: "";
    position: absolute;
    top: 50%;
    right: 16px;
    width: 30px;
    height: 30px;
    border: 1px solid var(--line);
    border-radius: 50%;
    background: var(--surface) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%238590A6' stroke-width='2.4' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m9 6 6 6-6 6'/%3E%3C/svg%3E") center / 16px no-repeat;
    transform: translateY(-50%);
    transition: background-color .15s, border-color .15s, transform .15s;
    pointer-events: none; /* the click goes to the row's link beneath */
}

.learn-row:hover::after {
    border-color: var(--brand);
    background-color: var(--brand);
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23FFFFFF' stroke-width='2.4' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m9 6 6 6-6 6'/%3E%3C/svg%3E");
    transform: translate(3px, -50%);
}

body.dark .learn-row:hover::after {
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%230B1222' stroke-width='2.4' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m9 6 6 6-6 6'/%3E%3C/svg%3E");
}

.learn-row-num {
    display: grid;
    flex: none;
    place-items: center;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: var(--surface-2);
    color: var(--ink-2);
    font-size: 13.5px;
    font-weight: 700;
}

.learn-row-body {
    flex: 1;
    min-width: 0;
}

.learn-row-title {
    color: var(--ink);
    font-size: 16.5px;
    font-weight: 680;
    letter-spacing: -.005em;
}

a.learn-row-title:hover {
    text-decoration: none;
}

/* The whole row is the link */
a.learn-row-title::after {
    content: "";
    position: absolute;
    inset: 0;
}

a.learn-row-title:focus-visible {
    outline: none;
}

a.learn-row-title:focus-visible::after {
    border-radius: inherit;
    box-shadow: inset 0 0 0 2px var(--brand);
}

.learn-row-desc {
    display: -webkit-box;
    margin-top: 2px;
    overflow: hidden;
    color: var(--ink-2);
    font-size: 14.5px;
    line-height: 1.45;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
}

.learn-row-meta a,
.learn-row-meta button {
    pointer-events: auto;
}

.learn-row-meta {
    position: relative;
    z-index: 1; /* its own links above the row's */
    pointer-events: none; /* the rest of it is the row's link */
    display: flex;
    flex: none;
    flex-wrap: wrap;
    align-items: center;
    justify-content: flex-end;
    gap: 6px 10px;
    color: var(--ink-3);
    font-size: 13.5px;
}

.learn-row-meta a {
    color: var(--ink-2);
}

.learn-row.is-soon:hover {
    background: none;
}

.learn-row.is-soon::after {
    content: none;
}

.learn-row.is-soon .learn-row-title {
    color: var(--ink-3);
}

/* Narrow: the meta (badges, a score) on a line of its own under the text, with room above it */
@media (max-width: 860px) {
    .learn-row {
        flex-wrap: wrap;
        gap: 10px 14px;
        padding-right: 56px;
    }

    .learn-row-meta {
        justify-content: flex-start;
        width: 100%;
    }

    /* in line with the text, past the row's number when it has one (lessons, quizzes; not programs) */
    .learn-row-num ~ .learn-row-meta {
        padding-left: 46px;
    }
}

/* ========== Search: the boxes (learn/_search.php, list filters) and the dialog (learn/_search_dialog.php) ========== */
.ls {
    position: relative;
    margin: 0;
}

.ls-field {
    position: relative;
    display: flex;
    align-items: center;
}

.ls-icon {
    position: absolute;
    left: 13px;
    color: var(--ink-3);
    pointer-events: none;
}

.ls-input {
    width: 100%;
    height: 42px;
    padding: 0 40px;
    border: 1px solid var(--line);
    border-radius: var(--r-md);
    background: var(--surface);
    color: var(--ink);
    font-size: 15px;
    outline: none;
    -webkit-appearance: none;
    appearance: none;
}

.ls-input::placeholder {
    color: var(--ink-3);
    opacity: 1;
}

.ls-input:focus {
    border-color: var(--brand);
    box-shadow: 0 0 0 3px color-mix(in srgb, var(--brand) 18%, transparent);
}

.ls-input::-webkit-search-cancel-button {
    -webkit-appearance: none;
}

.ls-key {
    position: absolute;
    right: 10px;
    min-width: 20px;
    padding: 0 6px;
    border: 1px solid var(--line);
    border-radius: 5px;
    background: var(--surface-2);
    color: var(--ink-3);
    font: 11.5px/18px var(--mono);
    text-align: center;
    pointer-events: none;
}

.ls-input:focus ~ .ls-key {
    display: none;
}

.ls-hero {
    max-width: 620px;
}

.ls-hero .ls-input {
    height: 52px;
    padding-left: 44px;
    border-radius: 12px;
    font-size: 16.5px;
    box-shadow: var(--shadow);
}

.ls-hero .ls-icon {
    left: 16px;
}

.ls-hero .ls-key {
    right: 14px;
}

/* The results */
.ls-pop {
    position: absolute;
    z-index: 40;
    top: calc(100% + 6px);
    left: 0;
    right: 0;
    min-width: 280px;
    max-height: min(440px, 70vh);
    overflow-y: auto;
    padding: 6px;
    border: 1px solid var(--line);
    border-radius: 12px;
    background: var(--surface);
    box-shadow: var(--shadow-pop);
}

.ls-list {
    margin: 0;
    padding: 0;
    list-style: none;
}

.ls-row {
    position: relative;
    border-radius: 8px;
}

.ls-row + .ls-row:not(.is-section) {
    margin-top: 2px;
}

.ls-go {
    display: block;
    padding: 9px 12px;
    border-radius: 8px;
    color: var(--ink);
    text-decoration: none;
}

.ls-go:hover,
.ls-go:focus {
    color: var(--ink);
    text-decoration: none;
}

.ls-row.is-active > .ls-go,
.ls-go:hover {
    background: var(--brand-soft);
}

.ls-row:not(.is-section) > .ls-go {
    padding-right: 72px;
}

.ls-title {
    display: block;
    color: var(--ink);
    font-size: 15px;
    font-weight: 650;
}

.ls-num {
    margin-right: 6px;
    color: var(--ink-3);
    font-weight: 500;
}

.ls-desc {
    display: -webkit-box;
    margin-top: 2px;
    overflow: hidden;
    color: var(--ink-2);
    font-size: 13.5px;
    line-height: 1.45;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
}

.ls-row.is-section > .ls-go {
    padding: 6px 12px 6px 32px;
    font-size: 14px;
}

.ls-hash {
    margin-right: 6px;
    color: var(--brand);
    font-weight: 700;
}

.ls-row.is-active .ls-head {
    color: var(--brand);
}

.ls-go mark {
    padding: 0;
    background: transparent;
    color: inherit;
    font-weight: 750;
    text-decoration: underline 2px var(--hi);
    text-underline-offset: 2px;
}

/* Errors and example programs (learn-search.js's libraries): an icon tile, the page's name, its group on the right.
   The IDE styles the same classes for its actions and snippets in ide.css */
.ls-row.ls-action > .ls-go {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 7px 12px;
}

.ls-action-icon {
    display: inline-flex;
    flex: none;
    align-items: center;
    justify-content: center;
    width: 30px;
    height: 30px;
    border-radius: 8px;
    background: var(--brand-soft);
    color: var(--brand);
}

.ls-action-go[data-target^="errors/"] .ls-action-icon {
    background: var(--bad-soft);
    color: var(--bad);
}

.ls-action-icon .ic {
    width: 16px;
    height: 16px;
}

.ls-action-label {
    flex: 1 1 auto;
    min-width: 0;
    overflow: hidden;
    color: var(--ink);
    font-size: 15px;
    font-weight: 600;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.ls-action-meta {
    flex: none;
    color: var(--ink-3);
    font-size: 13px;
}

.ls-quiz {
    position: absolute;
    top: 9px;
    right: 10px;
    padding: 1px 9px;
    border: 1px solid var(--line);
    border-radius: 999px;
    color: var(--ink-2);
    font-size: 12.5px;
    text-decoration: none;
    white-space: nowrap;
}

.ls-quiz .ic {
    width: 12px;
    height: 12px;
    vertical-align: -1px;
}

.ls-quiz:hover,
.ls-quiz:focus {
    border-color: var(--brand);
    color: var(--brand);
    text-decoration: none;
}

.ls-empty {
    margin: 0;
    padding: 10px 12px;
    color: var(--ink-2);
    font-size: 14px;
}

.ls-group,
.ls-popular-title {
    margin: 6px 0 10px;
    color: var(--ink-3);
    font-size: 13px;
    font-weight: 650;
}

/* The dialog: a large field, the popular lessons as chips until something is typed, then the results; the keys */
.ls-dialog {
    width: min(640px, calc(100vw - 32px));
    max-height: calc(100vh - 128px);
    margin: 64px auto auto;
    padding: 0;
    overflow: hidden;
    border: 1px solid var(--line);
    border-radius: var(--r-lg);
    background: var(--surface);
    color: var(--ink);
    font-family: var(--font);
    box-shadow: var(--shadow-pop);
}

.ls-dialog::backdrop {
    background: rgba(13, 27, 51, .45);
}

.ls-palette {
    display: flex;
    flex-direction: column;
    max-height: calc(100vh - 130px);
}

.ls-palette .ls-field {
    flex: none;
    height: 64px;
    border-bottom: 1px solid var(--line);
}

.ls-palette .ls-icon {
    left: 22px;
    width: 18px;
    height: 18px;
}

.ls-palette .ls-input,
.ls-palette .ls-input:focus {
    height: 100%;
    padding: 0 72px 0 54px;
    border: 0;
    border-radius: 0;
    background: transparent;
    font-size: 19px;
    box-shadow: none;
}

.ls-esc {
    position: absolute;
    right: 14px;
    width: 32px;
    height: 32px;
    padding: 0;
    border: 0;
    border-radius: 8px;
    background: transparent;
    color: var(--ink-3);
    font-size: 24px;
    line-height: 1;
}

.ls-esc:hover,
.ls-esc:focus-visible {
    background: var(--surface-2);
    color: var(--ink);
}

.ls-dialog .ls-palette .ls-pop {
    position: static;
    flex: 1 1 auto;
    min-width: 0;
    max-height: none;
    padding: 8px;
    border: 0;
    border-radius: 0;
    box-shadow: none;
}

.ls-popular,
.ls-start {
    padding: 10px 18px 18px;
}

.ls-pop:not([hidden]) ~ .ls-popular,
.ls-pop:not([hidden]) ~ .ls-start {
    display: none;
}

.ls-popular-list {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.ls-popular .ls-row + .ls-row:not(.is-section) {
    margin-top: 0;
}

.ls-popular .ls-row > .ls-go {
    display: inline-block;
    padding: 7px 15px;
    border: 1px solid var(--line);
    border-radius: 999px;
    background: var(--surface);
    font-size: 14.5px;
    font-weight: 560;
}

.ls-popular .ls-row.is-active > .ls-go,
.ls-popular .ls-go:hover {
    border-color: var(--brand);
    background: var(--brand-soft);
    color: var(--brand);
}

.ls-foot {
    display: flex;
    flex: none;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 10px 16px;
    border-top: 1px solid var(--line);
    background: var(--surface-2);
    color: var(--ink-3);
    font-size: 12.5px;
}

.ls-k {
    display: inline-block;
    min-width: 20px;
    margin: 0 2px;
    padding: 0 5px;
    border: 1px solid var(--line);
    border-bottom-width: 2px;
    border-radius: 5px;
    background: var(--surface);
    color: var(--ink-2);
    font: 11px/17px var(--mono);
    text-align: center;
}

.ls-all {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    margin-left: auto;
    font-weight: 650;
    white-space: nowrap;
}

@media (hover: none) {
    .ls-keys,
    .ls-key {
        display: none;
    }
}

/* Phones: the dialog keeps to the part of the screen above the keyboard (--ls-vv-*: learn-search.js) */
@media (max-width: 640px) {
    html:has(.ls-dialog[open]) {
        overflow: hidden;
    }

    .ls-dialog {
        width: calc(100vw - 16px);
        max-height: calc(var(--ls-vv-height, 100dvh) - 16px);
        margin-top: calc(var(--ls-vv-top, 0px) + 8px);
    }

    .ls-palette {
        max-height: calc(var(--ls-vv-height, 100dvh) - 18px);
    }

    .ls-palette .ls-field {
        height: 56px;
    }

    .ls-palette .ls-input,
    .ls-palette .ls-input:focus {
        padding-left: 48px;
        font-size: 17px;
    }

    .ls-palette .ls-icon {
        left: 18px;
    }

    .ls-input {
        font-size: 16px; /* iOS zooms into smaller fields */
    }
}

/* ========== The navbar (templates/learn_nav.php, learn-nav.js) ========== */
.lnav {
    position: sticky;
    top: 0;
    z-index: 30;
    display: flex;
    align-items: center;
    gap: 6px;
    height: var(--nav-h);
    padding: 0 20px;
    border-bottom: 1px solid var(--line);
    background: color-mix(in srgb, var(--surface) 88%, transparent);
    -webkit-backdrop-filter: saturate(1.4) blur(10px);
    backdrop-filter: saturate(1.4) blur(10px);
}

.lnav a {
    text-decoration: none;
}

.lnav-brand {
    display: flex;
    flex: none;
    align-items: center;
    gap: 9px;
    margin-right: 16px;
    color: var(--ink);
    font-size: 17px;
    font-weight: 750;
    letter-spacing: -.01em;
    white-space: nowrap;
}

.lnav-brand img {
    width: 28px;
    height: auto;
}

.lnav-links {
    display: flex;
    align-items: stretch;
    gap: 2px;
    height: 100%;
}

.lnav-links > a {
    position: relative;
    display: flex;
    align-items: center;
    gap: 5px;
    padding: 0 12px;
    border: 0;
    background: none;
    color: var(--ink-2);
    font: 620 14.5px var(--font);
    white-space: nowrap;
}

.lnav-links > a:hover,
.lnav-links [aria-current="page"] {
    color: var(--ink);
}

.lnav-links [aria-current="page"]::after {
    content: "";
    position: absolute;
    left: 12px;
    right: 12px;
    bottom: -1px;
    height: 2px;
    border-radius: 2px;
    background: var(--brand);
}

.lnav-drop {
    position: relative;
    display: flex;
}

.lnav-caret {
    width: 12px;
    height: 12px;
    color: var(--ink-3);
}

.lnav-end {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-left: auto;
}

.lnav-find {
    display: flex;
    align-items: center;
    gap: 8px;
    width: 210px;
    height: 34px;
    padding: 0 8px 0 11px;
    border: 1px solid var(--line);
    border-radius: 9px;
    background: var(--surface-2);
    color: var(--ink-3);
    font: 500 13.5px var(--font);
}

.lnav-find:hover {
    border-color: var(--ink-3);
}

.lnav-find kbd {
    margin-left: auto;
    padding: 1px 5px;
    border: 1px solid var(--line);
    border-radius: 4px;
    background: var(--surface);
    font-size: 11px;
}

/* The streak chip (learn_nav.php): the flame lights while the streak runs; the level beside it. To the dashboard */
.lnav-streak {
    display: inline-flex;
    flex: none;
    align-items: center;
    gap: 5px;
    height: 34px;
    padding: 0 10px 0 8px;
    border: 1px solid var(--line);
    border-radius: 999px;
    color: var(--ink-2);
    font-size: 13.5px;
    font-weight: 650;
    text-decoration: none;
}

.lnav-streak:hover {
    border-color: color-mix(in srgb, var(--lv3) 45%, var(--line));
    color: var(--ink);
    text-decoration: none;
}

.lnav-streak .ic {
    width: 17px;
    height: 17px;
    color: var(--ink-3);
}

.lnav-streak.is-on .ic {
    color: var(--lv3);
    fill: color-mix(in srgb, var(--lv3) 30%, transparent);
}

.lnav-streak b {
    color: var(--ink);
    font-weight: 750;
}

.lnav-lv {
    padding-left: 7px;
    border-left: 1px solid var(--line);
    color: var(--brand);
}

@media (max-width: 480px) {
    .lnav-lv {
        display: none;
    }
}

.lnav-icon {
    display: grid;
    flex: none;
    place-items: center;
    width: 34px;
    height: 34px;
    padding: 0;
    border: 0;
    border-radius: 9px;
    background: none;
    color: var(--ink-2);
}

.lnav-icon:hover {
    background: var(--surface-2);
    color: var(--ink);
}

/* Feedback: on the bar from 481px (its label from 1181px), in the panel below */
.lnav-feedback {
    display: inline-flex;
    flex: none;
    align-items: center;
    gap: 6px;
    height: 34px;
    padding: 0 11px;
    border: 1px solid var(--line);
    border-radius: 9px;
    background: var(--surface);
    color: var(--ink-2);
    font: 620 13.5px var(--font);
}

.lnav-feedback:hover {
    border-color: var(--ink-3);
    color: var(--ink);
}

.lnav-feedback .ic {
    width: 16px;
    height: 16px;
}

.lnav-feedback-item {
    display: none;
}

@media (max-width: 1180px) {
    .lnav-feedback {
        justify-content: center;
        width: 34px;
        padding: 0;
    }

    .lnav-feedback .label {
        display: none;
    }
}

@media (max-width: 480px) {
    .lnav-end > .lnav-feedback {
        display: none;
    }

    .lnav-feedback-item {
        display: flex;
    }
}

/* The theme button shows the moon in the light theme and the sun in the dark */
.learn-theme-toggle .ic-sun,
body.dark .learn-theme-toggle .ic-moon {
    display: none;
}

body.dark .learn-theme-toggle .ic-sun {
    display: inline;
}

.lnav-editor {
    display: flex;
    align-items: center;
    gap: 7px;
    height: 34px;
    padding: 0 12px;
    border: 1px solid var(--line);
    border-radius: 9px;
    background: none;
    color: var(--ink);
    font: 650 14px var(--font);
    white-space: nowrap;
}

.lnav-editor:hover {
    border-color: var(--ink-3);
}

.lnav-signin {
    display: flex;
    align-items: center;
    height: 34px;
    padding: 0 14px;
    border-radius: 9px;
    background: var(--brand);
    color: var(--brand-ink);
    font-size: 14px;
    font-weight: 650;
    white-space: nowrap;
}

.lnav-signin:hover {
    background: color-mix(in srgb, var(--brand) 88%, var(--ink));
}

/* The one menu button: ☰, or the account's initial once signed in (.is-member: templates/learn_nav.php). Wide
   screens need it only for the account; below 960px it holds the sections and editors too. */
.lnav-menu-btn {
    display: none;
    place-items: center;
    width: 34px;
    height: 34px;
    padding: 0;
    border: 0;
    border-radius: 9px;
    background: none;
    color: var(--ink-2);
}

.lnav-menu-btn:hover {
    background: var(--surface-2);
    color: var(--ink);
}

.lnav.is-member .lnav-menu-btn {
    display: grid;
    border-radius: 50%;
}

.lnav.is-member .lnav-menu-btn > .ic,
.lnav-menu-btn > .lnav-face {
    display: none;
}

.lnav.is-member .lnav-menu-btn > .lnav-face {
    display: grid;
}

.lnav-face {
    position: relative;
    display: grid;
    flex: none;
    place-items: center;
    width: 32px;
    height: 32px;
    overflow: hidden;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--brand), color-mix(in srgb, var(--brand) 55%, var(--p4)));
    color: #FFFFFF;
    font-size: 15px;
    font-weight: 750;
}

/* The Google or GitHub picture, over the first letter (learn_nav.php) */
.lnav-face img {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.lnav-menu-btn[aria-expanded="true"] > .lnav-face {
    box-shadow: 0 0 0 3px color-mix(in srgb, var(--brand) 30%, transparent);
}

/* The drop-down: Open editor */
.menu {
    position: absolute;
    z-index: 35;
    top: calc(100% + 8px);
    left: 0;
    padding: 8px;
    border: 1px solid var(--line);
    border-radius: 14px;
    background: var(--surface);
    box-shadow: var(--shadow-pop);
    animation: menu-in .14s ease-out;
}

@keyframes menu-in {
    from { opacity: 0; transform: translateY(-4px); }
}

/* An item: one compact line, a plain grey icon and its name (what it is: its tooltip). The names lead; only the page
   you're on, or the item under the pointer, takes the brand's colour (the owner's call, 2026-12-03: coloured tiles
   distracted) */
.lnav-item {
    display: flex;
    align-items: center;
    gap: 10px;
    width: 100%;
    padding: 7px 10px;
    border: 0;
    border-radius: 8px;
    background: none;
    color: var(--ink);
    font: inherit;
    line-height: 20px;
    text-align: left;
    text-decoration: none;
    cursor: pointer;
}

.lnav-item:hover,
.lnav-item:focus-visible {
    background: var(--surface-2);
    text-decoration: none;
}

.lnav-item[aria-current="page"] {
    background: var(--brand-soft);
}

.lnav-glyph {
    display: grid;
    flex: none;
    place-items: center;
    width: 18px;
    height: 18px;
    color: var(--ink-3);
}

.lnav-item:hover .lnav-glyph,
.lnav-item:focus-visible .lnav-glyph,
.lnav-item[aria-current="page"] .lnav-glyph {
    color: var(--brand);
}

.lnav-glyph .ic {
    width: 17px;
    height: 17px;
}

.lnav-emoji {
    font-size: 15px;
    line-height: 1;
}

.lnav-item-text {
    flex: 1;
    min-width: 0;
    overflow: hidden;
    font-size: 14.5px;
    font-weight: 500;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.lnav-editors {
    left: auto;
    right: 0;
    width: 290px;
}

.lnav-editors .lnav-item:last-child {
    margin-top: 6px;
    padding-top: 12px;
    border-top: 1px solid var(--line);
    border-radius: 0 0 10px 10px;
}

/* While the panel is open on a phone or tablet, the page behind it stays still (learn-nav.js: is-drawer-open) */
@media (max-width: 960px) {
    html.is-drawer-open {
        overflow: hidden;
    }
}

/* The panel: the account (signed in), the sections and the editors */
.lnav-panel {
    position: absolute;
    z-index: 35;
    top: calc(100% + 8px);
    right: 12px;
    display: grid;
    gap: 6px;
    width: min(300px, calc(100vw - 16px));
    max-height: calc(100dvh - var(--nav-h) - 20px);
    overflow-y: auto;
    overscroll-behavior: contain; /* its scroll never runs on into the page behind */
    padding: 8px;
    border: 1px solid var(--line);
    border-radius: 16px;
    background: var(--surface);
    box-shadow: var(--shadow-pop);
    animation: menu-in .14s ease-out;
}

.lnav-me,
.lnav-panel-group {
    display: grid;
}

.lnav-me + .lnav-panel-group,
.lnav-panel-group + .lnav-panel-group {
    padding-top: 6px;
    border-top: 1px solid var(--line);
}

.lnav-me-head {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 4px;
    padding: 12px 10px;
    border-radius: 12px;
    background: var(--surface-2);
}

.lnav-me-head .lnav-face {
    width: 40px;
    height: 40px;
    font-size: 18px;
}

.lnav-me-head > span:last-child {
    display: grid;
    min-width: 0;
}

.lnav-me-head b {
    overflow: hidden;
    font-size: 15px;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.lnav-me-head small {
    overflow: hidden;
    color: var(--ink-3);
    font-size: 12.5px;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* Search becomes its icon (Ctrl K still opens it) below 1280px, where the bar would be wider than the screen with
   Sign in; Open editor's name goes below 1080px */
@media (max-width: 1279px) {
    .lnav-find {
        justify-content: center;
        width: 34px;
        padding: 0;
    }

    .lnav-find .label,
    .lnav-find kbd {
        display: none;
    }
}

@media (max-width: 1080px) {
    .lnav-editor .label {
        display: none;
    }
}

@media (max-width: 960px) {
    .lnav {
        padding: 0 12px;
    }

    .lnav-links,
    .lnav-end > .lnav-drop-editor {
        display: none;
    }

    .lnav-menu-btn {
        display: grid;
    }

    .lnav-find {
        border: 0;
        background: none;
    }

    .lnav-panel {
        right: 8px;
    }
}

@media (max-width: 480px) {
    .lnav-brand span {
        display: none;
    }

    .lnav-end {
        gap: 4px;
    }
}

/* ========== The footer (templates/_site_footer.php) ========== */
/* Its own band under the white page (the owner's call): the brand's deep navy, a shade darker than the page in dark */
.site-footer {
    --f-ink: #F2F5FB;
    --f-ink-2: #B4C2DB;
    --f-ink-3: #8394B3;
    --f-line: rgba(255, 255, 255, .1);
    margin-top: 72px;
    background: #0B1630;
    color: var(--f-ink-2);
    font-size: 14.5px;
}

body.dark .site-footer {
    border-top: 1px solid var(--line);
    background: #090D15;
}

.site-footer :focus-visible {
    outline-color: var(--f-ink); /* the brand's blue is lost on the navy */
}

.site-footer-inner {
    display: grid;
    grid-template-columns: 1.3fr repeat(4, 1fr);
    gap: 28px;
    max-width: 1240px;
    margin: 0 auto;
    padding: 44px 24px 28px;
}

.site-footer-brand p {
    margin: 10px 0 0;
    color: var(--f-ink-3);
}

.site-footer-logo {
    display: inline-flex;
    align-items: center;
    gap: 9px;
    color: var(--f-ink);
    font-size: 16px;
    font-weight: 750;
}

.site-footer-logo:hover {
    text-decoration: none;
}

.site-footer-group {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 7px;
}

.site-footer-group h2 {
    margin: 0 0 4px;
    color: var(--f-ink);
    font-size: 14px;
    font-weight: 700;
    letter-spacing: 0;
}

.site-footer-group a,
.site-footer-link {
    padding: 0;
    border: 0;
    background: none;
    color: var(--f-ink-2);
    font-size: 14px;
    text-align: left;
}

.site-footer-group a:hover,
.site-footer-link:hover {
    color: var(--f-ink);
    text-decoration: underline;
    text-underline-offset: 3px;
}

.site-footer-copy {
    display: flex;
    justify-content: center;
    gap: 16px;
    padding: 16px 24px 22px;
    border-top: 1px solid var(--f-line);
    color: var(--f-ink-3);
    font-size: 13px;
}

#pmLink {
    display: none; /* the learn pages carry no ads, so no consent manager */
}

@media (max-width: 960px) {
    .site-footer-inner {
        grid-template-columns: repeat(2, 1fr);
    }

    .site-footer-brand {
        grid-column: 1 / -1;
    }
}

@media (max-width: 480px) {
    .site-footer-inner {
        grid-template-columns: 1fr;
    }
}

/* ========== The feedback dialog (templates/_feedback_dialog.php, feedback.js) ========== */
.feedback-dialog {
    width: min(520px, calc(100vw - 24px));
    max-height: calc(100dvh - 24px);
    padding: 0;
    overflow: auto;
    border: 1px solid var(--line);
    border-radius: var(--r-lg);
    background: var(--surface);
    color: var(--ink);
    font-family: var(--font);
    box-shadow: var(--shadow-pop);
}

.feedback-dialog::backdrop {
    background: rgba(13, 27, 51, .45);
}

body:has(.feedback-dialog[open]) {
    overflow: hidden;
}

.feedback-dialog .modal-header {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 18px 20px 6px;
}

.feedback-dialog .ide-dialog-icon {
    display: grid;
    place-items: center;
    width: 36px;
    height: 36px;
    border-radius: 10px;
    background: var(--brand-soft);
    color: var(--brand);
}

.feedback-dialog .modal-title {
    flex: 1;
    margin: 0;
    font-size: 19px;
}

.feedback-dialog .close {
    display: grid;
    place-items: center;
    width: 32px;
    height: 32px;
    padding: 0;
    border: 0;
    border-radius: 8px;
    background: none;
    color: var(--ink-3);
}

.feedback-dialog .close:hover {
    background: var(--surface-2);
    color: var(--ink);
}

.feedback-dialog .modal-body {
    padding: 10px 20px 4px;
}

.feedback-dialog fieldset {
    margin: 0 0 16px;
    padding: 0;
    border: 0;
}

.feedback-dialog legend,
.feedback-dialog .form-group label {
    display: block;
    margin-bottom: 8px;
    color: var(--ink);
    font-size: 14.5px;
    font-weight: 650;
}

.feedback-dialog .text-muted {
    color: var(--ink-3);
    font-weight: 400;
}

/* Five radios drawn as stars: the chosen one and those before it light up, or up to the one under the pointer */
.feedback-stars {
    display: flex;
    width: max-content;
}

.feedback-star {
    padding: 0 3px;
    color: var(--line);
    font-size: 28px;
    line-height: 1;
    cursor: pointer;
}

.feedback-star:has(input:checked),
.feedback-star:has(~ .feedback-star input:checked),
.feedback-stars:hover .feedback-star {
    color: var(--hi);
}

.feedback-stars:hover .feedback-star:hover ~ .feedback-star {
    color: var(--line);
}

.feedback-star input,
.feedback-chip input {
    position: absolute;
    opacity: 0;
    pointer-events: none;
}

.feedback-star input:focus-visible + span {
    outline: 2px solid var(--brand);
    outline-offset: 2px;
    border-radius: 4px;
}

.feedback-chips {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.feedback-chip span {
    display: inline-block;
    padding: 6px 13px;
    border: 1px solid var(--line);
    border-radius: 999px;
    color: var(--ink-2);
    font-size: 14px;
    cursor: pointer;
}

.feedback-chip input:checked + span {
    border-color: var(--brand);
    background: var(--brand-soft);
    color: var(--brand);
}

.feedback-chip input:focus-visible + span {
    outline: 2px solid var(--brand);
    outline-offset: 2px;
}

.feedback-dialog .form-group {
    margin-bottom: 14px;
}

.feedback-dialog .form-control {
    display: block;
    width: 100%;
    padding: 9px 12px;
    border: 1px solid var(--line);
    border-radius: var(--r-md);
    background: var(--surface);
    color: var(--ink);
    font-size: 15px;
}

.feedback-dialog .form-control:focus {
    border-color: var(--brand);
    outline: none;
    box-shadow: 0 0 0 3px color-mix(in srgb, var(--brand) 18%, transparent);
}

.feedback-error,
.feedback-done {
    display: flex;
    align-items: center;
    gap: 8px;
    margin: 0 0 12px;
}

.feedback-error {
    color: var(--bad);
}

.feedback-done {
    padding: 18px 0 8px;
    font-size: 16px;
}

.feedback-done .ic {
    color: var(--done);
}

.feedback-dialog [data-state="done"] .feedback-when-form,
.feedback-dialog [data-state="form"] .feedback-when-done {
    display: none;
}

.feedback-dialog .modal-footer {
    display: flex;
    justify-content: flex-end;
    gap: 8px;
    padding: 8px 20px 20px;
}
