/* ==========================================================================
   Yarra e-bike fleet induction web app
   Shared stylesheet. Mobile-first, dependency-free, print-friendly.
   ========================================================================== */

:root {
  --brand-900: #0d3d29;
  --brand-800: #10502f;
  --brand: #145c3e;
  --brand-600: #1f7a4d;
  --brand-100: #e3f2ea;
  --accent: #f5c518;
  --accent-ink: #4a3a00;
  --ink: #17211c;
  --muted: #5b6b64;
  --line: #d9e2dd;
  --bg: #f3f6f4;
  --card: #ffffff;
  --ok: #14794f;
  --ok-bg: #e3f2ea;
  --warn: #9a6b00;
  --warn-bg: #fdf4d8;
  --danger: #b3261e;
  --danger-bg: #fbe6e4;
  --info-bg: #e8f1fb;
  --info-line: #c7ddf5;
  --radius: 14px;
  --radius-sm: 9px;
  --shadow: 0 1px 2px rgba(16, 33, 25, .06), 0 6px 20px rgba(16, 33, 25, .07);
  --shadow-sm: 0 1px 2px rgba(16, 33, 25, .08);
  --maxw: 960px;
  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}

@media (prefers-color-scheme: dark) {
  :root {
    --ink: #eaf1ed;
    --muted: #a4b3ac;
    --line: #2b3a32;
    --bg: #0f1613;
    --card: #17211c;
    --brand-100: #14301f;
    --ok-bg: #14301f;
    --warn-bg: #33290a;
    --danger-bg: #3a1a17;
    --info-bg: #14283a;
    --info-line: #24435f;
    --shadow: 0 1px 2px rgba(0, 0, 0, .4), 0 8px 24px rgba(0, 0, 0, .45);
    --shadow-sm: 0 1px 2px rgba(0, 0, 0, .4);
  }
}

* { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }

body {
  margin: 0;
  font-family: var(--font);
  color: var(--ink);
  background: var(--bg);
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
}

img { max-width: 100%; height: auto; display: block; }

a { color: var(--brand-600); }
@media (prefers-color-scheme: dark) { a { color: #6fd3a1; } }

h1, h2, h3, h4 { line-height: 1.2; margin: 0 0 .4em; font-weight: 700; }
h1 { font-size: clamp(1.6rem, 4.4vw, 2.2rem); }
h2 { font-size: clamp(1.3rem, 3.4vw, 1.65rem); }
h3 { font-size: 1.12rem; }
p { margin: 0 0 1em; }
small { color: var(--muted); }

/* ---- layout ------------------------------------------------------------ */
.wrap { max-width: var(--maxw); margin: 0 auto; padding: 0 16px; }
.wrap-narrow { max-width: 720px; }
.section { padding-top: 28px; padding-bottom: 28px; }
.stack > * + * { margin-top: 1rem; }
.grid { display: grid; gap: 16px; }
@media (min-width: 640px) { .grid-2 { grid-template-columns: 1fr 1fr; } .grid-3 { grid-template-columns: repeat(3, 1fr); } }
.row { display: flex; gap: 12px; flex-wrap: wrap; align-items: center; }
.spread { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; }
.center { text-align: center; }
.muted { color: var(--muted); }
.hide { display: none !important; }

/* ---- header / nav ------------------------------------------------------ */
.site-header {
  position: sticky; top: 0; z-index: 40;
  background: var(--brand);
  color: #fff;
  box-shadow: var(--shadow-sm);
}
.site-header .wrap { display: flex; align-items: center; gap: 14px; min-height: 60px; }
.brand { display: flex; align-items: center; gap: 12px; color: #fff; text-decoration: none; font-weight: 700; }
.brand-text { font-size: 1rem; letter-spacing: .2px; line-height: 1.15; }
.brand-text small { display: block; font-weight: 400; font-size: .7rem; opacity: .85; letter-spacing: .3px; color: #fff; }
.council-mark { display: flex; align-items: center; padding-left: 12px; margin-left: 2px; border-left: 1px solid rgba(255, 255, 255, .3); }
.council-mark img { height: 30px; width: auto; display: block; filter: brightness(0) invert(1); opacity: .92; }
.logo-chip { flex: none; display: inline-grid; place-items: center; background: #fff; border-radius: 10px; padding: 4px; box-shadow: 0 1px 2px rgba(0, 0, 0, .18); }
.logo-chip img { display: block; height: 36px; width: 36px; }
.logo-chip-lg { padding: 6px; border-radius: 12px; }
.logo-chip-lg img { height: 60px; width: 60px; }
.site-header nav { margin-left: auto; display: flex; gap: 4px; overflow-x: auto; }
.site-header nav a {
  color: #eaf3ee; text-decoration: none; padding: 8px 12px; border-radius: 4px;
  font-size: .9rem; white-space: nowrap;
}
.site-header nav a:hover { background: rgba(255, 255, 255, .12); }
.site-header nav a[aria-current="page"] { background: #fff; color: var(--brand-900); font-weight: 600; }

@media (max-width: 560px) {
  .site-header .wrap { flex-wrap: wrap; padding-top: 8px; padding-bottom: 8px; }
  .brand { width: 100%; }
  .brand .logo-chip img { height: 32px; width: 32px; }
  .brand-text { font-size: .95rem; }
  .council-mark img { height: 26px; }
  .site-header nav { margin-left: 0; width: 100%; padding-bottom: 2px; }
  .site-header nav a { padding: 8px 10px; font-size: .88rem; }
  .lesson { scroll-margin-top: 112px; }
}

/* ---- hero -------------------------------------------------------------- */
.hero { background: linear-gradient(160deg, var(--brand-900), var(--brand-600)); color: #fff; padding: 40px 0 44px; }
.hero h1 { color: #fff; max-width: 18ch; }
.hero p { color: #d8ebe1; max-width: 56ch; font-size: 1.05rem; }
.hero .badge { background: rgba(255, 255, 255, .16); color: #fff; }
.hero-actions { display: flex; gap: 10px; flex-wrap: wrap; margin-top: 18px; }

/* ---- buttons ----------------------------------------------------------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  font: inherit; font-weight: 600; line-height: 1;
  padding: 12px 18px; border-radius: 4px; border: 1px solid transparent;
  background: var(--brand); color: #fff; cursor: pointer; text-decoration: none;
  transition: transform .06s ease, background .15s ease, box-shadow .15s ease;
}
.btn:hover { background: var(--brand-800); }
.btn:active { transform: translateY(1px); }
.btn[disabled] { opacity: .5; cursor: not-allowed; }
.btn-primary { background: var(--accent); color: var(--accent-ink); }
.btn-primary:hover { background: #e6b800; }
.btn-ghost { background: transparent; color: var(--brand-600); border-color: var(--line); }
.btn-ghost:hover { background: var(--brand-100); }
.site-header .btn-ghost, .hero .btn-ghost { color: #fff; border-color: rgba(255,255,255,.5); }
.site-header .btn-ghost:hover, .hero .btn-ghost:hover { background: rgba(255,255,255,.14); }
.btn-danger { background: transparent; color: var(--danger); border-color: var(--line); }
.btn-sm { padding: 8px 14px; font-size: .85rem; }
.btn-block { width: 100%; }

/* ---- cards ------------------------------------------------------------- */
.card {
  background: var(--card); border: 1px solid var(--line);
  border-radius: var(--radius); padding: 20px; box-shadow: var(--shadow-sm);
}
.card-link { text-decoration: none; color: inherit; display: block; transition: transform .12s ease, box-shadow .12s ease, border-color .12s ease; }
.card-link:hover { transform: translateY(-2px); box-shadow: var(--shadow); border-color: var(--brand-600); }
.card h3 { display: flex; align-items: center; gap: 10px; }
.card .ico { font-size: 1.5rem; }

/* ---- badges / pills ---------------------------------------------------- */
.badge {
  display: inline-block; padding: 3px 10px; border-radius: 4px;
  font-size: .74rem; font-weight: 700; letter-spacing: .3px; text-transform: uppercase;
  background: var(--brand-100); color: var(--brand-600);
}
.badge-ok { background: var(--ok-bg); color: var(--ok); }
.badge-warn { background: var(--warn-bg); color: var(--warn); }
.badge-danger { background: var(--danger-bg); color: var(--danger); }

/* ---- progress ---------------------------------------------------------- */
.progress { height: 10px; background: var(--line); border-radius: 999px; overflow: hidden; }
.progress > span { display: block; height: 100%; background: var(--brand-600); width: 0; transition: width .3s ease; }
.progress-label { font-size: .85rem; color: var(--muted); margin-top: 6px; }

/* ---- callouts ---------------------------------------------------------- */
.callout { border: 1px solid var(--line); border-left: 5px solid var(--brand-600); background: var(--card); border-radius: var(--radius-sm); padding: 14px 16px; }
.callout-warn { border-left-color: var(--warn); background: var(--warn-bg); }
.callout-danger { border-left-color: var(--danger); background: var(--danger-bg); }
.callout-info { border-left-color: #3b82c4; background: var(--info-bg); }
.callout h4 { margin: 0 0 4px; }
.callout p:last-child { margin-bottom: 0; }

/* ---- checklist --------------------------------------------------------- */
.check-group { margin-bottom: 20px; }
.check-group > header { display: flex; align-items: baseline; gap: 10px; margin-bottom: 10px; }
.check-item {
  display: flex; gap: 12px; align-items: flex-start;
  background: var(--card); border: 1px solid var(--line); border-radius: var(--radius-sm);
  padding: 13px 14px; margin-bottom: 8px; cursor: pointer;
  transition: border-color .12s ease, background .12s ease;
}
.check-item:hover { border-color: var(--brand-600); }
.check-item input { position: absolute; opacity: 0; width: 0; height: 0; }
.check-item .box {
  flex: none; width: 26px; height: 26px; border-radius: 7px; border: 2px solid var(--line);
  display: grid; place-items: center; background: var(--card); transition: all .12s ease; margin-top: 1px;
}
.check-item .box::after { content: ""; width: 7px; height: 12px; border: solid #fff; border-width: 0 3px 3px 0; transform: rotate(45deg) scale(0); transition: transform .12s ease; margin-top: -3px; }
.check-item input:checked + .box { background: var(--brand-600); border-color: var(--brand-600); }
.check-item input:checked + .box::after { transform: rotate(45deg) scale(1); }
.check-item input:checked ~ .txt { text-decoration: line-through; color: var(--muted); }
.check-item input:focus-visible + .box { outline: 3px solid var(--accent); outline-offset: 2px; }
.check-item .txt strong { display: block; }
.check-item .txt small { display: block; color: var(--muted); }
.check-item.done { background: var(--ok-bg); border-color: var(--ok); }

/* table-style competency grid */
.tbl { width: 100%; border-collapse: collapse; background: var(--card); border: 1px solid var(--line); border-radius: var(--radius-sm); overflow: hidden; }
.tbl th, .tbl td { padding: 10px 12px; text-align: left; border-bottom: 1px solid var(--line); vertical-align: middle; }
.tbl thead th { background: var(--brand); color: #fff; font-size: .8rem; text-transform: uppercase; letter-spacing: .4px; }
.tbl thead th.mark, .tbl td.mark { text-align: center; width: 90px; }
.tbl tbody tr:nth-child(even) { background: color-mix(in srgb, var(--bg) 60%, var(--card)); }
.tbl td .tick { position: relative; display: inline-block; }
.tbl td .tick input { -webkit-appearance: none; appearance: none; width: 26px; height: 26px; border: 2px solid var(--line); border-radius: 7px; background: var(--card); cursor: pointer; vertical-align: middle; }
.tbl td .tick input:checked { background: var(--brand-600); border-color: var(--brand-600); }
.tbl td .tick input:checked::after { content: ""; position: absolute; left: 9px; top: 4px; width: 7px; height: 12px; border: solid #fff; border-width: 0 3px 3px 0; transform: rotate(45deg); }
.tbl td .tick input:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; }

/* ---- forms ------------------------------------------------------------- */
.field { margin-bottom: 14px; }
.field label { display: block; font-weight: 600; font-size: .9rem; margin-bottom: 5px; }
.field .hint { font-weight: 400; color: var(--muted); font-size: .82rem; }
input[type=text], input[type=date], input[type=time], input[type=email], input[type=tel], textarea, select {
  width: 100%; font: inherit; color: var(--ink); background: var(--card);
  border: 1px solid var(--line); border-radius: var(--radius-sm); padding: 11px 12px;
}
textarea { min-height: 120px; resize: vertical; }
input:focus, textarea:focus, select:focus { outline: 3px solid color-mix(in srgb, var(--accent) 60%, transparent); border-color: var(--brand-600); }

.signature { position: relative; border: 2px dashed var(--line); border-radius: var(--radius-sm); background: var(--card); }
.signature canvas { width: 100%; height: 140px; display: block; touch-action: none; border-radius: var(--radius-sm); }
.signature .sig-hint { position: absolute; left: 14px; bottom: 10px; color: var(--muted); font-size: .85rem; pointer-events: none; }
.signature.filled { border-style: solid; border-color: var(--brand-600); }

/* ---- quiz -------------------------------------------------------------- */
.quiz { border: 1px solid var(--line); border-radius: var(--radius); padding: 16px; background: var(--card); }
.quiz .q { font-weight: 600; margin-bottom: 10px; }
.quiz .opts { display: grid; gap: 8px; }
.quiz .opt { display: flex; gap: 10px; align-items: center; padding: 11px 13px; border: 1px solid var(--line); border-radius: var(--radius-sm); cursor: pointer; background: var(--card); }
.quiz .opt:hover { border-color: var(--brand-600); }
.quiz .opt input { margin: 0; }
.quiz .opt.correct { background: var(--ok-bg); border-color: var(--ok); }
.quiz .opt.wrong { background: var(--danger-bg); border-color: var(--danger); }
.quiz .feedback { margin-top: 12px; font-weight: 600; }
.quiz .feedback.ok { color: var(--ok); }
.quiz .feedback.no { color: var(--danger); }
.quiz .explain { margin-top: 6px; font-weight: 400; color: var(--muted); }

/* ---- lesson accordion -------------------------------------------------- */
.lesson { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; margin-bottom: 12px; scroll-margin-top: 84px; }
.lesson > summary {
  list-style: none; cursor: pointer; padding: 16px 18px; display: flex; align-items: center; gap: 12px;
  font-weight: 700; font-size: 1.02rem;
}
.lesson > summary::-webkit-details-marker { display: none; }
.lesson > summary .num { flex: none; width: 30px; height: 30px; border-radius: 50%; background: var(--brand-100); color: var(--brand-600); display: grid; place-items: center; font-size: .95rem; }
.lesson[open] > summary { border-bottom: 1px solid var(--line); }
.lesson > summary .chev { margin-left: auto; color: var(--muted); transition: transform .2s ease; }
.lesson[open] > summary .chev { transform: rotate(180deg); }
.lesson > summary .t { flex: 1; }
.lesson .body { padding: 18px; }
.lesson .done-tick { color: var(--ok); font-weight: 700; font-size: .8rem; white-space: nowrap; }
figure.fig { margin: 16px 0; }
figure.fig img { border-radius: var(--radius-sm); border: 1px solid var(--line); }
figure.fig figcaption { font-size: .82rem; color: var(--muted); margin-top: 6px; }
.thought { border-left: 4px solid var(--accent); background: var(--bg); border-radius: var(--radius-sm); padding: 14px 16px; margin: 14px 0; }
.thought h4 { margin: 0 0 4px; }
.thought p { margin: 0; color: var(--muted); }

/* ---- footer ------------------------------------------------------------ */
.site-footer { background: var(--brand-900); color: #bcd6c9; padding: 28px 0; margin-top: 40px; font-size: .9rem; }
.site-footer a { color: #d9efe4; }
.site-footer .wrap { display: grid; gap: 16px; }
@media (min-width: 640px) { .site-footer .wrap { grid-template-columns: 1fr 1fr; } }
.footer-brand p { margin: 12px 0 0; }
.footer-council { display: inline-flex; align-items: center; gap: 9px; margin-top: 14px; }
.footer-council img { height: 28px; width: auto; filter: brightness(0) invert(1); opacity: .9; }
.footer-council small { font-size: .78rem; color: #bcd6c9; }

/* ---- toast ------------------------------------------------------------- */
.toast { position: fixed; left: 50%; bottom: 24px; transform: translate(-50%, 20px); background: var(--brand-900); color: #fff; padding: 12px 20px; border-radius: 999px; box-shadow: var(--shadow); opacity: 0; pointer-events: none; transition: all .25s ease; z-index: 100; font-size: .9rem; }
.toast.show { opacity: 1; transform: translate(-50%, 0); }

/* ---- contact strip ----------------------------------------------------- */
.contact-strip { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px; }
.contact-strip dl { margin: 0; display: grid; gap: 8px; }
.contact-strip dt { font-weight: 700; }
.contact-strip dd { margin: 0; }

/* ---- print ------------------------------------------------------------- */
@media print {
  :root { --bg: #fff; --card: #fff; --ink: #000; --muted: #333; --line: #999; }
  body { background: #fff; }
  .site-header, .site-footer, .no-print, .toast, .hero-actions, nav, .btn { display: none !important; }
  .wrap { max-width: none; padding: 0; }
  .card, .lesson, .callout, .tbl { box-shadow: none; break-inside: avoid; }
  .lesson { border: 1px solid #999; }
  .lesson .body { display: block !important; }
  details:not([open]) .body { display: block !important; }
  a { color: #000; text-decoration: none; }
  .tbl thead th { background: #ececec !important; color: #000 !important; print-color-adjust: exact; -webkit-print-color-adjust: exact; }
  .badge { border: 1px solid #999; color: #000 !important; background: transparent !important; }
  .site-header nav { display: none; }
  .signature canvas { height: 110px; }
  .progress { display: none; }
  .print-only { display: block !important; }
  .page-break { break-before: page; }
}
.print-only { display: none; }
