:root {
  --bg: #f3f6f5;
  --surface: #ffffff;
  --text: #17211e;
  --muted: #586964;
  --line: #d9e2df;
  --accent: #0b6e5b;
  --accent-dark: #085546;
  --accent-soft: #e2f2ed;
  --danger: #b3261e;
  --danger-soft: #fbe9e7;
  --stage: #171b1a;
  --radius: 10px;
  --header-h: 64px;
}

*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }

html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  background: var(--bg);
  color: var(--text);
  font: 16px/1.55 system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}

h1 { font-size: 1.7rem; line-height: 1.25; margin: 0 0 .75rem; }
h2 { font-size: 1.2rem; line-height: 1.3; margin: 1.5rem 0 .5rem; }
h3 { font-size: 1rem; margin: 1.25rem 0 .5rem; }
p { margin: 0 0 1rem; }
a { color: var(--accent); }
a:hover { color: var(--accent-dark); }
:focus-visible { outline: 3px solid #f2a900; outline-offset: 2px; }

.wrap { width: 100%; max-width: 1120px; margin: 0 auto; padding: 0 1.25rem; }
main.wrap { flex: 1; padding-top: 2rem; padding-bottom: 3rem; }
.muted { color: var(--muted); }
.center { text-align: center; }
.small-print { font-size: .9rem; margin-top: 1.25rem; }
.sr-only {
  position: absolute; width: 1px; height: 1px; overflow: hidden;
  clip: rect(0 0 0 0); white-space: nowrap;
}
.skip-link {
  position: absolute; left: -999px; top: 0; z-index: 100;
  background: var(--surface); padding: .5rem 1rem;
}
.skip-link:focus { left: .5rem; top: .5rem; }

/* --- header and footer --------------------------------------------------- */

.site-header { background: var(--surface); border-bottom: 1px solid var(--line); }
.site-header .wrap {
  display: flex; align-items: center; justify-content: space-between;
  gap: 1rem; min-height: var(--header-h); flex-wrap: wrap;
}
.brand { display: flex; align-items: center; gap: .7rem; color: var(--text); text-decoration: none; }
.brand-mark { width: 44px; height: 44px; flex: none; }
.brand-text { display: flex; flex-direction: column; line-height: 1.2; }
.brand-text span { font-size: .8rem; color: var(--muted); }
.site-nav { display: flex; align-items: center; gap: 1.1rem; flex-wrap: wrap; }
.site-nav a { text-decoration: none; font-weight: 500; }
.site-nav a:hover { text-decoration: underline; }
.site-nav form { margin: 0; }
.link-button {
  border: 0; background: none; padding: 0; font: inherit; font-weight: 500;
  color: var(--accent); cursor: pointer;
}
.link-button:hover { text-decoration: underline; }

.site-footer { border-top: 1px solid var(--line); color: var(--muted); font-size: .9rem; }
.site-footer .wrap { display: flex; flex-wrap: wrap; gap: .5rem 1.5rem; padding-top: 1rem; padding-bottom: 1rem; }

/* --- buttons, cards, forms ----------------------------------------------- */

.button {
  display: inline-block; padding: .65rem 1.15rem; border-radius: 8px;
  border: 1px solid var(--accent); background: var(--accent); color: #fff;
  font: inherit; font-weight: 600; text-decoration: none; text-align: center; cursor: pointer;
}
.button:hover { background: var(--accent-dark); border-color: var(--accent-dark); color: #fff; }
.button.secondary { background: var(--surface); color: var(--accent); }
.button.secondary:hover { background: var(--accent-soft); color: var(--accent-dark); }
.button.danger { background: var(--danger); border-color: var(--danger); }
.button.danger:hover { background: #8f1d17; border-color: #8f1d17; }
.button.small { padding: .35rem .7rem; font-size: .9rem; }
.button.block { display: block; width: 100%; }
.button:disabled { opacity: .45; cursor: default; }
.site-nav a.button { color: #fff; text-decoration: none; }

.card {
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 1.5rem; margin-bottom: 1.25rem;
}
.card > :last-child, .card form > :last-child { margin-bottom: 0; }
.card.narrow { max-width: 480px; margin-left: auto; margin-right: auto; }
.card.notice { border-color: var(--accent); background: var(--accent-soft); }
.card.danger-zone { border-color: #e9c3bf; }
.card.danger-zone h2, .card.notice h2, .card > h2:first-child { margin-top: 0; }

.field { margin-bottom: 1rem; }
.field label { display: block; font-weight: 600; margin-bottom: .3rem; }
.field input:not([type="checkbox"]), .field textarea, .field select {
  width: 100%; padding: .6rem .7rem; border: 1px solid #b9c6c2; border-radius: 8px;
  background: #fff; color: var(--text); font: inherit;
}
.field input[type="file"] { padding: .45rem; }
/* A select ignores line-height in some browsers; match the inputs' height. */
.field select { height: calc(1.55em + 1.2rem + 2px); padding-top: 0; padding-bottom: 0; }
.field input:focus, .field textarea:focus, .field select:focus { border-color: var(--accent); }
.field.has-error input, .field.has-error textarea, .field.has-error select { border-color: var(--danger); }
.field .label { font-weight: 600; margin: 0 0 .3rem; }
code { font-size: .92em; background: #eef2f0; border-radius: 4px; padding: .08rem .3rem; overflow-wrap: anywhere; }
.field .hint { margin: .3rem 0 0; font-size: .88rem; color: var(--muted); }
.field .error { margin: .3rem 0 0; font-size: .9rem; color: var(--danger); font-weight: 600; }
.field.check label { display: flex; gap: .6rem; align-items: flex-start; font-weight: 400; }
.field.check input { margin-top: .3rem; width: 1.1rem; height: 1.1rem; flex: none; }
.field-row { display: grid; grid-template-columns: 1fr 1fr; gap: 0 1rem; }
.actions { display: flex; flex-wrap: wrap; gap: .75rem; }

.flashes { margin-bottom: 1.25rem; }
.flash { padding: .75rem 1rem; border-radius: 8px; margin: 0 0 .6rem; border: 1px solid transparent; }
.flash-ok { background: var(--accent-soft); border-color: #b5dccf; }
.flash-error { background: var(--danger-soft); border-color: #f0bfba; color: #7a1a14; }

.badge {
  display: inline-block; padding: .1rem .55rem; border-radius: 999px;
  font-size: .78rem; font-weight: 600; vertical-align: middle; white-space: nowrap;
}
.badge-ok { background: var(--accent-soft); color: var(--accent-dark); }
.badge-muted { background: #e8ecea; color: var(--muted); }

.details { display: grid; grid-template-columns: max-content 1fr; gap: .35rem 1.25rem; margin: 0 0 1rem; }
.details dt { color: var(--muted); }
.details dd { margin: 0; overflow-wrap: anywhere; }

.secret code {
  display: inline-block; padding: .5rem .9rem; border-radius: 8px; background: #fff;
  border: 1px solid #b5dccf; font-size: 1.15rem; user-select: all;
}

/* --- home ---------------------------------------------------------------- */

.hero { padding: 2.5rem 0 2rem; max-width: 680px; }
.hero h1 { font-size: 2.2rem; }
.eyebrow {
  margin: 0 0 .5rem; font-size: .82rem; font-weight: 700; letter-spacing: .05em;
  text-transform: uppercase; color: var(--accent-dark);
}
.steps { margin-top: 1rem; }
.lead { font-size: 1.15rem; color: var(--muted); }
.steps { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 1.25rem; }
.step {
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 1.25rem;
}
.step h2 { margin: .75rem 0 .35rem; font-size: 1.1rem; }
.step p { margin: 0; color: var(--muted); }
.step-number {
  display: inline-flex; align-items: center; justify-content: center; width: 2rem; height: 2rem;
  border-radius: 50%; background: var(--accent-soft); color: var(--accent-dark); font-weight: 700;
}

/* --- course list --------------------------------------------------------- */

.course-card { display: grid; grid-template-columns: 300px 1fr; gap: 1.5rem; align-items: start; }
.course-cover {
  width: 100%; height: auto; border-radius: 8px; border: 1px solid var(--line); background: #eef2f0;
}
.film-cover {
  aspect-ratio: 16 / 9; display: flex; align-items: center; justify-content: center;
  background: var(--stage); border-color: var(--stage);
}
.film-cover svg { width: 4.5rem; height: 4.5rem; }
.film-cover circle { fill: rgba(255, 255, 255, .14); }
.film-cover path { fill: #fff; }
.course-body h2 { margin-top: 0; font-size: 1.35rem; }
.description { white-space: pre-line; }
.payment {
  margin: 1.25rem 0; padding: .9rem 1.1rem; border: 1px solid #b5dccf; border-radius: var(--radius);
  background: var(--accent-soft);
}
.payment h2, .payment h3 { margin: 0 0 .35rem; font-size: 1rem; }
.payment p { margin: 0; }
/* One click or tap selects the whole account number, ready to copy. */
.iban { font-family: ui-monospace, Menlo, Consolas, monospace; user-select: all; overflow-wrap: anywhere; }
.meters { display: grid; gap: .6rem; margin-bottom: 1.25rem; }
.meters label { display: block; font-size: .92rem; }
.meters label span { display: block; margin-bottom: .2rem; }
progress {
  display: block; width: 100%; height: .55rem; border: 0; border-radius: 999px;
  background: #e3e9e7; overflow: hidden; appearance: none; -webkit-appearance: none;
}
progress::-webkit-progress-bar { background: #e3e9e7; }
progress::-webkit-progress-value { background: var(--accent); }
progress::-moz-progress-bar { background: var(--accent); }

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

.page-head { display: flex; flex-wrap: wrap; align-items: flex-start; justify-content: space-between; gap: 1rem; }
.stat-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 1rem; margin-bottom: 1.5rem; }
.stat { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 1rem 1.25rem; }
.stat strong { display: block; font-size: 1.8rem; line-height: 1.2; }
.stat span { color: var(--muted); font-size: .92rem; }
.table-scroll {
  overflow-x: auto; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
}
.table { width: 100%; border-collapse: collapse; font-size: .95rem; }
.table th, .table td { padding: .6rem .8rem; text-align: left; border-bottom: 1px solid var(--line); vertical-align: middle; }
.table th { font-size: .8rem; text-transform: uppercase; letter-spacing: .03em; color: var(--muted); }
.table td { overflow-wrap: break-word; }
/* Columns of running text keep a readable width; on a narrow screen the
   table scrolls sideways instead of squeezing them. Long e-mail addresses
   may still break. */
.table td.wide { min-width: 10rem; }
.table td.breakable { overflow-wrap: anywhere; min-width: 13rem; }
.table .nowrap { white-space: nowrap; overflow-wrap: normal; }
.table td small { display: block; color: var(--muted); font-size: .85rem; }
.table tbody tr:last-child td { border-bottom: 0; }
.admin-course { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 1rem 1.5rem; }
.admin-course-info { flex: 1 1 320px; min-width: 0; }
.admin-course h2 { margin: 0 0 .25rem; }
.admin-course p { margin: 0; }
.admin-course .actions { align-items: center; gap: .5rem; }
.admin-course form { margin: 0; }
.slide-grid {
  list-style: none; margin: 0; padding: 0;
  display: grid; grid-template-columns: repeat(auto-fill, minmax(92px, 1fr)); gap: .4rem;
}
.slide-grid li {
  border: 1px solid var(--line); border-radius: 6px; padding: .3rem .5rem;
  display: flex; flex-direction: column; background: #f6f8f7; color: var(--muted);
}
.slide-grid li.seen { background: var(--accent-soft); border-color: #b5dccf; color: var(--text); }
.slide-grid span { font-weight: 700; }
.slide-grid small { font-size: .78rem; }

.prose { max-width: 760px; }
.prose h2 { margin-top: 1.75rem; }
.prose ul { padding-left: 1.25rem; }
.prose li { margin-bottom: .4rem; }

/* --- slide viewer -------------------------------------------------------- */

.page-viewer { height: 100vh; height: 100dvh; overflow: hidden; }
.viewer-main { flex: 1; min-height: 0; display: flex; flex-direction: column; }
.viewer-main .flashes { margin: .75rem 1.25rem 0; }
.viewer { flex: 1; min-height: 0; display: flex; flex-direction: column; background: var(--surface); }

.viewer-bar {
  display: flex; align-items: center; gap: .5rem 1.25rem; flex-wrap: wrap;
  padding: .55rem 1.25rem; border-bottom: 1px solid var(--line);
}
.viewer-bar h1 { font-size: 1.05rem; margin: 0; flex: 1; min-width: 12rem; }
.viewer-back { text-decoration: none; font-weight: 600; white-space: nowrap; }
.viewer-stats { display: flex; align-items: center; flex-wrap: wrap; gap: .25rem 1.25rem; font-size: .92rem; }
#stat-time { font-variant-numeric: tabular-nums; font-weight: 600; }

.viewer-body { position: relative; flex: 1; min-height: 0; display: flex; background: var(--stage); }
.thumbs { display: none; width: 190px; flex: none; overflow-y: auto; background: #222827; padding: .6rem; }
.show-thumbs .thumbs { display: block; }
.thumbs ol { list-style: none; margin: 0; padding: 0; display: grid; gap: .6rem; }
.thumb {
  position: relative; display: block; width: 100%; padding: 0; border: 2px solid transparent;
  border-radius: 6px; background: #000; cursor: pointer; overflow: hidden; opacity: .6;
}
.thumb img { display: block; width: 100%; height: auto; }
.thumb.seen { opacity: 1; }
.thumb.current { border-color: #4fd1b0; opacity: 1; }
.thumb-number {
  position: absolute; left: .3rem; bottom: .3rem; padding: 0 .4rem; border-radius: 4px;
  background: rgba(0, 0, 0, .7); color: #fff; font-size: .75rem; font-weight: 600;
}
.thumb.seen .thumb-number::after { content: " ✓"; color: #7fe3c8; }

.stage { position: relative; flex: 1; min-width: 0; display: flex; align-items: center; justify-content: center; }
#slide {
  width: 100%; height: 100%; object-fit: contain; user-select: none; -webkit-user-drag: none;
  transition: opacity .12s;
}
#slide.loading { opacity: .55; }
.stage-nav {
  position: absolute; top: 50%; transform: translateY(-50%);
  width: 3rem; height: 3rem; border-radius: 50%; border: 0;
  background: rgba(0, 0, 0, .55); color: #fff; font-size: 2rem; line-height: 1; cursor: pointer;
  display: flex; align-items: center; justify-content: center; padding: 0 0 .2rem;
}
.stage-nav:hover:not(:disabled) { background: rgba(0, 0, 0, .8); }
.stage-nav:disabled { opacity: .2; cursor: default; }
.stage-prev { left: .75rem; }
.stage-next { right: .75rem; }

.overlay {
  position: absolute; inset: 0; z-index: 10; display: flex; align-items: center; justify-content: center;
  padding: 1rem; background: rgba(10, 14, 13, .82);
}
.overlay-box {
  max-width: 420px; padding: 1.5rem; border-radius: var(--radius); background: var(--surface); text-align: center;
}
.overlay-box h2 { margin-top: 0; }

.viewer-foot {
  display: flex; align-items: center; gap: 1rem; padding: .55rem 1.25rem; border-top: 1px solid var(--line);
}
.viewer-position { flex: 1; min-width: 0; display: flex; align-items: center; gap: .9rem; font-size: .92rem; }
#stat-slide { white-space: nowrap; font-variant-numeric: tabular-nums; font-weight: 600; }
.bar { flex: 1; height: .4rem; border-radius: 999px; background: #e3e9e7; overflow: hidden; }
#bar-fill { height: 100%; width: 0; background: var(--accent); transition: width .2s; }
.viewer-note { margin: 0; padding: .45rem 1.25rem .6rem; font-size: .85rem; color: var(--muted); border-top: 1px solid var(--line); }

/* --- film player --------------------------------------------------------- */

#video { width: 100%; height: 100%; background: #000; }
.coverage-label { font-size: .85rem; color: var(--muted); white-space: nowrap; }
.coverage { flex: 1; min-width: 0; display: flex; height: .7rem; border-radius: 999px; overflow: hidden; background: #dfe6e3; }
.coverage .cell { flex: 1; min-width: 0; padding: 0; border: 0; background: none; cursor: pointer; }
.coverage .cell.done { background: var(--accent); }
.coverage .cell.current { background: #f2a900; }

.viewer:fullscreen { width: 100vw; height: 100vh; }
.viewer:fullscreen .viewer-note, .viewer:fullscreen .viewer-back { display: none; }

/* --- small screens ------------------------------------------------------- */

@media (max-width: 899px) {
  .thumbs { position: absolute; top: 0; bottom: 0; left: 0; z-index: 5; width: min(60vw, 220px); box-shadow: 4px 0 16px rgba(0, 0, 0, .4); }
  .course-card { grid-template-columns: 1fr; }
  .course-cover { max-width: 420px; }
}
@media (max-width: 600px) {
  h1 { font-size: 1.45rem; }
  .hero h1 { font-size: 1.7rem; }
  .field-row { grid-template-columns: 1fr; }
  .card { padding: 1.1rem; }
  .brand-text span { display: none; }
  .page-viewer .brand-text { display: none; }
  .page-viewer .site-header .wrap { min-height: 52px; flex-wrap: nowrap; }
  .viewer-bar { padding: .4rem .75rem; gap: .15rem .9rem; }
  .viewer-bar h1 { flex: 1 1 0; min-width: 0; font-size: .95rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  .viewer-stats { flex-basis: 100%; font-size: .85rem; gap: .15rem .9rem; }
  .viewer-foot { padding: .45rem .75rem; gap: .6rem; }
  .viewer-note { display: none; }
  .coverage-label { display: none; }
  .stage-nav { width: 2.4rem; height: 2.4rem; font-size: 1.6rem; }
  .details { grid-template-columns: 1fr; gap: 0; }
  .details dd { margin-bottom: .5rem; }
}

/* Phone held sideways: give the slide every pixel of height. */
@media (max-height: 520px) {
  .page-viewer .site-header, .viewer-note { display: none; }
  .viewer-bar { padding-top: .3rem; padding-bottom: .3rem; }
  .viewer-foot { padding-top: .3rem; padding-bottom: .3rem; }
}
