/* ─────────────────────────────────────────────
   Learn Data Analyst — Design System
   Light mode, HRFlow-based, Impeccable
   ───────────────────────────────────────────── */

@import url('https://fonts.bunny.net/css?family=lexend:400,500,600,700&family=dm-sans:400,500,600,700&family=roboto-mono:400,500');

/* Tokens — adapted from hrflow-DESIGN.md */
:root {
  --bg:           #FAFAFA;
  --surface:      #FFFFFF;
  --surface-2:    #F3F4F6;
  --border:       #E5E7EB;
  --ink:          #111827;
  --ink-2:        #374151;
  --ink-3:        #5F6B7A; /* darkened from HRFlow's #6B7280 to hold 4.5:1 on --surface-2, not just white */

  --accent:          #7C3AED;
  --accent-hover:    #5B21B6;
  --accent-light:    #F5F3FF;
  --accent-dark:     #5B21B6;
  --accent-selected: #EDE9FE;
  --accent-border:   #A78BFA;

  --secondary: #0D9488;
  --tertiary:  #F97316;
  --success:   #059669;
  --warning:   #D97706;
  --error:     #EF4444;
  --info:      #2563EB;

  --sidebar-bg:   var(--surface-2);
  --sidebar-2:    var(--accent-light);
  --sidebar-text: var(--ink-2);
  --sidebar-muted:var(--ink-3);
  --sidebar-w:    240px;
  --topbar-h:     52px;
  --tabs-h:       44px;

  --radius-sm:   4px;
  --radius:      8px;
  --radius-lg:   12px;
  --radius-full: 9999px;

  --shadow-sm: 0 1px 2px oklch(0% 0 0 / .05);
  --shadow:    0 2px 8px oklch(0% 0 0 / .08);
  --shadow-lg: 0 4px 16px oklch(0% 0 0 / .10);
  --focus-ring: 0 0 0 3px oklch(52% 0.19 293 / .25);

  /* Spacing scale (8px base) — apply to new components going forward */
  --space-xs: 4px; --space-sm: 8px; --space-md: 16px; --space-lg: 24px;
  --space-xl: 32px; --space-2xl: 48px; --space-3xl: 64px;

  /* Phase colors — mapped to HRFlow's 6 role colors */
  --fase-1: var(--accent);    /* purple */
  --fase-2: var(--secondary); /* teal */
  --fase-3: var(--success);   /* green */
  --fase-4: var(--warning);   /* amber */
  --fase-5: var(--tertiary);  /* orange */
  --fase-6: var(--error);     /* red */

  /* Semantic callouts — mapped to HRFlow's status colors */
  --info-bg:      #EFF6FF;
  --info-border:  #BFDBFE;
  --info-dark:    #1D4ED8;
  --tip-bg:       #ECFDF5;
  --tip-border:   #A7F3D0;
  --success-dark: #047857;
  --success-mid:  #10B981;
  --warn-bg:      #FFFBEB;
  --warn-border:  #FDE68A;
  --warning-dark: #B45309;
  --challenge-bg: #FFF7ED;
  --challenge-border: #FED7AA;
  --tertiary-dark: #C2410C;
  --trigger-bg:   var(--accent-light);
  --trigger-border: #DDD6FE;
}

/* Reset */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { font-size: 16px; scroll-behavior: smooth; }
body {
  font-family: 'DM Sans', system-ui, sans-serif;
  background: var(--bg);
  color: var(--ink);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
img { max-width: 100%; display: block; }

/* Headline font (HRFlow: Lexend for h1–h4 equivalents) */
.page-header h1, .hero h1, .section-title,
.week-title, .day-title, .fase-title, .buku-title, .book-title,
.tool-name, .sidebar-brand-name {
  font-family: 'Lexend', system-ui, sans-serif;
}

/* Focus ring — visible keyboard focus on all interactive elements */
a:focus-visible, button:focus-visible, .nav-item:focus-visible,
.tab:focus-visible, .week-header:focus-visible, [tabindex]:focus-visible {
  outline: none;
  box-shadow: var(--focus-ring);
  border-radius: var(--radius-sm);
}

/* ─── Layout ─── */
.shell {
  display: flex;
  min-height: 100vh;
}

/* Sidebar */
.sidebar {
  width: var(--sidebar-w);
  background: var(--sidebar-bg);
  color: var(--sidebar-text);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  position: fixed;
  top: 0; left: 0; bottom: 0;
  z-index: 200;
  overflow-y: auto;
  transition: transform .22s ease;
  overscroll-behavior: contain;
}
.sidebar::-webkit-scrollbar { width: 4px; }
.sidebar::-webkit-scrollbar-track { background: transparent; }
.sidebar::-webkit-scrollbar-thumb { background: var(--border); border-radius: 4px; }

.sidebar-header {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 18px 16px 14px;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}
.sidebar-logo { font-size: 22px; line-height: 1; }
.sidebar-brand { flex: 1; }
.sidebar-brand-name { font-size: 13px; font-weight: 600; color: var(--sidebar-text); }
.sidebar-brand-sub  { font-size: 11px; color: var(--sidebar-muted); margin-top: 1px; }
.sidebar-close {
  display: none;
  background: none; border: none; color: var(--sidebar-muted);
  font-size: 20px; cursor: pointer; padding: 4px; line-height: 1;
}

.sidebar-nav { padding: 12px 0 20px; flex: 1; }
.nav-group { margin-top: 20px; }
.nav-group-label {
  font-size: 10px; font-weight: 700; letter-spacing: .08em;
  color: var(--sidebar-muted);
  padding: 0 16px 6px;
  text-transform: uppercase;
  display: block;
}
.nav-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 7px 16px;
  font-size: 13.5px;
  color: var(--sidebar-muted);
  border-radius: 0;
  transition: background .12s, color .12s;
  line-height: 1.4;
}
.nav-item:hover {
  background: var(--sidebar-2);
  color: var(--ink);
  text-decoration: none;
}
.nav-item.active {
  background: var(--accent-selected);
  color: var(--accent-dark);
  font-weight: 500;
}
.nav-item .nav-num {
  font-size: 11px; color: var(--sidebar-muted);
  min-width: 20px; text-align: right;
}
.nav-divider {
  height: 1px;
  background: var(--border);
  margin: 12px 16px;
}

/* Main area */
.main {
  flex: 1;
  margin-left: var(--sidebar-w);
  min-width: 0;
}

/* Topbar */
.topbar {
  height: var(--topbar-h);
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 0 20px;
  border-bottom: 1px solid var(--border);
  background: var(--bg);
  position: sticky;
  top: 0;
  z-index: 100;
}
.menu-toggle {
  display: none;
  background: none; border: none;
  font-size: 20px; cursor: pointer;
  color: var(--ink-2); padding: 4px;
  line-height: 1;
}
.breadcrumb {
  font-size: 13px; color: var(--ink-3);
  display: flex; align-items: center; gap: 6px; flex: 1;
}
.breadcrumb a { color: var(--ink-3); }
.breadcrumb a:hover { color: var(--accent); }
.breadcrumb-sep { color: var(--border); }
.breadcrumb-current { color: var(--ink-2); font-weight: 500; }
.topbar-progress {
  font-size: 12px; color: var(--ink-3);
  display: flex; align-items: center; gap: 6px;
  white-space: nowrap;
}
.progress-pip {
  width: 6px; height: 6px; border-radius: 50%;
  background: var(--accent);
}

/* Section tabs */
.section-tabs {
  display: flex;
  align-items: center;
  gap: 2px;
  padding: 0 20px;
  border-bottom: 1px solid var(--border);
  background: var(--bg);
  position: sticky;
  top: var(--topbar-h);
  z-index: 90;
  overflow-x: auto;
  scrollbar-width: none;
  -webkit-overflow-scrolling: touch;
}
.section-tabs::-webkit-scrollbar { display: none; }
.tab {
  display: flex;
  align-items: center;
  padding: 0 14px;
  height: var(--tabs-h);
  font-size: 13.5px;
  color: var(--ink-3);
  font-weight: 500;
  white-space: nowrap;
  border-bottom: 2px solid transparent;
  transition: color .12s, border-color .12s;
  flex-shrink: 0;
}
.tab:hover { color: var(--ink-2); text-decoration: none; }
.tab.active { color: var(--accent); border-bottom-color: var(--accent); }

/* Content */
.content {
  max-width: 820px;
  padding: 40px 24px 80px;
  margin: 0 auto;
}

/* Page header */
.page-header { margin-bottom: 36px; }
.phase-badge {
  display: inline-flex;
  align-items: center;
  font-size: 11.5px; font-weight: 600;
  letter-spacing: .04em;
  color: var(--accent);
  background: var(--accent-light);
  padding: 3px 10px;
  border-radius: 20px;
  margin-bottom: 12px;
}
.page-header h1 {
  font-size: 28px; font-weight: 700;
  line-height: 1.25;
  letter-spacing: -.02em;
  color: var(--ink);
  margin-bottom: 8px;
  text-wrap: balance;
}
.page-header .subtitle {
  font-size: 16px; color: var(--ink-2);
  line-height: 1.5; max-width: 55ch;
}
.tag-row {
  display: flex; flex-wrap: wrap; gap: 8px;
  margin-top: 14px;
}
.tag {
  font-size: 12px;
  background: var(--surface);
  color: var(--ink-2);
  padding: 3px 10px;
  border-radius: 20px;
  border: 1px solid var(--border);
}

/* Section */
.section { padding-top: 48px; scroll-margin-top: calc(var(--topbar-h) + var(--tabs-h) + 24px); }
.section-title {
  font-size: 20px; font-weight: 700;
  letter-spacing: -.015em;
  color: var(--ink);
  margin-bottom: 6px;
  text-wrap: balance;
}
.section-subtitle {
  font-size: 14px; color: var(--ink-3);
  margin-bottom: 24px;
}
.section-divider {
  border: none; border-top: 1px solid var(--border);
  margin: 40px 0;
}

/* Kompetensi list */
.kompetensi-list {
  list-style: none;
  display: grid; gap: 6px;
  margin: 16px 0;
}
.kompetensi-list li {
  display: flex; align-items: flex-start; gap: 10px;
  font-size: 14px; color: var(--ink-2);
  line-height: 1.5;
}
.kompetensi-list li::before {
  content: '✓';
  color: var(--tip-border);
  font-weight: 700;
  flex-shrink: 0;
  margin-top: 1px;
}

/* Week card */
.week-card {
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  background: var(--surface);
  box-shadow: var(--shadow-sm);
  overflow: hidden;
  margin-bottom: 28px;
}
.week-header {
  display: flex; align-items: center; gap: 14px;
  padding: 16px 20px;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  cursor: pointer;
  user-select: none;
}
.week-num {
  width: 32px; height: 32px;
  border-radius: 50%;
  background: var(--accent);
  color: white;
  display: flex; align-items: center; justify-content: center;
  font-size: 12px; font-weight: 700;
  flex-shrink: 0;
}
.week-info { flex: 1; }
.week-title { font-size: 15px; font-weight: 600; color: var(--ink); }
.week-meta { font-size: 12.5px; color: var(--ink-3); margin-top: 2px; }
.week-toggle { color: var(--ink-3); font-size: 16px; transition: transform .2s; }
.week-card.open .week-toggle { transform: rotate(180deg); }

.week-body { padding: 20px; display: flex; flex-direction: column; gap: 20px; }
.week-card:not(.open) .week-body { display: none; }

/* Day block */
.day-block { border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface); overflow: hidden; }
.day-header {
  display: flex; align-items: center; gap: 12px;
  padding: 12px 16px;
  background: var(--surface-2);
  border-bottom: 1px solid var(--border);
}
.day-label {
  font-size: 11px; font-weight: 700;
  color: var(--accent);
  text-transform: uppercase; letter-spacing: .06em;
  background: var(--accent-light);
  padding: 2px 8px; border-radius: 4px;
  white-space: nowrap;
}
.day-title { font-size: 14.5px; font-weight: 600; color: var(--ink); }
.day-body { padding: 16px; display: flex; flex-direction: column; gap: 16px; }

/* Content cards */
.callout {
  border-radius: var(--radius);
  padding: 14px 16px;
}
.callout-header {
  display: flex; align-items: center; gap: 8px;
  font-size: 12px; font-weight: 700;
  text-transform: uppercase; letter-spacing: .06em;
  margin-bottom: 10px;
}
.callout-icon { font-size: 16px; }
.callout p, .callout li { font-size: 14px; line-height: 1.7; }
.callout ul, .callout ol {
  padding-left: 18px;
  display: flex; flex-direction: column; gap: 5px;
}
.callout + .callout { margin-top: 0; }

.callout.info { background: var(--info-bg); border: 1px solid var(--info-border); }
.callout.info .callout-header { color: var(--info-dark); }
.callout.tip { background: var(--tip-bg); border: 1px solid var(--tip-border); }
.callout.tip .callout-header { color: var(--success-dark); }
.callout.challenge { background: var(--challenge-bg); border: 1px solid var(--challenge-border); }
.callout.challenge .callout-header { color: var(--tertiary-dark); }
.callout.trigger { background: var(--trigger-bg); border: 1px solid var(--trigger-border); }
.callout.trigger .callout-header { color: var(--accent-dark); }
.callout.warn { background: var(--warn-bg); border: 1px solid var(--warn-border); }
.callout.warn .callout-header { color: var(--warning-dark); }

/* Code block */
.code-block {
  background: oklch(18% 0.03 255);
  border-radius: var(--radius);
  overflow: hidden;
  margin: 8px 0;
}
.code-lang {
  padding: 8px 14px 6px;
  font-size: 11px;
  color: oklch(55% 0.02 255);
  font-family: 'Roboto Mono', monospace;
  border-bottom: 1px solid oklch(25% 0.02 255);
  background: oklch(20% 0.03 255);
}
.code-block pre {
  margin: 0;
  padding: 14px;
  overflow-x: auto;
}
.code-block code {
  font-family: 'Roboto Mono', monospace;
  font-size: 13px;
  line-height: 1.65;
  color: oklch(88% 0.02 255);
  white-space: pre;
}
/* Syntax tokens */
.tok-kw   { color: oklch(72% 0.18 285); }  /* keyword - purple */
.tok-fn   { color: oklch(75% 0.15 200); }  /* function - cyan */
.tok-str  { color: oklch(72% 0.16 145); }  /* string - green */
.tok-num  { color: oklch(75% 0.16 55); }   /* number - amber */
.tok-cmt  { color: oklch(52% 0.02 255); font-style: italic; }  /* comment */
.tok-op   { color: oklch(80% 0.04 255); }  /* operator */
.tok-var  { color: oklch(82% 0.02 255); }  /* variable */

/* Exercise list */
.exercise-list {
  list-style: none;
  display: flex; flex-direction: column; gap: 8px;
  margin: 8px 0;
}
.exercise-list li {
  display: flex; align-items: flex-start; gap: 10px;
  font-size: 14px; line-height: 1.6;
}
.exercise-list .num {
  min-width: 22px; height: 22px;
  border-radius: 50%;
  background: var(--surface-2);
  color: var(--ink-2);
  font-size: 11px; font-weight: 700;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
  margin-top: 2px;
}

/* Concept chips */
.concept-chips {
  display: flex; flex-wrap: wrap; gap: 6px;
  margin: 12px 0;
}
.chip {
  font-size: 12.5px;
  background: var(--surface);
  border: 1px solid var(--border);
  color: var(--ink-2);
  padding: 4px 10px;
  border-radius: 20px;
}
.chip.primary {
  background: var(--accent-light);
  border-color: var(--accent-border);
  color: var(--accent-dark);
}

/* Timeline */
.week-timeline {
  display: flex; flex-direction: column; gap: 0;
  position: relative;
  padding-left: 24px;
}
.week-timeline::before {
  content: '';
  position: absolute;
  left: 7px; top: 12px; bottom: 12px;
  width: 2px;
  background: var(--border);
}

/* Output card */
.output-card {
  border: 1px solid var(--tip-border);
  background: var(--tip-bg);
  border-radius: var(--radius);
  padding: 16px;
}
.output-card h4 {
  font-size: 13px; font-weight: 700;
  color: var(--success-dark);
  margin-bottom: 10px;
  text-transform: uppercase; letter-spacing: .05em;
}
.output-card ul {
  list-style: none;
  display: flex; flex-direction: column; gap: 6px;
}
.output-card li {
  display: flex; align-items: center; gap: 8px;
  font-size: 14px; color: var(--ink-2);
}
.output-card li::before { content: '→'; color: var(--success-mid); }

/* Buku card */
.buku-grid { display: grid; gap: 14px; }
.buku-card {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: var(--shadow-sm);
  padding: 16px;
  display: flex; gap: 14px;
}
.buku-cover {
  width: 48px; height: 64px;
  border-radius: 4px;
  display: flex; align-items: center; justify-content: center;
  font-size: 24px;
  flex-shrink: 0;
}
.buku-info { flex: 1; }
.buku-title { font-size: 14.5px; font-weight: 600; color: var(--ink); }
.buku-author { font-size: 12.5px; color: var(--ink-3); margin-top: 2px; }
.buku-desc { font-size: 13.5px; color: var(--ink-2); margin-top: 6px; line-height: 1.5; }
.buku-badge {
  display: inline-block;
  font-size: 11px;
  padding: 2px 8px;
  border-radius: 10px;
  margin-top: 8px;
}
.buku-badge.free { background: var(--tip-bg); color: var(--success-dark); border: 1px solid var(--tip-border); }
.buku-badge.optional { background: var(--surface); color: var(--ink-3); border: 1px solid var(--border); }
.buku-badge.wajib { background: var(--accent-light); color: var(--accent-dark); border: 1px solid var(--accent-border); }

/* Tools grid */
.tools-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 12px; }
.tool-card {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: var(--shadow-sm);
  padding: 14px 16px;
}
.tool-icon { font-size: 24px; margin-bottom: 8px; }
.tool-name { font-size: 14px; font-weight: 600; color: var(--ink); }
.tool-desc { font-size: 13px; color: var(--ink-3); margin-top: 4px; line-height: 1.4; }
.tool-how { font-size: 12.5px; color: var(--ink-2); margin-top: 8px; }

/* Homepage specific */
.hero {
  padding: 48px 0 36px;
  border-bottom: 1px solid var(--border);
  margin-bottom: 40px;
}
.hero-eyebrow {
  font-size: 12px; font-weight: 600;
  color: var(--accent); letter-spacing: .08em;
  text-transform: uppercase;
  margin-bottom: 12px;
}
.hero h1 {
  font-size: 32px; font-weight: 800;
  line-height: 1.2; letter-spacing: -.03em;
  color: var(--ink);
  max-width: 18ch;
  text-wrap: balance;
  margin-bottom: 14px;
}
.hero p {
  font-size: 16px; color: var(--ink-2);
  max-width: 55ch; line-height: 1.65;
}
.hero-stats {
  display: flex; gap: 28px;
  margin-top: 24px;
}
.hero-stat-val { font-size: 20px; font-weight: 700; color: var(--ink); }
.hero-stat-label { font-size: 12px; color: var(--ink-3); margin-top: 2px; }

.fase-grid { display: grid; gap: 12px; margin-bottom: 40px; }
.fase-card {
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 20px;
  display: flex;
  align-items: flex-start;
  gap: 14px;
  background: var(--surface);
  box-shadow: var(--shadow-sm);
}
.fase-stripe {
  width: 10px; height: 10px;
  border-radius: var(--radius-full);
  margin-top: 7px;
  flex-shrink: 0;
}
.fase-card:nth-child(1) .fase-stripe { background: var(--fase-1); }
.fase-card:nth-child(2) .fase-stripe { background: var(--fase-2); }
.fase-card:nth-child(3) .fase-stripe { background: var(--fase-3); }
.fase-card:nth-child(4) .fase-stripe { background: var(--fase-4); }
.fase-card:nth-child(5) .fase-stripe { background: var(--fase-5); }
.fase-card:nth-child(6) .fase-stripe { background: var(--fase-6); }
.fase-content {}
.fase-timing { font-size: 12px; color: var(--ink-3); margin-bottom: 4px; }
.fase-title { font-size: 16px; font-weight: 700; color: var(--ink); margin-bottom: 8px; }
.fase-skills { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 10px; }
.fase-output { font-size: 13px; color: var(--ink-3); }
.fase-output strong { color: var(--ink-2); }

/* Overlay */
.sidebar-overlay {
  display: none;
  position: fixed; inset: 0;
  background: oklch(0% 0 0 / .4);
  z-index: 150;
}

/* ─── Responsive ─── */
@media (max-width: 768px) {
  :root { --sidebar-w: 280px; }
  .sidebar { transform: translateX(-100%); }
  .sidebar.open { transform: translateX(0); }
  .sidebar-close { display: flex; }
  .sidebar-overlay.show { display: block; }
  .main { margin-left: 0; }
  .menu-toggle { display: flex; }
  .topbar { padding: 0 14px; }
  .content { padding: 28px 16px 60px; }
  .hero h1 { font-size: 24px; }
  .hero-stats { flex-wrap: wrap; gap: 16px; }
  .buku-card { flex-direction: column; }
  .buku-cover { width: 56px; height: 56px; border-radius: 8px; }
  .section-tabs { padding: 0 12px; }
  .tab { padding: 0 12px; font-size: 13px; }
  .day-header { flex-direction: column; align-items: flex-start; gap: 6px; }
}

@media (max-width: 480px) {
  .content { padding: 20px 14px 60px; }
  .page-header h1 { font-size: 22px; }
  .tools-grid { grid-template-columns: 1fr; }
}

/* Motion */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition: none !important; animation: none !important; }
}
