/* Course platform — one hand-written stylesheet. Mobile first, dark by default.
   The brand color comes from the BRAND_COLOR env var and lands in --brand. */

:root {
  --brand: #C7A35A;
  --bg: #0B0B0D;
  --bg-2: #121216;
  --surface: #17171C;
  --surface-2: #1E1E25;
  --line: #2A2A33;
  --text: #F5F0E8;
  --muted: #A8A29A;
  --ok: #5BC48A;
  --warn: #E8B04B;
  --danger: #EF6F6C;
  --brand-soft: color-mix(in srgb, var(--brand) 16%, transparent);
  --brand-line: color-mix(in srgb, var(--brand) 45%, transparent);
  --radius: 16px;
  --radius-sm: 10px;
  --tap: 48px;
  --shadow: 0 1px 0 rgba(255,255,255,.03) inset, 0 10px 30px rgba(0,0,0,.35);
  --font: ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --mono: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  color-scheme: dark;
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }
body {
  margin: 0;
  background:
    radial-gradient(1200px 500px at 50% -200px, color-mix(in srgb, var(--brand) 10%, transparent), transparent 70%),
    var(--bg);
  color: var(--text);
  font: 400 17px/1.65 var(--font);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  overflow-x: hidden;
}
img, video, iframe { max-width: 100%; }
a { color: var(--brand); text-underline-offset: 3px; }
a:hover { text-decoration-thickness: 2px; }
code { font-family: var(--mono); font-size: .9em; background: var(--surface-2); border: 1px solid var(--line); padding: .1em .4em; border-radius: 6px; }
:focus-visible { outline: 3px solid var(--brand); outline-offset: 2px; border-radius: 6px; }
h1, h2, h3 { line-height: 1.2; letter-spacing: -.01em; margin: 0 0 .5rem; }
h1 { font-size: clamp(1.8rem, 6vw, 2.6rem); font-weight: 750; }
h2 { font-size: 1.3rem; }
p { margin: 0 0 1rem; }

.wrap { width: 100%; max-width: 760px; margin: 0 auto; padding: 0 18px; }
.main { flex: 1; padding-top: 20px; padding-bottom: 48px; }
.muted { color: var(--muted); }
.small { font-size: .9rem; }
.center { text-align: center; }
.inline { display: inline; margin: 0; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.skip { position: absolute; left: -999px; top: 8px; background: var(--brand); color: #111; padding: 10px 14px; border-radius: 8px; z-index: 10; }
.skip:focus { left: 8px; }

/* ---------- top bar ---------- */
.topbar {
  position: sticky; top: 0; z-index: 5;
  background: color-mix(in srgb, var(--bg) 82%, transparent);
  backdrop-filter: saturate(160%) blur(12px);
  -webkit-backdrop-filter: saturate(160%) blur(12px);
  border-bottom: 1px solid var(--line);
  padding-top: env(safe-area-inset-top);
}
.topbar-inner { display: flex; align-items: center; justify-content: space-between; gap: 12px; min-height: 60px; }
.logo { display: flex; align-items: center; gap: 10px; color: var(--text); text-decoration: none; font-weight: 700; min-height: var(--tap); min-width: 0; }
.logo-mark {
  flex: none; display: grid; place-items: center; width: 34px; height: 34px; border-radius: 10px;
  background: linear-gradient(140deg, var(--brand), color-mix(in srgb, var(--brand) 55%, #000));
  color: #111; font-weight: 800; text-transform: uppercase;
}
.logo-text { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.nav { display: flex; align-items: center; gap: 6px; flex: none; }
.nav-link {
  display: inline-flex; align-items: center; min-height: var(--tap); padding: 0 10px;
  color: var(--muted); text-decoration: none; font-size: .95rem; font-weight: 600;
}
.nav-link:hover { color: var(--text); }
.as-link { background: none; border: 0; font: inherit; cursor: pointer; color: inherit; padding: 0 10px; min-height: var(--tap); }

/* ---------- buttons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: var(--tap); padding: 0 22px; border-radius: 999px; border: 0;
  background: var(--brand); color: #111; font: 700 1rem/1.2 var(--font);
  text-decoration: none; cursor: pointer; text-align: center;
  box-shadow: 0 6px 20px color-mix(in srgb, var(--brand) 25%, transparent);
  transition: transform .08s ease, filter .15s ease;
}
.btn:hover { filter: brightness(1.07); }
.btn:active { transform: scale(.98); }
.btn[disabled] { opacity: .6; cursor: wait; }
.btn-small { min-height: 40px; padding: 0 16px; font-size: .95rem; box-shadow: none; }
.btn-lg { min-height: 56px; font-size: 1.08rem; }
.btn-block { width: 100%; }
.btn-ghost {
  background: var(--surface); color: var(--text); border: 1px solid var(--line); box-shadow: none;
  flex-direction: column; align-items: flex-start; border-radius: var(--radius-sm); padding: 10px 14px; gap: 2px;
}
.btn-ghost:hover { border-color: var(--brand-line); filter: none; }

/* ---------- flashes ---------- */
.flashes { display: grid; gap: 8px; margin-bottom: 16px; }
.flash { padding: 12px 16px; border-radius: var(--radius-sm); border: 1px solid var(--line); background: var(--surface); }
.flash-success { border-color: color-mix(in srgb, var(--ok) 50%, transparent); background: color-mix(in srgb, var(--ok) 10%, var(--surface)); }
.flash-error { border-color: color-mix(in srgb, var(--danger) 55%, transparent); background: color-mix(in srgb, var(--danger) 10%, var(--surface)); }
.flash-info { border-color: var(--brand-line); background: color-mix(in srgb, var(--brand) 8%, var(--surface)); }

/* ---------- hero + sections ---------- */
.hero { padding: 18px 0 22px; }
.hero-tight { padding-bottom: 8px; }
.eyebrow { color: var(--brand); text-transform: uppercase; letter-spacing: .12em; font-size: .78rem; font-weight: 700; margin-bottom: .4rem; }
.lead { font-size: 1.12rem; color: color-mix(in srgb, var(--text) 82%, var(--muted)); }
.section-title { margin: 28px 0 14px; }
.panel {
  background: linear-gradient(180deg, var(--surface), var(--bg-2));
  border: 1px solid var(--line); border-radius: var(--radius); padding: 18px; margin: 16px 0; box-shadow: var(--shadow);
}
.panel-title { font-size: 1.1rem; margin-bottom: 10px; }
.empty { text-align: center; padding: 40px 10px; }

/* ---------- progress bars ---------- */
.bar { display: block; height: 8px; border-radius: 99px; background: var(--surface-2); overflow: hidden; margin: 8px 0; }
.bar > span { display: block; height: 100%; border-radius: inherit; background: linear-gradient(90deg, var(--brand), color-mix(in srgb, var(--brand) 60%, #fff)); transition: width .4s ease; }
.bar-lg { height: 12px; }

.progress-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 10px; }
.progress-row {
  display: block; padding: 14px; border-radius: var(--radius-sm); background: var(--surface-2);
  border: 1px solid var(--line); color: var(--text); text-decoration: none;
}
.progress-row:hover { border-color: var(--brand-line); }
.progress-name { display: block; font-weight: 700; }
.progress-meta { display: block; color: var(--muted); font-size: .9rem; }
.progress-next { display: block; color: var(--brand); font-weight: 600; font-size: .95rem; }

/* ---------- course cards ---------- */
.cards { display: grid; gap: 16px; }
.card {
  display: block; overflow: hidden; border-radius: var(--radius); background: var(--surface);
  border: 1px solid var(--line); color: var(--text); text-decoration: none; box-shadow: var(--shadow);
  transition: transform .15s ease, border-color .15s ease;
}
.card:hover { transform: translateY(-2px); border-color: var(--brand-line); }
.card-cover { position: relative; aspect-ratio: 16 / 9; background: var(--surface-2); }
.card-cover img { width: 100%; height: 100%; object-fit: cover; display: block; }
.card-cover-blank {
  display: grid; place-items: center;
  background:
    radial-gradient(circle at 30% 20%, color-mix(in srgb, var(--brand) 45%, transparent), transparent 60%),
    linear-gradient(135deg, color-mix(in srgb, var(--brand) 30%, var(--surface-2)), var(--surface-2));
}
.card-cover-blank span { font-size: 4rem; font-weight: 800; color: color-mix(in srgb, var(--text) 85%, transparent); text-transform: uppercase; }
.card-cover .tag { position: absolute; left: 12px; top: 12px; }
.card-body { padding: 16px 18px 18px; }
.card-title { font-size: 1.2rem; margin-bottom: 4px; }
.card-sub { color: var(--muted); margin-bottom: 8px; }
.card-meta { color: var(--muted); font-size: .88rem; margin: 0; }

.tag {
  display: inline-flex; align-items: center; gap: 4px; padding: 3px 10px; border-radius: 99px;
  font-size: .78rem; font-weight: 700; background: var(--brand-soft); color: var(--brand); border: 1px solid var(--brand-line);
  vertical-align: middle;
}
.tag-warn { background: color-mix(in srgb, var(--warn) 18%, #000); color: var(--warn); border-color: color-mix(in srgb, var(--warn) 45%, transparent); }
.tag-done { background: color-mix(in srgb, var(--ok) 15%, transparent); color: var(--ok); border-color: color-mix(in srgb, var(--ok) 45%, transparent); }

/* ---------- course page ---------- */
.crumbs { margin-bottom: 8px; }
.crumbs a { display: inline-flex; align-items: center; min-height: var(--tap); color: var(--muted); text-decoration: none; font-weight: 600; }
.crumbs a:hover { color: var(--text); }
.course-head { margin-bottom: 18px; }
.course-cover { width: 100%; border-radius: var(--radius); aspect-ratio: 16 / 9; object-fit: cover; margin-bottom: 16px; border: 1px solid var(--line); }
.course-progress { margin-top: 18px; display: grid; gap: 10px; }
.done-note { color: var(--ok); font-weight: 700; }

.outline { display: grid; gap: 22px; margin-top: 10px; }
.module-title { display: flex; align-items: center; gap: 10px; font-size: 1.05rem; color: var(--text); margin-bottom: 10px; }
.module-num {
  display: grid; place-items: center; width: 28px; height: 28px; border-radius: 8px; font-size: .85rem;
  background: var(--brand-soft); color: var(--brand); border: 1px solid var(--brand-line);
}
.lesson-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.lesson-row {
  display: flex; align-items: center; gap: 14px; min-height: 64px; padding: 10px 14px;
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-sm);
  color: var(--text); text-decoration: none;
}
.lesson-row:hover { border-color: var(--brand-line); }
.lesson-row.is-current { border-color: var(--brand); background: color-mix(in srgb, var(--brand) 7%, var(--surface)); }
.check {
  flex: none; display: grid; place-items: center; width: 30px; height: 30px; border-radius: 50%;
  border: 2px solid var(--line); font-size: .9rem; font-weight: 800; color: var(--muted);
}
.is-done .check { background: var(--ok); border-color: var(--ok); color: #0B0B0D; }
.lesson-row-text { display: grid; min-width: 0; }
.lesson-row-title { font-weight: 650; overflow-wrap: anywhere; }
.lesson-row-meta { font-size: .85rem; color: var(--muted); }
.free { color: var(--brand); font-weight: 700; }

/* ---------- lesson page ---------- */
.lesson-head { margin-bottom: 16px; }
.lesson-meta { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; font-size: .92rem; }
.video {
  position: relative; margin: 0 -18px 16px; background: #000; aspect-ratio: 16 / 9; overflow: hidden;
}
.video video, .video iframe { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; background: #000; }
.transcript { margin: 0 0 22px; border: 1px solid var(--line); border-radius: var(--radius-sm); background: var(--surface); }
.transcript summary, .outline-toggle summary {
  cursor: pointer; min-height: var(--tap); display: flex; align-items: center; gap: 8px; padding: 0 16px; font-weight: 650; list-style: none;
}
.transcript summary::-webkit-details-marker, .outline-toggle summary::-webkit-details-marker { display: none; }
.transcript summary::before, .outline-toggle summary::before { content: "▸"; color: var(--brand); transition: transform .15s; }
.transcript[open] summary::before, .outline-toggle[open] summary::before { transform: rotate(90deg); }
.transcript-body { padding: 0 16px 8px; color: color-mix(in srgb, var(--text) 85%, var(--muted)); max-height: 50vh; overflow-y: auto; }
.outline-toggle { padding: 0; }
.outline-toggle summary { padding: 6px 18px; }
.outline-toggle .outline { padding: 0 14px 16px; }

.prose { overflow-wrap: anywhere; }
.prose :not(pre) > code { white-space: nowrap; }
.prose h1, .prose h2, .prose h3 { margin-top: 1.8rem; }
.prose h2 { font-size: 1.35rem; }
.prose h3 { font-size: 1.12rem; }
.prose ul, .prose ol { padding-left: 1.4rem; margin: 0 0 1rem; }
.prose li { margin: .3rem 0; }
.prose img { border-radius: var(--radius-sm); height: auto; }
.prose blockquote {
  margin: 1.2rem 0; padding: 12px 16px; border-left: 4px solid var(--brand);
  background: var(--brand-soft); border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
}
.prose blockquote p:last-child { margin-bottom: 0; }
.prose pre {
  background: #08080A; border: 1px solid var(--line); border-radius: var(--radius-sm);
  padding: 14px; overflow-x: auto; font-size: .9rem; line-height: 1.5;
}
.prose pre code { background: none; border: 0; padding: 0; }
.prose table { display: block; overflow-x: auto; border-collapse: collapse; margin: 0 0 1rem; font-size: .95rem; }
.prose th, .prose td { border: 1px solid var(--line); padding: 8px 12px; text-align: left; }
.prose th { background: var(--surface-2); }
.prose hr { border: 0; border-top: 1px solid var(--line); margin: 2rem 0; }
.prose.small { font-size: .98rem; color: color-mix(in srgb, var(--text) 85%, var(--muted)); }

.lesson-actions { display: grid; gap: 12px; margin: 30px 0 10px; }
.lesson-actions form { margin: 0; }
.prevnext { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.pn-next { align-items: flex-end; text-align: right; grid-column: 2; }
.pn-title { font-weight: 650; font-size: .95rem; overflow-wrap: anywhere; }

/* ---------- tutor ---------- */
.tutor textarea, .form input {
  width: 100%; font: inherit; color: var(--text); background: var(--bg); border: 1px solid var(--line);
  border-radius: var(--radius-sm); padding: 12px 14px; min-height: var(--tap);
}
.tutor textarea { resize: vertical; margin-bottom: 10px; }
.tutor textarea:focus, .form input:focus { outline: none; border-color: var(--brand); box-shadow: 0 0 0 3px var(--brand-soft); }
.tutor-answer {
  margin-top: 14px; padding: 14px; border-radius: var(--radius-sm); background: var(--surface-2);
  border: 1px solid var(--brand-line); white-space: pre-wrap;
}
.tutor-answer.is-error { border-color: color-mix(in srgb, var(--danger) 55%, transparent); }

/* ---------- forms ---------- */
.auth { max-width: 440px; margin: 24px auto; padding: 24px 20px; }
.auth h1 { font-size: 1.7rem; margin-bottom: 18px; }
.form { display: grid; gap: 16px; margin-bottom: 16px; }
.form label { display: grid; gap: 6px; font-weight: 650; font-size: .95rem; }
.form input { font-size: 17px; } /* 16px+ stops iOS from zooming in */
.hint { font-weight: 400; color: var(--muted); font-size: .85rem; }

/* ---------- admin ---------- */
.admin-courses { list-style: none; padding: 0; margin: 0 0 14px; display: grid; gap: 8px; }
.students { list-style: none; padding: 0; margin: 0; display: grid; gap: 10px; }
.student { padding: 14px; border: 1px solid var(--line); border-radius: var(--radius-sm); background: var(--surface-2); }
.student-top { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.student-email { font-weight: 700; overflow-wrap: anywhere; }
.student-progress { list-style: none; padding: 0; margin: 8px 0 0; display: grid; gap: 4px; font-size: .92rem; }
.student-progress li { display: flex; justify-content: space-between; gap: 12px; border-top: 1px dashed var(--line); padding-top: 4px; }

/* ---------- sales page (/), thank-you pages ---------- */
.sales-hero { padding: 22px 0 18px; }
.sales-headline { font-size: clamp(2rem, 8vw, 3.1rem); line-height: 1.1; margin-bottom: .8rem; }
.checks { list-style: none; padding: 0; margin: 0 0 22px; display: grid; gap: 10px; }
.checks li { position: relative; padding-left: 34px; font-size: 1.05rem; }
.checks li::before {
  content: "✓"; position: absolute; left: 0; top: .1em; display: grid; place-items: center;
  width: 24px; height: 24px; border-radius: 50%; font-size: .8rem; font-weight: 800;
  background: var(--brand-soft); color: var(--brand); border: 1px solid var(--brand-line);
}
.center .checks { text-align: left; }
.offer-card { border-color: var(--brand-line); background: linear-gradient(180deg, color-mix(in srgb, var(--brand) 9%, var(--surface)), var(--bg-2)); }
.offer-name { font-size: 1.5rem; }
.price { font-size: 2rem; font-weight: 800; color: var(--brand); margin-bottom: 12px; }
.offer-note { margin: 10px 0 0; }
.sales-block h2 { font-size: 1.4rem; }
.sales-faq .faq { margin-bottom: 10px; }
.disclaimer { margin-top: 28px; border-top: 1px solid var(--line); padding-top: 14px; }
.welcome-login { margin-top: 14px; }
/* Honeypot: off screen for people, still there for bots. */
.hp { position: absolute; left: -10000px; top: auto; width: 1px; height: 1px; overflow: hidden; }

/* ---------- admin stats ---------- */
.stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; margin: 8px 0 4px; }
.stat {
  display: grid; gap: 2px; padding: 14px 10px; text-align: center; border-radius: var(--radius-sm);
  background: var(--surface); border: 1px solid var(--line);
}
.stat strong { font-size: 1.6rem; color: var(--brand); line-height: 1.1; }
.stat span { color: var(--muted); font-size: .85rem; }

.footer { color: var(--muted); font-size: .85rem; padding-top: 20px; padding-bottom: calc(24px + env(safe-area-inset-bottom)); border-top: 1px solid var(--line); }

/* ---------- bigger screens ---------- */
@media (min-width: 640px) {
  .wrap { padding: 0 24px; }
  .cards { grid-template-columns: 1fr 1fr; }
  .video { margin: 0 0 18px; border-radius: var(--radius); border: 1px solid var(--line); }
  .panel { padding: 22px 24px; }
}
@media (min-width: 1000px) {
  .wrap { max-width: 860px; }
}
@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; }
}
