/* ============================================================
   Frame & Focus — design system (light theme)
   A clean, premium academy look: white/near-white surfaces with
   a deep teal + burnt-amber accent pair carried over from the
   brand's color-grading motif, retuned for contrast on light
   backgrounds rather than simply inverted from the old dark UI.
   Structural motifs (timecodes, sprocket holes, timeline scrubber)
   are kept — just re-skinned.
   ============================================================ */

@import url('https://fonts.googleapis.com/css2?family=Bebas+Neue&family=Oswald:wght@500;600&family=Inter:wght@400;500;600;700&family=JetBrains+Mono:wght@400;500&display=swap');

:root {
  /* Surfaces — subtly different tones create hierarchy without relying on borders alone */
  --bg: #ffffff;              /* page background */
  --bg-soft: #f6f6f3;         /* section backgrounds, sidebars, footer */
  --bg-elevated: #ffffff;     /* cards, form panels */
  --bg-elevated-2: #f1f1ee;   /* inputs, table headers, chips, nested panels */

  /* Text */
  --text: #1b1d1f;            /* charcoal, not pure black */
  --text-muted: #6b6f76;

  /* Borders */
  --border: #e6e5e0;
  --border-bright: #d2d1ca;

  /* Accents — deep teal / burnt amber, tuned for AA contrast on white */
  --teal: #0f766e;
  --teal-bright: #0d9488;
  --orange: #c2410c;
  --orange-bright: #ea580c;

  /* Semantic */
  --success: #157f3d;
  --success-bg: rgba(21, 127, 61, 0.08);
  --warning: #b45309;
  --warning-bg: rgba(180, 83, 9, 0.08);
  --tally: #dc2626;           /* error / danger / rec-dot */
  --error-bg: rgba(220, 38, 38, 0.08);

  --font-display: 'Bebas Neue', 'Oswald', sans-serif;
  --font-body: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
  --font-mono: 'JetBrains Mono', 'IBM Plex Mono', monospace;

  --radius: 8px;
  --radius-lg: 14px;
  --shadow-sm: 0 1px 2px rgba(15, 23, 42, 0.05), 0 1px 1px rgba(15, 23, 42, 0.04);
  --shadow-lift: 0 16px 36px rgba(15, 23, 42, 0.10);
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { animation-duration: 0.001ms !important; animation-iteration-count: 1 !important; transition-duration: 0.001ms !important; }
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-body);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

img { max-width: 100%; display: block; }

a { color: var(--orange); text-decoration: none; }
a:hover { text-decoration: underline; }

:focus-visible {
  outline: 2px solid var(--orange);
  outline-offset: 2px;
}

h1, h2, h3, h4 {
  font-family: var(--font-display);
  letter-spacing: 0.015em;
  font-weight: 400;
  margin: 0 0 0.4em;
  line-height: 1.08;
  color: var(--text);
}
h1 { font-size: clamp(2.6rem, 6vw, 4.4rem); }
h2 { font-size: clamp(1.9rem, 4vw, 2.7rem); }
h3 { font-size: 1.4rem; }
h4 { font-size: 1rem; letter-spacing: 0.08em; text-transform: uppercase; color: var(--text-muted); font-family: var(--font-body); font-weight: 700; }

p { margin: 0 0 1em; color: var(--text-muted); }

.container {
  max-width: 1120px;
  margin: 0 auto;
  padding: 0 24px;
}

.mono { font-family: var(--font-mono); }

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  font-family: var(--font-body);
  font-weight: 600;
  font-size: 0.95rem;
  padding: 12px 24px;
  border-radius: var(--radius);
  border: 1px solid transparent;
  cursor: pointer;
  transition: transform 0.15s ease, background 0.15s ease, border-color 0.15s ease, box-shadow 0.15s ease;
  text-decoration: none;
}
.btn:hover { text-decoration: none; }
.btn-primary {
  background: var(--orange);
  color: #ffffff;
  box-shadow: var(--shadow-sm);
}
.btn-primary:hover { background: var(--orange-bright); transform: translateY(-1px); box-shadow: var(--shadow-lift); }
.btn-ghost {
  background: var(--bg);
  color: var(--text);
  border-color: var(--border-bright);
}
.btn-ghost:hover { border-color: var(--orange); color: var(--orange); background: var(--bg-soft); }
.btn-sm { padding: 8px 16px; font-size: 0.85rem; }
.btn-danger { background: var(--bg); color: var(--tally); border-color: rgba(220,38,38,0.35); }
.btn-danger:hover { background: var(--tally); color: #fff; border-color: var(--tally); }
.btn[disabled] { opacity: 0.5; cursor: not-allowed; transform: none !important; box-shadow: none !important; }

/* Record-button dot on the primary CTA, tying back to the subject */
.btn-rec::before {
  content: '';
  width: 8px; height: 8px; border-radius: 50%;
  background: #fff;
  box-shadow: 0 0 0 3px rgba(255,255,255,0.35);
}

/* ---------- Nav ---------- */
.site-header {
  border-bottom: 1px solid var(--border);
  background: rgba(255,255,255,0.92);
  backdrop-filter: blur(8px);
  position: sticky;
  top: 0;
  z-index: 40;
}
.nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 0;
  gap: 16px;
}
.logo {
  font-family: var(--font-display);
  font-size: 1.5rem;
  letter-spacing: 0.03em;
  color: var(--text);
  display: flex;
  align-items: center;
  gap: 8px;
}
.logo span { color: var(--orange); }
.nav-links { display: flex; align-items: center; gap: 26px; }
.nav-links a { color: var(--text-muted); font-weight: 500; font-size: 0.95rem; }
.nav-links a:hover, .nav-links a.active { color: var(--text); text-decoration: none; }
.nav-actions { display: flex; align-items: center; gap: 12px; flex-shrink: 0; }
.nav-toggle { display: none; background: none; border: none; color: var(--text); font-size: 1.4rem; cursor: pointer; }

@media (max-width: 780px) {
  .nav-links {
    position: absolute; top: 100%; left: 0; right: 0;
    background: var(--bg); flex-direction: column; align-items: flex-start;
    padding: 18px 24px 22px; border-bottom: 1px solid var(--border);
    box-shadow: var(--shadow-lift);
    display: none; gap: 16px;
  }
  .nav-links.open { display: flex; }
  .nav-toggle { display: block; }
}

.avatar-chip {
  display: flex; align-items: center; gap: 8px;
  color: var(--text); font-size: 0.9rem; font-weight: 500;
}
.avatar-badge {
  width: 30px; height: 30px; border-radius: 50%;
  background: var(--bg-elevated-2); border: 1px solid var(--border-bright);
  display: flex; align-items: center; justify-content: center;
  font-family: var(--font-mono); font-size: 0.8rem; color: var(--orange);
}

.notif-bell {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 34px; height: 34px;
  border-radius: 50%;
  color: var(--text-muted);
}
.notif-bell:hover { color: var(--orange); background: var(--bg-soft); text-decoration: none; }
.notif-badge {
  position: absolute;
  top: -2px; right: -2px;
  min-width: 16px; height: 16px;
  padding: 0 3px;
  border-radius: 999px;
  background: var(--tally);
  color: #fff;
  font-size: 0.65rem;
  font-weight: 700;
  line-height: 16px;
  text-align: center;
  border: 2px solid var(--bg);
}

/* ---------- Language switcher ---------- */
.lang-switch {
  display: inline-flex;
  gap: 2px;
  background: var(--bg-elevated-2);
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 3px;
}
.lang-switch a {
  padding: 6px 14px;
  border-radius: 999px;
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--text-muted);
  white-space: nowrap;
}
.lang-switch a:hover { color: var(--text); text-decoration: none; }
.lang-switch a.active { background: var(--bg); color: var(--text); box-shadow: var(--shadow-sm); }
.lang-switch-mobile { display: none; }
.lang-switch-settings { margin-top: 4px; }

@media (max-width: 780px) {
  .lang-switch-mobile { display: inline-flex; margin-top: 6px; }
  .lang-switch-desktop { display: none; }
}

/* ---------- Sprocket-hole divider (film strip motif) ---------- */
.sprocket-divider {
  display: flex;
  justify-content: center;
  gap: 14px;
  padding: 36px 0;
  opacity: 0.6;
}
.sprocket-divider span {
  width: 6px; height: 6px; border-radius: 50%;
  background: var(--border-bright);
}

/* ---------- Hero / timeline scrubber signature ---------- */
.hero {
  padding: 90px 0 60px;
  position: relative;
  overflow: hidden;
  background: linear-gradient(180deg, var(--bg-soft) 0%, var(--bg) 65%);
}
.hero-eyebrow {
  font-family: var(--font-mono);
  color: var(--orange);
  font-size: 0.85rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  margin-bottom: 18px;
  display: flex;
  align-items: center;
  gap: 10px;
}
.hero-eyebrow::before {
  content: '';
  width: 8px; height: 8px; border-radius: 50%;
  background: var(--tally);
  animation: pulse 1.8s ease-in-out infinite;
}
@keyframes pulse { 0%,100% { opacity: 1; } 50% { opacity: 0.35; } }

.hero-grid {
  display: grid;
  grid-template-columns: 1.1fr 0.9fr;
  gap: 48px;
  align-items: center;
}
@media (max-width: 900px) {
  .hero-grid { grid-template-columns: 1fr; }
}

.hero p.lede { font-size: 1.15rem; max-width: 46ch; }

.scrubber {
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 20px;
  box-shadow: var(--shadow-lift);
}
.scrubber-readout {
  display: flex;
  justify-content: space-between;
  font-family: var(--font-mono);
  font-size: 0.85rem;
  color: var(--text-muted);
  margin-bottom: 14px;
}
.scrubber-readout .now { color: var(--orange); font-weight: 600; }
.scrubber-track {
  position: relative;
  height: 6px;
  background: var(--bg-elevated-2);
  border-radius: 4px;
  overflow: visible;
  margin-bottom: 18px;
}
.scrubber-fill {
  position: absolute; left: 0; top: 0; bottom: 0;
  width: 42%;
  background: linear-gradient(90deg, var(--teal), var(--orange));
  border-radius: 4px;
}
.scrubber-playhead {
  position: absolute; top: 50%; left: 42%;
  width: 14px; height: 14px;
  background: var(--bg);
  border: 2px solid var(--orange);
  border-radius: 50%;
  transform: translate(-50%, -50%);
  box-shadow: 0 0 0 4px rgba(194,65,12,0.15);
}
.scrubber-marks { display: flex; justify-content: space-between; }
.scrubber-marks span { width: 1px; height: 8px; background: var(--border-bright); }
.scrubber-caption { font-family: var(--font-mono); font-size: 0.78rem; color: var(--text-muted); margin-top: 16px; }

/* ---------- Sections & cards ---------- */
.section { padding: 60px 0; }
.section-head { display: flex; align-items: flex-end; justify-content: space-between; margin-bottom: 32px; gap: 24px; flex-wrap: wrap; }
.section-head p { margin: 0; max-width: 50ch; }

.grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 22px; }
.grid-2 { display: grid; grid-template-columns: repeat(2, 1fr); gap: 22px; }
@media (max-width: 900px) { .grid-3 { grid-template-columns: 1fr; } .grid-2 { grid-template-columns: 1fr; } }

.card {
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 26px;
  box-shadow: var(--shadow-sm);
  transition: border-color 0.15s ease, box-shadow 0.15s ease, transform 0.15s ease;
}
.card:hover { border-color: var(--border-bright); box-shadow: var(--shadow-lift); }

.course-card { display: flex; flex-direction: column; gap: 14px; }
.course-card-frame {
  aspect-ratio: 16/9;
  border-radius: var(--radius);
  background:
    repeating-linear-gradient(135deg, rgba(15,118,110,0.10) 0px, rgba(15,118,110,0.10) 2px, transparent 2px, transparent 14px),
    linear-gradient(135deg, rgba(15,118,110,0.85) 0%, var(--bg-elevated-2) 55%, rgba(194,65,12,0.85) 130%);
  position: relative;
  overflow: hidden;
  border: 1px solid var(--border);
}
.course-card-frame .tc {
  position: absolute; bottom: 10px; right: 12px;
  font-family: var(--font-mono); font-size: 0.72rem; color: #fff;
  background: rgba(27,29,31,0.55); padding: 2px 6px; border-radius: 2px;
}
.badge-row { display: flex; gap: 8px; flex-wrap: wrap; }
.badge {
  font-family: var(--font-mono);
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  padding: 4px 10px;
  border-radius: 20px;
  background: var(--bg-elevated-2);
  border: 1px solid var(--border);
  color: var(--text-muted);
}
.badge-level { color: var(--orange); background: rgba(194,65,12,0.08); border-color: rgba(194,65,12,0.22); }

.progress-mini {
  height: 5px; background: var(--bg-elevated-2); border-radius: 4px; overflow: hidden;
}
.progress-mini > div { height: 100%; background: linear-gradient(90deg, var(--teal), var(--orange)); }

/* ---------- Timeline-style lesson list ---------- */
.lesson-timeline { list-style: none; margin: 0; padding: 0; border-left: 2px solid var(--border); }
.lesson-row {
  position: relative;
  padding: 16px 0 16px 26px;
  border-bottom: 1px solid var(--border);
}
.lesson-row::before {
  content: '';
  position: absolute; left: -7px; top: 22px;
  width: 12px; height: 12px; border-radius: 50%;
  background: var(--bg); border: 2px solid var(--border-bright);
}
.lesson-row.complete::before { background: var(--teal-bright); border-color: var(--teal-bright); }
.lesson-row.current::before { background: var(--orange); border-color: var(--orange); }
.lesson-row-top { display: flex; align-items: center; justify-content: space-between; gap: 16px; flex-wrap: wrap; }
.lesson-row-title { display: flex; align-items: baseline; gap: 12px; }
.lesson-row-title .idx { font-family: var(--font-mono); color: var(--text-muted); font-size: 0.85rem; }
.lesson-row-title a { color: var(--text); font-weight: 600; }
.lesson-row-title a:hover { color: var(--orange); }
.lesson-row-meta { font-family: var(--font-mono); font-size: 0.8rem; color: var(--text-muted); white-space: nowrap; }

/* ---------- Forms ---------- */
.auth-shell {
  min-height: calc(100vh - 140px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 60px 24px;
  background: var(--bg-soft);
}
.form-card {
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lift);
  padding: 40px;
  width: 100%;
  max-width: 420px;
}
.field { margin-bottom: 18px; }
.field label {
  display: block; font-size: 0.85rem; font-weight: 600;
  margin-bottom: 6px; color: var(--text);
}
.field input, .field select, .field textarea {
  width: 100%;
  background: var(--bg);
  border: 1px solid var(--border-bright);
  color: var(--text);
  padding: 11px 13px;
  border-radius: var(--radius);
  font-family: var(--font-body);
  font-size: 0.95rem;
}
.field input:focus, .field select:focus, .field textarea:focus {
  outline: 2px solid var(--orange);
  outline-offset: 1px;
  border-color: var(--orange);
}
.field-hint { font-size: 0.78rem; color: var(--text-muted); margin-top: 6px; }
.form-foot { margin-top: 20px; font-size: 0.9rem; color: var(--text-muted); text-align: center; }

/* ---------- Flash messages ---------- */
.flash-stack { display: flex; flex-direction: column; gap: 10px; margin-bottom: 24px; }
.flash {
  padding: 12px 16px; border-radius: var(--radius);
  font-size: 0.9rem; border: 1px solid transparent;
}
.flash-success { border-color: rgba(21,127,61,0.3); color: var(--success); background: var(--success-bg); }
.flash-error { border-color: rgba(220,38,38,0.3); color: var(--tally); background: var(--error-bg); }

.notice-warning {
  border: 1px solid rgba(180,83,9,0.3);
  background: var(--warning-bg);
  color: var(--warning);
  padding: 14px 16px;
  border-radius: var(--radius);
  font-size: 0.88rem;
  line-height: 1.55;
}

/* ---------- Dashboard layout ---------- */
.dash-shell { display: grid; grid-template-columns: 220px 1fr; gap: 36px; padding: 40px 0 80px; }
@media (max-width: 860px) { .dash-shell { grid-template-columns: 1fr; } }
.dash-side { border-right: 1px solid var(--border); padding-right: 24px; }
@media (max-width: 860px) { .dash-side { border-right: none; border-bottom: 1px solid var(--border); padding-right: 0; padding-bottom: 20px; } }
.dash-side a {
  display: block; padding: 9px 12px; margin: 0 -12px; border-radius: var(--radius);
  color: var(--text-muted); font-weight: 500; font-size: 0.95rem;
}
.dash-side a.active { color: var(--text); background: var(--bg-elevated-2); text-decoration: none; }
.dash-side a:hover { color: var(--orange); text-decoration: none; }
.dash-side a.dash-link-red {
  background: var(--tally);
  color: #fff;
  font-weight: 600;
  text-align: center;
  margin-top: 6px;
}
.dash-side a.dash-link-red:hover { background: #b91c1c; color: #fff; }
.stat-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 18px; margin-bottom: 36px; }
@media (max-width: 700px) { .stat-grid { grid-template-columns: 1fr; } }
.stat-card { background: var(--bg-elevated); border: 1px solid var(--border); border-radius: var(--radius-lg); padding: 20px; box-shadow: var(--shadow-sm); }
.stat-card .num { font-family: var(--font-display); font-size: 2.4rem; color: var(--teal); }
.stat-card .label { font-family: var(--font-mono); font-size: 0.78rem; text-transform: uppercase; color: var(--text-muted); }

/* ---------- Tables (admin) ---------- */
table.data-table { width: 100%; border-collapse: collapse; }
.data-table th, .data-table td {
  text-align: left; padding: 12px 14px; border-bottom: 1px solid var(--border); font-size: 0.92rem;
}
.data-table th { font-family: var(--font-mono); font-size: 0.75rem; text-transform: uppercase; letter-spacing: 0.04em; color: var(--text-muted); background: var(--bg-elevated-2); }
.data-table tbody tr:hover { background: var(--bg-soft); }
.table-wrap { overflow-x: auto; background: var(--bg-elevated); border: 1px solid var(--border); border-radius: var(--radius-lg); box-shadow: var(--shadow-sm); }
.table-wrap table { min-width: 620px; }
.row-actions { display: flex; gap: 10px; flex-wrap: wrap; }

/* ---------- Video ---------- */
.video-frame { position: relative; width: 100%; aspect-ratio: 16/9; background: #000; border-radius: var(--radius-lg); overflow: hidden; border: 1px solid var(--border); box-shadow: var(--shadow-sm); }
.video-frame iframe, .video-frame video { width: 100%; height: 100%; border: none; }
.video-placeholder {
  aspect-ratio: 16/9; display: flex; align-items: center; justify-content: center;
  background: var(--bg-elevated-2); border: 1px dashed var(--border-bright); border-radius: var(--radius-lg);
  color: var(--text-muted); font-family: var(--font-mono); font-size: 0.85rem;
}

/* ---------- Footer ---------- */
.site-footer { border-top: 1px solid var(--border); background: var(--bg-soft); padding: 36px 0; margin-top: 60px; }
.site-footer .container { display: flex; justify-content: space-between; align-items: center; flex-wrap: wrap; gap: 12px; }
.site-footer p { margin: 0; font-size: 0.85rem; }

/* ---------- Utility ---------- */
.text-center { text-align: center; }
.mt-0 { margin-top: 0; }
.stack { display: flex; flex-direction: column; gap: 10px; }
.empty-state {
  text-align: center; padding: 60px 24px; color: var(--text-muted);
  background: var(--bg-soft);
  border: 1px dashed var(--border-bright); border-radius: var(--radius-lg);
}
