﻿/* ═════════════════════════════════════════════════════
   STERLING HAWKINS · COURSE PORTAL · v2 (light mode)
   Light theme matching sterlinghawkins.com
   ═════════════════════════════════════════════════════ */

@import url("https://fonts.googleapis.com/css2?family=Mulish:wght@300;400;500;600;700;800;900&display=swap");

/* ─── Baro Plain (Sterling's licensed heading font, self-hosted) ─── */
@font-face {
  font-family: 'Baro Plain';
  src: url('/fonts/Baro-Plain.otf') format('opentype');
  font-weight: 400 900;
  font-style: normal;
  font-display: swap;
}

:root {
  /* ─── LIGHT MODE (default) ─── */
  --bg:            #FAF9F6;    /* warm off-white page bg */
  --surface:       #FFFFFF;    /* card bg */
  --surface-hi:    #F5F3EF;    /* hover / subtle raise */
  --border:        rgba(10,10,10,0.09);
  --border-hi:     rgba(10,10,10,0.18);
  --text:          #0A0A0A;    /* near-black primary */
  --text-mid:      #4A4A4A;    /* secondary */
  --text-mute:     #7C7671;    /* captions, muted */
  --tan:           #CBC5C0;
  --brown:         #70645B;
  --yellow:        #F5D24C;    /* brand accent — kept */
  --yellow-warm:   #FEFAEE;    /* subtle yellow tint bg */
  --yellow-darker: #8A6E15;
  --teal:          #81B0AE;
  --green:         #4CAF50;
  --danger:        #E85A5A;

  /* Intentional DARK accents (used on purpose against light bg) */
  --accent-dark:      #0A0A0A;
  --accent-dark-warm: linear-gradient(135deg, #1A1408 0%, #0A0A0A 100%);
  --accent-cream:     linear-gradient(135deg, #FEFAEE 0%, #FFFFFF 100%);

  --radius:        10px;
  --radius-lg:     16px;
  --shadow:        0 6px 40px rgba(0,0,0,0.08);
  --shadow-sm:     0 2px 12px rgba(0,0,0,0.05);
  --font-body:     'Mulish', -apple-system, BlinkMacSystemFont, sans-serif;
  --font-display:  'Baro Plain', 'Fraunces', Georgia, serif;
}

/* Optional: [data-theme="dark"] on <html> switches back to dark palette */
html[data-theme="dark"] {
  --bg:            #0A0A0A;
  --surface:       #141414;
  --surface-hi:    #1C1C1C;
  --border:        rgba(255,255,255,0.08);
  --border-hi:     rgba(255,255,255,0.16);
  --text:          #FFFFFF;
  --text-mid:      #C8C4BF;
  --text-mute:     #7C7671;
  --yellow-warm:   #1A1408;
  --shadow:        0 6px 40px rgba(0,0,0,0.5);
}

* { box-sizing: border-box; margin: 0; padding: 0; }

html, body {
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-body);
  font-size: 16px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  min-height: 100vh;
}

a { color: inherit; text-decoration: none; }
img { max-width: 100%; display: block; }

/* ═════════════ TOP BAR (persistent) ═════════════ */
.appbar {
  height: 64px;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  padding: 0 28px;
  position: sticky;
  top: 0;
  z-index: 100;
}
.appbar-inner {
  width: 100%;
  max-width: 1400px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 32px;
}
.appbar-brand {
  display: flex;
  align-items: center;
  gap: 12px;
}
.appbar-logo {
  height: 24px;
  width: auto;
  max-width: 180px;
  object-fit: contain;
  display: block;
}
.appbar-brand-label {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.18em;
  color: var(--text-mute);
  text-transform: uppercase;
  border-left: 1px solid var(--border);
  padding-left: 12px;
  margin-left: 4px;
}
.appbar-nav {
  display: flex;
  gap: 8px;
  align-items: center;
}
.appbar-link {
  padding: 8px 14px;
  font-size: 14px;
  font-weight: 600;
  color: var(--text-mid);
  border-radius: 8px;
  transition: all 0.15s ease;
}
.appbar-link:hover { color: var(--text); background: var(--surface-hi); }
.appbar-link.active { color: var(--text); background: var(--surface-hi); }

.appbar-user {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 6px 12px;
  border-radius: 999px;
  background: var(--surface-hi);
  border: 1px solid var(--border);
  cursor: pointer;
}
.appbar-avatar {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: var(--yellow);
  color: var(--bg);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 900;
  font-size: 13px;
}
.appbar-user-name {
  font-size: 13px;
  font-weight: 600;
  color: var(--text);
}

/* ═════════════ MAIN WRAP ═════════════ */
.main {
  min-height: calc(100vh - 64px);
  padding: 48px 28px 80px;
}
.wrap {
  max-width: 1200px;
  margin: 0 auto;
}
.wrap-wide {
  max-width: 1400px;
  margin: 0 auto;
}
.wrap-narrow {
  max-width: 720px;
  margin: 0 auto;
}

/* ═════════════ TYPOGRAPHY ═════════════ */
h1, h2, h3, h4 {
  font-family: var(--font-display);
  font-weight: 700;
  line-height: 1.15;
  letter-spacing: -0.015em;
  color: var(--text);
}
h1 { font-size: 42px; margin-bottom: 12px; }
h2 { font-size: 32px; margin-bottom: 12px; }
h3 { font-size: 22px; margin-bottom: 8px; }
h4 { font-size: 17px; margin-bottom: 6px; }

.eyebrow {
  font-family: var(--font-body);
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--yellow);
  margin-bottom: 14px;
}
.lede {
  font-size: 17px;
  color: var(--text-mid);
  line-height: 1.6;
  margin-bottom: 16px;
}
.mute {
  color: var(--text-mute);
  font-size: 14px;
}

/* ═════════════ CARDS ═════════════ */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 28px;
}
.card-hoverable {
  transition: transform 0.15s ease, border-color 0.15s ease, background 0.15s ease;
  cursor: pointer;
}
.card-hoverable:hover {
  border-color: var(--border-hi);
  background: var(--surface-hi);
  transform: translateY(-2px);
}

/* ═════════════ BUTTONS ═════════════ */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 12px 22px;
  font-family: var(--font-body);
  font-size: 14px;
  font-weight: 800;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  border-radius: 999px;
  border: 1px solid transparent;
  cursor: pointer;
  transition: all 0.15s ease;
  text-decoration: none;
  white-space: nowrap;
}
.btn-primary {
  background: var(--yellow);
  color: #0A0A0A;
}
.btn-primary:hover {
  background: #FFDF6C;
  transform: translateY(-1px);
}
.btn-ghost {
  background: transparent;
  border-color: var(--border-hi);
  color: var(--text);
}
.btn-ghost:hover {
  background: var(--surface-hi);
  border-color: var(--text-mid);
}
.btn-outline {
  background: transparent;
  border-color: var(--yellow);
  color: var(--yellow);
}
.btn-outline:hover {
  background: rgba(245,210,76,0.08);
}
.btn-lg { padding: 16px 28px; font-size: 15px; }
.btn-sm { padding: 8px 14px; font-size: 12px; }
.btn-full { width: 100%; }
.btn:disabled, .btn.is-disabled {
  opacity: 0.35;
  cursor: not-allowed;
  pointer-events: none;
}

/* ═════════════ FORM (login) ═════════════ */
.login-shell {
  min-height: 100vh;
  display: grid;
  grid-template-columns: 1fr 1fr;
  background: var(--bg);
}
@media (max-width: 900px) {
  .login-shell { grid-template-columns: 1fr; }
  .login-hero { display: none; }
}
.login-hero {
  background: linear-gradient(160deg, #0A0A0A 0%, #1A1408 100%);
  padding: 60px 60px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  border-right: 1px solid var(--border);
  position: relative;
  overflow: hidden;
}
.login-hero::before {
  content: "";
  position: absolute;
  top: -80px; right: -80px;
  width: 400px; height: 400px;
  background: radial-gradient(circle, rgba(245,210,76,0.10) 0%, transparent 65%);
  pointer-events: none;
}
.login-hero-logo {
  height: 34px;
  width: auto;
  max-width: 240px;
  object-fit: contain;
  display: block;
  position: relative;
}
.login-hero-quote {
  position: relative;
  font-family: var(--font-display);
  font-size: 28px;
  line-height: 1.25;
  color: rgba(255, 255, 255, 0.9);
  font-weight: 500;
  font-style: italic;
  max-width: 460px;
}
.login-hero-quote-attribution {
  margin-top: 24px;
  font-family: var(--font-body);
  font-style: normal;
  font-size: 13px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: #FFFFFF;
  font-weight: 800;
}
.login-hero-tagline {
  position: relative;
  font-size: 12px;
  color: rgba(255, 255, 255, 0.9);
  letter-spacing: 0.1em;
  text-transform: uppercase;
}
.login-form-wrap {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 60px 40px;
}
.login-form {
  width: 100%;
  max-width: 380px;
}
.login-form h1 {
  font-family: var(--font-display);
  font-size: 34px;
  margin-bottom: 8px;
}
.login-form .lede { margin-bottom: 32px; font-size: 15px; }

.field { margin-bottom: 18px; }
.field label {
  display: block;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--text-mute);
  margin-bottom: 8px;
}
.field input[type="email"],
.field input[type="password"],
.field input[type="text"] {
  width: 100%;
  padding: 14px 16px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  color: var(--text);
  font-family: var(--font-body);
  font-size: 15px;
  transition: border-color 0.15s ease;
}
.field input:focus {
  outline: none;
  border-color: var(--yellow);
}
.field-row-right {
  display: flex;
  justify-content: flex-end;
  margin-top: -6px;
  margin-bottom: 22px;
}
.link-mute {
  font-size: 13px;
  color: var(--text-mute);
  text-decoration: underline;
  text-underline-offset: 3px;
}
.link-mute:hover { color: var(--yellow-darker); }
.login-support {
  margin-top: 32px;
  padding-top: 24px;
  border-top: 1px solid var(--border);
  font-size: 13px;
  color: var(--text-mute);
  text-align: center;
}

/* ═════════════ DASHBOARD ═════════════ */
.dash-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  margin-bottom: 40px;
  gap: 24px;
  flex-wrap: wrap;
}
.dash-header h1 {
  font-size: 40px;
  margin-bottom: 6px;
}
.dash-continue {
  background: linear-gradient(135deg, #FEFAEE 0%, #FFFFFF 100%);
  border: 1px solid rgba(245,210,76,0.5);
  border-radius: var(--radius-lg);
  padding: 32px;
  margin-bottom: 48px;
  box-shadow: var(--shadow-sm);
  display: grid;
  grid-template-columns: 200px 1fr auto;
  gap: 28px;
  align-items: center;
}
@media (max-width: 720px) {
  .dash-continue { grid-template-columns: 1fr; text-align: left; }
  .dash-continue-cover { max-width: 200px; }
}
.dash-continue-cover {
  width: 100%;
  aspect-ratio: 16 / 10;
  border-radius: var(--radius);
  overflow: hidden;
  background: var(--surface-hi);
  position: relative;
}
.dash-continue-cover img { width: 100%; height: 100%; object-fit: cover; }
.dash-continue-cover::after {
  content: "▶";
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  color: rgba(255,255,255,0.85);
  font-size: 28px;
  background: rgba(0,0,0,0.35);
}
.dash-continue-meta .eyebrow { margin-bottom: 8px; }
.dash-continue-title {
  font-family: var(--font-display);
  font-size: 24px;
  font-weight: 700;
  margin-bottom: 6px;
}
.dash-continue-sub {
  font-size: 14px;
  color: var(--text-mute);
  margin-bottom: 14px;
}
.dash-progress {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 4px;
}
.dash-progress-bar {
  flex: 1;
  height: 6px;
  background: var(--surface-hi);
  border-radius: 999px;
  overflow: hidden;
}
.dash-progress-fill {
  height: 100%;
  background: var(--yellow);
  border-radius: 999px;
}
.dash-progress-label {
  font-size: 12px;
  font-weight: 700;
  color: var(--text-mute);
  white-space: nowrap;
}

.section-heading {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  margin-bottom: 20px;
  margin-top: 24px;
}
.section-heading h2 {
  font-family: var(--font-display);
  font-size: 22px;
  margin-bottom: 0;
}
.section-heading-mute {
  font-size: 13px;
  color: var(--text-mute);
  font-weight: 600;
}

/* Library grid */
.library-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 24px;
}
.product-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  overflow: hidden;
  transition: all 0.15s ease;
  display: flex;
  flex-direction: column;
}
.product-card.owned { cursor: pointer; }
.product-card.owned:hover {
  transform: translateY(-3px);
  border-color: var(--border-hi);
  box-shadow: var(--shadow);
}
.product-cover {
  aspect-ratio: 16 / 10;
  background: var(--surface-hi);
  position: relative;
  overflow: hidden;
}
.product-cover img { width: 100%; height: 100%; object-fit: cover; }
.product-cover-fallback {
  width: 100%; height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, #1A1408 0%, #0A0A0A 100%);
  color: var(--yellow);
  font-family: var(--font-display);
  font-size: 32px;
  font-weight: 700;
  text-align: center;
  padding: 12px;
  letter-spacing: -0.02em;
}
.product-lock-overlay {
  position: absolute;
  inset: 0;
  background: rgba(0,0,0,0.72);
  display: flex;
  align-items: center;
  justify-content: center;
  color: rgba(255,255,255,0.6);
  font-size: 34px;
}
.product-body { padding: 20px 22px 22px; flex: 1; display: flex; flex-direction: column; }
.product-eyebrow {
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--text-mute);
  margin-bottom: 8px;
  display: flex;
  align-items: center;
  gap: 8px;
}
.product-eyebrow .badge-owned {
  background: rgba(76,175,80,0.15);
  color: var(--green);
  padding: 2px 8px;
  border-radius: 999px;
  letter-spacing: 0.08em;
  font-size: 9px;
}
.product-eyebrow .badge-locked {
  background: rgba(255,255,255,0.05);
  color: var(--text-mute);
  padding: 2px 8px;
  border-radius: 999px;
  letter-spacing: 0.08em;
  font-size: 9px;
}
.product-title {
  font-family: var(--font-display);
  font-size: 20px;
  font-weight: 700;
  line-height: 1.2;
  margin-bottom: 6px;
  color: var(--text);
}
.product-sub {
  font-size: 13px;
  color: var(--text-mute);
  margin-bottom: 14px;
  flex: 1;
}
.product-meta {
  display: flex;
  gap: 16px;
  font-size: 12px;
  color: var(--text-mute);
  margin-bottom: 14px;
  font-weight: 600;
}
.product-meta span::before { content: "· "; color: var(--border-hi); margin-right: 6px; }
.product-meta span:first-child::before { content: ""; margin: 0; }
.product-cta { margin-top: auto; }

/* ═════════════ COURSE PAGE (module list) ═════════════ */
.course-hero {
  display: grid;
  grid-template-columns: 1.4fr 1fr;
  gap: 40px;
  align-items: center;
  margin-bottom: 48px;
}
@media (max-width: 900px) {
  .course-hero { grid-template-columns: 1fr; }
}
.course-hero-cover {
  aspect-ratio: 16 / 10;
  border-radius: var(--radius-lg);
  overflow: hidden;
  background: linear-gradient(135deg, #1A1408 0%, #0A0A0A 100%);
  position: relative;
}
.course-hero-cover img { width: 100%; height: 100%; object-fit: cover; opacity: 0.55; }
.course-hero-cover-overlay {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  padding: 32px;
}
.course-hero-cover-title {
  font-family: var(--font-display);
  font-size: 34px;
  color: white;
  font-weight: 700;
  line-height: 1.1;
  letter-spacing: -0.015em;
  max-width: 340px;
}
.course-hero-meta h1 {
  font-size: 40px;
  margin-bottom: 14px;
}
.course-hero-meta .lede { margin-bottom: 20px; }
.course-hero-stats {
  display: flex;
  gap: 24px;
  margin-bottom: 24px;
  font-size: 13px;
  color: var(--text-mute);
  font-weight: 600;
}
.course-hero-stats > div::before {
  content: "";
  display: inline-block;
  width: 4px; height: 4px;
  border-radius: 50%;
  background: var(--yellow);
  margin-right: 8px;
  vertical-align: middle;
}

.module-list {
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  overflow: hidden;
  background: var(--surface);
}
.module-item {
  display: grid;
  grid-template-columns: 60px 1fr auto;
  gap: 20px;
  padding: 22px 28px;
  border-bottom: 1px solid var(--border);
  align-items: center;
  transition: background 0.15s ease;
  cursor: pointer;
  color: inherit;
  text-decoration: none;
}
.module-item:last-child { border-bottom: none; }
.module-item:hover { background: var(--surface-hi); }
.module-item.is-complete .module-num {
  background: rgba(76,175,80,0.15);
  color: var(--green);
  border-color: rgba(76,175,80,0.35);
}
.module-item.is-locked { opacity: 0.5; cursor: not-allowed; pointer-events: none; }
.module-num {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: var(--surface-hi);
  border: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-mid);
  font-family: var(--font-display);
  font-size: 16px;
  font-weight: 700;
  flex-shrink: 0;
}
.module-body { min-width: 0; }
.module-title {
  font-family: var(--font-display);
  font-size: 19px;
  font-weight: 700;
  line-height: 1.2;
  color: var(--text);
  margin-bottom: 4px;
}
.module-sub {
  font-size: 13px;
  color: var(--text-mute);
  margin-bottom: 6px;
}
.module-meta {
  display: flex;
  gap: 14px;
  font-size: 11px;
  color: var(--text-mute);
  font-weight: 700;
  letter-spacing: 0.05em;
  text-transform: uppercase;
}
.module-meta > span::before { content: "· "; color: var(--border-hi); margin-right: 6px; }
.module-meta > span:first-child::before { content: ""; margin: 0; }
.module-action { color: var(--text-mute); font-size: 20px; }
.module-item:hover .module-action { color: var(--yellow-darker); }

/* ═════════════ MODULE VIEW (sidebar + content) ═════════════ */
.module-shell {
  display: grid;
  grid-template-columns: 320px 1fr;
  gap: 32px;
  align-items: start;
}
@media (max-width: 960px) {
  .module-shell { grid-template-columns: 1fr; }
  .module-sidebar { position: static; }
}
.module-sidebar {
  position: sticky;
  top: 92px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 24px;
}
.module-sidebar-title {
  font-family: var(--font-display);
  font-size: 15px;
  color: var(--text-mid);
  margin-bottom: 4px;
  font-weight: 700;
}
.module-sidebar-course {
  font-size: 13px;
  color: var(--text-mute);
  margin-bottom: 20px;
  padding-bottom: 20px;
  border-bottom: 1px solid var(--border);
}
.sidebar-mod-list { list-style: none; }
.sidebar-mod {
  display: grid;
  grid-template-columns: 24px 1fr;
  gap: 12px;
  padding: 12px 10px;
  border-radius: 8px;
  cursor: pointer;
  transition: background 0.12s ease;
  color: var(--text-mid);
  text-decoration: none;
  margin-bottom: 2px;
  align-items: start;
}
.sidebar-mod:hover { background: var(--surface-hi); color: var(--text); }
.sidebar-mod.is-current {
  background: rgba(245,210,76,0.08);
  color: var(--text);
}
.sidebar-mod.is-current .sidebar-mod-title { color: var(--yellow-darker); }
.sidebar-mod.is-complete .sidebar-mod-indicator {
  background: var(--green);
  border-color: var(--green);
  color: var(--bg);
}
.sidebar-mod-indicator {
  width: 20px;
  height: 20px;
  border-radius: 50%;
  border: 1.5px solid var(--border-hi);
  display: flex;
  align-items: center;
  justify-content: center;
  color: transparent;
  font-size: 11px;
  font-weight: 900;
  margin-top: 3px;
}
.sidebar-mod.is-complete .sidebar-mod-indicator::before { content: "✓"; }
.sidebar-mod-title {
  font-size: 14px;
  font-weight: 600;
  line-height: 1.3;
  margin-bottom: 2px;
}
.sidebar-mod-meta {
  font-size: 11px;
  color: var(--text-mute);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.module-main .breadcrumb {
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--text-mute);
  margin-bottom: 16px;
}
.module-main .breadcrumb a { color: var(--text-mid); }
.module-main .breadcrumb a:hover { color: var(--yellow-darker); }
.module-main h1 {
  font-size: 38px;
  margin-bottom: 12px;
}
.module-main .lede { margin-bottom: 32px; }

.video-container {
  aspect-ratio: 16 / 9;
  background: #000;
  border-radius: var(--radius-lg);
  overflow: hidden;
  position: relative;
  margin-bottom: 28px;
  border: 1px solid var(--border);
}
.video-placeholder {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-direction: column;
  gap: 16px;
  color: rgba(255,255,255,0.65);
  background: linear-gradient(135deg, #141414 0%, #0A0A0A 100%);
}
.video-play-icon {
  width: 72px;
  height: 72px;
  border-radius: 50%;
  background: var(--yellow);
  color: var(--bg);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 26px;
  padding-left: 4px;
}
.video-placeholder-label {
  font-size: 12px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  font-weight: 700;
}

.module-content-block {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 32px;
  margin-bottom: 24px;
}
.module-content-block h3 {
  font-family: var(--font-display);
  margin-bottom: 14px;
  font-size: 22px;
}
.module-content-block p {
  color: var(--text-mid);
  line-height: 1.7;
  margin-bottom: 12px;
  font-size: 15px;
}
.module-content-block p:last-child { margin-bottom: 0; }

.exercise-block {
  background: linear-gradient(135deg, #FEFAEE 0%, #FFFFFF 100%);
  border: 1px solid rgba(245,210,76,0.4);
  border-radius: var(--radius-lg);
  padding: 32px;
  margin-bottom: 24px;
  box-shadow: var(--shadow-sm);
}
.exercise-block .eyebrow { color: var(--yellow-darker); }
.exercise-block h3 { color: var(--text); }
.exercise-block textarea {
  width: 100%;
  min-height: 140px;
  padding: 14px 16px;
  background: #FFFFFF;
  border: 1px solid var(--border-hi);
  border-radius: 10px;
  color: var(--text);
  font-family: var(--font-body);
  font-size: 14px;
  line-height: 1.6;
  resize: vertical;
  margin-top: 14px;
}
.exercise-block textarea:focus { outline: none; border-color: var(--yellow); }
.exercise-save-note {
  margin-top: 8px;
  font-size: 12px;
  color: var(--text-mute);
  font-style: italic;
}

/* ── Chapter-aware video overlay ── */
.video-container video {
  transition: filter 0.6s ease, opacity 0.6s ease;
}
.video-container video.is-chapter-ended {
  filter: brightness(0.2) blur(2px);
  opacity: 0.6;
}
.chapter-overlay {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(160deg, rgba(10,10,10,0.92) 0%, rgba(26,20,8,0.94) 100%);
  color: #FFFFFF;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.4s ease;
  padding: 32px;
  z-index: 2;
}
.chapter-overlay.is-visible {
  opacity: 1;
  pointer-events: auto;
}
.chapter-overlay-inner {
  text-align: center;
  max-width: 480px;
}
.chapter-overlay-eyebrow {
  font-size: 11px;
  font-weight: 900;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: var(--yellow);
  margin-bottom: 12px;
}
.chapter-overlay-title {
  font-family: var(--font-display);
  font-size: 28px;
  font-weight: 700;
  color: #FFFFFF;
  margin-bottom: 24px;
  letter-spacing: -0.01em;
}
.chapter-overlay-cta {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 14px 28px;
  background: var(--yellow);
  color: #0A0A0A;
  font-size: 13px;
  font-weight: 800;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  border-radius: 999px;
  text-decoration: none;
  transition: transform 0.15s ease;
}
.chapter-overlay-cta:hover { transform: translateX(3px); }
.chapter-overlay-replay {
  display: block;
  margin: 16px auto 0;
  background: transparent;
  border: none;
  color: rgba(255,255,255,0.55);
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.06em;
  cursor: pointer;
  padding: 8px 12px;
  transition: color 0.15s ease;
}
.chapter-overlay-replay:hover { color: #FFFFFF; }
@media (max-width: 640px) {
  .chapter-overlay { padding: 20px; }
  .chapter-overlay-title { font-size: 22px; margin-bottom: 18px; }
  .chapter-overlay-cta { padding: 12px 22px; font-size: 12px; }
}

/* ── Action / Accountability blocks (light-mode safe) ── */
.action-block, .accountability-block {
  padding: 14px 18px;
  border-radius: 10px;
  margin-bottom: 12px;
  border: 1px solid transparent;
}
.action-block {
  background: #FFF8DA;
  border-color: rgba(245,210,76,0.55);
  border-left: 4px solid var(--yellow);
}
.action-block .block-label {
  font-size: 10px;
  font-weight: 900;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--yellow-darker);
  margin-bottom: 6px;
}
.action-block .block-body {
  font-size: 15px;
  color: var(--text);
  line-height: 1.55;
  font-weight: 500;
}
.accountability-block {
  background: var(--surface-hi);
  border-color: var(--border);
  border-left: 4px solid #C8C4BF;
}
.accountability-block .block-label {
  font-size: 10px;
  font-weight: 900;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--text-mute);
  margin-bottom: 6px;
}
.accountability-block .block-body {
  font-size: 15px;
  color: var(--text);
  line-height: 1.55;
}

[data-theme="dark"] .action-block {
  background: rgba(245,210,76,0.08);
  border-color: rgba(245,210,76,0.35);
}
[data-theme="dark"] .action-block .block-body { color: var(--text); }
[data-theme="dark"] .accountability-block {
  background: rgba(255,255,255,0.04);
  border-color: rgba(255,255,255,0.10);
}
[data-theme="dark"] .accountability-block .block-body { color: var(--text-mid); }

.download-row {
  display: flex;
  gap: 12px;
  padding: 14px 18px;
  background: var(--surface-hi);
  border: 1px solid var(--border);
  border-radius: 10px;
  align-items: center;
  margin-bottom: 12px;
  text-decoration: none;
  color: var(--text);
  transition: all 0.15s ease;
}
.download-row:hover {
  border-color: var(--yellow);
  background: rgba(245,210,76,0.06);
}
.download-icon {
  width: 40px; height: 40px;
  border-radius: 8px;
  background: rgba(245,210,76,0.12);
  color: var(--yellow);
  display: flex; align-items: center; justify-content: center;
  font-size: 18px;
  flex-shrink: 0;
}
.download-title { font-size: 14px; font-weight: 700; }
.download-sub { font-size: 12px; color: var(--text-mute); }

.module-nav {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  padding: 28px 0 0;
  margin-top: 32px;
  border-top: 1px solid var(--border);
}
.mark-complete-row {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 20px;
  padding: 18px 22px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
}
.mark-complete-row label {
  display: flex; align-items: center; gap: 12px; cursor: pointer;
  font-size: 14px; font-weight: 700;
}
.mark-complete-row input[type="checkbox"] {
  width: 22px; height: 22px;
  appearance: none; -webkit-appearance: none;
  border: 2px solid var(--border-hi);
  border-radius: 6px;
  background: transparent;
  cursor: pointer;
  position: relative;
  flex-shrink: 0;
}
.mark-complete-row input[type="checkbox"]:checked {
  background: var(--green); border-color: var(--green);
}
.mark-complete-row input[type="checkbox"]:checked::after {
  content: "✓";
  position: absolute;
  left: 4px; top: -1px;
  color: white;
  font-size: 14px;
  font-weight: 900;
}
.mark-complete-row .helper {
  margin-left: auto;
  font-size: 12px;
  color: var(--text-mute);
  font-weight: 600;
}

/* ═════════════ FOOTER ═════════════ */
.portal-footer {
  padding: 40px 28px;
  text-align: center;
  font-size: 12px;
  color: var(--text-mute);
  border-top: 1px solid var(--border);
  margin-top: 60px;
}
.portal-footer .footer-links { margin-top: 8px; }
.portal-footer .footer-links a { margin: 0 8px; color: var(--text-mute); }
.portal-footer .footer-links a:hover { color: var(--yellow); }

/* ═════════════ WORKBOOK NOTES SECTION ═════════════ */
.workbook-section {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 28px;
  margin-top: 32px;
  margin-bottom: 24px;
}
.workbook-section h2 {
  font-family: var(--font-display);
  font-size: 22px;
  margin-bottom: 16px;
  color: var(--text);
}
.workbook-section textarea {
  width: 100%;
  min-height: 140px;
  padding: 14px 16px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  color: var(--text);
  font-family: var(--font-body);
  font-size: 15px;
  line-height: 1.6;
  resize: vertical;
  margin-bottom: 14px;
}
.workbook-section textarea:focus {
  outline: none;
  border-color: var(--yellow);
}
.workbook-section .btn-row {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
  align-items: center;
  margin-bottom: 12px;
}
.workbook-section .btn-secondary {
  background: transparent;
  border: 2px solid var(--yellow);
  color: var(--yellow-darker);
  font-weight: 800;
}
.workbook-section .btn-secondary:hover {
  background: rgba(245,210,76,0.08);
}
.workbook-actions {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
  margin-top: 16px;
}
@media (max-width: 720px) {
  .workbook-section {
    padding: 20px;
    margin-top: 24px;
  }
  .workbook-section h2 {
    font-size: 20px;
  }
  .workbook-section .btn-row {
    flex-direction: column;
  }
  .workbook-section .btn-row .btn {
    width: 100%;
  }
  .workbook-actions {
    flex-direction: column;
  }
  .workbook-actions .btn {
    width: 100%;
  }
}


/* ═════════════ RESPONSIVE ═════════════ */

/* ─── Tablet & below ─── */
@media (max-width: 960px) {
  .wrap, .wrap-wide, .wrap-narrow { padding: 0; }
  .module-shell { grid-template-columns: 1fr; gap: 20px; }
  .module-sidebar { position: static; }
  .course-hero { grid-template-columns: 1fr; gap: 24px; }
  .course-hero-cover { max-width: 100%; }
}

/* ─── Mobile (main) ─── */
@media (max-width: 720px) {
  /* ─── App bar: [hamburger] [logo] ────── [avatar] ─── */
  .appbar { padding: 0 12px; height: 56px; }
  .appbar-nav { display: none; }
  .appbar-brand-label { display: none; }
  .appbar-logo { height: 20px; max-width: 130px; }
  .appbar-inner {
    gap: 10px;
    justify-content: flex-start;   /* override desktop's space-between */
  }
  .appbar-brand { flex: 0 0 auto; }
  .appbar-user {
    margin-left: auto;              /* push avatar to far right */
    padding: 4px 10px 4px 4px;
  }
  .appbar-user-name { display: none; } /* avatar-only on mobile */

  /* Main */
  .main { padding: 28px 18px 56px; min-height: calc(100vh - 60px); }

  /* Typography */
  h1 { font-size: 30px; }
  h2 { font-size: 22px; }
  h3 { font-size: 19px; }
  .lede { font-size: 15px; }
  .breadcrumb { font-size: 11px; margin-bottom: 12px; }

  /* Dashboard header */
  .dash-header { flex-direction: column; align-items: flex-start; gap: 8px; margin-bottom: 28px; }
  .dash-header h1 { font-size: 30px; }

  /* Continue-where-you-left-off */
  .dash-continue {
    grid-template-columns: 1fr;
    padding: 18px;
    gap: 16px;
    margin-bottom: 32px;
  }
  .dash-continue-cover { max-width: 100%; aspect-ratio: 16 / 9; }
  .dash-continue-cover::after { font-size: 22px; }
  .dash-continue-title { font-size: 20px; }
  .dash-continue .btn { width: 100%; text-align: center; }

  /* Section heading */
  .section-heading { flex-direction: column; align-items: flex-start; gap: 4px; margin-bottom: 14px; }

  /* Library grid → single column */
  .library-grid { grid-template-columns: 1fr; gap: 16px; }
  .product-cover { aspect-ratio: 16 / 9; }
  .product-title { font-size: 18px; }

  /* Course hero */
  .course-hero { margin-bottom: 32px; }
  .course-hero-meta h1 { font-size: 28px; }
  .course-hero-cover-title { font-size: 24px; padding: 0; }
  .course-hero-cover-overlay { padding: 20px; }
  .course-hero-stats {
    flex-wrap: wrap;
    gap: 8px 16px;
    font-size: 12px;
    margin-bottom: 20px;
  }
  .course-hero-meta .btn { width: 100%; text-align: center; }

  /* Module list rows */
  .module-item {
    grid-template-columns: 36px 1fr;
    gap: 14px;
    padding: 16px 16px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 12px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.04);
    margin-bottom: 12px;
  }
  .module-item:last-child { border-bottom: 1px solid var(--border); }
  .module-item .module-action { display: none; }
  .module-num { width: 32px; height: 32px; font-size: 13px; }
  .module-title { font-size: 15px; }
  .module-sub { font-size: 12px; line-height: 1.45; margin-bottom: 4px; }
  .module-meta { font-size: 10px; gap: 8px; }

  /* Module sidebar → collapsible-feeling static block */
  .module-sidebar {
    padding: 16px;
    border-radius: 12px;
    margin-bottom: 8px;
  }
  .module-sidebar-title { font-size: 13px; }
  .module-sidebar-course { margin-bottom: 14px; padding-bottom: 14px; font-size: 12px; }
  .sidebar-mod { padding: 10px 8px; }
  .sidebar-mod-title { font-size: 13px; }
  .sidebar-mod-meta { font-size: 10px; }

  /* Module main */
  .module-main h1 { font-size: 26px; }
  .module-content-block, .exercise-block { padding: 20px; }
  .exercise-block h3 { font-size: 20px; }
  .exercise-block textarea { min-height: 120px; font-size: 14px; }

  /* Video */
  .video-play-icon { width: 56px; height: 56px; font-size: 20px; }
  .video-placeholder-label { font-size: 10px; padding: 0 20px; text-align: center; }

  /* Mark complete */
  .mark-complete-row {
    flex-direction: column;
    align-items: flex-start;
    padding: 14px 16px;
    gap: 8px;
  }
  .mark-complete-row .helper { margin-left: 0; }

  /* Download rows */
  .download-row { padding: 12px 14px; }
  .download-title { font-size: 13px; }
  .download-sub { font-size: 11px; }

  /* Module nav — stack buttons */
  .module-nav { flex-direction: column-reverse; gap: 10px; padding-top: 22px; margin-top: 26px; }
  .module-nav .btn { width: 100%; }

  /* Cards + buttons */
  .card { padding: 22px; }
  .btn { padding: 12px 18px; font-size: 13px; }
  .btn-lg { padding: 14px 22px; font-size: 14px; }

  /* Footer */
  .portal-footer { padding: 32px 14px; margin-top: 40px; }
}

/* ─── Login page (kept the branded left panel visible on mobile as a small strip) ─── */
@media (max-width: 900px) {
  .login-shell { grid-template-columns: 1fr; min-height: auto; }
  .login-hero {
    display: flex;
    flex-direction: row;
    align-items: center;
    justify-content: flex-start;
    padding: 20px 24px;
    border-right: none;
    border-bottom: 1px solid var(--border);
    min-height: auto;
  }
  .login-hero::before { display: none; }
  .login-hero-logo { height: 24px; }
  .login-hero-quote,
  .login-hero > div:last-child { display: none; }
  .login-form-wrap { padding: 40px 24px 60px; min-height: calc(100vh - 65px); }
  .login-form h1 { font-size: 28px; }
}

/* ─── Small mobile (extra tight) ─── */
@media (max-width: 480px) {
  h1 { font-size: 26px; }
  .dash-header h1 { font-size: 26px; }
  .course-hero-meta h1 { font-size: 24px; }
  .course-hero-cover-title { font-size: 20px; }
  .module-main h1 { font-size: 22px; }
  .dash-continue-title { font-size: 18px; }
  .dash-continue { padding: 16px; }
  .module-item { padding: 14px; }
  .product-body { padding: 16px 18px 18px; }
  .btn { font-size: 12px; letter-spacing: 0.05em; }
  .video-play-icon { width: 48px; height: 48px; font-size: 17px; }
  .exercise-block, .module-content-block { padding: 18px; }
  .module-sidebar { padding: 14px; }
}

/* Clip horizontal overflow without creating a scroll container for the sticky sidebar. */
html, body { overflow-x: clip; }

/* ═════════════ AVATAR DROPDOWN ═════════════ */
.avatar-menu {
  position: absolute;
  top: calc(100% + 10px);
  right: 0;
  min-width: 240px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  box-shadow: 0 12px 40px rgba(0,0,0,0.15);
  padding: 8px 0;
  display: none;
  z-index: 200;
  animation: menuIn 0.14s ease-out;
}
.avatar-menu.is-open { display: block; }
@keyframes menuIn { from { opacity: 0; transform: translateY(-8px); } to { opacity: 1; transform: translateY(0); } }
.avatar-menu-header {
  padding: 12px 16px 14px;
  border-bottom: 1px solid var(--border);
  margin-bottom: 6px;
}
.avatar-menu-name { font-size: 14px; font-weight: 700; color: var(--text); }
.avatar-menu-email { font-size: 12px; color: var(--text-mute); margin-top: 2px; }
.avatar-menu-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 16px;
  font-size: 14px;
  color: var(--text);
  font-weight: 600;
  cursor: pointer;
  transition: background 0.12s ease;
  text-decoration: none;
}
.avatar-menu-item:hover { background: var(--surface-hi); }
.avatar-menu-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 20px;
  height: 20px;
  color: var(--yellow-darker);
  font-weight: 900;
  font-size: 13px;
  flex-shrink: 0;
}
.avatar-menu-divider { height: 1px; background: var(--border); margin: 6px 0; }
.avatar-menu-signout { color: var(--danger); }
.avatar-menu-signout .avatar-menu-icon { color: var(--danger); }
.avatar-menu-signout:hover { background: rgba(232,90,90,0.06); }

/* ═════════════ HAMBURGER BUTTON ═════════════ */
.hamburger-btn {
  display: none;
  width: 44px;
  height: 44px;
  background: transparent;
  border: 1px solid var(--border);
  border-radius: 10px;
  cursor: pointer;
  padding: 0;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
  transition: all 0.15s ease;
  flex-shrink: 0;
}
.hamburger-btn:hover { border-color: var(--border-hi); background: var(--surface-hi); }
.hamburger-btn:active { transform: scale(0.94); }
.hamburger-btn span {
  display: block;
  width: 18px;
  height: 2px;
  background: var(--text);
  border-radius: 2px;
  transition: transform 0.2s ease;
}
@media (max-width: 720px) {
  .hamburger-btn { display: flex; }
  .appbar-nav { display: none !important; }  /* Hidden on mobile — replaced by drawer */
}

/* ═════════════ MOBILE DRAWER ═════════════ */
.mobile-drawer {
  position: fixed;
  inset: 0;
  z-index: 300;
  display: none;
  pointer-events: none;
}
.mobile-drawer.is-open { display: block; pointer-events: auto; }
.mobile-drawer-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0,0,0,0.5);
  opacity: 0;
  transition: opacity 0.2s ease;
}
.mobile-drawer.is-open .mobile-drawer-backdrop { opacity: 1; }
.mobile-drawer-panel {
  position: absolute;
  top: 0; right: 0;
  bottom: 0;
  width: 300px;
  max-width: 88vw;
  background: var(--surface);
  padding: 20px 0;
  transform: translateX(100%);
  transition: transform 0.24s cubic-bezier(0.32, 0.72, 0, 1);
  overflow-y: auto;
  box-shadow: -8px 0 40px rgba(0,0,0,0.2);
}
.mobile-drawer.is-open .mobile-drawer-panel { transform: translateX(0); }
.mobile-drawer-close {
  position: absolute;
  top: 12px;
  right: 16px;
  background: transparent;
  border: none;
  font-size: 28px;
  color: var(--text-mute);
  cursor: pointer;
  padding: 4px 12px;
  border-radius: 8px;
}
.mobile-drawer-close:hover { color: var(--text); background: var(--surface-hi); }
.mobile-drawer-section {
  padding: 12px 20px;
  border-bottom: 1px solid var(--border);
}
.mobile-drawer-section:last-of-type { border-bottom: none; }
.mobile-drawer-heading {
  font-size: 10px;
  font-weight: 900;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--text-mute);
  margin-bottom: 8px;
  padding-top: 4px;
}
.mobile-drawer-link {
  display: block;
  padding: 10px 12px;
  margin: 0 -8px;
  border-radius: 8px;
  font-size: 15px;
  font-weight: 600;
  color: var(--text);
  text-decoration: none;
  transition: background 0.12s ease;
}
.mobile-drawer-link:hover { background: var(--surface-hi); }
.mobile-drawer-link.is-current { background: rgba(245,210,76,0.14); color: var(--yellow-darker); font-weight: 800; }
.mobile-drawer-link.is-complete .mobile-drawer-check {
  color: var(--green);
  font-weight: 900;
  display: inline-block;
  width: 18px;
}
.mobile-drawer-check { display: inline-block; width: 18px; color: transparent; font-weight: 900; }
.mobile-drawer-meta { display: block; font-size: 11px; color: var(--text-mute); margin-top: 2px; margin-left: 18px; letter-spacing: 0.05em; text-transform: uppercase; }

body.drawer-open { overflow: hidden; }

/* ═════════════ MOBILE POLISH ═════════════ */
@media (max-width: 720px) {
  .appbar-user-name { display: none; }
  .appbar { padding: 0 12px; }
  .appbar-brand-label { display: none; }
  .avatar-menu { right: -6px; }
}

/* ═════════════════════════════════════════════════════
   MOBILE-FIRST POLISH + SAFETY NET
   Catches inline-styled + per-page patterns and raises touch
   targets across the portal. Applies everywhere via portal.css.
   ═════════════════════════════════════════════════════ */

/* ─── AI COMPANION CARD (shared across product portals) ─── */
.ai-companion-card {
  background: linear-gradient(135deg, #FFFFFF 0%, #FEFAEE 100%);
  border: 1px solid rgba(245,210,76,0.55);
  border-radius: var(--radius-lg);
  padding: 28px 30px;
  margin-bottom: 20px;
  box-shadow: 0 4px 24px rgba(0,0,0,0.04);
}
.ai-companion-inner {
  display: flex;
  align-items: flex-start;
  gap: 18px;
  flex-wrap: wrap;
}
.ai-companion-icon {
  width: 56px;
  height: 56px;
  border-radius: 12px;
  background: var(--yellow);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 26px;
  flex-shrink: 0;
}
.ai-companion-body { flex: 1; min-width: 240px; }
.ai-companion-eyebrow {
  font-size: 11px;
  font-weight: 900;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--yellow-darker);
  margin-bottom: 6px;
}
.ai-companion-title {
  font-family: var(--font-display);
  font-size: 22px;
  font-weight: 700;
  color: var(--text);
  margin-bottom: 8px;
  letter-spacing: -0.01em;
  line-height: 1.2;
}
.ai-companion-desc {
  font-size: 15px;
  color: var(--text-mid);
  line-height: 1.6;
  margin-bottom: 16px;
}
.ai-companion-footnote {
  font-size: 12px;
  color: var(--text-mute);
  margin-top: 10px;
  font-style: italic;
}
.ai-companion-footnote code {
  background: rgba(0,0,0,0.05);
  padding: 2px 6px;
  border-radius: 4px;
  font-size: 11px;
}

/* Compact variant — used above the Vault tab bar (single-row layout) */
.ai-companion-card--compact {
  padding: 16px 20px;
  border-radius: 14px;
  margin-bottom: 24px;
}
.ai-companion-card--compact .ai-companion-inner { align-items: center; }
.ai-companion-card--compact .ai-companion-icon { width: 44px; height: 44px; border-radius: 10px; font-size: 22px; }
.ai-companion-card--compact .ai-companion-title { font-size: 17px; margin-bottom: 4px; }
.ai-companion-card--compact .ai-companion-desc { font-size: 13px; line-height: 1.5; margin-bottom: 0; }
.ai-companion-card--compact .ai-companion-eyebrow { font-size: 10px; margin-bottom: 4px; }

@media (max-width: 720px) {
  .ai-companion-card {
    padding: 20px 18px;
    border-radius: 14px;
    margin-bottom: 16px;
  }
  .ai-companion-inner { gap: 12px; }
  .ai-companion-icon { width: 42px; height: 42px; border-radius: 10px; font-size: 20px; }
  .ai-companion-body { min-width: 0; flex: 1 1 100%; }
  .ai-companion-eyebrow { font-size: 10px; letter-spacing: 0.12em; }
  .ai-companion-title { font-size: 17px; line-height: 1.15; }
  .ai-companion-desc { font-size: 14px; line-height: 1.5; margin-bottom: 14px; }
  .ai-companion-card .btn { width: 100%; text-align: center; padding: 14px 18px; font-size: 12px; }
  .ai-companion-footnote { font-size: 11px; line-height: 1.5; }

  /* Compact card on mobile — stack icon + text + button vertically */
  .ai-companion-card--compact { padding: 16px 16px; }
  .ai-companion-card--compact .ai-companion-title { font-size: 15px; }
  .ai-companion-card--compact .ai-companion-desc { font-size: 12px; }
}

/* Touch targets: any button or link-styled control should hit ≥44px */
@media (hover: none) and (pointer: coarse) {
  .btn, .reader-nav-btn, .reader-menu button, .ab-btn, .ab-chapter,
  .script-copy-btn, .path-steps a, .avatar-menu-item,
  .mobile-drawer-link, .hamburger-btn {
    min-height: 44px;
  }
}

/* Universal: no element ever forces the viewport to scroll horizontally. */
img, video, iframe, table, pre, code { max-width: 100%; }
pre, code, .prompt-block, .code-block {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  word-break: break-word;
}

@media (max-width: 720px) {
  /* Any wrap constrains its inner padding — kill the old zero-padding hack
     that leaves content flush to screen edges on tiny screens. */
  .wrap, .wrap-wide, .wrap-narrow { padding: 0 0; max-width: 100%; }

  /* ─── Sterling AI access page (sai-*) ─── */
  .sai-hero { padding: 24px 20px; margin-bottom: 24px; border-radius: 14px; }
  .sai-hero h1 { font-size: 26px; }
  .sai-hero .lede { font-size: 15px; }

  .path-card { padding: 20px 18px; margin-bottom: 14px; border-radius: 14px; }
  .path-badge { top: -10px; right: 12px; font-size: 9px; padding: 5px 10px; }
  .path-header { flex-wrap: wrap; gap: 10px; margin-bottom: 8px; align-items: flex-start; }
  .path-num { font-size: 28pt; }
  .path-title { font-size: 18px; }
  .path-subtitle { font-size: 11px; }
  .path-body { font-size: 14px; }
  .path-steps li { padding-left: 30px; font-size: 13px; }
  .path-steps li::before { width: 20px; height: 20px; font-size: 11px; }

  .prompt-block, .code-block {
    padding: 14px 16px;
    font-size: 12px;
    border-radius: 8px;
  }

  /* ─── 30-Day Journey — week overview & day cards ─── */
  .arc-stack { gap: 14px; }
  .week-hero { padding: 20px 18px; min-height: auto; }
  .week-num { font-size: 56px; }
  .week-pillar { font-size: 20px; }
  .week-mission { font-size: 13px; }
  .week-hero-bottom { margin-top: 16px; gap: 10px; }
  .week-ring { width: 44px; height: 44px; }
  .week-status { font-size: 10px; }
  .week-days { padding: 12px 14px; }
  .week-day-item { padding: 10px 4px; gap: 10px; }
  .week-day-label { font-size: 12px; }
  .week-day-arrow { opacity: 1; }

  /* Inline day-numbers on week pages (font-size: 38pt inline) — override
     via attribute selector so we don't have to touch every page. */
  [style*="38pt"], [style*="36pt"] { font-size: 32px !important; line-height: 1 !important; }
  .exercise-block [style*="font-size:38pt"],
  .exercise-block [style*="font-size: 38pt"] { font-size: 28px !important; }

  /* Course-hero decorative covers (e.g. Journey's giant "30 · one action · every day"
     black card) — inline 64pt / 24pt fonts + 40px padding overwhelm mobile. */
  [style*="64pt"] { font-size: 52px !important; line-height: 0.95 !important; }
  [style*="24pt"] { font-size: 15px !important; line-height: 1.3 !important; }
  .course-hero-cover { aspect-ratio: 5 / 3; max-height: 240px; }
  .course-hero-cover > div[style*="padding:40px"],
  .course-hero-cover > div[style*="padding: 40px"] { padding: 20px !important; }

  /* Any header row with an inline flex+baseline pattern → wrap safely */
  .exercise-block > div[style*="display:flex"],
  .exercise-block > div[style*="display: flex"] { flex-wrap: wrap !important; }

  /* Textareas & inputs: prevent iOS zoom & respect width */
  textarea, input[type="text"], input[type="email"], input[type="password"], input[type="search"] {
    font-size: 16px !important;
    max-width: 100%;
  }

  /* Anything with inline max-width that assumes desktop */
  [style*="max-width:360px"], [style*="max-width: 360px"],
  [style*="max-width:520px"], [style*="max-width: 520px"] { max-width: 100% !important; }

  /* Video / audiobook player wrappers on any page */
  .video-container, .video-frame, iframe { max-width: 100%; }

  /* Utility: force any raw <table> to scroll horizontally */
  table { display: block; overflow-x: auto; }
}

@media (max-width: 480px) {
  /* Tight mobile — trim margins one more notch */
  .main { padding: 20px 12px 48px; }
  .card { padding: 18px; }
  .sai-hero { padding: 20px 16px; }
  .sai-hero h1 { font-size: 22px; }
  .path-card { padding: 16px 14px; }
  .path-num { font-size: 24pt; }
  .path-title { font-size: 17px; }
  .week-hero { padding: 18px 16px; }
  .week-num { font-size: 44px; }
  .week-pillar { font-size: 18px; }
}

.portal-shell { display: flex; min-height: 100vh; align-items: flex-start; background: #FAF9F6; }
.portal-sidebar {
  width: 248px;
  flex: 0 0 248px;
  background: #0A0A0A;
  color: #fff;
  position: sticky;
  top: 0;
  height: 100vh;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  padding: 28px 16px 20px;
  z-index: 30;
  align-self: flex-start;
}
.portal-brand { display: flex; flex-direction: column; gap: 8px; margin-bottom: 28px; }
.portal-brand img { height: 28px; width: auto; max-width: 180px; align-self: flex-start; object-fit: contain; }
.portal-brand span {
  color: #F5D24C;
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}
.portal-nav-label {
  margin: 16px 12px 6px;
  color: rgba(255,255,255,0.45);
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}
.portal-nav { display: flex; flex-direction: column; gap: 4px; }
.portal-nav a {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 10px 12px;
  border-radius: 8px;
  color: #fff;
  font-size: 14px;
  font-weight: 700;
}
.portal-nav a.is-active { background: #F5D24C; color: #0A0A0A; }
.portal-lock { font-size: 12px; }
.library-continue { background: #fff; border: 1px solid rgba(245,210,76,0.8); border-radius: 12px; padding: 20px; margin-bottom: 24px; }
.upgrade-modal { position: fixed; inset: 0; background: rgba(0,0,0,0.45); display: flex; align-items: center; justify-content: center; padding: 16px; z-index: 999; }
.upgrade-modal-card { background: #fff; color: #0A0A0A; width: min(520px, 100%); max-height: 90vh; overflow: auto; border-radius: 12px; padding: 32px; display: grid; gap: 16px; }
.upgrade-modal-card h2 { margin: 0 0 4px; font-size: 24px; }
.upgrade-modal-card .upgrade-description { color: var(--text-mid); margin: 0 0 8px; }
.upgrade-modal-card form { display: grid; gap: 16px; }
.upgrade-modal-card label { display: block; font-weight: 600; font-size: 14px; margin-bottom: 6px; }
.upgrade-modal-card input { 
  width: 100%; 
  box-sizing: border-box; 
  min-height: 48px; 
  padding: 12px 14px;
  border: 1px solid #ccc;
  border-radius: 8px;
  font-size: 16px;
  font-family: var(--font-body);
}
.upgrade-modal-card input:focus {
  outline: none;
  border-color: #F5D24C;
  box-shadow: 0 0 0 2px rgba(245, 210, 76, 0.2);
}
.upgrade-modal-card input.upgrade-email-readonly {
  background: #f5f5f5;
  color: var(--text-mid);
  cursor: not-allowed;
}
.upgrade-modal-card .stripe-field { 
  min-height: 48px; 
  border: 1px solid #ccc; 
  border-radius: 8px; 
  padding: 12px 14px; 
  background: #fff;
  transition: border-color 0.2s, box-shadow 0.2s;
}
.upgrade-modal-card .stripe-field:focus-within {
  border-color: #F5D24C;
  box-shadow: 0 0 0 2px rgba(245, 210, 76, 0.2);
}
.upgrade-modal-card .upgrade-helper-text {
  margin: -8px 0 0;
  font-size: 13px;
  color: var(--text-mid);
}
.upgrade-modal-card .upgrade-legal {
  font-size: 13px;
  color: var(--text-mute);
  margin: 8px 0 0;
}
.upgrade-modal-card .upgrade-error {
  background: #fee;
  color: var(--danger);
  padding: 12px;
  border-radius: 8px;
  font-size: 14px;
  margin: 0;
}
.upgrade-modal-card button[type="submit"] {
  margin-top: 8px;
}
.portal-nav a.is-locked {
  cursor: pointer;
}
.portal-identity { display: flex; align-items: center; gap: 10px; margin-top: auto; padding: 12px; color: #fff; font-weight: 700; }
.portal-avatar { width: 32px; height: 32px; border-radius: 50%; background: #F5D24C; color: #0A0A0A; display: flex; align-items: center; justify-content: center; font-weight: 800; }
.portal-logout {
  background: transparent;
  border: 0;
  color: rgba(255,255,255,0.8);
  text-align: left;
  padding: 12px;
  font: inherit;
  font-weight: 700;
  cursor: pointer;
}
.portal-menu-btn, .portal-sidebar-backdrop, .portal-mobile-header, .portal-drawer-close { display: none; }
.portal-main { 
  flex: 1; 
  min-width: 0; 
  padding: 48px 40px 80px;
}
.portal-main .wrap {
  max-width: 1200px;
  margin: 0 auto;
}
.library-empty { margin: 0 0 20px; color: var(--text-mid); }
.library-product-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}
.library-product {
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 16px;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}
a.library-product { color: inherit; text-decoration: none; }
a.library-product h2 { font-size: 22px; }
.portal-nav a:focus-visible,
.portal-menu-btn:focus-visible {
  outline: 2px solid #F5D24C;
  outline-offset: 2px;
}
.portal-main a:focus-visible,
.portal-main button:focus-visible {
  outline: 2px solid #8A6E15;
  outline-offset: 2px;
}
.portal-main .card { margin-bottom: 16px; }
.vault-tabs { display: flex; gap: 8px; overflow-x: auto; margin: 0 0 20px; padding-bottom: 4px; }
.vault-tabs a {
  flex: 0 0 auto;
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 10px 14px;
  text-decoration: none;
  color: inherit;
  font-weight: 700;
  background: #fff;
}
.vault-tabs a.is-active { background: #F5D24C; color: #0A0A0A; border-color: #F5D24C; }
.prompt-nav { display: flex; flex-wrap: wrap; gap: 12px; align-items: end; }
.prompt-nav form { display: flex; flex-wrap: wrap; gap: 8px; align-items: end; }
.prompt-nav input { width: 5rem; min-height: 44px; }
.billing-table-wrap { overflow-x: auto; margin-bottom: 16px; background: #fff; border: 1px solid var(--border); border-radius: 16px; }
.billing-table { width: 100%; border-collapse: collapse; }
.billing-table th, .billing-table td { text-align: left; padding: 12px 14px; border-bottom: 1px solid var(--border); vertical-align: top; }
.billing-table th { font-size: 12px; letter-spacing: 0.08em; text-transform: uppercase; }
.field { display: grid; gap: 6px; margin-bottom: 12px; }
.field input, .field select { width: 100%; max-width: 420px; min-height: 44px; box-sizing: border-box; }
.sai-hero {
  background: #0A0A0A;
  color: #fff;
  border-radius: 16px;
  padding: 36px 40px;
  margin-bottom: 24px;
}
.sai-hero .eyebrow { color: #F5D24C; }
.sai-hero h1, .sai-hero .lede { color: #fff; }
.library-product.is-owned {
  background: rgba(254, 250, 238, 0.4);
  border-color: #F5D24C;
}
.library-product-cover { aspect-ratio: 16 / 9; background: #111; overflow: hidden; }
.library-product-cover img { width: 100%; height: 100%; object-fit: cover; }
.library-product-body { padding: 16px; display: flex; flex-direction: column; gap: 8px; flex: 1; }
.library-product-eyebrow {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  align-items: center;
  color: #8A6E15;
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}
.library-product h3 { font-size: 20px; line-height: 1.25; }
.library-product p { color: var(--text-mid); font-size: 14px; margin: 0; }
.badge-owned, .badge-locked {
  border-radius: 999px;
  padding: 3px 8px;
  letter-spacing: 0.08em;
}
.badge-owned { background: #e7f6ec; color: #1d7a3a; }
.badge-locked { background: #eee; color: #666; }
.library-progress { display: flex; flex-direction: column; gap: 4px; font-size: 12px; font-weight: 700; color: var(--text-mid); }
.library-progress-bar { height: 6px; background: rgba(10,10,10,0.08); border-radius: 99px; overflow: hidden; }
.library-progress-bar span { display: block; height: 100%; background: #F5D24C; }
.library-price { font-size: 18px; font-weight: 800; }
.declaration-preview {
  margin-top: 28px;
  padding: 20px;
  background: rgba(254, 250, 238, 0.9);
  border: 1px solid #F5D24C;
  border-radius: 16px;
}
.declaration-preview p {
  font-family: Georgia, serif;
  font-style: italic;
  font-size: 18px;
  margin: 8px 0 12px;
}
@media (max-width: 900px) {
  .portal-menu-btn {
    display: flex;
    position: fixed;
    top: 12px;
    left: 12px;
    z-index: 40;
    background: transparent;
    color: var(--text);
    border: 1px solid var(--border);
    border-radius: 10px;
    padding: 0;
    font-weight: 800;
    width: 44px;
    height: 44px;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 4px;
    cursor: pointer;
    transition: all 0.15s ease;
  }
  .portal-menu-btn:hover {
    background: var(--surface-hi);
    border-color: var(--border-hi);
  }
  .portal-menu-btn span {
    display: block;
    width: 18px;
    height: 2px;
    background: var(--text);
    border-radius: 2px;
  }
  .portal-sidebar {
    position: fixed;
    transform: translateX(-105%);
    transition: transform 0.24s cubic-bezier(0.32, 0.72, 0, 1);
    box-shadow: 8px 0 40px rgba(0,0,0,0.3);
  }
  /* Open drawer + scrim sit above the fixed mobile header (35) and hamburger (40); modal stays on top (999). */
  .portal-sidebar.is-open { transform: none; z-index: 50; }
  .portal-sidebar-backdrop {
    display: block;
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.4);
    border: 0;
    z-index: 45;
  }
  .portal-main { padding: 72px 16px 56px; }
  .library-product-grid { grid-template-columns: 1fr; }
  
  /* Mobile header bar */
  .portal-mobile-header {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    height: 56px;
    background: var(--surface);
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0 60px;
    z-index: 35;
  }
  .portal-mobile-header img {
    height: 20px;
    width: auto;
    max-width: 160px;
    object-fit: contain;
    align-self: center;
  }
  
  /* Close button in drawer */
  .portal-drawer-close {
    position: absolute;
    top: 16px;
    right: 16px;
    background: transparent;
    border: none;
    width: 32px;
    height: 32px;
    border-radius: 8px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    color: rgba(255,255,255,0.7);
    font-size: 24px;
    line-height: 1;
    transition: all 0.15s ease;
  }
  .portal-drawer-close:hover {
    background: rgba(255,255,255,0.1);
    color: #fff;
  }
}

