/* The reference pages of M6d (CDA-47, CDA-25): the glossary, the lab guide and its first-visit note, the templates and
   the role guides (the Bond Pricing Lab's reference.css, with this lab's A to Z letters, templates and role paths).
   Kept apart from app.css so the parts of the lab written in parallel do not edit one file. */

/* The glossary: search, the letters A to Z, and one entry per term. */
.glossary-search { display: flex; flex-wrap: wrap; align-items: center; gap: 0.5rem 0.75rem; margin: 0 0 0.75rem; }
.glossary-search label { font-weight: 600; }
.glossary-search input {
    flex: 1 1 14rem; max-width: 26rem; min-width: 0; padding: 0.45rem 0.6rem; font: inherit; color: var(--mud-palette-text-primary);
    background: var(--mud-palette-surface); border: 1px solid var(--mud-palette-lines-inputs); border-radius: 6px;
}
.glossary-letters { display: flex; flex-wrap: wrap; gap: 0.25rem; margin: 0 0 1rem; }
.glossary-letter {
    display: inline-flex; align-items: center; justify-content: center; min-width: 2rem; height: 2rem; padding: 0 0.3rem;
    border-radius: 6px; border: 1px solid var(--mud-palette-lines-default); font-weight: 600; text-decoration: none;
    color: var(--mud-palette-primary);
}
a.glossary-letter:hover, a.glossary-letter:focus-visible { background: var(--mud-palette-primary); color: var(--mud-palette-primary-text); }
.glossary-letter.is-empty { color: var(--mud-palette-text-secondary); border-style: dashed; }
.glossary-group { scroll-margin-top: 80px; }
.glossary-group + .glossary-group { margin-top: 1.25rem; }
.glossary-group-letter { margin: 0 0 0.25rem; color: var(--mud-palette-primary); scroll-margin-top: 80px; }
.glossary { margin: 0; }
.glossary-entry { padding: 0.75rem 0; border-top: 1px solid var(--mud-palette-lines-default); scroll-margin-top: 80px; }
.glossary-entry:first-child { border-top: none; padding-top: 0.25rem; }
.glossary-entry:target { outline: 2px solid var(--mud-palette-primary); outline-offset: 4px; border-radius: 4px; }
.glossary-term { font-weight: 700; font-size: 1.05rem; }
.glossary-english { font-weight: 400; font-size: 0.9rem; }
.glossary-entry dd { margin: 0.2rem 0 0; }
.glossary-definition { margin: 0 0 0.35rem; line-height: 1.55; max-width: 860px; }
.glossary-links { display: flex; flex-wrap: wrap; align-items: baseline; gap: 0.2rem 0.6rem; margin: 0.15rem 0; }
.glossary-label { color: var(--mud-palette-text-secondary); }
.glossary-number { min-width: 1.4rem; text-align: center; }
/* A term stays on one line when it fits and wraps inside itself only when it is longer than the line (issue #92: a
   long Polish term pushed a 320 px phone sideways). */
.page-terms a { display: inline-block; max-width: 100%; overflow-wrap: anywhere; }

/* The lab guide (/guide): annotated screenshots, numbered markers, the path and suggested paths. */
.guide-intro { max-width: 860px; }
.guide-toc ol { margin: 0 0 1.5rem; padding-left: 1.5rem; columns: 2; column-gap: 2rem; }
.guide-toc li { margin: 0.2rem 0; break-inside: avoid; }
.guide-section { max-width: 960px; margin-bottom: 2.5rem; scroll-margin-top: 80px; }
.guide-lead { font-size: 1.05rem; line-height: 1.6; margin: 0 0 1rem; }
.guide-text p { margin: 0 0 0.75rem; line-height: 1.6; }
.guide-shot { margin: 0 0 1.25rem; }
.guide-shot-frame { position: relative; display: inline-block; max-width: 100%; border: 1px solid var(--mud-palette-lines-default); border-radius: 8px; overflow: hidden; background: var(--mud-palette-surface); }
.guide-shot-frame img { display: block; max-width: 100%; height: auto; }
.guide-pin {
    position: absolute; transform: translate(-50%, -50%); width: 1.5rem; height: 1.5rem; border-radius: 50%;
    background: #F7B955; color: #0B0E1D; font-weight: 700; font-size: 0.85rem; display: inline-flex; align-items: center;
    justify-content: center; box-shadow: 0 0 0 2px #0B0E1D;
}
.guide-callouts { list-style: none; margin: 0.75rem 0 0; padding: 0; }
.guide-callouts li { display: flex; gap: 0.5rem; align-items: flex-start; margin: 0.3rem 0; line-height: 1.5; }
.guide-pin-inline { position: static; transform: none; flex: 0 0 auto; margin-top: 0.1rem; box-shadow: none; }
.guide-path-steps { margin: 0; padding-left: 1.25rem; }
.guide-path-steps li { margin: 0.25rem 0; }
.guide-hint { display: flex; flex-wrap: wrap; align-items: center; gap: 0.5rem; margin: 0 0 1rem; padding: 0.4rem 0.75rem; border: 1px solid var(--mud-palette-lines-default); border-radius: 8px; background: var(--mud-palette-surface); }
.guide-hint-text { flex: 1 1 14rem; font-size: 0.9rem; }

/* The path: Theory, Course, Tools, Capstone as four numbered cards joined by arrows (down the page on a phone). */
.guide-path-figure { margin: 0 0 1.25rem; }
.guide-path-diagram { list-style: none; margin: 0 0 0.5rem; padding: 0; display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 1.75rem; }
.guide-stop {
    position: relative; display: flex; flex-direction: column; gap: 0.3rem; padding: 0.9rem 1rem; border-radius: 10px;
    background: #151A33; color: #E6E8EE; border: 1.5px solid #19F7D1; border-top-width: 4px;
}
.guide-stop:nth-child(2) { border-color: #7C5CFF; }
.guide-stop:nth-child(3) { border-color: #F7B955; }
.guide-stop:nth-child(4) { border-color: #3DD68C; }
.guide-stop + .guide-stop::before {
    content: "→"; position: absolute; left: -1.45rem; top: 50%; transform: translateY(-50%); color: var(--mud-palette-text-secondary);
    font-size: 1.3rem; font-weight: 700;
}
.guide-stop-number {
    display: inline-flex; align-items: center; justify-content: center; width: 1.6rem; height: 1.6rem; border-radius: 50%;
    background: #F7B955; color: #0B0E1D; font-weight: 700; font-size: 0.85rem;
}
.guide-stop .guide-stop-name { color: #E6E8EE; font-weight: 700; font-size: 1.1rem; }
.guide-stop-gives { color: #A7AEC4; font-size: 0.9rem; line-height: 1.45; }
@media (max-width: 900px) {
    .guide-path-diagram { grid-template-columns: minmax(0, 1fr); gap: 1.5rem; }
    .guide-stop + .guide-stop::before { content: "↓"; left: 50%; top: -1.35rem; transform: translateX(-50%); }
}
@media (max-width: 600px) { .guide-toc ol { columns: 1; } }

/* The templates: the seven as cards, then each in full. */
.template-card .mud-card-header-content { min-width: 0; }
.chapter-template-list { margin: 0; padding-left: 2rem; columns: 2; column-gap: 2rem; }
.chapter-template-list li { margin: 0.25rem 0; break-inside: avoid; }
@media (max-width: 900px) { .chapter-template-list { columns: 1; } }

/* The role guides: the roles as cards, and each path as four numbered steps. */
.role-cards { list-style: none; margin: 0 0 0.5rem; padding: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(15rem, 1fr)); gap: 0.75rem; }
.role-card {
    display: flex; flex-direction: column; gap: 0.25rem; height: 100%; box-sizing: border-box; padding: 0.8rem 1rem;
    border: 1px solid var(--mud-palette-lines-default); border-left: 4px solid var(--mud-palette-primary); border-radius: 8px;
    background: var(--mud-palette-surface); color: var(--mud-palette-text-primary); text-decoration: none;
}
.role-card:hover, .role-card:focus-visible { border-color: var(--mud-palette-primary); }
.role-card-name { font-weight: 700; color: var(--mud-palette-primary); text-decoration: underline; }
.role-card-who { font-size: 0.9rem; line-height: 1.45; }
.role-card-time { font-size: 0.8rem; color: var(--mud-palette-text-secondary); }
.role-guide { scroll-margin-top: 80px; }
.role-time-icon { vertical-align: middle; }
.role-path { list-style: none; margin: 0 0 1rem; padding: 0; display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 1rem; }
.role-step { border: 1px solid var(--mud-palette-lines-default); border-top: 4px solid var(--mud-palette-primary); border-radius: 8px; padding: 0.75rem 0.9rem; min-width: 0; }
.role-step-title { display: flex; align-items: center; gap: 0.5rem; margin: 0 0 0.5rem; font-weight: 700; }
.role-step-number {
    display: inline-flex; align-items: center; justify-content: center; flex: 0 0 auto; width: 1.6rem; height: 1.6rem; border-radius: 50%;
    background: var(--mud-palette-primary); color: var(--mud-palette-primary-text); font-size: 0.85rem;
}
.role-links { margin: 0; padding-left: 1.1rem; }
.role-links li { margin: 0.2rem 0; line-height: 1.4; overflow-wrap: anywhere; }
.role-templates { display: flex; flex-wrap: wrap; gap: 0.2rem 0.6rem; margin: 0.6rem 0 0; }
.role-takeaways ul { margin: 0.25rem 0 0; padding-left: 1.25rem; }
.role-takeaways li { margin: 0.2rem 0; }
@media (max-width: 1100px) { .role-path { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 600px) { .role-path { grid-template-columns: minmax(0, 1fr); } }

@media print {
    .guide-hint { display: none !important; }
    .guide-shot, .guide-path, .guide-stop, .glossary-entry, .role-step, .template-section { break-inside: avoid; }
    .glossary-entry:target { outline: none; }
    /* Long reference pages break between their parts, not inside one paper that cannot fit a page. */
    .lesson-paper:has(.glossary-group), .role-guide { break-inside: auto; }
    .guide-stop { background: #fff; color: #000; }
    .guide-stop .guide-stop-name, .guide-stop-gives { color: #000; }
    .role-path { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    /* "Print the template" on the Templates page: only the chosen template; "Print all seven": one per page. */
    body.print-one-template .templates-page > *:not(.is-printing) { display: none !important; }
    .lab-template + .lab-template { break-before: page; }
    body.print-one-template .lab-template { break-before: auto; }
}
