/* ================================================================
   main.css — Power BI Training Roadmap
   askfarouk.net · Ahmed Farouk · Microsoft Certified Trainer
   ================================================================ */

/* ── GOOGLE FONTS ── */
/* ── SELF-HOSTED FONTS ── */
/* Drop font files into the fonts/ folder next to main.css */

@font-face {
  font-family: 'DM Serif Display';
  src: url('fonts/DMSerifDisplay-Regular.woff2') format('woff2');
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: 'DM Serif Display';
  src: url('fonts/DMSerifDisplay-Italic.woff2') format('woff2');
  font-weight: 400;
  font-style: italic;
  font-display: swap;
}

@font-face {
  font-family: 'DM Sans';
  src: url('fonts/DMSans-Light.woff2') format('woff2');
  font-weight: 300;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: 'DM Sans';
  src: url('fonts/DMSans-Regular.woff2') format('woff2');
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: 'DM Sans';
  src: url('fonts/DMSans-Medium.woff2') format('woff2');
  font-weight: 500;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: 'DM Sans';
  src: url('fonts/DMSans-SemiBold.woff2') format('woff2');
  font-weight: 600;
  font-style: normal;
  font-display: swap;
}

/* ================================================================
   1. CSS VARIABLES
   ================================================================ */
:root {
  /* Colors */
  --cream:          #faf8f5;
  --white:          #ffffff;
  --ink:            #1a1a2e;
  --ink-soft:       #3d3d5c;
  --ink-muted:      #8888a8;
  --accent:         #e8580a;
  --accent-hover:   #d14d07;
  --accent-soft:    #fff4ef;
  --accent-mid:     #fcd5bf;
  --border:         #e8e4de;
  --border-light:   #f2efe9;
  --success:        #2e9e5b;
  --success-soft:   #edf7f2;

  /* Sidebar */
  --sidebar-w:      268px;
  --sidebar-bg:     #16162a;
  --sidebar-border: rgba(255,255,255,0.07);
  --sidebar-text:   #c8c8e0;
  --sidebar-muted:  #6666888;
  --sidebar-active-bg:  rgba(232,88,10,0.15);
  --sidebar-active-border: var(--accent);
  --sidebar-hover-bg: rgba(255,255,255,0.05);

  /* Typography */
  --font-display:   'DM Serif Display', Georgia, serif;
  --font-body:      'DM Sans', system-ui, sans-serif;

  /* Spacing */
  --space-xs:   4px;
  --space-sm:   8px;
  --space-md:   16px;
  --space-lg:   24px;
  --space-xl:   40px;
  --space-2xl:  64px;

  /* Radii */
  --radius-sm:  8px;
  --radius:     12px;
  --radius-lg:  16px;

  /* Shadows */
  --shadow-xs:  0 1px 3px rgba(26,26,46,0.05);
  --shadow-sm:  0 2px 8px rgba(26,26,46,0.07);
  --shadow-md:  0 4px 20px rgba(26,26,46,0.09);
  --shadow-lg:  0 8px 36px rgba(26,26,46,0.12);
  --shadow-accent: 0 4px 14px rgba(232,88,10,0.28);

  /* Transitions */
  --ease:       cubic-bezier(.4,0,.2,1);
  --dur-fast:   0.15s;
  --dur:        0.22s;
  --dur-slow:   0.35s;
}

/* ================================================================
   2. RESET & BASE
   ================================================================ */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  scroll-behavior: smooth;
  -webkit-text-size-adjust: 100%;
}

body {
  font-family: var(--font-body);
  font-size: 15px;
  color: var(--ink);
  background: var(--cream);
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

img, video { max-width: 100%; display: block; }
a { color: inherit; text-decoration: none; }
button { cursor: pointer; font-family: inherit; }
ul, ol { list-style: none; }

/* ================================================================
   3. LAYOUT — SIDEBAR + MAIN
   ================================================================ */

/* The sidebar is fixed; the page content shifts right */
.page-wrapper {
  display: flex;
  min-height: 100vh;
}

/* Sidebar slot — filled by sidebar.js */
#sidebar {
  position: fixed;
  top: 0;
  left: 0;
  width: var(--sidebar-w);
  height: 100vh;
  z-index: 200;
  overflow-y: auto;
  overflow-x: hidden;
  background: var(--sidebar-bg);
  border-right: 1px solid var(--sidebar-border);
  scrollbar-width: thin;
  scrollbar-color: rgba(255,255,255,0.1) transparent;
  transition: transform var(--dur-slow) var(--ease);
}

#sidebar::-webkit-scrollbar { width: 4px; }
#sidebar::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.1); border-radius: 2px; }

/* Main content area */
.main-content {
  flex: 1;
  margin-left: var(--sidebar-w);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

/* ── TOPBAR (mobile) ── */
.topbar {
  display: none;
  align-items: center;
  gap: 12px;
  background: var(--white);
  border-bottom: 1px solid var(--border);
  padding: 14px 20px;
  position: sticky;
  top: 0;
  z-index: 100;
  box-shadow: var(--shadow-xs);
}

.topbar-brand {
  flex: 1;
  font-weight: 600;
  font-size: 14px;
  color: var(--ink);
}

.hamburger-btn {
  background: none;
  border: none;
  width: 36px;
  height: 36px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 5px;
  border-radius: var(--radius-sm);
  transition: background var(--dur-fast);
}

.hamburger-btn:hover { background: var(--border-light); }

.hamburger-btn span {
  display: block;
  width: 20px;
  height: 2px;
  background: var(--ink);
  border-radius: 1px;
  transition: transform var(--dur) var(--ease), opacity var(--dur-fast);
}

.hamburger-btn.open span:nth-child(1) { transform: translateY(7px) rotate(45deg); }
.hamburger-btn.open span:nth-child(2) { opacity: 0; }
.hamburger-btn.open span:nth-child(3) { transform: translateY(-7px) rotate(-45deg); }

/* Sidebar overlay (mobile) */
.sidebar-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.45);
  z-index: 190;
  backdrop-filter: blur(2px);
}

.sidebar-overlay.visible { display: block; }

/* ================================================================
   4. PAGE INNER — content container
   ================================================================ */
.page-inner {
  flex: 1;
  padding: var(--space-xl) var(--space-xl) var(--space-2xl);
  max-width: 1100px;
  width: 100%;
}

/* ================================================================
   5. TYPOGRAPHY
   ================================================================ */
.eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 1.2px;
  text-transform: uppercase;
  color: var(--accent);
  margin-bottom: 12px;
}

.eyebrow::before {
  content: '';
  width: 20px;
  height: 2px;
  background: var(--accent);
  border-radius: 1px;
  flex-shrink: 0;
}

h1.page-title {
  font-family: var(--font-display);
  font-size: clamp(28px, 4vw, 42px);
  line-height: 1.12;
  color: var(--ink);
  letter-spacing: -0.5px;
  margin-bottom: 14px;
}

h1.page-title em {
  font-style: italic;
  color: var(--accent);
}

h2.section-title {
  font-family: var(--font-display);
  font-size: clamp(20px, 3vw, 26px);
  line-height: 1.2;
  color: var(--ink);
  letter-spacing: -0.3px;
  margin-bottom: 10px;
}

h3.group-heading {
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.9px;
  text-transform: uppercase;
  color: var(--ink-muted);
  margin-bottom: 10px;
  display: flex;
  align-items: center;
  gap: 10px;
}

h3.group-heading::after {
  content: '';
  flex: 1;
  height: 1px;
  background: var(--border);
}

.page-desc {
  font-size: 15px;
  color: var(--ink-soft);
  font-weight: 300;
  line-height: 1.75;
}

/* ================================================================
   6. META ROW
   ================================================================ */
.meta-row {
  display: flex;
  flex-wrap: wrap;
  gap: 20px;
  margin-top: 20px;
  padding-top: 20px;
  border-top: 1px solid var(--border-light);
}

.meta-item {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 12.5px;
  color: var(--ink-muted);
  font-weight: 400;
}

.meta-item svg {
  width: 14px;
  height: 14px;
  color: var(--accent);
  flex-shrink: 0;
}

/* ================================================================
   7. CARDS
   ================================================================ */
.card {
  background: var(--white);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
  overflow: hidden;
  transition: box-shadow var(--dur) var(--ease), border-color var(--dur) var(--ease);
}

.card:hover { box-shadow: var(--shadow-md); }
.card.accent { border-top: 3px solid var(--accent); }
.card.open { border-color: var(--accent-mid); box-shadow: var(--shadow-md); }

.card-body { padding: var(--space-lg) var(--space-lg); }
.card-body-lg { padding: var(--space-xl) var(--space-xl); }

/* ================================================================
   8. ACCORDION
   ================================================================ */
.accordion-header {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 20px 22px;
  cursor: pointer;
  user-select: none;
  transition: background var(--dur-fast);
}

.accordion-header:hover { background: #fdfcfb; }

.accordion-body {
  display: none;
  border-top: 1px solid var(--border-light);
  padding: 20px 22px 24px 72px;
  animation: fade-slide var(--dur) var(--ease);
}

.accordion-body.open { display: block; }

.chevron-icon {
  width: 20px;
  height: 20px;
  color: var(--ink-muted);
  transition: transform var(--dur) var(--ease);
  flex-shrink: 0;
}

.accordion-header[aria-expanded="true"] .chevron-icon { transform: rotate(180deg); }

/* ================================================================
   9. TOPIC NUMBER BADGE
   ================================================================ */
.topic-badge {
  width: 38px;
  height: 38px;
  border-radius: 10px;
  background: var(--accent-soft);
  border: 1.5px solid var(--accent-mid);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  font-weight: 600;
  color: var(--accent);
  flex-shrink: 0;
  letter-spacing: 0.3px;
}

.topic-badge.large {
  width: 52px;
  height: 52px;
  border-radius: 14px;
  font-size: 16px;
}

/* ================================================================
   10. SUBTOPIC LIST
   ================================================================ */
.subtopic-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.subtopic-list li {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 13.5px;
  color: var(--ink-soft);
  padding: 9px 14px;
  border-radius: var(--radius-sm);
  background: var(--cream);
  border: 1px solid var(--border-light);
  transition: background var(--dur-fast), border-color var(--dur-fast), color var(--dur-fast);
}

.subtopic-list li:hover {
  background: var(--accent-soft);
  border-color: var(--accent-mid);
  color: var(--ink);
}

.dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--accent);
  flex-shrink: 0;
  opacity: 0.55;
}

/* ================================================================
   11. SUBTOPIC GROUP
   ================================================================ */
.subtopic-group {
  margin-top: 18px;
}

.subtopic-group:first-child { margin-top: 14px; }

/* ================================================================
   12. MEDIA SLOTS
   ================================================================ */
/*
  USAGE:
  ─────────────────────────────────────────────────────────────────
  IMAGE:
    <div class="media-slot">
      <img src="YOUR_URL" alt="Description">
      <p class="media-caption">Caption text</p>
    </div>

  VIDEO (hosted file):
    <div class="media-slot">
      <video controls>
        <source src="YOUR_URL" type="video/mp4">
      </video>
      <p class="media-caption">Caption text</p>
    </div>

  VIDEO (YouTube embed):
    <div class="media-slot media-slot--video">
      <iframe src="https://www.youtube.com/embed/VIDEO_ID"
        frameborder="0" allowfullscreen></iframe>
      <p class="media-caption">Caption text</p>
    </div>

  PLACEHOLDER (waiting for content):
    <div class="media-slot media-slot--placeholder">
      <div class="media-placeholder-inner">
        <svg>…</svg>
        <span>Image coming soon</span>
      </div>
    </div>
  ─────────────────────────────────────────────────────────────────
*/

.media-slot {
  margin-top: 22px;
  border-radius: var(--radius);
  overflow: hidden;
  border: 1px solid var(--border);
  background: var(--white);
}

.media-slot img {
  width: 100%;
  height: auto;
  display: block;
}

.media-slot video {
  width: 100%;
  display: block;
  background: #000;
}

/* 16:9 iframe wrapper */
.media-slot--video {
  position: relative;
  padding-bottom: 56.25%;
  height: 0;
  border-radius: var(--radius);
  overflow: hidden;
}

.media-slot--video iframe {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  border: none;
}

/* Placeholder state */
.media-slot--placeholder {
  border: 1.5px dashed var(--accent-mid);
  background: var(--accent-soft);
  min-height: 160px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.media-placeholder-inner {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 9px;
  padding: 32px;
  color: var(--accent);
  opacity: 0.55;
}

.media-placeholder-inner svg { width: 30px; height: 30px; }

.media-placeholder-inner span {
  font-size: 12.5px;
  font-weight: 500;
  letter-spacing: 0.2px;
  color: var(--ink-muted);
}

.media-caption {
  padding: 10px 14px;
  font-size: 12px;
  color: var(--ink-muted);
  font-style: italic;
  border-top: 1px solid var(--border-light);
  background: var(--cream);
}

/* ================================================================
   13. BREADCRUMB
   ================================================================ */
.breadcrumb {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 12.5px;
  color: var(--ink-muted);
  margin-bottom: 24px;
  flex-wrap: wrap;
}

.breadcrumb a {
  color: var(--ink-muted);
  text-decoration: none;
  transition: color var(--dur-fast);
}

.breadcrumb a:hover { color: var(--accent); }

.breadcrumb-sep {
  width: 14px;
  height: 14px;
  flex-shrink: 0;
  opacity: 0.4;
}

.breadcrumb-current { color: var(--ink-soft); font-weight: 500; }

/* ================================================================
   14. NAVIGATION ARROWS (prev / next topic)
   ================================================================ */
.topic-nav {
  display: flex;
  gap: 12px;
  margin-top: 40px;
  padding-top: 28px;
  border-top: 1px solid var(--border);
}

.topic-nav-btn {
  flex: 1;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 16px 18px;
  background: var(--white);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  transition: border-color var(--dur), box-shadow var(--dur), background var(--dur-fast);
  cursor: pointer;
  text-decoration: none;
  color: var(--ink);
  min-width: 0;
}

.topic-nav-btn:hover {
  border-color: var(--accent-mid);
  box-shadow: var(--shadow-md);
  background: var(--accent-soft);
}

.topic-nav-btn.next { flex-direction: row-reverse; text-align: right; }

.nav-btn-icon {
  width: 32px;
  height: 32px;
  background: var(--accent-soft);
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  color: var(--accent);
}

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

.nav-btn-text { flex: 1; min-width: 0; }

.nav-btn-label {
  font-size: 10.5px;
  font-weight: 600;
  letter-spacing: 0.8px;
  text-transform: uppercase;
  color: var(--ink-muted);
  margin-bottom: 2px;
}

.nav-btn-title {
  font-size: 13.5px;
  font-weight: 600;
  color: var(--ink);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* ================================================================
   15. PILLS & BADGES
   ================================================================ */
.pill {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  border-radius: 20px;
  padding: 4px 12px;
  font-size: 12px;
  font-weight: 500;
  white-space: nowrap;
}

.pill-accent {
  background: var(--accent-soft);
  border: 1px solid var(--accent-mid);
  color: var(--accent);
}

.pill-neutral {
  background: var(--border-light);
  border: 1px solid var(--border);
  color: var(--ink-muted);
}

.pill-count {
  background: var(--border-light);
  border: 1px solid var(--border);
  color: var(--ink-muted);
  font-size: 11.5px;
  padding: 3px 10px;
}

/* ================================================================
   16. DIVIDER
   ================================================================ */
.divider {
  border: none;
  border-top: 1px solid var(--border);
  margin: var(--space-lg) 0;
}

.divider-lg { margin: var(--space-xl) 0; }

/* ================================================================
   17. FORM ELEMENTS
   ================================================================ */
.form-group {
  display: flex;
  flex-direction: column;
  gap: 7px;
}

label.form-label {
  font-size: 13px;
  font-weight: 600;
  color: var(--ink-soft);
  letter-spacing: 0.1px;
}

label.form-label .optional {
  font-weight: 400;
  color: var(--ink-muted);
}

input[type="text"],
input[type="email"],
textarea,
select {
  width: 100%;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 11px 14px;
  font-family: var(--font-body);
  font-size: 14px;
  color: var(--ink);
  background: var(--cream);
  outline: none;
  transition: border-color var(--dur-fast), box-shadow var(--dur-fast), background var(--dur-fast);
  line-height: 1.55;
}

input[type="text"]:focus,
input[type="email"]:focus,
textarea:focus,
select:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(232,88,10,0.10);
  background: var(--white);
}

input::placeholder,
textarea::placeholder { color: var(--ink-muted); }

textarea { resize: vertical; min-height: 90px; }

/* ================================================================
   18. BUTTONS
   ================================================================ */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  border: none;
  border-radius: var(--radius-sm);
  padding: 12px 24px;
  font-family: var(--font-body);
  font-size: 14px;
  font-weight: 600;
  letter-spacing: 0.1px;
  cursor: pointer;
  transition: background var(--dur-fast), box-shadow var(--dur-fast), transform var(--dur-fast);
  white-space: nowrap;
  text-decoration: none;
}

.btn-primary {
  background: var(--accent);
  color: white;
  box-shadow: var(--shadow-accent);
}

.btn-primary:hover {
  background: var(--accent-hover);
  box-shadow: 0 6px 18px rgba(232,88,10,0.30);
  transform: translateY(-1px);
}

.btn-primary:active { transform: translateY(0); }

.btn-ghost {
  background: transparent;
  color: var(--ink-soft);
  border: 1px solid var(--border);
}

.btn-ghost:hover { background: var(--border-light); border-color: var(--border); }

.btn-sm { padding: 8px 16px; font-size: 13px; }
.btn-full { width: 100%; }

/* ================================================================
   19. STAR RATING
   ================================================================ */
.star-row { display: flex; gap: 4px; }

.star-btn {
  background: none;
  border: none;
  font-size: 24px;
  color: var(--border);
  padding: 0;
  line-height: 1;
  transition: color var(--dur-fast), transform var(--dur-fast);
  cursor: pointer;
}

.star-btn:hover,
.star-btn.lit { color: #f5a623; }

.star-btn.lit:last-child { transform: scale(1.15); }

/* ================================================================
   20. ANIMATIONS
   ================================================================ */
@keyframes fade-slide {
  from { opacity: 0; transform: translateY(-6px); }
  to   { opacity: 1; transform: translateY(0); }
}

@keyframes fade-in {
  from { opacity: 0; }
  to   { opacity: 1; }
}

@keyframes slide-in-left {
  from { transform: translateX(-100%); }
  to   { transform: translateX(0); }
}

/* ================================================================
   21. FOOTER
   ================================================================ */
.page-footer {
  margin-top: auto;
  padding: 20px var(--space-xl);
  border-top: 1px solid var(--border);
  font-size: 12.5px;
  color: var(--ink-muted);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
}

.page-footer a { color: var(--accent); }
.page-footer a:hover { text-decoration: underline; }

/* ================================================================
   22. RESPONSIVE — Mobile (sidebar collapses)
   ================================================================ */
@media (max-width: 768px) {

  #sidebar {
    transform: translateX(-100%);
    box-shadow: none;
  }

  #sidebar.mobile-open {
    transform: translateX(0);
    box-shadow: var(--shadow-lg);
  }

  .main-content { margin-left: 0; }

  .topbar { display: flex; }

  .page-inner {
    padding: var(--space-lg) var(--space-lg) var(--space-xl);
  }

  .topic-nav { flex-direction: column; }

  .page-footer { padding: var(--space-lg); }
}

@media (max-width: 480px) {
  .page-inner { padding: var(--space-md) var(--space-md) var(--space-xl); }
  .accordion-body { padding-left: var(--space-md); }
}
