/* ═══════════════════════════════════════════════
   CWM Slide — Main Styles (Nas.io inspired)
   ═══════════════════════════════════════════════ */

/* ── CSS Variables ── */
:root {
  --font-body: 'DM Sans', 'Inter', system-ui, sans-serif;
  --font-mono: 'JetBrains Mono', 'Fira Code', monospace;
  --radius-sm:   8px;
  --radius-md:  14px;
  --radius-lg:  20px;
  --radius-xl:  28px;
  --radius-pill: 999px;
  --navbar-h:   64px;
  --breadcrumb-h: 44px;
  --transition: 200ms cubic-bezier(0.4, 0, 0.2, 1);
}

/* ── Light Theme (default — Nas.io style) ── */
[data-theme="light"] {
  --bg:           #f5f5f5;
  --bg-surface:   #efefef;
  --bg-card:      #ffffff;
  --bg-card-h:    #fdf8f0;
  --bg-warm:      #fffbf4;
  --border:       rgba(0, 0, 0, 0.10);
  --border-h:     rgba(0, 0, 0, 0.20);
  --text-1:       #1a1a1a;
  --text-2:       #666666;
  --text-3:       #aaaaaa;
  --accent:       #F5B730;
  --accent-dark:  #d4980f;
  --accent-soft:  rgba(245, 183, 48, 0.12);
  --accent-glow:  rgba(245, 183, 48, 0.3);
  --orange:       #E87B3A;
  --orange-soft:  rgba(232, 123, 58, 0.1);
  --green:        #22a861;
  --green-soft:   rgba(34, 168, 97, 0.1);
  --blue:         #3b82f6;
  --shadow:       0 4px 32px rgba(0,0,0,0.07);
  --shadow-card:  0 2px 16px rgba(0,0,0,0.06);
  --shadow-btn:   0 4px 16px rgba(245, 183, 48, 0.4);
  --navbar-bg:    rgba(255,255,255,0.9);
  --scrollbar:    #e0e0e0;
  /* warm blob glow colors */
  --glow-1: rgba(245, 183, 48, 0.18);
  --glow-2: rgba(232, 123, 58, 0.12);
  --glow-3: rgba(255, 220, 150, 0.25);
}

/* ── Dark theme card overrides ── */
[data-theme="dark"] .card-info {
  background: linear-gradient(to top,
    rgba(0, 0, 0, 0.80) 0%,
    rgba(0, 0, 0, 0.45) 40%,
    rgba(0, 0, 0, 0.12) 65%,
    transparent 100%);
}

[data-theme="dark"] .card-info-icon  { color: var(--accent); }
[data-theme="dark"] .card-info-name  { color: #ffffff; }
[data-theme="dark"] .card-info-sub   { color: rgba(255,255,255,0.50); }

[data-theme="dark"] .app-icon-box::before {
  background: radial-gradient(ellipse 80% 40% at 50% 10%,
    rgba(255,255,255,0.08) 0%,
    transparent 70%);
}

/* ── Dark Theme ── */
[data-theme="dark"] {
  --bg:           #111111;
  --bg-surface:   #1a1a1a;
  --bg-card:      #222222;
  --bg-card-h:    #2a2a2a;
  --bg-warm:      #1e1a14;
  --border:       rgba(255,255,255,0.08);
  --border-h:     rgba(255,255,255,0.15);
  --text-1:       #f0ece4;
  --text-2:       #888888;
  --text-3:       #555555;
  --accent:       #F5B730;
  --accent-dark:  #d4980f;
  --accent-soft:  rgba(245, 183, 48, 0.12);
  --accent-glow:  rgba(245, 183, 48, 0.25);
  --orange:       #E87B3A;
  --orange-soft:  rgba(232, 123, 58, 0.12);
  --green:        #22a861;
  --green-soft:   rgba(34, 168, 97, 0.12);
  --blue:         #3b82f6;
  --shadow:       0 4px 32px rgba(0,0,0,0.4);
  --shadow-card:  0 2px 16px rgba(0,0,0,0.3);
  --shadow-btn:   0 4px 16px rgba(245, 183, 48, 0.3);
  --navbar-bg:    rgba(17,17,17,0.92);
  --scrollbar:    #333333;
  --glow-1: rgba(245, 183, 48, 0.08);
  --glow-2: rgba(232, 123, 58, 0.06);
  --glow-3: rgba(255, 200, 100, 0.08);
}

/* ── Reset & Base ── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html {
  font-size: 16px;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

body {
  font-family: var(--font-body);
  background: var(--bg);
  color: var(--text-1);
  min-height: 100dvh;
  overflow-x: hidden;
  transition: background 300ms ease, color 300ms ease;
}

/* Scrollbar */
::-webkit-scrollbar { width: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--scrollbar); border-radius: 99px; }

/* ── App Shell ── */
#app {
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  position: relative;
}

/* ── Background school name watermark ── */
#bg-watermark {
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  font-size: 11vw;
  font-weight: 900;
  letter-spacing: -0.04em;
  white-space: nowrap;
  color: var(--orange);
  opacity: 0.07;
  filter: blur(2px);
  pointer-events: none;
  user-select: none;
  z-index: 0;
  transition: opacity 400ms ease;
}

#bg-watermark:empty { opacity: 0; }

/* Warm background glow blobs */
#app::before {
  content: '';
  position: fixed;
  top: -80px;
  left: 50%;
  transform: translateX(-50%);
  width: 900px;
  height: 500px;
  background: radial-gradient(ellipse at center,
    var(--glow-3) 0%,
    var(--glow-1) 40%,
    transparent 70%);
  pointer-events: none;
  z-index: 0;
  transition: background 300ms ease;
  opacity: 0.7;
}

/* ── Navbar ── */
#navbar {
  position: fixed;
  top: 0; left: 0; right: 0;
  z-index: 100;
  height: var(--navbar-h);
  background: var(--navbar-bg);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  padding: 0 32px;
  gap: 24px;
  transition: background 300ms ease, border-color 300ms ease;
}

/* ── Brand ── */
.nav-brand {
  display: flex;
  align-items: center;
  flex-shrink: 0;
  background: none;
  border: none;
  cursor: pointer;
  padding: 6px 10px;
  border-radius: var(--radius-md);
  transition: background var(--transition);
  -webkit-tap-highlight-color: transparent;
}

.nav-brand:hover { background: var(--accent-soft); }

.brand-name {
  font-size: 20px;
  font-weight: 800;
  letter-spacing: -0.5px;
  color: var(--text-1);
  transition: color 300ms ease;
  white-space: nowrap;
}

.brand-accent { color: var(--accent); }

/* ── School Tabs ── */
.school-tabs {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
}

.school-tab {
  position: relative;
  padding: 8px 20px;
  border-radius: var(--radius-pill);
  border: 1.5px solid transparent;
  background: transparent;
  color: var(--text-2);
  font-family: var(--font-body);
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: all var(--transition);
  white-space: nowrap;
  display: flex;
  align-items: center;
  gap: 7px;
  letter-spacing: -0.2px;
}

.school-tab:hover {
  color: var(--text-1);
  background: var(--accent-soft);
  border-color: rgba(245, 183, 48, 0.2);
}

.school-tab.active {
  color: var(--text-1);
  background: var(--accent);
  border-color: var(--accent);
  box-shadow: var(--shadow-btn);
}

[data-theme="dark"] .school-tab.active { color: #111111; }

.school-tab .tab-icon { font-size: 15px; }
.school-tab .tab-logo  { height: 28px; width: auto; display: block; flex-shrink: 0; }

/* ── Nav Actions ── */
.nav-actions {
  flex-shrink: 0;
  display: flex;
  align-items: center;
  gap: 8px;
}

.icon-btn {
  height: 38px;
  padding: 0 16px;
  border-radius: var(--radius-pill);
  border: 1.5px solid var(--border);
  background: var(--bg-card);
  color: var(--text-2);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  font-family: var(--font-body);
  font-size: 13px;
  font-weight: 600;
  transition: all var(--transition);
}

.icon-btn:hover {
  color: var(--text-1);
  border-color: var(--border-h);
  background: var(--bg-card-h);
}

.icon { width: 16px; height: 16px; }
.icon-btn .icon { width: 15px; height: 15px; }

/* Theme icon switching */
[data-theme="dark"] .sun-icon  { display: block; }
[data-theme="dark"] .moon-icon { display: none; }
[data-theme="light"] .sun-icon  { display: none; }
[data-theme="light"] .moon-icon { display: block; }

/* ── Breadcrumb ── */
.breadcrumb {
  position: fixed;
  top: var(--navbar-h);
  left: 0; right: 0;
  z-index: 90;
  height: var(--breadcrumb-h);
  background: var(--bg);
  border-bottom: 1px solid var(--border);
  padding: 0 36px;
  display: flex;
  align-items: center;
  gap: 6px;
  transition: background 300ms ease;
}

.bc-item { font-size: 13px; font-weight: 500; }

.bc-link {
  color: var(--text-3);
  background: none;
  border: none;
  cursor: pointer;
  font-family: var(--font-body);
  font-size: 13px;
  font-weight: 600;
  padding: 4px 8px;
  border-radius: 6px;
  transition: all var(--transition);
}

.bc-link:hover { color: var(--orange); }
.bc-sep { color: var(--text-3); font-size: 14px; }
.bc-current { color: var(--text-1); font-weight: 700; }

/* ── Main Content ── */
#main-content {
  flex: 1;
  position: relative;
  z-index: 1;
  padding: 60px 36px;
  max-width: 1440px;
  width: 100%;
  margin: 0 auto;
  padding-top: calc(var(--navbar-h) + 48px);
  transition: padding-top var(--transition);
}

#main-content.with-breadcrumb {
  padding-top: calc(var(--navbar-h) + var(--breadcrumb-h) + 40px);
}

/* ── Snap-page scroll mode (course grid) ── */
#main-content.horiz-scroll {
  display: flex;
  overflow-x: scroll;
  overflow-y: hidden;
  scroll-snap-type: x mandatory;
  -webkit-overflow-scrolling: touch;
  touch-action: pan-x;
  padding: 0;
  max-width: none;
  margin: 0;
  width: 100%;
  /* hide scrollbar — paging feel */
  scrollbar-width: none;
}

#main-content.horiz-scroll::-webkit-scrollbar { display: none; }

/* Each snap page = one full screen */
.course-snap-page {
  flex: 0 0 100%;
  width: 100%;
  height: 100dvh;
  scroll-snap-align: start;
  padding: calc(var(--navbar-h) + 36px) 0 32px;
  box-sizing: border-box;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  align-items: center;
}

/* inner block sized to the grid — header left-aligns with first card */
.course-content-wrap {
  display: flex;
  flex-direction: column;
  flex: 1;
  min-height: 0;
}

.course-snap-page .section-header {
  margin-bottom: 24px;
  flex-shrink: 0;
  text-align: left;
}

/* ── Section Header ── */
.section-header { margin-bottom: 44px; }

.section-label {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 2px;
  color: var(--orange);
  margin-bottom: 12px;
  display: flex;
  align-items: center;
  gap: 10px;
}

.section-label::before {
  content: '';
  display: inline-block;
  width: 22px;
  height: 2px;
  background: var(--orange);
  border-radius: 99px;
  flex-shrink: 0;
}

.section-title {
  font-size: 36px;
  font-weight: 800;
  letter-spacing: -1.5px;
  color: var(--text-1);
  line-height: 1.1;
}

.section-title span { color: var(--orange); }

.section-subtitle {
  font-size: 15px;
  color: var(--text-2);
  margin-top: 10px;
  font-weight: 400;
}

/* ── Course Scroll Area ── */
.course-scroll-wrapper {
  position: relative;
  user-select: none;
}


/* ── 5-column 2-row grid — cards set their own width via aspect-ratio ── */
.course-scroll-track {
  flex: 1;
  min-height: 0;
  display: grid;
  /* columns set dynamically by JS */
  grid-template-rows: repeat(2, 1fr);
  gap: 16px;
  padding: 0;
}

/* ── Page indicator dots ── */
.snap-dots {
  position: sticky;
  left: 0;
  width: 100vw;
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 8px;
  padding: 16px 0 8px;
  pointer-events: none;
}

.snap-dot {
  width: 7px;
  height: 7px;
  border-radius: 99px;
  background: var(--text-3);
  transition: width 220ms ease, background 220ms ease;
}

.snap-dot.active {
  width: 22px;
  background: var(--orange);
}

/* ── Course Thumbnail Card ── */
.app-icon-wrap {
  display: block;
  width: auto;
  height: 100%;
  background: none;
  border: none;
  padding: 0;
  cursor: pointer;
  outline: none;
  -webkit-tap-highlight-color: transparent;
  transition: transform 280ms cubic-bezier(0.34, 1.4, 0.64, 1);
}

.app-icon-wrap:hover  { transform: translateY(-10px) scale(1.03); }
.app-icon-wrap:hover .card-visual { color: var(--accent); opacity: 0.85; transition: color 200ms ease, opacity 200ms ease; }
.app-icon-wrap:active { transform: scale(0.96); transition-duration: 80ms; }

/* Card shell — height fills row, width derived from 4:5 ratio */
.app-icon-box {
  height: 100%;
  aspect-ratio: 4 / 5;
  width: auto;
  border-radius: 22px;
  position: relative;
  overflow: hidden;
  background: var(--bg-card);
  border: 1.5px solid var(--border);
  box-shadow: var(--shadow-card);
  transition: box-shadow 280ms ease, border-color 280ms ease,
              transform 280ms cubic-bezier(0.34, 1.4, 0.64, 1);
}

/* Soft white highlight at top */
.app-icon-box::before {
  content: '';
  position: absolute;
  inset: 0;
  background: radial-gradient(ellipse 80% 40% at 50% 10%,
    rgba(255,255,255,0.60) 0%,
    transparent 70%);
  pointer-events: none;
  z-index: 1;
}

.app-icon-wrap:hover .app-icon-box {
  box-shadow: var(--shadow), 0 0 0 1px var(--accent);
  border-color: var(--accent);
}

/* ── Ghost feature text — large decorative background element ── */
.card-visual {
  position: absolute;
  top: 0;
  left: 0;        /* fix: no overflow, let card clip naturally */
  right: 0;
  bottom: 42%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 900;
  text-transform: uppercase;
  color: var(--border-h);
  transition: color 200ms ease, opacity 200ms ease;
  pointer-events: none;
  z-index: 2;
  line-height: 0.88;
  text-align: center;
  overflow: hidden;               /* fix: clip inside element too */
  user-select: none;
}

/* fix: tighter font sizes so text fills card without asymmetric clipping */
.card-visual.feat-xl { font-size: 88px;  letter-spacing: -4px; }
.card-visual.feat-lg { font-size: 56px;  letter-spacing: -2px; }
.card-visual.feat-md { font-size: 40px;  letter-spacing: -1px; line-height: 1.0; }
.card-visual.feat-sm { font-size: 26px;  letter-spacing: 0;    line-height: 1.15; }

/* ── Light yellow bottom overlay + info ── */
.card-info {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  padding: 52px 14px 16px;
  background: linear-gradient(to top,
    rgba(255, 248, 210, 0.97) 0%,
    rgba(255, 251, 225, 0.88) 40%,
    rgba(255, 254, 240, 0.50) 65%,
    transparent 100%);
  z-index: 3;
}

.card-info-icon {
  font-size: 11px;
  color: rgba(160, 120, 0, 0.70);
  display: block;
  margin-bottom: 5px;
  line-height: 1;
}

.card-info-name {
  font-size: 12px;
  font-weight: 800;
  color: #1a1a1a;
  line-height: 1.3;
  margin-bottom: 4px;
  overflow: hidden;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
}

.card-info-sub {
  font-size: 8px;
  font-weight: 700;
  letter-spacing: 1.8px;
  text-transform: uppercase;
  color: rgba(120, 90, 0, 0.60);
}

/* Module badge */
.app-icon-badge {
  position: absolute;
  top: 10px;
  right: 10px;
  z-index: 3;
  min-width: 24px;
  height: 24px;
  border-radius: 99px;
  background: var(--accent);
  color: #111;
  font-size: 10px;
  font-weight: 800;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0 6px;
  box-shadow: 0 2px 8px rgba(0,0,0,0.4);
}

/* ── Module List ── */
.module-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.module-item {
  display: flex;
  align-items: center;
  gap: 16px;
  background: var(--bg-card);
  border: 1.5px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 18px 22px;
  cursor: pointer;
  transition: all 250ms cubic-bezier(0.34, 1.2, 0.64, 1);
  text-align: left;
  width: 100%;
  box-shadow: var(--shadow-card);
}

.module-item:hover {
  border-color: var(--accent);
  background: var(--bg-warm);
  transform: translateX(6px);
  box-shadow: 0 4px 24px rgba(245, 183, 48, 0.15);
}

.module-num {
  width: 42px;
  height: 42px;
  border-radius: 50%;
  background: var(--accent-soft);
  color: var(--accent-dark);
  font-size: 13px;
  font-weight: 800;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  font-family: var(--font-mono);
  transition: all var(--transition);
}

[data-theme="dark"] .module-num { color: var(--accent); }

.module-item:hover .module-num {
  background: var(--accent);
  color: #111;
  transform: scale(1.05);
}

.module-info { flex: 1; min-width: 0; }

.module-title {
  font-size: 15px;
  font-weight: 700;
  color: var(--text-1);
  line-height: 1.4;
}

.module-meta {
  font-size: 12px;
  color: var(--text-3);
  margin-top: 3px;
  font-weight: 500;
}

.module-arrow {
  color: var(--text-3);
  transition: all var(--transition);
  flex-shrink: 0;
}

.module-item:hover .module-arrow {
  color: var(--accent);
  transform: translateX(4px);
}

/* ── Empty / Loading State ── */
.empty-state {
  text-align: center;
  padding: 100px 40px;
  color: var(--text-2);
}

.empty-icon {
  font-size: 52px;
  margin-bottom: 18px;
  opacity: 0.6;
  display: block;
}

.empty-title {
  font-size: 22px;
  font-weight: 800;
  color: var(--text-1);
  margin-bottom: 8px;
  letter-spacing: -0.5px;
}

.empty-text {
  font-size: 15px;
  color: var(--text-2);
}

/* ── Utility ── */
.hidden { display: none !important; }

/* ── Responsive ── */
@media (max-width: 1100px) {
  .course-page { grid-template-columns: repeat(5, 1fr); }
}

@media (max-width: 900px) {
  .course-page { grid-template-columns: repeat(4, 1fr); gap: 22px 12px; }
  .app-icon-img { width: 76px; height: 76px; border-radius: 18px; }
  .app-icon-label { font-size: 11px; width: 80px; }
}

@media (max-width: 768px) {
  #navbar { padding: 0 20px; }
  #main-content { padding: 24px 20px; padding-top: calc(var(--navbar-h) + 24px); }
  #main-content.with-breadcrumb { padding-top: calc(var(--navbar-h) + var(--breadcrumb-h) + 20px); }
  .breadcrumb { padding: 0 16px; }
  .section-title { font-size: 26px; letter-spacing: -1px; }
  .school-tab { padding: 7px 14px; font-size: 13px; }
  .page-nav-arrow { display: none; }
}

@media (max-width: 540px) {
  .course-page { grid-template-columns: repeat(3, 1fr); gap: 18px 8px; }
  .app-icon-img { width: 68px; height: 68px; border-radius: 16px; }
  .app-icon-label { font-size: 10px; width: 70px; }
}

@media (max-width: 480px) {
  .school-tab .tab-icon { display: none; }
  .school-tab .tab-logo { display: none; }
  .brand-name { display: none; }
}
