/* Shared look for the learner app and the admin: Juno orange on warm neutrals, flat colours, Manrope. */
@font-face {
  font-family: "Manrope";
  src: url("/assets/fonts/manrope-latin-wght-normal.woff2") format("woff2");
  font-weight: 200 800;
  font-display: swap;
}

:root {
  --orange: #ff6900;
  --orange-ink: #c24e00;
  --orange-soft: #fff1e6;
  --ink: #1d1a17;
  --ink-2: #4a443e;
  --muted: #7b736b;
  --line: #ebe5de;
  --bg: #f8f5f1;
  --card: #ffffff;
  --green: #12805c;
  --green-soft: #e5f5ee;
  --red: #c8372d;
  --red-soft: #fdecea;
  --blue: #2457c5;
  --blue-soft: #e9f0fd;
  --amber: #a8640a;
  --amber-soft: #fff4dc;
  --radius: 16px;
  --radius-sm: 10px;
  --shadow: 0 1px 2px rgba(40, 25, 10, 0.05), 0 4px 16px rgba(40, 25, 10, 0.05);
  color-scheme: light;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  font: 16px/1.6 "Manrope", system-ui, -apple-system, "Segoe UI", sans-serif;
  color: var(--ink);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
}
img { max-width: 100%; }
a { color: var(--orange-ink); }
h1, h2, h3, h4 { line-height: 1.25; margin: 0 0 0.5em; letter-spacing: -0.01em; }
button, input, select, textarea { font: inherit; color: inherit; }
:focus-visible { outline: 3px solid rgba(255, 105, 0, 0.45); outline-offset: 2px; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
[hidden] { display: none !important; }

/* ---------- buttons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 44px; padding: 10px 18px; border-radius: 999px; border: 1.5px solid var(--line);
  background: var(--card); color: var(--ink); font-weight: 700; font-size: 15px;
  cursor: pointer; text-decoration: none; transition: transform 0.08s, background 0.15s, border-color 0.15s;
}
.btn:hover { border-color: #d8cfc5; }
.btn:active { transform: scale(0.98); }
.btn[disabled] { opacity: 0.5; cursor: not-allowed; transform: none; }
.btn.primary { background: var(--orange); border-color: var(--orange); color: #fff; }
.btn.primary:hover { background: #f25f00; }
.btn.dark { background: var(--ink); border-color: var(--ink); color: #fff; }
.btn.ghost { background: transparent; border-color: transparent; }
.btn.ghost:hover { background: rgba(0, 0, 0, 0.04); }
.btn.danger { color: var(--red); }
.btn.big { min-height: 54px; font-size: 17px; padding: 14px 26px; }
.btn.block { width: 100%; }
.btn.sm { min-height: 34px; padding: 6px 12px; font-size: 13.5px; }
.btn svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }

/* ---------- forms ---------- */
.field { display: grid; gap: 6px; margin-bottom: 14px; }
.field > span { font-weight: 700; font-size: 14px; color: var(--ink-2); }
.field small { color: var(--muted); font-size: 13px; }
.input, select.input, textarea.input {
  width: 100%; min-height: 46px; padding: 10px 14px; border: 1.5px solid var(--line); border-radius: var(--radius-sm);
  background: #fff; font-size: 16px; transition: border-color 0.15s;
}
textarea.input { min-height: 96px; resize: vertical; line-height: 1.5; }
.input:focus { outline: none; border-color: var(--orange); box-shadow: 0 0 0 3px rgba(255, 105, 0, 0.15); }
.form-error { background: var(--red-soft); color: var(--red); padding: 10px 14px; border-radius: var(--radius-sm); font-size: 14px; font-weight: 600; margin-bottom: 14px; }

/* ---------- pieces ---------- */
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); }
.badge { display: inline-flex; align-items: center; gap: 4px; padding: 2px 10px; border-radius: 999px; font-size: 12.5px; font-weight: 700; background: #f1ece6; color: var(--ink-2); white-space: nowrap; }
.badge.orange { background: var(--orange-soft); color: var(--orange-ink); }
.badge.green { background: var(--green-soft); color: var(--green); }
.badge.red { background: var(--red-soft); color: var(--red); }
.badge.blue { background: var(--blue-soft); color: var(--blue); }
.badge.amber { background: var(--amber-soft); color: var(--amber); }
.bar { height: 8px; background: #efe8e0; border-radius: 99px; overflow: hidden; }
.bar > i { display: block; height: 100%; background: var(--orange); border-radius: 99px; transition: width 0.5s ease; }
.bar.green > i { background: var(--green); }
.muted { color: var(--muted); }
.spinner { width: 28px; height: 28px; border: 3px solid #eadfd4; border-top-color: var(--orange); border-radius: 50%; animation: spin 0.8s linear infinite; margin: 48px auto; }
@keyframes spin { to { transform: rotate(360deg); } }

.toast {
  position: fixed; left: 50%; bottom: 24px; transform: translate(-50%, 20px); opacity: 0; pointer-events: none;
  background: var(--ink); color: #fff; padding: 12px 20px; border-radius: 999px; font-weight: 600; font-size: 14.5px;
  transition: all 0.25s; z-index: 100; max-width: calc(100% - 32px); text-align: center;
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }
.toast.err { background: var(--red); }

/* ---------- lesson content (also used by the admin preview) ---------- */
.lesson-body { font-size: 17px; line-height: 1.7; color: var(--ink-2); }
.lesson-body > * + * { margin-top: 18px; }
.lesson-body h2, .lesson-body h3, .lesson-body h4 { color: var(--ink); margin-top: 28px; }
.lesson-body h2 { font-size: 22px; }
.lesson-body h3 { font-size: 19px; }
.lesson-body h4 { font-size: 17px; }
.lesson-body p { margin: 0 0 12px; }
.lesson-body ul, .lesson-body ol { padding-left: 22px; margin: 0 0 12px; }
.lesson-body li { margin: 4px 0; }
.lesson-body strong { color: var(--ink); }
.lesson-body code { background: #f3eee8; padding: 1px 6px; border-radius: 6px; font-size: 0.92em; }
.table-wrap { overflow-x: auto; border: 1px solid var(--line); border-radius: var(--radius-sm); }
.lesson-body table { border-collapse: collapse; width: 100%; font-size: 15px; }
.lesson-body th, .lesson-body td { padding: 10px 12px; border-bottom: 1px solid var(--line); text-align: left; vertical-align: top; }
.lesson-body th { background: #faf6f2; color: var(--ink); font-weight: 700; }
.lesson-body tr:last-child td { border-bottom: 0; }
.b-callout { border-radius: var(--radius-sm); padding: 14px 16px; background: var(--blue-soft); }
.b-callout p:last-child { margin-bottom: 0; }
.b-callout-head { display: flex; align-items: center; gap: 8px; font-weight: 800; font-size: 14px; text-transform: uppercase; letter-spacing: 0.04em; margin-bottom: 6px; color: var(--blue); }
.b-callout-head svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.b-callout.warn { background: var(--amber-soft); }
.b-callout.warn .b-callout-head { color: var(--amber); }
.b-callout.tip { background: var(--green-soft); }
.b-callout.tip .b-callout-head { color: var(--green); }
.b-check { list-style: none; padding: 0 !important; display: grid; gap: 10px; }
.b-check li { display: flex; gap: 10px; align-items: flex-start; background: #faf6f2; border-radius: var(--radius-sm); padding: 10px 14px; margin: 0 !important; }
.b-check svg { flex: none; width: 22px; height: 22px; margin-top: 2px; padding: 3px; border-radius: 50%; background: var(--orange); stroke: #fff; stroke-width: 3; fill: none; stroke-linecap: round; stroke-linejoin: round; }
.b-image, .b-video { margin: 0; }
.b-image img { border-radius: var(--radius-sm); border: 1px solid var(--line); display: block; }
figcaption { font-size: 14px; color: var(--muted); margin-top: 6px; }
.ratio { position: relative; padding-top: 56.25%; border-radius: var(--radius-sm); overflow: hidden; background: #000; }
.ratio iframe { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; }
.b-file { display: flex; align-items: center; gap: 14px; padding: 14px 16px; border: 1.5px solid var(--line); border-radius: var(--radius-sm); text-decoration: none; color: var(--ink); background: #fff; }
.b-file:hover { border-color: var(--orange); }
.b-file svg { width: 32px; height: 32px; flex: none; fill: none; stroke: var(--orange); stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.b-file span { display: grid; }
.b-file small { color: var(--muted); }
