/* ==========================================================================
   Sequence — design tokens
   Clean, professional white theme with a blue accent.
   ========================================================================== */

:root {
  --navy-900: #0f172a;
  --navy-800: #1e293b;
  --slate-700: #334155;
  --slate-500: #64748b;
  --slate-400: #94a3b8;
  --line: #e2e8f0;
  --line-soft: #edf1f6;

  --white: #ffffff;
  --surface: #f8fafc;
  --surface-alt: #f1f5f9;

  --blue-700: #1d4ed8;
  --blue-600: #2563eb;
  --blue-500: #3b82f6;
  --blue-100: #dbeafe;
  --blue-50: #eff6ff;
  --red-600: #dc2626;

  --font-display: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  --font-body: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  --font-mono: 'IBM Plex Mono', 'Menlo', 'Consolas', monospace;

  --radius-sm: 6px;
  --radius: 12px;
  --radius-lg: 18px;
  --container: 1240px;
  --shadow: 0 1px 2px rgba(15, 23, 42, 0.06), 0 4px 12px rgba(15, 23, 42, 0.06);
  --shadow-lift: 0 16px 40px rgba(15, 23, 42, 0.12);
}

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

* { box-sizing: border-box; margin: 0; padding: 0; }

html { scroll-behavior: smooth; }

body {
  background: var(--white);
  color: var(--navy-900);
  font-family: var(--font-body);
  font-size: 16px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  min-height: 100vh;
}

.wrap { max-width: var(--container); margin: 0 auto; padding: 0 24px; }

h1, h2, h3 { font-family: var(--font-display); font-weight: 700; line-height: 1.15; color: var(--navy-900); letter-spacing: -0.015em; }
h1 { font-size: 2.6rem; }
h2 { font-size: 1.9rem; }
h3 { font-size: 1.15rem; }

p { color: var(--slate-500); }

a { color: var(--blue-600); text-decoration: none; }
a:hover { color: var(--blue-700); text-decoration: underline; }

:focus-visible {
  outline: 2px solid var(--blue-500);
  outline-offset: 2px;
  border-radius: 3px;
}

.eyebrow {
  font-family: var(--font-mono);
  font-size: 0.72rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--blue-600);
}

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-family: var(--font-body);
  font-size: 0.92rem;
  font-weight: 600;
  padding: 11px 20px;
  border-radius: var(--radius-sm);
  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;
  white-space: nowrap;
  line-height: 1;
}
.btn:active { transform: translateY(1px); }

.btn--primary {
  background: var(--blue-600);
  color: var(--white);
  box-shadow: 0 1px 2px rgba(37, 99, 235, 0.25);
}
.btn--primary:hover { background: var(--blue-700); }

.btn--secondary {
  background: var(--white);
  color: var(--navy-900);
  border-color: var(--line);
}
.btn--secondary:hover { border-color: var(--blue-500); color: var(--blue-700); }

.btn--ghost {
  background: transparent;
  color: var(--slate-500);
  padding: 8px 12px;
  font-size: 0.85rem;
}
.btn--ghost:hover { color: var(--blue-700); }

.btn--block { width: 100%; justify-content: center; }
.btn[disabled] { opacity: 0.5; cursor: not-allowed; }

/* ---------- Nav ---------- */
.nav {
  border-bottom: 1px solid var(--line);
  position: sticky;
  top: 0;
  background: rgba(255, 255, 255, 0.92);
  backdrop-filter: blur(8px);
  z-index: 40;
}
.nav .wrap { display: flex; align-items: center; justify-content: space-between; height: 68px; gap: 16px; }
.nav__brand { font-family: var(--font-display); font-weight: 800; font-size: 1.3rem; display: flex; align-items: center; gap: 10px; color: var(--navy-900); }
.nav__dot { width: 9px; height: 9px; border-radius: 50%; background: var(--blue-600); box-shadow: 0 0 8px rgba(37, 99, 235, 0.5); }
.nav__links { display: flex; align-items: center; gap: 24px; }
.nav__links a { color: var(--slate-500); font-size: 0.92rem; }
.nav__links a:hover { color: var(--navy-900); text-decoration: none; }
.nav__icon-btn {
  background: transparent; border: 1px solid var(--line); color: var(--slate-500);
  width: 38px; height: 38px; border-radius: 50%; display: inline-flex; align-items: center; justify-content: center;
  cursor: pointer; font-size: 1rem; transition: border-color 0.15s, color 0.15s;
}
.nav__icon-btn:hover { border-color: var(--blue-500); color: var(--blue-700); }

/* ---------- Hero ---------- */
.hero { padding: 88px 0 64px; border-bottom: 1px solid var(--line); background: linear-gradient(180deg, var(--blue-50) 0%, var(--white) 60%); }
.hero__grid { display: grid; grid-template-columns: 1.1fr 0.9fr; gap: 64px; align-items: center; }
.hero__title { font-size: clamp(2.1rem, 4vw, 3.2rem); margin-bottom: 18px; }
.hero__title em { font-style: normal; color: var(--blue-600); }
.hero__sub { font-size: 1.08rem; margin-bottom: 32px; max-width: 50ch; line-height: 1.7; }
.hero__actions { display: flex; gap: 12px; flex-wrap: wrap; margin-bottom: 46px; }
.hero__stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 32px; }
.hero__stat b { display: block; font-family: var(--font-mono); font-size: 1.5rem; color: var(--blue-700); font-weight: 600; }
.hero__stat span { font-size: 0.8rem; color: var(--slate-400); }

/* Signature: an "admit one" screening ticket, tilted */
.ticket-showcase { display: flex; justify-content: center; }
.ticket {
  width: 100%; max-width: 360px;
  background: var(--white);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow-lift);
  transform: rotate(2.5deg);
  transition: transform 0.35s ease;
  overflow: hidden;
}
.ticket:hover { transform: rotate(0deg); }
.ticket__top { padding: 20px 22px 16px; }
.ticket__row { display: flex; justify-content: space-between; align-items: baseline; margin-bottom: 6px; }
.ticket__label { font-family: var(--font-mono); font-size: 0.68rem; letter-spacing: 0.1em; text-transform: uppercase; color: var(--slate-400); }
.ticket__value { font-family: var(--font-mono); font-size: 0.78rem; color: var(--blue-700); }
.ticket__title { font-family: var(--font-display); font-weight: 700; font-size: 1.3rem; margin: 10px 0 4px; color: var(--navy-900); }
.ticket__sub { font-size: 0.85rem; color: var(--slate-500); }
.ticket__perf {
  height: 18px;
  background-image: radial-gradient(circle at 10px 9px, var(--white) 6px, transparent 6.5px);
  background-size: 20px 18px;
  background-repeat: repeat-x;
  border-top: 1px dashed var(--line);
  border-bottom: 1px dashed var(--line);
}
.ticket__bottom { padding: 16px 22px 22px; display: flex; align-items: center; justify-content: space-between; background: var(--surface); }
.ticket__seat { font-family: var(--font-mono); font-size: 0.72rem; color: var(--slate-400); }
.ticket__admit { font-family: var(--font-mono); font-size: 0.72rem; letter-spacing: 0.08em; color: var(--blue-600); font-weight: 600; }

/* ---------- Steps ---------- */
.steps { padding: 72px 0; border-bottom: 1px solid var(--line); }
.steps__head { margin-bottom: 40px; }
.steps__head p { max-width: 60ch; margin-top: 8px; }
.step-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 20px; }
.step { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 28px 24px; transition: border-color 0.15s, box-shadow 0.15s; }
.step:hover { border-color: var(--blue-500); box-shadow: var(--shadow); }
.step__code { font-family: var(--font-mono); color: var(--blue-600); font-size: 0.78rem; letter-spacing: 0.08em; text-transform: uppercase; display: block; margin-bottom: 14px; }
.step h3 { margin-bottom: 8px; }
.step p { font-size: 0.94rem; }

/* ---------- Library / catalog ---------- */
.catalog { padding: 72px 0 100px; }
.catalog__head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 36px; flex-wrap: wrap; gap: 16px; }
.course-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 22px; }

.course-card {
  display: flex; flex-direction: column;
  background: var(--white);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  overflow: hidden;
  text-decoration: none;
  color: inherit;
  transition: border-color 0.18s ease, transform 0.18s ease, box-shadow 0.18s ease;
  position: relative;
}
.course-card:hover { border-color: var(--blue-500); transform: translateY(-3px); box-shadow: var(--shadow-lift); text-decoration: none; }
.course-card__media { position: relative; aspect-ratio: 16/9; background: var(--surface-alt); overflow: hidden; }
.course-card__media img { width: 100%; height: 100%; object-fit: cover; display: block; }
.course-card__badge {
  position: absolute; right: 10px; bottom: 10px;
  background: rgba(15, 23, 42, 0.78);
  border: 1px solid var(--blue-500);
  color: var(--white);
  font-family: var(--font-mono); font-size: 0.7rem; font-weight: 600;
  padding: 4px 9px; border-radius: 3px;
}
.course-card__type {
  position: absolute; left: 10px; top: 10px;
  background: rgba(15, 23, 42, 0.78);
  color: var(--white);
  font-family: var(--font-mono); font-size: 0.65rem; letter-spacing: 0.06em; text-transform: uppercase;
  padding: 3px 8px; border-radius: 3px; border: 1px solid rgba(255,255,255,0.25);
}
.course-card__body { padding: 18px 18px 20px; flex: 1; display: flex; flex-direction: column; gap: 6px; }
.course-card__title { font-size: 1.05rem; color: var(--navy-900); }
.course-card__channel { font-size: 0.85rem; color: var(--slate-400); }
.course-card__meta { font-family: var(--font-mono); font-size: 0.78rem; color: var(--slate-500); margin-top: auto; padding-top: 10px; border-top: 1px dashed var(--line); display: flex; justify-content: space-between; }
.course-card__delete {
  position: absolute; top: 10px; right: 10px;
  width: 28px; height: 28px; border-radius: 50%;
  background: rgba(255, 255, 255, 0.92); border: 1px solid var(--line); color: var(--slate-500);
  display: flex; align-items: center; justify-content: center; cursor: pointer;
  opacity: 0; transition: opacity 0.15s;
  font-size: 0.9rem;
  box-shadow: var(--shadow);
}
.course-card:hover .course-card__delete { opacity: 1; }
.course-card__delete:hover { border-color: var(--red-600); color: var(--red-600); }

.empty-state { text-align: center; padding: 72px 24px; color: var(--slate-500); border: 1px dashed var(--line); border-radius: var(--radius-lg); background: var(--surface); }
.empty-state p:first-child { font-family: var(--font-display); font-weight: 700; font-size: 1.3rem; color: var(--navy-900); margin-bottom: 10px; }
.empty-state p { margin-bottom: 4px; }

/* ---------- Modal ---------- */
.modal {
  display: none; position: fixed; inset: 0; background: rgba(15, 23, 42, 0.45);
  z-index: 50; align-items: center; justify-content: center; padding: 20px;
  animation: fadeIn 0.18s ease;
}
.modal.is-open { display: flex; }
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
@keyframes slideUp { from { transform: translateY(16px); opacity: 0; } to { transform: translateY(0); opacity: 1; } }

.modal__content {
  background: var(--white); border: 1px solid var(--line);
  border-radius: var(--radius-lg); padding: 30px;
  max-width: 480px; width: 100%;
  box-shadow: var(--shadow-lift);
  animation: slideUp 0.25s ease;
  max-height: 90vh; overflow-y: auto;
}
.modal__header h2 { margin-bottom: 6px; }
.modal__description { color: var(--slate-500); font-size: 0.92rem; }
.modal__close { position: absolute; }

.form-group { display: flex; flex-direction: column; gap: 7px; margin: 18px 0; }
.form-group label { font-size: 0.88rem; font-weight: 600; color: var(--navy-900); }
.form-group input, .form-group textarea {
  font-family: var(--font-body); font-size: 0.94rem; padding: 11px 13px;
  border: 1px solid var(--line); border-radius: var(--radius-sm);
  background: var(--white); color: var(--navy-900);
  transition: border-color 0.15s, box-shadow 0.15s;
}
.form-group input::placeholder, .form-group textarea::placeholder { color: var(--slate-400); }
.form-group input:focus, .form-group textarea:focus { outline: none; border-color: var(--blue-500); box-shadow: 0 0 0 3px var(--blue-100); }
.form-group small { color: var(--slate-400); font-size: 0.8rem; }
.form-actions { display: flex; gap: 10px; justify-content: flex-end; margin-top: 22px; }

.callout {
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-sm);
  padding: 12px 14px; font-size: 0.85rem; color: var(--slate-500); margin: 16px 0;
}
.callout strong { color: var(--navy-900); }
.form-error { color: var(--red-600); font-size: 0.85rem; margin-top: 4px; display: none; }
.form-error.is-visible { display: block; }
.form-loading { display: none; align-items: center; gap: 10px; color: var(--slate-500); font-size: 0.88rem; margin-top: 4px; }
.form-loading.is-visible { display: flex; }
.spinner {
  width: 15px; height: 15px; border-radius: 50%;
  border: 2px solid var(--line); border-top-color: var(--blue-600);
  animation: spin 0.7s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ---------- Footer ---------- */
.site-footer { border-top: 1px solid var(--line); padding: 34px 0; color: var(--slate-400); font-size: 0.85rem; background: var(--surface); }
.site-footer .wrap { display: flex; justify-content: space-between; align-items: center; flex-wrap: wrap; gap: 16px; }

/* ==========================================================================
   Course detail page
   ========================================================================== */
.course-header {
  border-bottom: 1px solid var(--line);
  padding: 22px 0;
  background: var(--surface);
}
.course-header__back { font-family: var(--font-mono); font-size: 0.82rem; color: var(--slate-500); display: inline-flex; align-items: center; gap: 6px; margin-bottom: 12px; }
.course-header__back:hover { color: var(--blue-700); text-decoration: none; }
.course-header__title { font-size: 1.7rem; margin-bottom: 6px; }
.course-header__meta { font-family: var(--font-mono); font-size: 0.82rem; color: var(--slate-500); display: flex; gap: 18px; flex-wrap: wrap; }
.course-header__meta strong { color: var(--blue-700); }

.course-layout {
  display: grid;
  grid-template-columns: 1fr 340px;
  gap: 32px;
  padding: 32px 0 80px;
  align-items: start;
}

.player-wrap { background: #000; border-radius: var(--radius); overflow: hidden; aspect-ratio: 16/9; border: 1px solid var(--line); box-shadow: var(--shadow); }
.player-wrap iframe { width: 100%; height: 100%; border: 0; display: block; }

.lesson-panel { padding-top: 22px; }
.lesson-panel__eyebrow { display: flex; align-items: center; justify-content: space-between; margin-bottom: 10px; }
.lesson-panel__title { font-size: 1.5rem; margin-bottom: 14px; }
.lesson-panel__desc { color: var(--slate-500); font-size: 0.95rem; line-height: 1.75; white-space: pre-wrap; max-height: 210px; overflow: hidden; position: relative; }
.lesson-panel__desc.is-expanded { max-height: none; }
.lesson-panel__desc:not(.is-expanded)::after {
  content: ''; position: absolute; left: 0; right: 0; bottom: 0; height: 60px;
  background: linear-gradient(to bottom, transparent, var(--white));
}
.lesson-panel__more { margin-top: 10px; }

.lesson-nav { display: flex; justify-content: space-between; gap: 12px; margin-top: 26px; padding-top: 22px; border-top: 1px dashed var(--line); }

.mark-complete { display: inline-flex; align-items: center; gap: 8px; font-size: 0.85rem; color: var(--slate-500); cursor: pointer; user-select: none; }
.mark-complete input { width: 16px; height: 16px; accent-color: var(--blue-600); cursor: pointer; }

/* Sidebar ledger */
.ledger { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; }
.ledger__head { padding: 16px 18px; border-bottom: 1px solid var(--line); display: flex; justify-content: space-between; align-items: center; background: var(--white); }
.ledger__head h3 { font-size: 0.95rem; }
.ledger__count { font-family: var(--font-mono); font-size: 0.78rem; color: var(--blue-600); }
.ledger__list { max-height: 640px; overflow-y: auto; }

.ticket-row {
  display: flex; gap: 12px; align-items: center;
  padding: 13px 16px;
  border-bottom: 1px solid var(--line);
  cursor: pointer;
  text-decoration: none;
  color: inherit;
  transition: background 0.12s;
  border-left: 3px solid transparent;
  position: relative;
}
.ticket-row:hover { background: var(--white); text-decoration: none; }
.ticket-row.is-active { background: var(--blue-50); border-left-color: var(--blue-600); }
.ticket-row__num { font-family: var(--font-mono); font-size: 0.78rem; color: var(--slate-400); width: 22px; flex-shrink: 0; text-align: right; }
.ticket-row.is-active .ticket-row__num { color: var(--blue-700); }
.ticket-row__thumb { width: 64px; aspect-ratio: 16/9; border-radius: 3px; overflow: hidden; flex-shrink: 0; background: var(--surface-alt); }
.ticket-row__thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.ticket-row__body { min-width: 0; flex: 1; }
.ticket-row__title { font-size: 0.86rem; color: var(--navy-900); line-height: 1.35; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.ticket-row__dur { font-family: var(--font-mono); font-size: 0.72rem; color: var(--slate-400); margin-top: 3px; }
.ticket-row__check { width: 16px; height: 16px; border-radius: 50%; border: 1px solid var(--line); flex-shrink: 0; display: flex; align-items: center; justify-content: center; font-size: 0.6rem; color: transparent; }
.ticket-row__check.is-done { background: var(--blue-600); border-color: var(--blue-600); color: var(--white); }

/* Mobile sidebar toggle */
.lesson-toggle { display: none; }

@media (max-width: 960px) {
  .course-layout { grid-template-columns: 1fr; }
  .ledger { display: none; }
  .ledger.is-open {
    display: block; position: fixed; inset: 0; z-index: 60;
    border-radius: 0; max-height: none;
  }
  .ledger.is-open .ledger__list { max-height: calc(100vh - 58px); }
  .lesson-toggle { display: inline-flex; }
}

/* ---------- Shared responsive ---------- */
@media (max-width: 1024px) {
  .hero__grid { grid-template-columns: 1fr; gap: 40px; }
  .ticket-showcase { order: -1; max-width: 320px; margin: 0 auto; }
  .hero__stats { grid-template-columns: repeat(3, 1fr); }
}

@media (max-width: 640px) {
  .wrap { padding: 0 18px; }
  h1 { font-size: 1.9rem; }
  h2 { font-size: 1.5rem; }
  .hero { padding: 44px 0 36px; }
  .hero__stats { grid-template-columns: repeat(3, 1fr); gap: 14px; }
  .hero__stat b { font-size: 1.2rem; }
  .nav .wrap { height: 58px; }
  .nav__links { gap: 12px; }
  .nav__links a { display: none; }
  .modal__content { padding: 22px; }
  .course-header__title { font-size: 1.35rem; }
  .catalog__head h2 { font-size: 1.5rem; }
}
