/*
 * OfCourse. One stylesheet, no build step (docs/decisions/0002).
 *
 * The look is the facilitator's wall from lutzen.dk and AgileIdeas.dk:
 * grid paper behind everything, sticky notes for the course outline,
 * handwritten headings, and one green accent. Long text stays in a plain,
 * readable sans-serif, so a whole module is comfortable to read.
 *
 * Fonts are self-hosted (OFL licensed, see public/fonts) so no visitor
 * data goes to Google.
 */
@font-face {
    font-family: "Caveat";
    font-style: normal;
    font-display: swap;
    font-weight: 400 700;
    src: url("../fonts/caveat-latin-wght-normal.woff2") format("woff2-variations");
    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: "DM Sans";
    font-style: normal;
    font-display: swap;
    font-weight: 100 1000;
    src: url("../fonts/dm-sans-latin-wght-normal.woff2") format("woff2-variations");
    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: "DM Sans";
    font-style: italic;
    font-display: swap;
    font-weight: 100 1000;
    src: url("../fonts/dm-sans-latin-wght-italic.woff2") format("woff2-variations");
    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;
}

:root {
    --board: #e9e3d8;          /* the wall: kraft paper */
    --grid: rgba(0, 0, 0, 0.045);
    --paper: #fffdf8;          /* sheets and the header */
    --paper-2: #f1ece2;        /* quiet fills on paper */
    --ink: #1f1d1a;
    --muted: #5c574f;
    --rule: #d6cfc2;
    --accent: #1d9e75;         /* lutzen.dk green, for lines and marks */
    --accent-ink: #13684e;     /* the same green, dark enough for text */
    --accent-on: #fffdf8;
    --note-yellow: #fef3a3;
    --note-green: #c9f0d6;
    --note-blue: #cfe2fb;
    --note-pink: #fbd5d5;
    --note-purple: #e4dafc;
    --note-ink: #1f1d1a;
    --prompt: #fffbe0;
    --code-bg: #1f1d1a;
    --code-ink: #f4efe4;
    --code-muted: #b9b0a0;
    --inline-code: #f1ece2;
    --danger: #a4262c;
    --shadow: 3px 4px 0 rgba(0, 0, 0, 0.12);

    --font-hand: "Caveat", "Segoe Print", "Bradley Hand", cursive;
    --font-text: "DM Sans", "Segoe UI", system-ui, sans-serif;
    --font-code: ui-monospace, "SFMono-Regular", Menlo, Consolas, monospace;

    --measure: 46rem;
    color-scheme: light;
}

@media (prefers-color-scheme: dark) {
    :root {
        --board: #1d1b18;
        --grid: rgba(255, 255, 255, 0.04);
        --paper: #282521;
        --paper-2: #33302b;
        --ink: #f1ece2;
        --muted: #b5ada0;
        --rule: #46413a;
        --accent: #3cc497;
        --accent-ink: #5fd6ad;
        --accent-on: #10241c;
        --prompt: #33302b;
        --code-bg: #12110f;
        --inline-code: #33302b;
        --danger: #f08a8f;
        --shadow: 3px 4px 0 rgba(0, 0, 0, 0.45);
        color-scheme: dark;
    }
}

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

html { -webkit-text-size-adjust: 100%; }

body {
    margin: 0;
    background-color: var(--board);
    background-image:
        linear-gradient(var(--grid) 1px, transparent 1px),
        linear-gradient(90deg, var(--grid) 1px, transparent 1px);
    background-size: 28px 28px;
    color: var(--ink);
    font-family: var(--font-text);
    font-size: 1.125rem;
    line-height: 1.65;
}

a { color: var(--accent-ink); text-underline-offset: 0.18em; text-decoration-thickness: 1px; }
a:hover { text-decoration-thickness: 2px; }

:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; border-radius: 2px; }

.skip { position: absolute; left: -999px; }
.skip:focus { left: 1rem; top: 1rem; background: var(--paper); padding: 0.5rem 1rem; z-index: 10; }

h1, h2, h3 { font-family: var(--font-hand); font-weight: 700; line-height: 1.05; letter-spacing: -0.005em; }
h1 { font-size: clamp(2.6rem, 1.9rem + 3vw, 3.9rem); margin: 0 0 1.25rem; }
h2 { font-size: 2.35rem; margin: 2.5rem 0 0.6rem; }
h3 { font-size: 1.8rem; margin: 2rem 0 0.4rem; }
h4 { font-size: 1.05rem; margin: 1.5rem 0 0.4rem; }

/* The hand-drawn underline from lutzen.dk, under page titles. */
.prose h1::after,
.course-head h1::after,
.intro h1::after {
    content: "";
    display: block;
    width: min(22rem, 80%);
    height: 0.75rem;
    margin-top: 0.4rem;
    background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 340 10' fill='none'%3E%3Cpath d='M2 7 Q60 2 120 6 Q200 10 260 5 Q300 2 338 6' stroke='%231d9e75' stroke-width='3' stroke-linecap='round'/%3E%3C/svg%3E") no-repeat left center / 100% 100%;
}

/* Header and footer */

header.site {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.5rem 1.5rem;
    padding: 0.9rem clamp(1rem, 4vw, 2.5rem);
    background: var(--paper);
    border-bottom: 2px solid var(--ink);
}
.wordmark { font-family: var(--font-hand); font-weight: 700; font-size: 2.25rem; line-height: 1; color: var(--ink); text-decoration: none; }
.wordmark span { color: var(--accent); }
.by { color: var(--muted); font-size: 0.9rem; }
.by a { color: inherit; }
.account { margin-left: auto; display: flex; gap: 1rem; align-items: center; font-size: 0.95rem; }
.account a, .account .link { color: var(--ink); font-weight: 500; }
.account form { margin: 0; }
.who { color: var(--muted); }

footer.site {
    margin-top: 5rem;
    padding: 1.5rem clamp(1rem, 4vw, 2.5rem);
    background: var(--paper);
    border-top: 2px solid var(--ink);
    color: var(--muted);
    font-size: 0.95rem;
}

main { padding: 0 clamp(1rem, 4vw, 2.5rem); max-width: 80rem; margin: 0 auto; }

.preview-banner {
    margin: 0;
    padding: 0.45rem clamp(1rem, 4vw, 2.5rem);
    background: var(--note-yellow);
    color: var(--note-ink);
    font-size: 0.9rem;
    border-bottom: 1px solid var(--rule);
}

/* Buttons and forms */

.button {
    display: inline-flex;
    align-items: center;
    min-height: 2.9rem;
    padding: 0 1.4rem;
    border: 2px solid var(--ink);
    border-radius: 999px;
    background: var(--accent-ink);
    color: var(--accent-on);
    font: inherit;
    font-weight: 700;
    font-size: 1rem;
    line-height: 1.2;
    text-decoration: none;
    cursor: pointer;
    box-shadow: 3px 3px 0 var(--ink);
    transition: transform 0.08s ease, box-shadow 0.08s ease;
}
.button:hover { transform: translate(-1px, -1px); box-shadow: 4px 4px 0 var(--ink); }
.button:active { transform: translate(2px, 2px); box-shadow: 1px 1px 0 var(--ink); }
.button-quiet { background: var(--paper); color: var(--ink); }
button.link {
    background: none; border: 0; padding: 0; color: var(--accent-ink); cursor: pointer;
    font: inherit; text-decoration: underline; text-underline-offset: 0.18em;
}
form.inline { display: inline; }

.email-form { margin: 1.5rem 0; max-width: 34rem; }
.email-form label { display: block; font-weight: 700; margin-bottom: 0.35rem; }
.email-row { display: flex; gap: 0.6rem; flex-wrap: wrap; align-items: center; }
.email-row input {
    flex: 1 1 16rem;
    min-height: 2.9rem;
    font: inherit;
    padding: 0 0.9rem;
    border: 2px solid var(--ink);
    border-radius: 999px;
    background: var(--paper);
    color: var(--ink);
}
.email-row input:focus { border-color: var(--accent); outline: none; }
.error { color: var(--danger); }
.sent { background: var(--note-green); color: var(--note-ink); padding: 0.9rem 1.1rem; box-shadow: var(--shadow); }
.note { color: var(--muted); font-size: 0.95rem; }

/* A sheet of paper pinned to the wall: pages, notices, course heads. */

.sheet,
.page,
.notice,
.course-head {
    background: var(--paper);
    border-radius: 3px;
    box-shadow: 0 1px 0 var(--rule), 6px 8px 0 rgba(0, 0, 0, 0.08);
}

/* Home */

.intro { max-width: 50rem; margin: 3.5rem 0 2.5rem; }
.intro h1 { font-size: clamp(2.8rem, 2rem + 3.5vw, 4.5rem); }
.intro p { font-size: 1.25rem; max-width: 40rem; }
.catalogue { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 22rem), 1fr)); gap: 1.75rem; }
.listing { background: var(--note-yellow); color: var(--note-ink); padding: 1.5rem 1.6rem 1.75rem; box-shadow: var(--shadow); transform: rotate(-0.8deg); }
.listing:nth-child(2n) { background: var(--note-green); transform: rotate(0.7deg); }
.listing:nth-child(3n) { background: var(--note-blue); }
.listing h2 { margin: 0 0 0.4rem; font-size: 2.1rem; }
.listing h2 a { color: var(--note-ink); text-decoration: none; }
.listing h2 a:hover { text-decoration: underline; }
.listing .subtitle, .listing .byline { color: var(--note-ink); }
.subtitle { font-size: 1.2rem; margin: 0.25rem 0; }
.byline { color: var(--muted); font-size: 0.95rem; margin: 0.25rem 0 1.25rem; }
.empty { background: var(--paper); padding: 1.5rem; }

/* Course home */

.course-head { max-width: 56rem; margin: 3rem 0 0; padding: clamp(1.75rem, 4vw, 3rem) clamp(1.5rem, 4vw, 3.5rem); }
.course-head h1 { font-size: clamp(2.8rem, 2rem + 3.5vw, 4.6rem); line-height: 0.98; }
.course-head .subtitle { font-size: 1.3rem; max-width: 40rem; }
.course-head .actions { display: flex; flex-wrap: wrap; gap: 0.9rem; align-items: center; margin-top: 1.5rem; }

/* The course outline: one sticky note per section, folded to its title
   unless it holds the page being read. Modules fold to one line too. */

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

.leg { background: var(--note-yellow); color: var(--note-ink); padding: 0.85rem 1.1rem; box-shadow: var(--shadow); transform: rotate(-1deg); }
.leg:nth-of-type(5n + 2) { background: var(--note-green); transform: rotate(0.8deg); }
.leg:nth-of-type(5n + 3) { background: var(--note-blue); transform: rotate(-0.5deg); }
.leg:nth-of-type(5n + 4) { background: var(--note-pink); transform: rotate(0.6deg); }
.leg:nth-of-type(5n + 5) { background: var(--note-purple); transform: rotate(-0.7deg); }
.leg[open] { padding-bottom: 1.1rem; }

.leg-head { list-style: none; cursor: pointer; display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 0 0.6rem; align-items: start; }
.leg-head::-webkit-details-marker { display: none; }
.leg-head::after { content: "+"; grid-column: 2; grid-row: 1; font-family: var(--font-hand); font-size: 1.6rem; line-height: 1; font-weight: 700; }
.leg[open] > .leg-head::after { content: "\2013"; }
.leg-title { grid-column: 1; font-family: var(--font-hand); font-size: 1.6rem; font-weight: 700; line-height: 1.1; color: var(--note-ink); }
.leg-meta { grid-column: 1 / -1; font-size: 0.8rem; opacity: 0.75; margin-top: 0.15rem; }
.leg[open] > .leg-head { margin-bottom: 0.5rem; }

.groups, .stops { list-style: none; margin: 0; padding: 0; }
.group + .group, .group + .stop, .stop + .group { margin-top: 0.15rem; }

.module > summary { list-style: none; cursor: pointer; display: grid; grid-template-columns: 1.6rem minmax(0, 1fr) auto; gap: 0 0.5rem; align-items: baseline; padding: 0.3rem 0.35rem; margin: 0 -0.35rem; border-radius: 3px; }
.module > summary::-webkit-details-marker { display: none; }
.module > summary:hover .stop-title { text-decoration: underline; text-underline-offset: 0.18em; }
.module-number { grid-column: 1; display: inline-flex; align-items: center; justify-content: center; width: 1.45rem; height: 1.45rem; border: 1.5px solid var(--note-ink); border-radius: 50%; font-size: 0.75rem; font-weight: 700; line-height: 1; transform: translateY(0.1rem); }
.module-name { grid-column: 2; display: flex; flex-direction: column; min-width: 0; }
.module > summary .stop-note { grid-column: 3; }
.module[open] > summary { margin-bottom: 0.15rem; }
.module .stops { margin: 0 0 0.35rem 2.1rem; padding-left: 0.6rem; border-left: 2px solid rgba(0, 0, 0, 0.18); }
.group.is-current > .module > summary .stop-title { font-weight: 700; }
.group.is-locked > .module > summary { opacity: 0.62; }

.stop { padding: 0.08rem 0; }
.stop.has-number a { display: grid; grid-template-columns: 1.6rem minmax(0, 1fr) auto; gap: 0 0.5rem; }
.stop a { display: flex; gap: 0.75rem; justify-content: space-between; align-items: baseline; color: var(--note-ink); text-decoration: none; padding: 0.2rem 0.35rem; margin: 0 -0.35rem; border-radius: 3px; }
.stop a:hover .stop-title { text-decoration: underline; text-underline-offset: 0.18em; }
.stop.is-locked a { opacity: 0.62; }
.stop.is-locked .stop-title::after,
.group.is-locked > .module > summary .stop-title::after {
    content: "";
    display: inline-block;
    width: 0.8em;
    height: 0.8em;
    margin-left: 0.35em;
    vertical-align: -0.05em;
    background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%231f1d1a' stroke-width='2.4' stroke-linecap='round'%3E%3Crect x='5' y='11' width='14' height='10' rx='2'/%3E%3Cpath d='M8 11V7a4 4 0 0 1 8 0v4'/%3E%3C/svg%3E") no-repeat center / contain;
}
.stop-note { font-size: 0.8rem; white-space: nowrap; opacity: 0.75; }
.stop-summary { margin: 0.1rem 0 0.35rem; font-size: 0.92rem; line-height: 1.45; color: var(--note-ink); opacity: 0.8; font-weight: 400; }
.stop.is-current .stop-title { font-weight: 700; background: linear-gradient(transparent 55%, rgba(29, 158, 117, 0.38) 55%); }

/* On the course home the notes become columns: the route. */
.route-full { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 17rem), 1fr)); gap: 1.75rem; margin: 2.75rem 0 0; align-items: start; }
.route-full .leg { padding: 1.1rem 1.25rem 1.25rem; }
.route-full .leg-title { font-size: 1.85rem; }
.route-full .groups > li { padding: 0.35rem 0; border-top: 1px dashed rgba(0, 0, 0, 0.18); }
.route-full .groups > li:first-child { border-top: 0; }
.route-full .module-name .stop-title, .route-full .stop > a .stop-title { font-weight: 600; }

/* Reading layout */

.reading {
    display: grid;
    grid-template-columns: minmax(14rem, 18rem) minmax(0, var(--measure));
    gap: clamp(2rem, 4vw, 3.5rem);
    padding-top: 2.5rem;
    justify-content: center;
}
.route-side { position: sticky; top: 1.5rem; align-self: start; max-height: calc(100vh - 3rem); overflow-y: auto; font-size: 0.95rem; padding: 0.5rem 0.75rem 1rem 0.25rem; display: flex; flex-direction: column; gap: 1.25rem; }
.route-side > summary { display: none; }
.route-course { margin: 0 0 0.35rem; font-family: var(--font-hand); font-size: 1.6rem; font-weight: 700; line-height: 1.1; }
.route-course a { color: var(--ink); text-decoration: none; }

.page { padding: clamp(1.5rem, 4vw, 3rem) clamp(1.25rem, 4vw, 3.5rem) clamp(2rem, 4vw, 3.5rem); min-width: 0; }
.page-meta { color: var(--muted); font-size: 0.85rem; font-weight: 500; letter-spacing: 0.05em; text-transform: uppercase; margin: 0 0 0.4rem; }

.prose > :first-child { margin-top: 0; }
.prose p, .prose li { hyphens: auto; }
.prose li + li { margin-top: 0.3rem; }
.prose blockquote { margin: 1.5rem 0; padding: 0.9rem 1.2rem; background: var(--paper-2); border-radius: 4px; }
.prose blockquote > :first-child { margin-top: 0; }
.prose blockquote > :last-child { margin-bottom: 0; }
.prose code { font-family: var(--font-code); font-size: 0.86em; background: var(--inline-code); padding: 0.1em 0.35em; border-radius: 4px; }
.prose pre { background: var(--code-bg); color: var(--code-ink); padding: 1rem 1.25rem; border-radius: 6px; overflow-x: auto; line-height: 1.55; font-size: 0.92rem; }
.prose pre code { background: none; padding: 0; font-size: inherit; color: inherit; }
.prose pre.mermaid { background: var(--paper); color: var(--ink); border: 1.5px solid var(--ink); text-align: center; }
.prose table { border-collapse: collapse; width: 100%; margin: 1.5rem 0; font-size: 0.95rem; line-height: 1.45; display: block; overflow-x: auto; }
.prose th, .prose td { text-align: left; padding: 0.55rem 0.75rem; border-bottom: 1px solid var(--rule); vertical-align: top; }
.prose th { font-weight: 700; border-bottom: 2px solid var(--ink); }
.prose details { margin: 1.25rem 0; border: 1.5px solid var(--ink); border-radius: 4px; padding: 0.6rem 1rem; background: var(--paper); }
.prose details summary { cursor: pointer; font-weight: 700; }
.prose details[open] summary { margin-bottom: 0.5rem; }
.prose ul.contains-task-list { list-style: none; padding-left: 0.25rem; }
.prose input[type="checkbox"] { width: 1.1rem; height: 1.1rem; margin-right: 0.5rem; vertical-align: -0.15em; accent-color: var(--accent-ink); }
.prose img { max-width: 100%; height: auto; }
.prose hr { border: 0; border-top: 2px dashed var(--rule); margin: 2.5rem 0; }

/* Syntax highlighting (highlight.php, server side): warm colours on the
   dark code block, readable in light and dark mode. */
.prose .hljs-comment, .prose .hljs-quote { color: #a39a8b; font-style: italic; }
.prose .hljs-keyword, .prose .hljs-selector-tag, .prose .hljs-literal, .prose .hljs-built_in, .prose .hljs-type { color: #f2a65a; }
.prose .hljs-string, .prose .hljs-regexp, .prose .hljs-addition, .prose .hljs-template-variable { color: #a8dba8; }
.prose .hljs-number, .prose .hljs-symbol, .prose .hljs-bullet { color: #f5d76e; }
.prose .hljs-title, .prose .hljs-function .hljs-title, .prose .hljs-section, .prose .hljs-name { color: #8ec5ff; }
.prose .hljs-variable, .prose .hljs-params, .prose .hljs-attr, .prose .hljs-attribute { color: #f4c2c2; }
.prose .hljs-meta, .prose .hljs-meta .hljs-keyword, .prose .hljs-doctag, .prose .hljs-tag { color: #c9b6ff; }
.prose .hljs-deletion { color: #ff9b9b; }
.prose .hljs-emphasis { font-style: italic; }
.prose .hljs-strong { font-weight: 700; }

/* Videos: a sticky note with a play mark until the video exists. */

.video { margin: 2rem 0; }
.video-placeholder {
    position: relative;
    background: var(--note-yellow);
    color: var(--note-ink);
    padding: 1.25rem 1.5rem 1.25rem 5.5rem;
    min-height: 5.5rem;
    box-shadow: var(--shadow);
}
.video-placeholder::before {
    content: "";
    position: absolute;
    left: 1.4rem;
    top: 1.25rem;
    width: 3rem;
    height: 3rem;
    border: 2px solid var(--note-ink);
    border-radius: 50%;
    background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%231f1d1a' stroke-width='2' stroke-linejoin='round'%3E%3Cpolygon points='9 6 18 12 9 18 9 6'/%3E%3C/svg%3E") no-repeat center / 1.3rem;
}
.video-placeholder figcaption { display: flex; flex-direction: column; gap: 0.1rem; }
.video-placeholder figcaption strong { font-family: var(--font-hand); font-size: 1.7rem; line-height: 1.1; }
.video-placeholder figcaption span { font-size: 0.9rem; }
.video-placeholder p { margin: 0.5rem 0 0; font-size: 1rem; }
.video-frame { position: relative; aspect-ratio: 16 / 9; background: #000; border-radius: 6px; overflow: hidden; border: 2px solid var(--ink); }
.video-frame iframe { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; }
.video-embed figcaption { color: var(--muted); font-size: 0.9rem; margin-top: 0.4rem; }
.video-play {
    position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center;
    gap: 0.6rem; padding: 1.5rem; text-align: center; text-decoration: none;
    background: radial-gradient(circle at 50% 40%, #3a362f, var(--code-bg) 70%); color: var(--code-ink);
}
.video-play-button {
    width: 4.5rem; height: 4.5rem; border-radius: 50%; border: 2px solid var(--code-ink); background: var(--accent);
    box-shadow: 3px 3px 0 rgba(0, 0, 0, 0.4); transition: transform 0.12s ease;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='%23fffdf8'%3E%3Cpolygon points='9 6 18 12 9 18 9 6'/%3E%3C/svg%3E");
    background-repeat: no-repeat; background-position: 55% center; background-size: 2rem;
}
.video-play:hover .video-play-button, .video-play:focus-visible .video-play-button { transform: scale(1.06); }
.video-play:focus-visible { outline: 3px solid var(--accent); outline-offset: -3px; }
.video-play-title { font-family: var(--font-hand); font-size: 2rem; font-weight: 700; line-height: 1.1; }
.video-play-note { font-size: 0.9rem; color: var(--code-muted); }

/* Gate and notices */

.gate { padding: 0.5rem 0 1rem; }
.gate-summary { font-size: 1.25rem; }
.notice { max-width: 40rem; margin: 3.5rem auto 0; padding: clamp(1.5rem, 4vw, 3rem); }

/* Previous / next */

.pager { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 1rem; margin-top: 3.5rem; }
.pager a { flex: 1 1 14rem; display: flex; flex-direction: column; gap: 0.1rem; text-decoration: none; color: var(--ink); font-weight: 700; padding: 0.9rem 1.1rem; border-radius: 4px; background: var(--paper-2); }
.pager a:hover { text-decoration: underline; }
.pager-next { margin-left: auto; text-align: right; background: var(--accent-ink) !important; color: var(--accent-on) !important; }
.pager-dir { font-weight: 400; font-size: 0.85rem; opacity: 0.8; }

/* Setup switch and variant blocks (course.yaml variants, ::: blocks) */

.variant-switch {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.6rem 1rem;
    padding: 0.65rem clamp(1rem, 4vw, 2.5rem);
    border-bottom: 1px solid var(--rule);
    background: var(--paper);
    font-size: 0.92rem;
}
.variant-switch[hidden] { display: none; }
.variant-switch-intro { font-family: var(--font-hand); font-size: 1.4rem; line-height: 1; color: var(--muted); }
.variant-switch fieldset { display: flex; flex-wrap: wrap; gap: 0.4rem; border: 0; padding: 0; margin: 0; }
.variant-switch legend { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
.variant-switch label { position: relative; cursor: pointer; }
.variant-switch input { position: absolute; opacity: 0; inset: 0; margin: 0; cursor: pointer; }
.variant-switch label span { display: flex; align-items: center; min-height: 2.25rem; padding: 0 0.9rem; border: 1.5px solid var(--ink); border-radius: 999px; background: var(--paper); color: var(--ink); }
.variant-switch label:hover span { background: var(--paper-2); }
.variant-switch input:checked + span { background: var(--ink); color: var(--paper); font-weight: 700; }
.variant-switch input:focus-visible + span { outline: 3px solid var(--accent); outline-offset: 2px; }
.variant-notice { display: none; flex-basis: 100%; margin: 0; padding: 0.5rem 0.85rem; background: var(--note-yellow); color: var(--note-ink); box-shadow: 2px 3px 0 rgba(0, 0, 0, 0.1); }
.variant-notice a { color: inherit; font-weight: 700; }

.prose .variant { margin: 1.25rem 0; }
.prose .variant > .variant-tag {
    margin: 0 0 0.3rem;
    font-size: 0.78rem;
    font-weight: 700;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: var(--muted);
}
.prose .variant > :nth-child(2) { margin-top: 0; }
.prose .variant > :last-child { margin-bottom: 0; }

/* Copy buttons, and prompt blocks (```prompt): what to say to the agent. */

.prose .codeblock, .prose .prompt { position: relative; margin: 1.5rem 0; }
.prose .codeblock > pre { margin: 0; padding-right: 5.5rem; }
.prose button.copy {
    position: absolute;
    top: 0.55rem;
    right: 0.55rem;
    min-height: 2.1rem;
    padding: 0 0.85rem;
    font: inherit;
    font-size: 0.82rem;
    font-weight: 700;
    border: 1.5px solid var(--code-muted);
    border-radius: 999px;
    background: transparent;
    color: var(--code-ink);
    cursor: pointer;
}
.prose button.copy:hover { border-color: var(--code-ink); }
.prose button.copy.is-done { background: var(--accent); border-color: var(--accent); color: var(--accent-on); }

.prose .prompt { margin-top: 2rem; border: 1.5px solid var(--ink); border-radius: 4px; background: var(--prompt); padding: 1.35rem 6rem 1rem 1.25rem; }
.prose .prompt-label { position: absolute; top: -0.95rem; left: 1rem; margin: 0; padding: 0 0.45rem; background: var(--paper); font-family: var(--font-hand); font-size: 1.4rem; font-weight: 700; line-height: 1.2; color: var(--accent-ink); }
.prose .prompt button.copy { border-color: var(--ink); color: var(--ink); background: var(--paper); }
.prose .prompt button.copy:hover { background: var(--paper-2); }
.prose .prompt button.copy.is-done { background: var(--accent-ink); border-color: var(--accent-ink); color: var(--accent-on); }
.prose pre.prompt-text { margin: 0; padding: 0; background: none; color: var(--ink); border-radius: 0; overflow: visible; white-space: pre-wrap; font-family: var(--font-text); font-size: 1.05rem; line-height: 1.6; }

/* Wizards (```wizard): a few questions, one at a time, ending in a plan.
   Without JavaScript (.is-live missing) they read as a plain checklist. */

.prose .wizard { position: relative; margin: 2.25rem 0; padding: 1.6rem 1.5rem 1.4rem; border: 1.5px solid var(--ink); border-radius: 4px; background: var(--paper); box-shadow: var(--shadow); }
.prose .wizard::before { content: "find your starting point"; position: absolute; top: -0.95rem; left: 1rem; padding: 0 0.45rem; background: var(--paper); font-family: var(--font-hand); font-size: 1.4rem; font-weight: 700; line-height: 1.2; color: var(--accent-ink); }
.prose .wizard [hidden] { display: none !important; }
.prose .wizard-top { display: flex; align-items: center; gap: 1rem; margin-bottom: 1.1rem; }
.prose .wizard-progress { margin: 0; font-size: 0.85rem; font-weight: 700; letter-spacing: 0.04em; text-transform: uppercase; color: var(--muted); white-space: nowrap; }
.prose .wizard-bar { flex: 1; height: 0.4rem; border-radius: 999px; background: var(--paper-2); overflow: hidden; }
.prose .wizard-bar span { display: block; height: 100%; width: 0; background: var(--accent); transition: width 0.25s ease; }
.prose .wizard-form { margin: 0; }
.prose .wizard-q { border: 0; margin: 0 0 1.4rem; padding: 0; min-width: 0; }
.prose .wizard.is-live .wizard-q { margin-bottom: 0.5rem; }
.prose .wizard-ask { display: block; float: left; width: 100%; margin: 0 0 0.9rem; padding: 0; font-weight: 700; font-size: 1.3rem; line-height: 1.35; }
.prose .wizard-ask:focus { outline: none; }
.prose .wizard-ask:focus-visible { outline: 3px solid var(--accent); outline-offset: 4px; }
.prose .wizard-answers { clear: both; display: flex; flex-wrap: wrap; gap: 0.6rem; }
.prose .wizard-answer { position: relative; cursor: pointer; }
.prose .wizard-answer input { position: absolute; opacity: 0; inset: 0; margin: 0; cursor: pointer; }
.prose .wizard-answer span { display: flex; align-items: center; min-height: 3rem; padding: 0 1.2rem; border: 1.5px solid var(--ink); border-radius: 999px; background: var(--paper); font-weight: 600; }
.prose .wizard-answer:hover span { background: var(--paper-2); }
.prose .wizard-answer input:checked + span { background: var(--ink); color: var(--paper); }
.prose .wizard-answer input:focus-visible + span { outline: 3px solid var(--accent); outline-offset: 2px; }
.prose .wizard-ifs { clear: both; margin: 0; padding-left: 1.2rem; }
.prose .wizard-check { margin: 1rem 0 0; border-style: dashed; background: var(--paper); }
.prose .wizard-check summary { font-weight: 600; color: var(--accent-ink); }
.prose .wizard-check .codeblock { margin: 0.75rem 0; }
.prose .wizard-expect { margin: 0.5rem 0 0.75rem; }
.prose .wizard-check > p:last-child { margin-bottom: 0.2rem; }
.prose .wizard-nav { display: flex; justify-content: space-between; gap: 0.75rem; margin-top: 1.4rem; }
.prose .wizard-nav .button:disabled { opacity: 0.45; cursor: default; transform: none; box-shadow: 3px 3px 0 var(--ink); }

.prose .wizard.is-live .wizard-ifs { display: none; }
.prose .wizard:not(.is-live) .wizard-answers,
.prose .wizard:not(.is-live) .wizard-q[data-variant] { display: none; }
.prose .wizard:not(.is-live) .wizard-ask { font-size: 1.1rem; margin-bottom: 0.4rem; }

.prose .wizard-result-title { margin: 0 0 0.25rem; font-family: var(--font-hand); font-size: 2.2rem; font-weight: 700; line-height: 1.1; }
.prose .wizard-result-title:focus { outline: none; }
.prose .wizard-result-intro { margin: 0 0 1rem; color: var(--muted); }
.prose .wizard-plan { list-style: none; counter-reset: plan; margin: 0 0 1.25rem; padding: 0; }
.prose .wizard-plan li { counter-increment: plan; position: relative; margin: 0; padding: 0.7rem 0 0.7rem 3rem; border-top: 1px solid var(--rule); }
.prose .wizard-plan li:first-child { border-top: 0; }
.prose .wizard-plan li::before { content: counter(plan); position: absolute; left: 0; top: 0.6rem; display: flex; align-items: center; justify-content: center; width: 2rem; height: 2rem; border-radius: 50%; background: var(--accent-ink); color: var(--accent-on); font-weight: 700; font-size: 0.95rem; }
.prose .wizard-plan a { font-weight: 700; }
.prose .wizard-why { display: block; color: var(--muted); font-size: 0.95rem; }
.prose .wizard-skip { margin: 0 0 1.25rem; padding: 0.75rem 1rem; background: var(--paper-2); border-radius: 4px; }
.prose .wizard-skip p { margin: 0 0 0.3rem; font-weight: 600; }
.prose .wizard-skip ul { margin: 0; padding-left: 1.2rem; }
.prose .wizard-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 1rem; margin: 0; }

/* Small screens: the outline folds into a toggle above the page. */

@media (max-width: 60rem) {
    .reading { grid-template-columns: minmax(0, 1fr); padding-top: 1.25rem; gap: 1.25rem; }
    .route-side { position: static; max-height: none; padding: 0.75rem 1rem; background: var(--note-yellow); color: var(--note-ink); box-shadow: var(--shadow); }
    .route-side > summary { display: list-item; cursor: pointer; font-weight: 700; min-height: 2.75rem; line-height: 2.75rem; }
    .route-side:not([open]) { gap: 0; }
    .route-side .leg { transform: none; box-shadow: none; padding: 0.6rem 0.25rem; background: transparent; }
    .route-side .route-course { display: none; }
    .by, .who { display: none; }
    body { font-size: 1.0625rem; }
    .page { border-radius: 0; }
    .prose .prompt { padding: 3rem 1rem 1rem; }
    .prose .wizard { padding: 1.6rem 1rem 1.2rem; }
    .prose .wizard-answer { flex: 1 1 100%; }
}

@media (prefers-reduced-motion: reduce) {
    .button, .video-play-button { transition: none; }
    .prose .wizard-bar span { transition: none; }
}

@media print {
    body { background: #fff; }
    header.site, footer.site, .variant-switch, .route-side, .pager, button.copy { display: none !important; }
    .page { box-shadow: none; padding: 0; }
    .reading { display: block; }
}
