/* Holo Alert Training Portal — V1 stylesheet
   Brand: Instrument Sans, #171717 ink, #4294d8 blue, #45b864 green, #f46036 orange (sparingly). */

:root {
  --ink: #171717;
  --ink-2: #43474d;
  --ink-3: #6b7280;
  --line: #e4e7eb;
  --line-2: #f0f2f5;
  --bg: #ffffff;
  --bg-2: #f7f9fb;
  --surface: #ffffff;
  --header-bg: rgba(255, 255, 255, .95);
  --on-accent: #ffffff;
  --danger-ink: #a12d2d;
  --danger-line: #e3c3c3;
  --danger-bg: #fdf2f2;
  --pill-done-ink: #226b39;
  --pill-done-line: #bfe6cb;
  --pill-warn-ink: #7a5312;
  --pill-warn-line: #ecd3a3;
  --alert-note-ink: #23557f;
  --alert-note-line: #cfe3f5;
  --blue: #4294d8;
  --blue-dark: #2f76b3;
  --blue-tint: #eaf3fb;
  --green: #45b864;
  --green-tint: #ebf8ef;
  --orange: #f46036;
  --orange-tint: #fdefe9;
  --amber-tint: #fff6e5;
  --amber-line: #e0a03a;
  --radius: 12px;
  --shadow: 0 1px 2px rgba(23, 23, 23, .05), 0 6px 20px rgba(23, 23, 23, .05);
  --font: 'Instrument Sans', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
}


/* ------------------------------------------------------------ dark mode
   Applied automatically from the operating system setting, and overridden
   by the header toggle, which stores a choice on data-theme.
   Colours are tuned so text keeps an accessible contrast ratio on dark. */

:root { color-scheme: light; }
:root[data-theme="dark"] { color-scheme: dark; }
:root[data-theme="light"] { color-scheme: light; }

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    color-scheme: dark;
    --ink: #e9ecf1;
    --ink-2: #b6bcc6;
    --ink-3: #8a919c;
    --line: #2c323b;
    --line-2: #232830;
    --bg: #13161b;
    --bg-2: #1a1e25;
    --surface: #1a1e25;
    --header-bg: rgba(19, 22, 27, .95);
    --on-accent: #0d1014;
    --blue: #5aa9e6;
    --blue-dark: #8cc6f2;
    --blue-tint: #16283a;
    --green: #4fc177;
    --green-tint: #14291d;
    --orange: #f4794f;
    --orange-tint: #2f1d15;
    --amber-tint: #2b2317;
    --amber-line: #c99a45;
    --danger-ink: #f0908c;
    --danger-line: #5c3131;
    --danger-bg: #2b1818;
    --pill-done-ink: #7fd79b;
    --pill-done-line: #2c5138;
    --pill-warn-ink: #e5bc72;
    --pill-warn-line: #574526;
    --alert-note-ink: #9dcdf3;
    --alert-note-line: #2a4763;
    --shadow: 0 1px 2px rgba(0, 0, 0, .4), 0 6px 20px rgba(0, 0, 0, .35);
  }
}

:root[data-theme="dark"] {
  --ink: #e9ecf1;
  --ink-2: #b6bcc6;
  --ink-3: #8a919c;
  --line: #2c323b;
  --line-2: #232830;
  --bg: #13161b;
  --bg-2: #1a1e25;
  --surface: #1a1e25;
  --header-bg: rgba(19, 22, 27, .95);
  --on-accent: #0d1014;
  --blue: #5aa9e6;
  --blue-dark: #8cc6f2;
  --blue-tint: #16283a;
  --green: #4fc177;
  --green-tint: #14291d;
  --orange: #f4794f;
  --orange-tint: #2f1d15;
  --amber-tint: #2b2317;
  --amber-line: #c99a45;
  --danger-ink: #f0908c;
  --danger-line: #5c3131;
  --danger-bg: #2b1818;
  --pill-done-ink: #7fd79b;
  --pill-done-line: #2c5138;
  --pill-warn-ink: #e5bc72;
  --pill-warn-line: #574526;
  --alert-note-ink: #9dcdf3;
  --alert-note-line: #2a4763;
  --shadow: 0 1px 2px rgba(0, 0, 0, .4), 0 6px 20px rgba(0, 0, 0, .35);
}

/* Code blocks are already dark; lift them slightly so they read as a panel. */
:root[data-theme="dark"] pre { background: #0d1014; border: 1px solid var(--line); }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) pre { background: #0d1014; border: 1px solid var(--line); }
}

/* --------------------------------------------------------- theme toggle */

.theme-toggle {
  display: inline-flex; align-items: center; justify-content: center;
  width: 34px; height: 34px; flex: none; padding: 0;
  background: var(--bg-2); border: 1px solid var(--line); border-radius: 8px;
  color: var(--ink-2); cursor: pointer;
}
.theme-toggle:hover { background: var(--surface); color: var(--ink); border-color: var(--blue); }
.theme-toggle svg { width: 17px; height: 17px; display: block; }

/* Show the icon for the theme you would switch TO. */
.theme-toggle .icon-sun { display: none; }
.theme-toggle .icon-moon { display: block; }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .theme-toggle .icon-sun { display: block; }
  :root:not([data-theme="light"]) .theme-toggle .icon-moon { display: none; }
}
:root[data-theme="dark"] .theme-toggle .icon-sun { display: block; }
:root[data-theme="dark"] .theme-toggle .icon-moon { display: none; }
:root[data-theme="light"] .theme-toggle .icon-sun { display: none; }
:root[data-theme="light"] .theme-toggle .icon-moon { display: block; }

.login-theme-toggle { position: absolute; top: 1.25rem; right: 1.25rem; }

/* Sits at the far right on desktop; stays beside the Menu button on mobile. */
.header-inner > .theme-toggle { order: 3; }
.header-right { order: 2; }

* { box-sizing: border-box; }

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

body {
  margin: 0;
  font-family: var(--font);
  font-size: 17px;
  line-height: 1.65;
  color: var(--ink);
  background: var(--bg);
}

h1, h2, h3, h4 { line-height: 1.25; font-weight: 600; margin: 0 0 .5em; letter-spacing: -.01em; }
h1 { font-size: 2rem; margin-bottom: .4em; }
h2 { font-size: 1.35rem; margin-top: 1.8em; }
h3 { font-size: 1.1rem; margin-top: 1.4em; }
p, ul, ol { margin: 0 0 1.1em; }
li { margin-bottom: .4em; }
a { color: var(--blue-dark); text-decoration-thickness: 1px; text-underline-offset: 2px; }
a:hover { color: var(--ink); }
code {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: .87em; background: var(--bg-2); border: 1px solid var(--line);
  padding: .08em .35em; border-radius: 5px;
}
pre {
  background: #12181f; color: #e8eef5; padding: 1rem 1.1rem; border-radius: var(--radius);
  overflow-x: auto; font-size: .85rem; line-height: 1.6;
}
pre code { background: none; border: 0; color: inherit; padding: 0; }
hr { border: 0; border-top: 1px solid var(--line); margin: 2.2rem 0; }
img.md-img { max-width: 100%; height: auto; border-radius: var(--radius); }

.sr-only {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}
.skip-link {
  position: absolute; left: -9999px; top: 0; background: var(--ink); color: var(--bg);
  padding: .6rem 1rem; z-index: 100; border-radius: 0 0 8px 0;
}
.skip-link:focus { left: 0; }
:focus-visible { outline: 3px solid var(--blue); outline-offset: 2px; border-radius: 4px; }

.muted { color: var(--ink-3); }
.small { font-size: .875rem; }
.nowrap { white-space: nowrap; }
.lede { font-size: 1.08rem; color: var(--ink-2); max-width: 68ch; }
.crumb { font-size: .875rem; color: var(--ink-3); margin-bottom: .6rem; }

/* ------------------------------------------------------------- header */

.site-header {
  border-bottom: 1px solid var(--line);
  background: var(--header-bg);
  backdrop-filter: saturate(140%) blur(6px);
  position: sticky; top: 0; z-index: 40;
}
.header-inner {
  max-width: 1240px; margin: 0 auto; padding: .7rem 1.5rem;
  display: flex; align-items: center; gap: 1.25rem; flex-wrap: wrap;
}
.brand { display: flex; align-items: center; gap: .6rem; text-decoration: none; color: var(--ink); }
.brand-text { display: flex; flex-direction: column; font-weight: 600; line-height: 1.15; }
.brand-text em { font-style: normal; font-size: .74rem; color: var(--ink-3); font-weight: 500; letter-spacing: .02em; }
.logo-mark { flex: none; }

.header-right { display: flex; align-items: center; gap: 1.1rem; margin-left: auto; flex-wrap: wrap; }
.mainnav { display: flex; gap: .2rem; flex-wrap: wrap; }
.mainnav a {
  padding: .4rem .7rem; border-radius: 8px; text-decoration: none;
  color: var(--ink-2); font-size: .92rem; font-weight: 500; white-space: nowrap;
}
.mainnav a:hover { background: var(--bg-2); color: var(--ink); }
.mainnav a.active { background: var(--blue-tint); color: var(--blue-dark); }

.searchbox input {
  width: 170px; padding: .42rem .7rem; border: 1px solid var(--line);
  border-radius: 8px; font: inherit; font-size: .9rem; background: var(--bg-2);
}
.searchbox input:focus { background: var(--surface); }

.user-chip { display: flex; align-items: center; gap: .55rem; font-size: .85rem; color: var(--ink-3); }
.link-btn {
  background: none; border: 0; padding: 0; font: inherit; font-size: .85rem;
  color: var(--blue-dark); cursor: pointer; text-decoration: underline;
}
.nav-toggle {
  display: none; margin-left: auto; background: var(--bg-2); border: 1px solid var(--line);
  border-radius: 8px; padding: .4rem .8rem; font: inherit; font-size: .9rem; cursor: pointer;
}

main { max-width: 880px; margin: 0 auto; padding: 2.5rem 1.5rem 4rem; }
main.wide { max-width: 1240px; }

.site-footer {
  border-top: 1px solid var(--line); padding: 1.6rem 1.5rem 2.5rem;
  text-align: center; font-size: .82rem; color: var(--ink-3);
}
.site-footer p { margin: .2rem 0; }

/* -------------------------------------------------------------- login */

.login-body {
  min-height: 100vh; display: flex; align-items: center; justify-content: center;
  background: var(--bg-2); padding: 2rem 1.25rem;
}
.login-card {
  background: var(--surface); border: 1px solid var(--line); border-radius: 16px;
  box-shadow: var(--shadow); padding: 2.25rem; width: 100%; max-width: 420px;
}
.login-brand { display: flex; align-items: center; gap: .8rem; margin-bottom: 1.75rem; }
.login-brand strong { display: block; font-size: 1.05rem; }
.login-brand span { display: block; font-size: .8rem; color: var(--ink-3); }
.login-card h1 { font-size: 1.5rem; }
.login-card label { display: block; font-size: .88rem; font-weight: 500; margin: 1rem 0 .35rem; }
.login-card input {
  width: 100%; padding: .7rem .85rem; border: 1px solid var(--line);
  border-radius: 9px; font: inherit; background: var(--surface); color: var(--ink);
}
.login-help { margin: 1.25rem 0 0; font-size: .82rem; }

/* ------------------------------------------------------------ buttons */

.btn {
  display: inline-flex; align-items: center; gap: .4rem; justify-content: center;
  padding: .62rem 1.15rem; border-radius: 9px; border: 1px solid transparent;
  font: inherit; font-size: .94rem; font-weight: 500; cursor: pointer;
  text-decoration: none; transition: background-color .12s ease, border-color .12s ease;
}
.btn-primary { background: var(--blue); color: var(--on-accent); }
.btn-primary:hover { background: var(--blue-dark); color: var(--on-accent); }
.btn-quiet { background: var(--surface); border-color: var(--line); color: var(--ink); }
.btn-quiet:hover { background: var(--bg-2); color: var(--ink); }
.btn-danger { background: var(--surface); border-color: var(--danger-line); color: var(--danger-ink); }
.btn-danger:hover { background: var(--danger-bg); color: var(--danger-ink); }
.btn-block { width: 100%; margin-top: 1.5rem; }
.btn.small { padding: .32rem .7rem; font-size: .82rem; }

/* -------------------------------------------------------- components */

.alert { padding: .8rem 1rem; border-radius: 9px; margin: 1rem 0; font-size: .92rem; }
.alert-error { background: var(--danger-bg); border: 1px solid var(--danger-line); color: var(--danger-ink); }
.alert-note { background: var(--blue-tint); border: 1px solid var(--alert-note-line); color: var(--alert-note-ink); }

.pill {
  display: inline-block; padding: .12rem .6rem; border-radius: 999px;
  font-size: .78rem; font-weight: 500; background: var(--bg-2);
  border: 1px solid var(--line); color: var(--ink-2); white-space: nowrap;
}
.pill-done { background: var(--green-tint); border-color: var(--pill-done-line); color: var(--pill-done-ink); }
.pill-warn { background: var(--amber-tint); border-color: var(--pill-warn-line); color: var(--pill-warn-ink); }
.pill.small { font-size: .72rem; }

.panel {
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 1.4rem 1.5rem; margin: 1.5rem 0;
}
.panel h2 { margin-top: 0; font-size: 1.15rem; }
.panel > :last-child { margin-bottom: 0; }
.panel-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 1.25rem; margin: 2rem 0; }
.panel-row .panel { margin: 0; }
.section-title { margin-top: 2.5rem; }

.bar { display: block; height: 7px; background: var(--line-2); border-radius: 99px; overflow: hidden; margin: .6rem 0; }
.bar span { display: block; height: 100%; width: 0; background: var(--blue); border-radius: 99px; transition: width .25s ease; }

/* Fill widths as classes, because the Content-Security-Policy blocks inline styles. */
.bar .fill-0   { width: 0; }
.bar .fill-5   { width: 5%; }
.bar .fill-10  { width: 10%; }
.bar .fill-15  { width: 15%; }
.bar .fill-20  { width: 20%; }
.bar .fill-25  { width: 25%; }
.bar .fill-30  { width: 30%; }
.bar .fill-35  { width: 35%; }
.bar .fill-40  { width: 40%; }
.bar .fill-45  { width: 45%; }
.bar .fill-50  { width: 50%; }
.bar .fill-55  { width: 55%; }
.bar .fill-60  { width: 60%; }
.bar .fill-65  { width: 65%; }
.bar .fill-70  { width: 70%; }
.bar .fill-75  { width: 75%; }
.bar .fill-80  { width: 80%; }
.bar .fill-85  { width: 85%; }
.bar .fill-90  { width: 90%; }
.bar .fill-95  { width: 95%; }
.bar .fill-100 { width: 100%; background: var(--green); }

.callout {
  border: 1px solid var(--line); border-left: 4px solid var(--blue);
  background: var(--blue-tint); border-radius: 10px; padding: 1rem 1.2rem; margin: 1.4rem 0;
}
.callout > :last-child { margin-bottom: 0; }
.callout-title { font-weight: 600; margin-bottom: .35rem; }
.callout-note { border-left-color: var(--blue); background: var(--blue-tint); }
.callout-warning { border-left-color: var(--amber-line); background: var(--amber-tint); }
.callout-danger { border-left-color: var(--orange); background: var(--orange-tint); }
.callout-success { border-left-color: var(--green); background: var(--green-tint); }

.info-required {
  display: inline-block; background: var(--amber-tint); border: 1px dashed var(--amber-line);
  color: var(--pill-warn-ink); padding: .1rem .5rem; border-radius: 6px; font-size: .88em;
}
.info-required strong { font-weight: 600; letter-spacing: .02em; font-size: .82em; text-transform: uppercase; margin-right: .3rem; }

blockquote {
  margin: 1.4rem 0; padding: .3rem 0 .3rem 1.2rem;
  border-left: 3px solid var(--line); color: var(--ink-2);
}

.table-wrap { overflow-x: auto; margin: 1.4rem 0; border: 1px solid var(--line); border-radius: var(--radius); }
table { border-collapse: collapse; width: 100%; font-size: .92rem; background: var(--surface); }
th, td { text-align: left; padding: .7rem .9rem; border-bottom: 1px solid var(--line); vertical-align: top; }
th { background: var(--bg-2); font-weight: 600; font-size: .85rem; white-space: nowrap; }
tbody tr:last-child td { border-bottom: 0; }

/* ---------------------------------------------------------- dashboard */

.hero {
  display: grid; grid-template-columns: 1.1fr 1fr; gap: 2.5rem; align-items: start;
  padding-bottom: 2rem; border-bottom: 1px solid var(--line);
}
.stat-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 1rem; }
.stat {
  background: var(--bg-2); border: 1px solid var(--line);
  border-radius: var(--radius); padding: .9rem 1rem;
}
.stat-num { display: block; font-size: 1.5rem; font-weight: 600; line-height: 1.2; }
.stat-label { display: block; font-size: .8rem; color: var(--ink-3); }

.module-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(270px, 1fr)); gap: 1.1rem; }
.module-card {
  display: block; text-decoration: none; color: inherit; background: var(--surface);
  border: 1px solid var(--line); border-radius: var(--radius); padding: 1.2rem;
  transition: border-color .12s ease, box-shadow .12s ease;
}
.module-card:hover { border-color: var(--blue); box-shadow: var(--shadow); color: inherit; }
.module-card.is-done { background: var(--green-tint); border-color: var(--pill-done-line); }
.module-card-top { display: flex; justify-content: space-between; align-items: center; margin-bottom: .5rem; }
.module-card h3 { margin: 0 0 .3rem; font-size: 1.03rem; }
.module-card p { font-size: .87rem; margin-bottom: .6rem; }
.module-number {
  font-size: .72rem; font-weight: 600; letter-spacing: .06em;
  text-transform: uppercase; color: var(--blue-dark);
}

/* ------------------------------------------------------------ modules */

.module-block { padding: 1.5rem 0; border-bottom: 1px solid var(--line); }
.module-block-head { display: flex; justify-content: space-between; align-items: baseline; gap: 1rem; }
.module-block h2 { margin: 0; font-size: 1.25rem; }
.lesson-list { list-style: none; padding: 0; margin: .8rem 0 0; }
.lesson-list li { display: flex; justify-content: space-between; gap: 1rem; padding: .35rem 0; border-bottom: 1px solid var(--line-2); }
.lesson-list li a { display: flex; gap: .6rem; text-decoration: none; color: var(--ink); }
.lesson-list li a:hover { color: var(--blue-dark); }
.lesson-list li.done a { color: var(--ink-3); }
.tick { display: inline-block; width: 1em; color: var(--green); font-weight: 700; }

.lesson-rows { display: flex; flex-direction: column; gap: .5rem; margin-top: 1.2rem; }
.lesson-row {
  display: flex; align-items: center; gap: 1rem; padding: .9rem 1.1rem;
  border: 1px solid var(--line); border-radius: var(--radius);
  text-decoration: none; color: inherit; background: var(--surface);
}
.lesson-row:hover { border-color: var(--blue); color: inherit; }
.lesson-row.done { background: var(--bg-2); }
.lesson-num {
  flex: none; width: 28px; height: 28px; border-radius: 50%;
  background: var(--blue-tint); color: var(--blue-dark);
  display: grid; place-items: center; font-size: .8rem; font-weight: 600;
}
.lesson-main { display: flex; flex-direction: column; flex: 1; min-width: 0; }
.lesson-meta { display: flex; align-items: center; gap: .5rem; flex: none; }

/* ------------------------------------------------------------- lesson */

.lesson-layout { display: grid; grid-template-columns: 250px 1fr; gap: 2.5rem; align-items: start; }
/* Grid items default to min-width:auto, so a wide child — a photo carousel, a
   long table, a code block — stretches its column and gives the whole page
   horizontal scroll on a phone. This lets the columns shrink properly. */
.lesson-layout > * { min-width: 0; }
.lesson-side { position: sticky; top: 90px; }
.side-details summary { cursor: pointer; font-weight: 600; font-size: .95rem; padding: .4rem 0; }
.side-lessons { list-style: none; padding: 0; margin: .6rem 0; }
.side-lessons li { margin: 0; }
.side-lessons a {
  display: flex; gap: .4rem; padding: .38rem .6rem; border-radius: 7px;
  font-size: .88rem; text-decoration: none; color: var(--ink-2); line-height: 1.35;
}
.side-lessons a:hover { background: var(--bg-2); }
.side-lessons li.current > a { background: var(--blue-tint); color: var(--blue-dark); font-weight: 500; }
.side-lessons li.done > a { color: var(--ink-3); }

.lesson { max-width: 74ch; }
.lesson-body h2 { margin-top: 2.2rem; padding-top: .2rem; }
.lesson-body h3 { margin-top: 1.8rem; }
.lesson-section { margin-top: 2.5rem; }
.lesson-finish { margin-top: 2.5rem; background: var(--bg-2); }
.complete-toggle { display: flex; align-items: center; gap: .6rem; font-weight: 500; cursor: pointer; }
.complete-toggle input { width: 20px; height: 20px; accent-color: var(--green); cursor: pointer; }
.complete-status { margin: .4rem 0 0; }
.lesson-nav { display: flex; justify-content: space-between; gap: 1rem; margin-top: 1.6rem; flex-wrap: wrap; }

/* -------------------------------------------------------------- video */

.video { margin: 0 0 1.5rem; }
.video-frame {
  position: relative; padding-top: 56.25%; background: #12181f;
  border-radius: var(--radius); overflow: hidden;
}
.video-frame iframe { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; }
.video figcaption { font-size: .88rem; margin-top: .6rem; }
.video details { margin-top: .5rem; }
.video summary { cursor: pointer; color: var(--blue-dark); font-size: .88rem; }
.video-panel { padding: 1.2rem; }

/* ----------------------------------------------------------- resources */

.filter-form { display: flex; gap: .6rem; margin: 1.5rem 0; flex-wrap: wrap; }
.filter-form input[type="search"] {
  flex: 1; min-width: 220px; padding: .65rem .9rem;
  border: 1px solid var(--line); border-radius: 9px; font: inherit;
}
.chip-row { display: flex; flex-wrap: wrap; gap: .45rem; margin-bottom: 2rem; }
.chip {
  display: inline-block; padding: .28rem .75rem; border-radius: 999px;
  border: 1px solid var(--line); background: var(--bg-2);
  font-size: .82rem; text-decoration: none; color: var(--ink-2);
}
.chip:hover { border-color: var(--blue); color: var(--blue-dark); }
.resource-cat { margin-bottom: 2.5rem; }
.resource-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 1rem; }
.resource {
  border: 1px solid var(--line); border-radius: var(--radius);
  padding: 1.1rem 1.2rem; background: var(--surface);
}
.resource-head { display: flex; justify-content: space-between; gap: .6rem; align-items: start; }
.resource h3 { margin: 0 0 .3rem; font-size: 1rem; }
.resource p { font-size: .88rem; margin-bottom: .5rem; }
.resource-actions { display: flex; gap: .5rem; flex-wrap: wrap; margin-top: .7rem; }

.search-results { list-style: none; padding: 0; }
.search-results li { padding: .8rem 0; border-bottom: 1px solid var(--line-2); }
.search-results a { text-decoration: none; }
.search-results p { margin: .25rem 0 0; color: var(--ink-3); }

/* ---------------------------------------------------------- checklist */

.checklist { list-style: none; padding: 0; }
.checklist li { padding: .5rem 0; border-bottom: 1px solid var(--line-2); }
.checklist li:last-child { border-bottom: 0; }
.checklist label { display: flex; gap: .7rem; align-items: flex-start; cursor: pointer; }
.checklist input { margin-top: .35rem; width: 19px; height: 19px; accent-color: var(--green); flex: none; cursor: pointer; }
.item-note { margin: .1rem 0 0 1.7rem; }

/* --------------------------------------------------------------- quiz */

.quiz { margin-top: 2.5rem; }
.quiz .question {
  border: 1px solid var(--line); border-radius: var(--radius);
  padding: 1.1rem 1.3rem; margin: 0 0 1rem;
}
.quiz legend { font-weight: 500; padding: 0 .3rem; }
.qnum { color: var(--blue-dark); font-weight: 600; }
.options { display: flex; flex-direction: column; gap: .1rem; margin-top: .7rem; }
.option {
  display: flex; gap: .65rem; align-items: flex-start;
  padding: .5rem .6rem; border-radius: 8px; cursor: pointer;
}
.option:hover { background: var(--bg-2); }
.option input { margin-top: .35rem; accent-color: var(--blue); flex: none; }
.question.correct { border-color: var(--pill-done-line); background: var(--green-tint); }
.question.incorrect { border-color: var(--pill-warn-line); background: var(--amber-tint); }
.feedback { margin-top: .7rem; font-size: .88rem; padding-top: .6rem; border-top: 1px solid rgba(0,0,0,.07); }
.feedback strong { font-weight: 600; }
.quiz-actions { display: flex; gap: .7rem; margin-top: 1.2rem; flex-wrap: wrap; }
.quiz-result { margin-top: 1.2rem; padding: 1rem 1.2rem; border-radius: var(--radius); font-weight: 500; }
.quiz-result.pass { background: var(--green-tint); border: 1px solid var(--pill-done-line); color: var(--pill-done-ink); }
.quiz-result.fail { background: var(--amber-tint); border: 1px solid var(--pill-warn-line); color: var(--pill-warn-ink); }
.quiz-previous { font-size: .9rem; }

/* -------------------------------------------------------------- admin */

.admin-table td { font-size: .85rem; }
.admin-table .bar { margin: .3rem 0 0; }
.inline-form { display: flex; flex-direction: column; gap: .3rem; margin-bottom: .5rem; }
.inline-form input[type="text"] {
  padding: .3rem .5rem; border: 1px solid var(--line);
  border-radius: 6px; font: inherit; font-size: .8rem; min-width: 150px;
}

/* --------------------------------------------------------- responsive */

@media (max-width: 900px) {
  .lesson-layout { grid-template-columns: 1fr; gap: 1.2rem; }
  .lesson-side { position: static; }
  .side-details { border: 1px solid var(--line); border-radius: var(--radius); padding: .7rem 1rem; background: var(--bg-2); }
  .hero { grid-template-columns: 1fr; gap: 1.75rem; }
}

@media (max-width: 760px) {
  body { font-size: 16px; }
  h1 { font-size: 1.6rem; }
  main { padding: 1.75rem 1.15rem 3rem; }
  .nav-toggle { display: block; margin-left: .5rem; order: 2; }
  .header-inner > .theme-toggle { order: 1; margin-left: auto; }
  .header-right { order: 3; }
  .header-right {
    display: none; width: 100%; flex-direction: column;
    align-items: stretch; gap: .8rem; padding-top: .8rem;
  }
  .header-right.open { display: flex; }
  .mainnav { flex-direction: column; }
  .mainnav a { padding: .55rem .7rem; }
  .searchbox input { width: 100%; }
  .user-chip { justify-content: space-between; border-top: 1px solid var(--line); padding-top: .7rem; }
  .stat-grid { grid-template-columns: repeat(2, 1fr); }
  .panel { padding: 1.15rem 1.15rem; }
  .lesson-row { flex-wrap: wrap; }
  .lesson-meta { width: 100%; padding-left: 44px; }
}

@media print {
  .site-header, .site-footer, .lesson-side, .quiz-actions, .lesson-nav, .skip-link { display: none; }
  body { font-size: 12pt; }
  a { color: inherit; text-decoration: none; }
}

/* ---- call recordings ---------------------------------------------------- */
.recording {
  margin: 0 0 1.25rem;
  padding: 1rem 1.1rem;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--surface-2, transparent);
}
.recording-head { margin-bottom: .65rem; }
.recording-head p { margin: .3rem 0 0; }
.recording audio { width: 100%; display: block; }
.recording details { margin-top: .75rem; }

/* ---- product photography in lessons -------------------------------------
   Overrides the generic img.md-img rule above, so it must match that rule's
   specificity (element + class) or it will be ignored. */
img.md-img {
  display: block;
  max-width: 300px;
  width: 100%;
  height: auto;
  margin: 1.25rem auto;
  border-radius: 12px;
}

/* ---- admin: releasing modules to trainees ------------------------------- */
.module-toggles {
  display: grid;
  gap: .5rem;
  margin: 1rem 0;
}
.module-toggle {
  display: flex;
  align-items: flex-start;
  gap: .75rem;
  padding: .7rem .85rem;
  border: 1px solid var(--border);
  border-radius: 10px;
  cursor: pointer;
}
.module-toggle input { margin-top: .25rem; flex: none; }
.module-toggle-body { display: flex; flex-direction: column; gap: .15rem; }
.module-toggle.is-on { border-color: var(--brand, #4294d8); }

/* ---- product photo carousel ---------------------------------------------
   min-width:0 on the flex/scroll containers matters: without it a flex item
   refuses to shrink below its content width, and the whole page picks up a
   few pixels of horizontal scroll on a phone. */
.gallery { margin: 0 0 1.75rem; min-width: 0; max-width: 100%; }

.gallery-frame { position: relative; min-width: 0; }

.gallery-track {
  display: flex;
  gap: .75rem;
  overflow-x: auto;
  scroll-snap-type: x mandatory;
  scroll-behavior: smooth;
  border-radius: 14px;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
  min-width: 0;
  max-width: 100%;
}
.gallery-track::-webkit-scrollbar { display: none; }
.gallery-track:focus-visible { outline: 2px solid var(--brand, #4294d8); outline-offset: 3px; }

.gallery-slide {
  flex: 0 0 100%;
  min-width: 0;
  scroll-snap-align: center;
  margin: 0;
}
.gallery-slide img {
  display: block;
  width: 100%;
  aspect-ratio: 3 / 2;
  object-fit: cover;
  border-radius: 14px;
  background: #f4f4f5;
}
/* The product shots are square with a plain background — show them whole
   rather than cropping the device out of frame. */
.gallery-slide img[src$=".png"] { object-fit: contain; }

.gallery-slide figcaption {
  margin-top: .6rem;
  font-size: .92rem;
  line-height: 1.5;
  color: var(--muted, #666);
}

.gallery-arrow {
  position: absolute;
  top: calc(50% - 1.5rem);
  transform: translateY(-50%);
  width: 2.5rem; height: 2.5rem;
  display: grid; place-items: center;
  border: none;
  border-radius: 50%;
  background: rgba(0,0,0,.55);
  color: #fff;
  cursor: pointer;
}
.gallery-arrow svg { width: 1.25rem; height: 1.25rem; }
.gallery-arrow:hover:not(:disabled) { background: rgba(0,0,0,.75); }
.gallery-arrow:disabled { opacity: 0; pointer-events: none; }
.gallery-prev { left: .6rem; }
.gallery-next { right: .6rem; }

.gallery-thumbs {
  display: flex;
  gap: .5rem;
  margin-top: .75rem;
  overflow-x: auto;
  scrollbar-width: none;
  min-width: 0;
  max-width: 100%;
}
.gallery-thumbs::-webkit-scrollbar { display: none; }
.gallery-thumb {
  flex: 0 0 auto;
  width: 4.25rem; height: 3.25rem;
  padding: 0;
  border: 2px solid transparent;
  border-radius: 8px;
  background: #f4f4f5;
  cursor: pointer;
  overflow: hidden;
  opacity: .6;
}
.gallery-thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.gallery-thumb.is-current { border-color: var(--brand, #4294d8); opacity: 1; }
.gallery-thumb:hover { opacity: 1; }

.gallery-count { margin: .5rem 0 0; }

@media (max-width: 34rem) {
  .gallery-thumb { width: 3.25rem; height: 2.5rem; }
}
