@import url("https://fonts.googleapis.com/css2?family=Source+Sans+3:wght@400;500;600;700&family=Source+Serif+4:opsz,wght@8..60,500;8..60,600;8..60,700&display=swap");

:root {
  --navy: #0B1F33;
  --charcoal: #1A1A1A;
  --page-bg: #F4F4F2;
  --accent: #0B1F33;
  --accent-hover: #16324F;
  --border: #D9D6D0;
  --muted: #5C5C5C;
  --white: #FFFFFF;
  --radius: 4px;
}

html { overflow-y: scroll; }
body {
  background: var(--page-bg);
  color: var(--charcoal);
  font-family: "Source Sans 3", system-ui, sans-serif;
  margin: 0;
}

.hero-heading {
  font-family: "Source Serif 4", "Times New Roman", Georgia, serif;
  font-weight: 600;
  letter-spacing: -0.01em;
  color: var(--navy);
}
.sub-hero {
  color: #111111;
  font-weight: 400;
}

.site-nav {
  background: #fff;
  border-bottom: 1px solid var(--border);
}
.nav-tab {
  padding: 8px 12px;
  font-size: 13px;
  font-weight: 600;
  color: var(--charcoal);
  border: none;
  background: none;
  border-radius: var(--radius);
  cursor: pointer;
}
.nav-tab:hover,
.nav-tab.active { background: #EEECE7; color: var(--navy); }

.cart-badge {
  position: absolute;
  top: 2px;
  right: 2px;
  min-width: 16px;
  height: 16px;
  padding: 0 4px;
  border-radius: 8px;
  background: var(--accent);
  color: #fff;
  font-size: 10px;
  font-weight: 600;
  display: flex;
  align-items: center;
  justify-content: center;
}
.site-nav-cart {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  color: var(--charcoal);
  border-radius: var(--radius);
}
.site-nav-cart:hover { background: #EEECE7; }
.site-nav-cart svg { width: 1.125rem; height: 1.125rem; display: block; }

.btn-primary,
.buy-btn,
.pay-btn,
.watch-free-btn {
  height: 36px;
  border-radius: var(--radius);
  border: none;
  background: var(--accent);
  color: #fff;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0 14px;
  box-sizing: border-box;
  transition: background 0.15s ease;
}
.btn-primary:hover,
.buy-btn:hover,
.pay-btn:hover,
.watch-free-btn:hover { background: var(--accent-hover); }
.btn-primary:disabled,
.pay-btn:disabled { opacity: 0.6; cursor: not-allowed; }
#payButton { width: 100%; height: 44px; }
.course-center .btn-primary { width: 100%; }

.btn-secondary,
.add-cart-btn {
  height: 36px;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  background: var(--white);
  color: var(--charcoal);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  padding: 0 14px;
  box-sizing: border-box;
}
.btn-secondary:hover,
.add-cart-btn:hover { background: #F3F1EC; }
.add-cart-btn.in-cart {
  background: #F3F1EC;
  color: var(--muted);
  cursor: default;
}

.back-link { font-size: 0.875rem; color: var(--muted); text-decoration: none; }
.back-link:hover { color: var(--navy); }

.filter-bar {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 6px;
  margin: 0 auto 20px;
  max-width: 56rem;
}
.filter-pill {
  padding: 6px 12px;
  font-size: 12px;
  font-weight: 600;
  color: var(--charcoal);
  background: var(--white);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  cursor: pointer;
}
.filter-pill:hover { background: #EEECE7; color: var(--navy); }
.filter-pill:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.filter-pill.active {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
}
.section-label {
  font-size: 12px;
  font-weight: 600;
  color: var(--muted);
  letter-spacing: 0.04em;
  text-transform: uppercase;
  text-align: center;
  margin: 0 0 14px;
}
.catalog-empty {
  grid-column: 1 / -1;
  text-align: center;
  padding: 28px 16px;
  font-size: 14px;
  color: var(--muted);
}

#videoDirectory {
  display: grid;
  grid-template-columns: 1fr;
  gap: 10px;
  align-items: stretch;
}
@media (min-width: 900px) {
  #videoDirectory { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
}

.course-card {
  display: grid;
  grid-template-columns: 108px 1fr;
  align-items: stretch;
  background: var(--white);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  min-height: 0;
}
.course-card:hover { border-color: #C4C0B8; }
.course-card .thumb {
  position: relative;
  width: 108px;
  min-height: 86px;
  background: #EEECE7;
  overflow: hidden;
}
.course-card .thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}
.course-card .body {
  padding: 10px 12px 10px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  min-width: 0;
}
.tag-row {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  align-items: center;
}
.tag {
  display: inline-flex;
  align-items: center;
  padding: 2px 7px;
  border-radius: 2px;
  font-size: 11px;
  font-weight: 600;
  line-height: 1.3;
}
.tag-topic {
  background: transparent;
  color: var(--muted);
  border: 1px solid var(--border);
}
.tag-duration {
  background: #EEECE7;
  color: var(--muted);
  border: 1px solid transparent;
}
.tag-free {
  position: absolute;
  top: 6px;
  left: 6px;
  background: var(--accent);
  color: #fff;
  font-size: 10px;
  font-weight: 600;
  padding: 2px 6px;
  border-radius: 2px;
}
.tag-free-inline {
  background: var(--accent);
  color: #fff;
  border: 1px solid transparent;
  font-weight: 600;
}
.tag-paid-inline {
  background: #EEECE7;
  color: var(--navy);
  border: 1px solid var(--border);
  font-weight: 600;
}
.course-card h3 {
  font-size: 14px;
  font-weight: 600;
  line-height: 1.3;
  color: var(--navy);
  margin: 0;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.course-blurb {
  margin: 0;
  font-size: 12px;
  line-height: 1.4;
  color: var(--muted);
  display: -webkit-box;
  -webkit-line-clamp: 1;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.card-actions {
  margin-top: auto;
  display: flex;
  flex-direction: row;
  gap: 6px;
}
.card-actions .btn-primary,
.card-actions .btn-secondary,
.card-actions .buy-btn,
.card-actions .add-cart-btn,
.card-actions .watch-free-btn {
  flex: 1;
  width: auto !important;
  height: 32px;
  font-size: 12px;
}

.form-card,
.panel {
  background: var(--white);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: none;
}
.form-card { padding: 28px 24px; }
.form-card .btn-primary,
.form-card .btn-secondary { width: 100%; }
.form-label {
  font-size: 13px;
  font-weight: 500;
  color: var(--muted);
  margin-bottom: 6px;
  display: block;
}
.form-input,
.form-textarea {
  width: 100%;
  background: var(--white);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  font-size: 14px;
  color: var(--charcoal);
  box-sizing: border-box;
  font-family: inherit;
}
.form-input { height: 40px; padding: 0 12px; }
.form-textarea { min-height: 140px; padding: 12px; resize: vertical; }
.form-input:focus,
.form-textarea:focus { outline: none; border-color: var(--navy); }
.password-wrapper { position: relative; }
.password-wrapper .form-input { padding-right: 44px; }
.password-toggle {
  position: absolute;
  right: 10px;
  top: 50%;
  transform: translateY(-50%);
  display: flex;
  align-items: center;
  justify-content: center;
  background: none;
  border: none;
  color: var(--muted);
  cursor: pointer;
  padding: 4px;
}

.toast {
  position: fixed;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%) translateY(12px);
  background: var(--charcoal);
  color: #fff;
  font-size: 13px;
  font-weight: 500;
  padding: 10px 16px;
  border-radius: var(--radius);
  opacity: 0;
  pointer-events: none;
  transition: all 0.2s ease;
  z-index: 80;
}
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }

.course-page {
  max-width: 720px;
  margin: 0 auto;
}
.course-center {
  max-width: 28rem;
  margin: 0 auto;
  text-align: center;
}
.course-center .form-label,
.course-center input { text-align: left; }
.video-placeholder {
  height: 140px;
  background: linear-gradient(160deg, #0B1F33 0%, #16324F 100%);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
}
.play-icon {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.16);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 16px;
  margin: 0 auto;
}
.module-list {
  margin: 0;
  padding-left: 1.15rem;
  color: var(--charcoal);
  font-size: 14px;
  line-height: 1.7;
}
.module-list li { margin-bottom: 4px; }
.access-pill {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 10px 14px;
  border-radius: var(--radius);
  font-size: 13px;
  font-weight: 600;
  background: #F3F1EC;
  color: var(--navy);
  border: 1px solid var(--border);
  text-align: center;
}
.access-pill .dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--navy);
}
.paywall-card {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding: 14px 16px;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  background: #fff;
}
.quiz-card {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px;
  background: #fff;
}
.choice-row {
  display: flex;
  gap: 10px;
  align-items: flex-start;
  padding: 10px 12px;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  cursor: pointer;
  font-size: 13px;
  color: var(--charcoal);
  background: #fff;
}
.choice-row:hover { background: #F9F8F6; }
.choice-row input { margin-top: 2px; }
.choice-row.choice-correct { border-color: #6EE7B7; background: #ECFDF5; }
.choice-row.choice-wrong { border-color: #FECACA; background: #FFF1F2; }
.btn-submit-q {
  height: 34px;
  padding: 0 14px;
  border-radius: var(--radius);
  border: none;
  background: var(--navy);
  color: #fff;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
}
.summary-row {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  font-size: 13px;
  padding: 8px 0;
  border-bottom: 1px solid var(--border);
}
.summary-row:last-child { border-bottom: none; }
.summary-row .label { color: var(--muted); }
.summary-row .value { color: var(--charcoal); font-weight: 500; text-align: right; }
.price-total {
  font-size: 22px;
  font-weight: 600;
  color: var(--navy);
  font-family: "Source Serif 4", "Times New Roman", Georgia, serif;
}
#paymentStatus {
  min-height: 1.25rem;
  font-size: 13px;
  color: var(--muted);
  margin-top: 10px;
}
#paymentStatus.is-error { color: #B91C1C; }
.error-card {
  background: #FFF7F7;
  border: 1px solid #FECACA;
  border-radius: var(--radius);
  padding: 20px 18px;
}
.error-title { font-weight: 600; color: var(--navy); font-size: 15px; margin: 0 0 6px; }
.error-body { font-size: 13px; color: var(--muted); line-height: 1.55; margin: 0 0 14px; }
.error-link { font-size: 13px; font-weight: 600; color: var(--accent); }
.spinner {
  width: 28px;
  height: 28px;
  border: 3px solid #E5E7EB;
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

.cart-row {
  display: flex;
  align-items: center;
  gap: 16px;
  background: var(--white);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 12px;
}

@media (max-width: 639px) {
  .course-card { grid-template-columns: 84px 1fr; }
  .course-card .thumb { width: 84px; min-height: 78px; }
}
