@import url('/static/css/fonts.css');

:root {
  /* brand colours are overridden per company in views/layout.ejs */
  --primary: #BF4E2E;
  --on-primary: #FFFFFF;
  --accent: #FAAB0A;
  --on-accent: #111111;

  --ink: #111111;
  --ink-soft: #55575c;
  --line: #e4e4e6;
  --bg: #f4f4f4;
  --card: #ffffff;
  --ok: #1f7a46;
  --warn: #9a5b00;
  --danger: #b3261e;
  --radius: 18px;
  --font: 'Jost', 'Futura', 'Century Gothic', 'Avenir Next', system-ui, sans-serif;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; font-family: var(--font); font-weight: 400; font-size: 18px; line-height: 1.5;
  color: var(--ink); background: var(--bg);
  min-height: 100vh; display: flex; flex-direction: column;
}
main { flex: 1; }
a { color: inherit; }
img { max-width: 100%; }
h1, h2, h3 { font-weight: 600; line-height: 1.15; margin: 0 0 .4em; letter-spacing: -.01em; }
h1 { font-size: clamp(30px, 5vw, 52px); font-weight: 600; }
h2 { font-size: 24px; }
p { margin: 0 0 1em; }
code { background: #ececee; padding: 1px 6px; border-radius: 6px; font-size: .9em; word-break: break-all; }

.wrap { width: 100%; max-width: 1120px; margin: 0 auto; padding: 0 24px; }
.narrow { max-width: 520px; }
.narrow-lg { max-width: 820px; }
.muted { color: var(--ink-soft); }
.small { font-size: 15px; }
.center { text-align: center; }
.lead { font-size: 21px; font-weight: 300; color: var(--ink-soft); max-width: 720px; }
.lead.small { font-size: 17px; }
.eyebrow { text-transform: uppercase; letter-spacing: .22em; font-size: 13px; font-weight: 500; margin-bottom: 14px; color: var(--ink-soft); }
.crumb { font-size: 16px; margin-bottom: 18px; } .crumb a { text-decoration: none; color: var(--ink-soft); } .crumb a:hover { color: var(--ink); }
.inline { display: inline; margin: 0; }

/* ---------- header / footer ---------- */
.site-header { background: #fff; position: sticky; top: 0; z-index: 20; border-bottom: 1px solid var(--line); }
.header-row { display: flex; align-items: center; justify-content: space-between; min-height: 72px; gap: 16px; }
.brand { display: inline-flex; align-items: center; text-decoration: none; min-height: 72px; }
.brand-logo { max-height: 44px; max-width: 200px; width: auto; display: block; }
.brand-word { font-size: 26px; font-weight: 600; letter-spacing: -.02em; }
.brand-word .dot { color: var(--accent); }
.nav { display: flex; align-items: center; gap: 22px; font-size: 16px; font-weight: 400; flex-wrap: wrap; justify-content: flex-end; }
.nav a { text-decoration: none; padding: 4px 0; border-bottom: 2px solid transparent; }
.nav a:hover, .nav a.on { border-bottom-color: var(--accent); }
.site-footer { background: #111; color: #fff; padding: 28px 0; font-size: 15px; margin-top: 64px; }
.site-footer .wrap { display: flex; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.site-footer .muted { color: #a9abb0; }

/* ---------- buttons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px; font: inherit; font-weight: 500; font-size: 17px;
  border: 2px solid transparent; border-radius: 999px; padding: 12px 28px; cursor: pointer; text-decoration: none; line-height: 1.2;
  transition: transform .08s ease, opacity .15s ease, background .15s ease;
}
.btn:hover { opacity: .9; } .btn:active { transform: translateY(1px); }
.btn:focus-visible, a:focus-visible, input:focus-visible, textarea:focus-visible, button:focus-visible, video:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; }
.btn-primary { background: var(--primary); color: var(--on-primary); }
.btn-dark { background: #111; color: #fff; }
.btn-ghost { background: transparent; color: var(--ink); border-color: #111; }
.btn-danger { background: var(--danger); color: #fff; }
.btn-sm { font-size: 15px; padding: 8px 18px; }
.btn-block { width: 100%; }
button.link { background: none; border: 0; padding: 0; font: inherit; font-size: 15px; color: var(--primary); text-decoration: underline; cursor: pointer; }
button.link.danger { color: var(--danger); }

/* ---------- hero / headings ---------- */
.hero, .page-head { position: relative; overflow: hidden; background: var(--bg); padding: 64px 0 40px; }
.hero::before, .page-head::after {
  content: ''; position: absolute; right: -120px; top: -120px; width: 520px; height: 520px; border-radius: 50%;
  border: 2px dashed var(--accent); opacity: .55; pointer-events: none;
}
.hero .wrap, .page-head .wrap { position: relative; }
.page-head { padding-bottom: 28px; }
.page-head .head-actions { display: flex; align-items: center; gap: 20px; flex-wrap: wrap; margin-top: 22px; }
.login { padding: 72px 0 24px; text-align: center; }
.login .lead { margin-left: auto; margin-right: auto; }

/* ---------- cards / forms ---------- */
.card { background: var(--card); border-radius: var(--radius); padding: 28px; box-shadow: 0 1px 0 rgba(0,0,0,.03); }
.form { display: flex; flex-direction: column; gap: 16px; margin-bottom: 24px; }
.form h2 { margin-bottom: 0; }
.form > .btn { align-self: flex-start; }
.form > .btn.btn-block { align-self: stretch; }
.login-card { text-align: left; margin-top: 28px; }
label { display: flex; flex-direction: column; gap: 6px; font-size: 16px; font-weight: 500; }
label.check { flex-direction: row; align-items: center; gap: 10px; font-weight: 400; }
input[type=text], input[type=email], input[type=password], input:not([type]), textarea {
  font: inherit; font-weight: 400; padding: 12px 14px; border: 1.5px solid #cfd0d4; border-radius: 12px; background: #fff; width: 100%;
}
input[type=color] { width: 100%; height: 46px; border: 1.5px solid #cfd0d4; border-radius: 12px; padding: 4px; background: #fff; }
input[type=file] { font: inherit; font-size: 15px; }
input[type=checkbox] { width: 20px; height: 20px; accent-color: var(--primary); }
textarea { resize: vertical; }
.alert { padding: 12px 16px; border-radius: 12px; font-size: 16px; margin-bottom: 8px; }
.alert-error { background: #fdeceb; color: var(--danger); }
.alert-ok { background: #e8f5ee; color: var(--ok); }
.alert-warn { background: #fff4de; color: var(--warn); }
.empty { text-align: center; color: var(--ink-soft); }

/* ---------- course grid ---------- */
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 24px; }
.course-card { display: flex; flex-direction: column; padding: 0; overflow: hidden; text-decoration: none; transition: transform .12s ease, box-shadow .12s ease; }
.course-card:hover { transform: translateY(-3px); box-shadow: 0 10px 28px rgba(0,0,0,.08); }
.course-cover { background: var(--accent); color: var(--on-accent); min-height: 150px; display: flex; flex-direction: column; align-items: center; justify-content: center; position: relative; overflow: hidden; }
.course-cover::before, .tile-mark::before {
  content: ''; position: absolute; width: 120px; height: 120px; border-radius: 50%; border: 2px dashed currentColor; opacity: .4; left: -78px; bottom: -48px; pointer-events: none;
}
.course-cover::after, .tile-mark::after {
  content: ''; position: absolute; width: 70px; height: 70px; border-radius: 50%; border: 2px dashed currentColor; opacity: .3; right: -24px; top: -26px; pointer-events: none;
}
.course-cover img { width: 100%; height: 100%; object-fit: cover; position: absolute; inset: 0; }
.cover-num { font-size: 56px; font-weight: 500; line-height: 1; } .cover-cap { font-size: 14px; letter-spacing: .2em; text-transform: uppercase; }
.course-body { padding: 24px; display: flex; flex-direction: column; gap: 4px; flex: 1; }
.course-body h2 { margin-bottom: 4px; }
.meta { font-size: 15px; color: var(--ink-soft); margin: 4px 0 10px; }
.bar { height: 8px; background: #ececee; border-radius: 999px; overflow: hidden; margin-top: auto; }
.bar span { display: block; height: 100%; background: var(--primary); border-radius: 999px; }

/* ---------- lesson tiles ---------- */
.lesson-list { display: flex; flex-direction: column; gap: 20px; }
.lesson-tile { display: grid; grid-template-columns: 170px 1fr; background: #fff; border-radius: var(--radius); overflow: hidden; }
.tile-mark { background: var(--accent); color: var(--on-accent); display: flex; align-items: center; justify-content: center; position: relative; overflow: hidden; min-height: 130px; }
.tile-mark span { font-size: 38px; font-weight: 400; position: relative; }
.tile-body { padding: 22px 26px; display: flex; flex-direction: column; align-items: flex-start; gap: 2px; }
.tile-body h2 { font-size: 21px; margin-bottom: 4px; }
.tile-body .meta { margin-bottom: 12px; }
.lesson-tile.done .tile-mark { background: #111; color: #fff; }
.lesson-tile.done .tile-mark span::after { content: ' ✓'; font-size: 26px; color: var(--accent); }
.ok { color: var(--ok); font-weight: 500; } .warn { color: var(--warn); font-weight: 500; }

/* ---------- lesson page ---------- */
.lesson-head { text-align: center; padding: 40px 0 28px; }
.lesson-head h1 { max-width: 880px; margin-left: auto; margin-right: auto; }
.lesson-head .lead { margin-left: auto; margin-right: auto; }
.lesson-head .crumb { text-align: left; }
.player-wrap { max-width: 1000px; }
.player { background: #000; border-radius: 14px; overflow: hidden; aspect-ratio: 16 / 9; box-shadow: 0 14px 40px rgba(0,0,0,.18); }
.player video { width: 100%; height: 100%; display: block; background: #000; }
.status-row { display: flex; justify-content: space-between; align-items: center; gap: 12px; margin-top: 14px; flex-wrap: wrap; }
.badge { font-size: 15px; padding: 6px 14px; border-radius: 999px; background: #e9e9ec; color: var(--ink-soft); }
.badge-done { background: #111; color: #fff; }
.section-title { margin: 44px 0 16px; font-size: 28px; }
.prose { background: #fff; border-radius: var(--radius); padding: 24px 28px; white-space: pre-line; }
.files { list-style: none; padding: 0; margin: 0; display: flex; flex-direction: column; gap: 10px; }
.file { display: flex; align-items: center; gap: 14px; background: #fff; border-radius: 14px; padding: 14px 18px; text-decoration: none; transition: background .12s; }
.file:hover { background: #fffaf0; }
.file-ext { background: #111; color: #fff; font-size: 12px; letter-spacing: .08em; font-weight: 600; padding: 6px 10px; border-radius: 8px; min-width: 52px; text-align: center; }
.file-name { flex: 1; font-weight: 500; overflow-wrap: anywhere; }
.file-dl { font-size: 15px; color: var(--primary); font-weight: 500; }
.pager > :last-child { margin-left: auto; }
.pager { display: flex; justify-content: space-between; gap: 12px; margin-top: 48px; flex-wrap: wrap; }

/* ---------- admin ---------- */
.admin-nav { background: #111; color: #fff; }
.admin-nav .wrap { display: flex; gap: 6px; padding-top: 0; padding-bottom: 0; }
.admin-nav a { color: #d9dadd; text-decoration: none; padding: 14px 18px; font-size: 16px; border-bottom: 3px solid transparent; }
.admin-nav a:hover { color: #fff; } .admin-nav a.on { color: #fff; border-bottom-color: var(--accent); }
.admin-page { padding-top: 32px; }
.admin-page h1 { font-size: 36px; }
.row-between { display: flex; align-items: center; justify-content: space-between; gap: 16px; flex-wrap: wrap; margin-bottom: 8px; }
.inline-form { display: flex; gap: 14px; align-items: flex-end; margin-bottom: 28px; }
.grow { flex: 1; }
.two-col { display: grid; grid-template-columns: 1fr 1fr; gap: 24px; align-items: start; }
.colors { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.logo-now { display: flex; align-items: center; gap: 16px; background: #f4f4f4; border-radius: 12px; padding: 12px; }
.logo-now img { max-height: 44px; max-width: 180px; }
.preview { background: #fff; }
.mini-header { display: flex; align-items: center; justify-content: space-between; border-bottom: 1px solid var(--line); padding-bottom: 12px; margin: 14px 0; min-height: 44px; }
.mini-header img { max-height: 32px; max-width: 150px; }
.mini-header .brand-word { font-size: 20px; }
.mini-tile { display: grid; grid-template-columns: 90px 1fr; border-radius: 14px; overflow: hidden; background: var(--bg); }
.mini-tile .tile-mark { min-height: 84px; } .mini-tile .tile-mark span { font-size: 24px; } .mini-tile .tile-body { padding: 12px 16px; gap: 8px; }
.table-wrap { overflow-x: auto; background: #fff; border-radius: var(--radius); margin-top: 12px; }
.table { width: 100%; border-collapse: collapse; font-size: 16px; }
.table th { text-align: left; font-weight: 500; color: var(--ink-soft); font-size: 14px; padding: 14px 16px; border-bottom: 1.5px solid #111; white-space: nowrap; }
.table td { padding: 12px 16px; border-bottom: 1px solid var(--line); vertical-align: middle; }
.table tr:last-child td { border-bottom: 0; }
.table .num { text-align: right; font-variant-numeric: tabular-nums; }
.table tr.off td { color: #9a9ca2; }
.table .actions { display: flex; gap: 14px; flex-wrap: wrap; justify-content: flex-end; }
.table .actions form { margin: 0; }
.table code { font-size: 16px; letter-spacing: .03em; }
.tag { font-size: 12px; padding: 2px 8px; border-radius: 999px; background: #ececee; color: var(--ink-soft); vertical-align: middle; }
.tag-admin { background: var(--accent); color: var(--on-accent); }
.danger-zone { border: 1.5px solid #f0c6c3; margin-top: 40px; }
.plain { padding-left: 20px; }
.course-admin { margin-bottom: 20px; }
.course-admin .table-wrap { box-shadow: none; border: 1px solid var(--line); }

/* ---------- responsive ---------- */
@media (max-width: 760px) {
  body { font-size: 17px; }
  .wrap { padding: 0 16px; }
  .header-row { flex-wrap: wrap; min-height: 0; padding-top: 8px; padding-bottom: 8px; row-gap: 4px; }
  .brand { min-height: 44px; } .brand-logo { max-height: 36px; max-width: 150px; }
  .nav { width: 100%; justify-content: space-between; gap: 10px; font-size: 15px; flex-wrap: nowrap; }
  .nav .btn-sm { padding: 6px 14px; font-size: 14px; }
  .lesson-tile { grid-template-columns: 84px 1fr; }
  .tile-mark { min-height: 100px; } .tile-mark span { font-size: 26px; }
  .tile-body { padding: 16px; }
  .two-col, .colors { grid-template-columns: 1fr; }
  .inline-form { flex-direction: column; align-items: stretch; }
  .hero::before, .page-head::after { width: 320px; height: 320px; right: -140px; top: -140px; }
  .file-dl { display: none; }
  .card { padding: 20px; }
}
@media print { .site-header, .site-footer, .btn { display: none; } }

/* YouTube player and admin course editor */
.player iframe { width: 100%; height: 100%; border: 0; display: block; }
.yt-lesson { border-top: 1px solid #e5e5e5; padding: 10px 0; }
.yt-lesson summary { cursor: pointer; display: flex; gap: 10px; align-items: center; }
.yt-lesson .form { margin-top: 12px; }
.yt-lesson textarea, .card textarea { width: 100%; font: inherit; padding: 10px 12px; border: 1px solid #d5d5d5; border-radius: 10px; }
.inline-actions { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 8px; }
.inline-actions form { display: inline; }

/* playback speed buttons */
.player-bar { display: flex; align-items: center; justify-content: space-between; gap: 16px; flex-wrap: wrap; margin-top: 14px; }
.speed-row { display: flex; align-items: center; flex-wrap: wrap; gap: 8px; }
.switch { display: inline-flex; align-items: center; gap: 10px; font: inherit; font-size: 14px; background: none; border: 0; padding: 4px 0; cursor: pointer; color: #111; margin-left: auto; }
.switch-track { width: 42px; height: 24px; border-radius: 999px; background: #cfcfcf; position: relative; transition: background .15s; flex: none; }
.switch-knob { position: absolute; top: 3px; left: 3px; width: 18px; height: 18px; border-radius: 50%; background: #fff; transition: transform .15s; }
.switch[aria-checked="true"] .switch-track { background: #111; }
.switch[aria-checked="true"] .switch-knob { transform: translateX(18px); }
.speed-btn { font: inherit; font-size: 14px; padding: 6px 12px; border-radius: 999px; border: 1px solid #cfcfcf; background: #fff; color: #111; cursor: pointer; }
.speed-btn:hover { border-color: #111; }
.speed-btn.on { background: #111; color: #fff; border-color: #111; }

/* horizontal course cards */
.course-list { grid-template-columns: 1fr; gap: 20px; }
.course-list .course-card { flex-direction: row; }
.course-list .course-cover { flex: 0 0 220px; min-height: 180px; }
.course-list .course-body { padding: 24px 28px; justify-content: center; }
.course-list .bar { margin-top: 12px; max-width: 420px; }
@media (max-width: 760px) {
  .course-list .course-card { flex-direction: column; }
  .course-list .course-cover { flex-basis: auto; min-height: 120px; }
}

.lesson-group > summary { font-size: 17px; padding: 10px 0; }
.course-admin textarea { line-height: 1.5; }

/* bulk materials upload */
.bulk-row { display: grid; grid-template-columns: 1.4fr 1.2fr 160px; gap: 12px; align-items: center; padding: 8px 0; border-bottom: 1px solid #ececee; }
.bulk-name { overflow-wrap: anywhere; font-size: 15px; }
.bulk-state { font-size: 14px; color: var(--ink-soft); }
.bulk-row select, #course { font: inherit; padding: 8px 10px; border: 1.5px solid #cfd0d4; border-radius: 10px; background: #fff; width: 100%; }
@media (max-width: 760px) { .bulk-row { grid-template-columns: 1fr; } }

/* whole lesson card is clickable */
.lesson-tile { position: relative; cursor: pointer; }
.tile-link { color: inherit; text-decoration: none; }
.tile-link::after { content: ''; position: absolute; inset: 0; border-radius: inherit; z-index: 1; }
.lesson-tile .btn { position: relative; z-index: 2; }
@media (hover: hover) {
  .lesson-tile { transition: transform .15s, box-shadow .15s; }
  .lesson-tile:hover { transform: translateY(-3px); box-shadow: 0 0 0 2px #111, 0 14px 30px rgba(0,0,0,.14); }
  .lesson-tile:hover .tile-mark { background: #111; color: #fff; }
}
.tile-actions { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }
.lesson-tile .btn:hover { transform: translateY(-1px); box-shadow: 0 6px 14px rgba(0,0,0,.25); }
.lesson-tile .btn-dark:hover, .lesson-tile .btn-ghost:hover { background: var(--primary, #c0392b); border-color: var(--primary, #c0392b); color: var(--on-primary, #fff); opacity: 1; }
.btn-dark:hover { background: #333; opacity: 1; }
.btn-ghost:hover { background: #111; color: #fff; opacity: 1; }
.btn-primary:hover { filter: brightness(.88); opacity: 1; }
.speed-btn:hover { background: #111; color: #fff; border-color: #111; }
.course-card:hover { box-shadow: 0 0 0 2px #111, 0 14px 30px rgba(0,0,0,.14); }
.file:hover { background: #fff3d6; box-shadow: 0 0 0 2px #111; }
.switch:hover .switch-track { filter: brightness(.8); }
.tile-link:focus-visible::after { outline: 2px solid #111; outline-offset: 2px; }
