/* -------------------------------------------------------------
   KOREA TRAILS — DESIGN SYSTEM STYLESHEET (Option B)
   ------------------------------------------------------------- */

/* 1. Design Tokens & CSS Variables */
:root, [data-theme="light"] {
  /* Brand Tokens */
  --font-body: 'Satoshi', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  --font-display: 'Cabinet Grotesk', 'Satoshi', -apple-system, BlinkMacSystemFont, sans-serif;

  /* Colors (Light Mode - Sleek Modern Explorer) */
  --bg: #f8fafc;
  --surface: #ffffff;
  --surface2: #f1f5f9;
  --border: #e2e8f0;
  --divider: #cbd5e1;
  
  --text: #0f172a;
  --muted: #64748b;
  --faint: #94a3b8;
  
  --primary: #0ea5e9;
  --primary-hover: #0284c7;
  --primary-highlight: #e0f2fe;
  
  --success: #10b981;
  --success-highlight: #d1fae5;
  --warning: #f97316;
  --warning-highlight: #ffedd5;
  --error: #ef4444;
  --error-highlight: #fee2e2;

  /* Spacing */
  --space-1: 0.25rem;
  --space-2: 0.5rem;
  --space-3: 0.75rem;
  --space-4: 1rem;
  --space-5: 1.25rem;
  --space-6: 1.5rem;
  --space-8: 2rem;
  --space-10: 2.5rem;
  --space-12: 3rem;
  --space-16: 4rem;

  /* Borders & Radius */
  --radius-sm: 0.375rem;
  --radius-md: 0.5rem;
  --radius-lg: 0.75rem;
  --radius-xl: 1rem;
  --radius-2xl: 1.5rem;
  --radius-full: 9999px;

  /* Shadows */
  --shadow-sm: 0 1px 2px rgba(15, 23, 42, 0.05);
  --shadow-md: 0 4px 12px rgba(15, 23, 42, 0.08);
  --shadow-lg: 0 12px 32px rgba(15, 23, 42, 0.12);

  /* Transitions */
  --transition: 200ms cubic-bezier(0.16, 1, 0.3, 1);
  --transition-slow: 350ms cubic-bezier(0.16, 1, 0.3, 1);

  /* Legacy Variable Bridge (for gradual/non-breaking playbook migration) */
  --color-bg: var(--bg);
  --color-surface: var(--surface);
  --color-surface-2: var(--surface2);
  --color-surface-offset: var(--surface2);
  --color-surface-dynamic: var(--surface2);
  --color-divider: var(--divider);
  --color-border: var(--border);
  --color-text: var(--text);
  --color-text-muted: var(--muted);
  --color-text-faint: var(--faint);
  --color-primary: var(--primary);
  --color-primary-hover: var(--primary-hover);
  --color-primary-highlight: var(--primary-highlight);
  --color-success: var(--success);
  --color-success-highlight: var(--success-highlight);
  --color-gold: #d19900;
  --color-gold-highlight: #fef3c7;
  --color-warning: var(--warning);
  --color-warning-highlight: var(--warning-highlight);
  --color-error: var(--error);
  --color-orange: var(--warning);
  
  --shadow-sm: var(--shadow-sm);
  --shadow-md: var(--shadow-md);
  --shadow-lg: var(--shadow-lg);
  --radius-sm: var(--radius-sm);
  --radius-md: var(--radius-md);
  --radius-lg: var(--radius-lg);
  --radius-xl: var(--radius-xl);
  --radius-full: var(--radius-full);
}

[data-theme="dark"] {
  /* Colors (Dark Mode) */
  --bg: #09090b;
  --surface: #18181b;
  --surface2: #27272a;
  --border: #27272a;
  --divider: #3f3f46;
  
  --text: #f4f4f5;
  --muted: #a1a1aa;
  --faint: #52525b;
  
  --primary: #38bdf8;
  --primary-hover: #0ea5e9;
  --primary-highlight: #0c4a6e;
  
  --success: #34d399;
  --success-highlight: #064e3b;
  --warning: #fb923c;
  --warning-highlight: #7c2d12;
  --error: #f87171;
  --error-highlight: #7f1d1d;

  --color-gold: #fbbf24;
  --color-gold-highlight: #78350f;

  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.4);
  --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.5);
  --shadow-lg: 0 12px 32px rgba(0, 0, 0, 0.6);
}

/* 2. Global Reset */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  scroll-behavior: smooth;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

body {
  font-family: var(--font-body);
  font-size: clamp(0.95rem, 0.9rem + 0.25vw, 1.1rem);
  color: var(--text);
  background-color: var(--bg);
  min-height: 100dvh;
  line-height: 1.6;
  transition: background-color var(--transition), color var(--transition);
}

img, svg {
  display: block;
  max-width: 100%;
}

a {
  color: var(--primary);
  text-decoration: none;
  transition: color var(--transition);
}
a:hover {
  color: var(--primary-hover);
}

button {
  cursor: pointer;
  border: none;
  background: none;
  font: inherit;
  color: inherit;
}

/* Typography Scales */
h1, h2, h3, h4, h5, h6 {
  font-family: var(--font-display);
  font-weight: 800;
  line-height: 1.2;
}

/* 3. Layout Grid & Flex Utilities */
.wrap {
  width: 100%;
  max-width: 100%;
  margin: 0 auto;
  padding: 0 var(--space-4);
}

@media (min-width: 640px) {
  .wrap {
    padding: 0 var(--space-6);
  }
}

@media (min-width: 1024px) {
  .wrap {
    max-width: clamp(1080px, 90vw, 1440px);
    padding: 0 var(--space-8);
  }
}

/* 4. Common Components */

/* Glassmorphic Cards */
.card {
  background-color: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-xl);
  padding: var(--space-6);
  box-shadow: var(--shadow-sm);
  transition: transform var(--transition), box-shadow var(--transition), background-color var(--transition), border-color var(--transition);
}

.card-hoverable {
  transition: transform var(--transition), box-shadow var(--transition), border-color var(--transition), background-color var(--transition);
}

.card-hoverable:hover {
  transform: translateY(-6px) scale(1.02);
  box-shadow: var(--shadow-lg);
  border-color: var(--primary);
}

/* Badges */
.badge {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  padding: 0.25rem 0.75rem;
  border-radius: var(--radius-full);
  font-size: var(--text-xs);
  font-weight: 700;
}

.diff-badge {
  font-weight: 700;
  font-size: 0.8rem;
  padding: 2px 10px;
  border-radius: var(--radius-full);
  display: inline-block;
}
.diff-easy { background-color: var(--success-highlight); color: var(--success); }
.diff-medium { background-color: var(--warning-highlight); color: var(--warning); }
.diff-hard { background-color: var(--error-highlight); color: var(--error); }
.diff-expert { background-color: #fee2e2; color: #b91c1c; }

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-2);
  padding: var(--space-3) var(--space-6);
  border-radius: var(--radius-full);
  font-weight: 700;
  font-size: 0.95rem;
  transition: all var(--transition);
}

.btn-primary {
  background-color: var(--primary);
  color: #ffffff;
}
.btn-primary:hover {
  background-color: var(--primary-hover);
  color: #ffffff;
  box-shadow: 0 4px 12px rgba(14, 165, 233, 0.25);
}

.btn-secondary {
  background-color: var(--surface2);
  color: var(--text);
  border: 1px solid var(--border);
}
.btn-secondary:hover {
  background-color: var(--border);
}

/* Tabs & Tab Panes (Yangmingshan & Seoraksan hybrid support) */
.tabs {
  display: flex;
  gap: var(--space-2);
  border-bottom: 1px solid var(--border);
  padding-bottom: var(--space-2);
  margin-bottom: var(--space-6);
  overflow-x: auto;
}

.tab {
  padding: var(--space-2) var(--space-4);
  font-weight: 700;
  font-size: 0.95rem;
  color: var(--muted);
  border-bottom: 2px solid transparent;
  white-space: nowrap;
}

.tab.active, .tab.active:hover {
  color: var(--primary);
  border-bottom-color: var(--primary);
}

.tab:hover {
  color: var(--text);
}

.tabpane {
  display: none;
  animation: fadeIn var(--transition);
}

.tabpane.active {
  display: block;
}

/* Accordions (Segment list in Yangmingshan) */
.accordion {
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  overflow: hidden;
  margin-bottom: var(--space-3);
  background-color: var(--surface);
}

.accordion-header {
  padding: var(--space-4) var(--space-5);
  font-weight: 800;
  background-color: var(--surface);
  display: flex;
  justify-content: space-between;
  align-items: center;
  width: 100%;
  text-align: left;
  transition: background-color var(--transition);
}

.accordion-header:hover {
  background-color: var(--surface2);
}

.accordion-content {
  display: none;
  padding: var(--space-5);
  border-top: 1px solid var(--border);
  background-color: var(--surface);
}

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

.accordion-header::after {
  content: '▼';
  font-size: 0.8rem;
  color: var(--muted);
  transition: transform var(--transition);
}

.accordion.open .accordion-header::after {
  transform: rotate(180deg);
}

/* Responsive Table Wrapper */
.table-wrap {
  width: 100%;
  overflow-x: auto;
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  margin-bottom: var(--space-6);
  background-color: var(--surface);
}

table {
  width: 100%;
  border-collapse: collapse;
  text-align: left;
  font-size: 0.95rem;
}

th, td {
  padding: var(--space-4) var(--space-5);
  border-bottom: 1px solid var(--border);
}

th {
  background-color: var(--surface2);
  font-weight: 800;
  color: var(--text);
}

tr:last-child td {
  border-bottom: none;
}

/* Stats KPIs */
.stats {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: var(--space-4);
  margin-bottom: var(--space-6);
}

.stat {
  background-color: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: var(--space-4);
  text-align: center;
}

.stat .l {
  font-size: 0.85rem;
  color: var(--muted);
  font-weight: 600;
}

.stat .v {
  font-family: var(--font-display);
  font-size: 1.6rem;
  font-weight: 800;
  color: var(--primary);
  margin-top: var(--space-1);
}

/* Leaflet dark-mode invert helper */
[data-theme="dark"] .terrain-layer-dark-filter {
  filter: invert(90%) hue-rotate(180deg) brightness(85%) contrast(90%);
}

/* 5. Header & Navigation (Unified & Responsive) */
.site-header, .header {
  position: sticky;
  top: 0;
  z-index: 100;
  background-color: rgba(248, 250, 252, 0.85); /* Light mode translucent */
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border);
  padding: var(--space-4) var(--space-8);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-4);
  transition: background-color var(--transition), border-color var(--transition);
}

[data-theme="dark"] .site-header,
[data-theme="dark"] .header {
  background-color: rgba(9, 9, 11, 0.85); /* Dark mode translucent */
}

.logo-wrap, .brand {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  text-decoration: none;
}

.logo-svg, .logo {
  width: 36px;
  height: 36px;
  border-radius: var(--radius-md);
  background: linear-gradient(135deg, var(--primary), var(--primary-hover));
  display: grid;
  place-items: center;
  box-shadow: var(--shadow-sm);
  flex-shrink: 0;
}

.logo-text, .brand h1 {
  font-family: var(--font-display);
  font-size: var(--text-lg);
  font-weight: 800;
  color: var(--text) !important;
  text-decoration: none;
  line-height: 1;
}

.header-right, .header-actions {
  display: flex;
  align-items: center;
  gap: var(--space-4);
}

.header-nav {
  display: none;
  align-items: center;
  gap: var(--space-6);
}

.header-nav-link {
  font-size: var(--text-sm);
  font-weight: 700;
  color: var(--muted);
  transition: color var(--transition);
  text-decoration: none;
}

.header-nav-link:hover, .header-nav-link.active {
  color: var(--primary);
}

@media (min-width: 1024px) {
  .header-nav {
    display: flex;
  }
}

@media (max-width: 640px) {
  .site-header, .header {
    padding: var(--space-3) var(--space-4);
  }
}

/* Skip link accessibility */
.skip-link {
  position: absolute;
  top: -40px;
  left: 0;
  background: #0f172a;
  color: #f8fafc;
  padding: var(--space-2) var(--space-4);
  z-index: 1000;
  transition: top var(--transition);
  font-weight: 700;
}

[data-theme="dark"] .skip-link {
  background: #f8fafc;
  color: #0f172a;
}

.skip-link:focus {
  top: 0;
}

/* Animations */
@keyframes fadeIn {
  from { opacity: 0; transform: translateY(4px); }
  to { opacity: 1; transform: translateY(0); }
}

@media (prefers-reduced-motion: reduce) {
  * {
    animation-delay: 0s !important;
    animation-duration: 0s !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0s !important;
    scroll-behavior: auto !important;
  }
}

/* Accessibility contrast overrides for alerts, tip boxes, and badges */
.tip-box {
  color: #0369a1 !important; /* High contrast dark blue for light mode */
}
[data-theme="dark"] .tip-box {
  color: #bae6fd !important; /* High contrast light blue for dark mode */
}
.warn-box {
  color: #c2410c !important; /* High contrast dark orange for light mode */
}
[data-theme="dark"] .warn-box {
  color: #fed7aa !important; /* High contrast light orange for dark mode */
}
.hero-bleed .hero-badge {
  color: #0369a1 !important;
}
[data-theme="dark"] .hero-bleed .hero-badge {
  color: #bae6fd !important;
}

/* Checkpoint table badges accessibility contrast overrides */
.badge-summit {
  color: #c2410c !important; /* Dark orange */
}
[data-theme="dark"] .badge-summit {
  color: #fdba74 !important; /* Light orange */
}
.badge-shelter {
  color: #0369a1 !important; /* Dark blue */
}
[data-theme="dark"] .badge-shelter {
  color: #7dd3fc !important; /* Light blue */
}
.badge-temple {
  color: #047857 !important; /* Dark green */
}
[data-theme="dark"] .badge-temple {
  color: #6ee7b7 !important; /* Light green */
}
.badge-landmark {
  color: #b45309 !important; /* Dark amber/gold */
}
[data-theme="dark"] .badge-landmark {
  color: #fcd34d !important; /* Light amber/gold */
}

/* 6. Landing Cards Grid (Unified & Responsive) */
.mountain-grid {
  display: grid;
  grid-template-columns: repeat(1, 1fr);
  gap: var(--space-6);
  margin-top: var(--space-8);
}

@media (min-width: 640px) {
  .mountain-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (min-width: 1024px) {
  .mountain-grid {
    grid-template-columns: repeat(3, 1fr);
    gap: var(--space-8);
  }
}

@media (min-width: 1280px) {
  .mountain-grid {
    grid-template-columns: repeat(4, 1fr);
  }
}

@media (min-width: 1536px) {
  .mountain-grid {
    grid-template-columns: repeat(5, 1fr);
  }
}

/* 7. Additional Rebranding Accessibility Overrides */
[data-theme="dark"] .btn-primary {
  color: #09090b !important;
}
[data-theme="dark"] .btn-primary:hover {
  color: #09090b !important;
}

/* Difficulty Badge Accessibility Overrides */
.diff-badge.diff-easy {
  color: #047857 !important;
}
[data-theme="dark"] .diff-badge.diff-easy {
  color: #6ee7b7 !important;
}
.diff-badge.diff-medium {
  color: #b45309 !important;
}
[data-theme="dark"] .diff-badge.diff-medium {
  color: #fcd34d !important;
}
.diff-badge.diff-hard {
  color: #c2410c !important;
}
[data-theme="dark"] .diff-badge.diff-hard {
  color: #fdba74 !important;
}
.diff-badge.diff-expert {
  color: #b91c1c !important;
}
[data-theme="dark"] .diff-badge.diff-expert {
  color: #fca5a5 !important;
  background-color: #7f1d1d !important;
}

/* Footer Link Accessibility */
footer a, .site-footer a {
  text-decoration: underline !important;
}

/* Playbook Split Layout for Desktop (>=1280px) */
@media (min-width: 1280px) {
  .playbook-split-container {
    display: grid;
    grid-template-columns: minmax(0, 1.6fr) minmax(0, 1.1fr);
    gap: var(--space-8);
    align-items: start;
    margin-top: var(--space-6);
  }
  
  .playbook-main-col {
    display: flex;
    flex-direction: column;
    gap: var(--space-8);
  }
  
  .playbook-sidebar-col {
    position: sticky;
    top: 90px; /* Offset to clear the sticky glassmorphic header */
    display: flex;
    flex-direction: column;
    gap: var(--space-6);
  }
  
  /* Show all panes on desktop sequentially */
  .panel .tabs,
  .course-panel .tab-bar {
    display: none !important;
  }
  
  .panel .tabpane,
  .course-panel .tab-content {
    display: block !important;
    opacity: 1 !important;
    visibility: visible !important;
    margin-bottom: 0 !important;
  }
  
  /* Reduce KPI grid columns slightly in 2-column layout to fit side-by-side */
  .grid6, .stat-grid {
    grid-template-columns: repeat(3, 1fr) !important;
    gap: var(--space-4) !important;
  }
}

/* 8. Unified Icon & Hero Component Classes (Phase B) */
.icon-svg {
  width: 1em;
  height: 1em;
  vertical-align: -0.125em;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
  display: inline-block;
}

/* Hero Badge styling */
.hero-badge {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  background-color: var(--primary-highlight);
  color: var(--primary);
  padding: 0.375rem 0.875rem;
  border-radius: var(--radius-full);
  font-size: var(--text-xs);
  font-weight: 700;
  margin-bottom: var(--space-4);
  line-height: 1;
}

.hero-badge .icon-svg {
  width: 1rem;
  height: 1rem;
}

/* Search Hero Centering Container */
.search-hero-container {
  display: flex;
  justify-content: center;
  margin-bottom: var(--space-8);
}

/* Hero Stats */
.hero-stats {
  display: flex;
  justify-content: center;
  gap: var(--space-8);
  margin-bottom: 0;
}

.hero-stat {
  margin: 0;
  text-align: center;
}

.hero-stat-value {
  font-size: var(--text-xl);
  color: #ffffff;
  font-family: var(--font-display);
  font-weight: 800;
}

.hero-stat-label {
  color: rgba(244, 244, 245, 0.7);
  font-size: var(--text-xs);
  font-weight: 700;
  text-transform: uppercase;
  margin-top: var(--space-1);
}

/* Filter Bar Styles (Unifying inline styles) */
.filter-bar-content {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-4);
  align-items: center;
  justify-content: space-between;
}

.filter-group {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-3);
}

.filter-select-wrapper {
  position: relative;
  display: inline-flex;
  align-items: center;
}

.filter-select-wrapper .filter-icon {
  position: absolute;
  left: 0.75rem;
  width: 1rem;
  height: 1rem;
  color: var(--muted);
  pointer-events: none;
  transition: color var(--transition);
}

.filter-select-wrapper .filter-select {
  padding-left: 2.25rem !important; /* Make room for the left icon */
}

.filter-select-wrapper:focus-within .filter-icon {
  color: var(--primary);
}

.filter-sort-group {
  display: flex;
  gap: var(--space-3);
  align-items: center;
}

.filter-results-count {
  font-size: var(--text-xs);
  color: var(--muted);
  font-weight: 700;
  min-width: 80px;
  text-align: right;
}

/* Hero Ambient Background Video */
.hero-bg-video {
  position: absolute;
  top: 50%;
  left: 50%;
  width: 100%;
  height: 100%;
  min-width: 100%;
  min-height: 100%;
  object-fit: cover;
  transform: translate(-50%, -50%);
  z-index: 0;
  pointer-events: none;
}

/* Language Toggle Switcher */
.lang-toggle {
  display: inline-flex;
  align-items: center;
  border: 1px solid var(--border);
  border-radius: var(--radius-full, 9999px);
  padding: 2px;
  background-color: var(--surface2, #f1f5f9);
  gap: 1px;
}

[data-theme="dark"] .lang-toggle {
  background-color: var(--surface2, #27272a);
}

.lang-btn {
  padding: 4px 10px;
  font-size: var(--text-xs, 0.75rem);
  font-weight: 700;
  color: var(--muted, #64748b);
  border: none;
  background: none;
  border-radius: var(--radius-full, 9999px);
  cursor: pointer;
  text-decoration: none;
  transition: all var(--transition, 0.2s);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  outline: none;
}

.lang-btn:focus-visible {
  box-shadow: 0 0 0 2px var(--primary);
}

.lang-btn.active {
  color: var(--primary, #0f766e);
  background-color: var(--surface, #ffffff);
  box-shadow: var(--shadow-sm, 0 1px 2px rgba(0,0,0,0.05));
}

[data-theme="dark"] .lang-btn.active {
  color: var(--primary, #2dd4bf);
  background-color: var(--surface, #18181b);
}

.lang-btn:hover:not(.active) {
  color: var(--text, #0f172a);
}

[data-theme="dark"] .lang-btn:hover:not(.active) {
  color: var(--text, #f4f4f5);
}

/* ==========================================================================
   READABILITY UPGRADE: COURSE STATS SUMMARY, METERS, TIMELINE, CARD ACCORDIONS
   ========================================================================== */

/* 1. Scannable Stats Pills */
.course-stats-summary {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-3);
  margin-bottom: var(--space-6);
}
.stat-pill {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  background-color: var(--surface);
  border: 1px solid var(--border);
  padding: var(--space-2) var(--space-4);
  border-radius: var(--radius-full);
  font-size: var(--text-sm);
  color: var(--text);
  font-weight: 500;
  box-shadow: var(--shadow-sm);
  transition: border-color var(--transition), background-color var(--transition), box-shadow var(--transition);
}
.stat-pill:hover {
  border-color: var(--primary);
  background-color: var(--surface2);
  box-shadow: var(--shadow-md);
}
.stat-pill .pill-icon {
  font-size: 1.1rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
.stat-pill .pill-label {
  color: var(--muted);
  font-weight: 500;
  font-size: var(--text-xs);
  margin-right: var(--space-1);
}
.stat-pill .pill-value {
  font-weight: 700;
}

/* 2. Difficulty Segment Meter */
.difficulty-meter {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
}
.meter-segments {
  display: flex;
  gap: 3px;
}
.meter-segments .segment {
  width: 12px;
  height: 8px;
  background-color: var(--border);
  border-radius: 2px;
  transition: background-color var(--transition);
}
.meter-segments .segment.active-easy {
  background-color: var(--success);
}
.meter-segments .segment.active-medium {
  background-color: var(--color-gold);
}
.meter-segments .segment.active-hard {
  background-color: var(--warning);
}
.meter-segments .segment.active-expert {
  background-color: var(--error);
}

/* 3. Vertical Checkpoint Stepper/Timeline */
.checkpoint-timeline {
  position: relative;
  padding-left: var(--space-8);
  margin-top: var(--space-4);
  margin-bottom: var(--space-8);
  display: flex;
  flex-direction: column;
  gap: var(--space-5);
}
.checkpoint-timeline::before {
  content: "";
  position: absolute;
  left: 12px; /* Center of the dot */
  top: 14px;
  bottom: 14px;
  width: 2px;
  background-color: var(--border);
  z-index: 1;
}
.timeline-item {
  position: relative;
  display: flex;
  flex-direction: column;
  z-index: 2;
}
.timeline-marker {
  position: absolute;
  left: -26px; /* -8 space padding + marker width alignment */
  top: 4px;
  width: 26px;
  height: 26px;
  border-radius: var(--radius-full);
  background-color: var(--surface);
  border: 2px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: var(--text-xs);
  font-weight: 700;
  color: var(--muted);
  box-shadow: var(--shadow-sm);
  transition: border-color var(--transition), color var(--transition), background-color var(--transition);
}
.timeline-item:hover .timeline-marker {
  border-color: var(--primary);
  color: var(--primary);
}
.timeline-item.start .timeline-marker,
.timeline-item.end .timeline-marker {
  border-color: var(--primary);
  background-color: var(--primary-highlight);
  color: var(--primary);
}
.timeline-item.summit .timeline-marker {
  border-color: var(--color-gold);
  background-color: var(--color-gold-highlight);
  color: var(--color-gold);
}
.timeline-content {
  flex: 1;
  background-color: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: var(--space-4) var(--space-5);
  box-shadow: var(--shadow-sm);
  transition: border-color var(--transition), box-shadow var(--transition);
}
.timeline-item:hover .timeline-content {
  border-color: var(--primary-hover);
  box-shadow: var(--shadow-md);
}
.timeline-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: var(--space-2);
  margin-bottom: var(--space-2);
}
.checkpoint-name {
  font-weight: 700;
  font-size: var(--text-base);
  color: var(--text);
}
.timeline-meta {
  display: flex;
  gap: var(--space-4);
  font-size: var(--text-xs);
  color: var(--muted);
  margin-bottom: var(--space-2);
}
.meta-item {
  display: inline-flex;
  align-items: center;
  gap: 4px;
}
.timeline-features {
  font-size: var(--text-sm);
  color: var(--muted);
  border-top: 1px dashed var(--border);
  padding-top: var(--space-2);
  margin-top: var(--space-2);
}
.feature-label {
  font-weight: 600;
  color: var(--text);
}

/* 4. Route Accordion Header Chips */
.acc-meta-chips {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-2);
  margin-top: var(--space-2);
}
.meta-chip {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  background-color: var(--surface2);
  border: 1px solid var(--border);
  padding: 2px 8px;
  border-radius: var(--radius-sm);
  font-size: var(--text-xs);
  color: var(--muted);
  font-weight: 600;
}

/* ==========================================================================
   READABILITY & UX UPGRADE: TABS & VIDEO GRIDS
   ========================================================================== */

/* 5. Styled Navigation Tabs for Mobile & Desktop */
.tab-bar, .tabs-nav {
  display: flex;
  gap: var(--space-2);
  overflow-x: auto;
  padding: var(--space-2) 0;
  margin: var(--space-4) 0 var(--space-6);
  border-bottom: 1px solid var(--border);
  scrollbar-width: none; /* Hide scrollbar for Cleanliness */
  -ms-overflow-style: none;
}
.tab-bar::-webkit-scrollbar, .tabs-nav::-webkit-scrollbar {
  display: none;
}

.tab-btn {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  border: none;
  background: var(--surface2);
  padding: var(--space-2) var(--space-4);
  border-radius: var(--radius-full);
  cursor: pointer;
  white-space: nowrap;
  color: var(--muted);
  font-weight: 700;
  font-size: var(--text-sm);
  transition: all var(--transition);
  outline: none;
}

.tab-btn:hover {
  background: var(--border);
  color: var(--text);
}

.tab-btn.active {
  background-color: var(--primary);
  color: var(--surface);
}

.beginner .tab-btn.active,
.easy .tab-btn.active,
.green .tab-btn.active,
#panel-beginner .tab-btn.active,
#course-beginner .tab-btn.active {
  background: var(--success-highlight);
  color: var(--success);
  border: 1px solid var(--success);
}

.intermediate .tab-btn.active,
.medium .tab-btn.active,
.blue .tab-btn.active,
#panel-intermediate .tab-btn.active,
#course-intermediate .tab-btn.active {
  background: var(--primary-highlight);
  color: var(--primary);
  border: 1px solid var(--primary);
}

.advanced .tab-btn.active,
.hard .tab-btn.active,
.red .tab-btn.active,
#panel-advanced .tab-btn.active,
#course-advanced .tab-btn.active {
  background: var(--warning-highlight);
  color: var(--warning);
  border: 1px solid var(--warning);
}

/* 6. YouTube Shorts Grid */
.video-section {
  padding: var(--space-10) var(--space-6);
  background: var(--surface);
  border-top: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
}
.video-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: var(--space-4);
  margin-top: var(--space-6);
}
@media(max-width:640px){
  .video-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: var(--space-3);
  }
}
.video-card {
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  overflow: hidden;
  display: flex;
  flex-direction: column;
}
.video-facade-btn {
  position: relative;
  width: 100%;
  aspect-ratio: 9/16;
  background: #000;
  border: none;
  padding: 0;
  cursor: pointer;
  overflow: hidden;
  display: block;
}
.video-thumbnail {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform var(--transition);
}
.video-facade-btn:hover .video-thumbnail {
  transform: scale(1.05);
}
.video-play-btn {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 48px;
  height: 48px;
  background: rgba(0, 0, 0, 0.7);
  border: 2px solid #ffffff;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #ffffff;
  transition: background var(--transition), transform var(--transition);
  pointer-events: none;
}
.video-facade-btn:hover .video-play-btn {
  background: rgba(220, 50, 50, 0.9);
  transform: translate(-50%, -50%) scale(1.1);
}
.video-play-icon {
  width: 0;
  height: 0;
  border-style: solid;
  border-width: 8px 0 8px 14px;
  border-color: transparent transparent transparent #ffffff;
  margin-left: 4px;
}
.video-iframe {
  width: 100%;
  aspect-ratio: 9/16;
  border: none;
}
.video-info {
  padding: var(--space-3);
  display: flex;
  flex-direction: column;
  gap: var(--space-1);
}
.video-label {
  font-size: var(--text-sm);
  font-weight: 700;
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.video-link {
  font-size: var(--text-xs);
  color: var(--primary);
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  gap: 4px;
}
.video-link:hover {
  text-decoration: underline;
}

/* --- Section Difficulty Bars --- */
.diff-bar-row, .diff-row {
  display: flex;
  align-items: center;
  gap: 12px;
  margin: 8px 0;
  width: 100%;
}
.diff-bar-label, .diff-label {
  flex: 0 0 132px;
  font-size: .9rem;
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.diff-bar-track, .diff-bar {
  flex: 1;
  height: 8px;
  border-radius: 999px;
  background: var(--color-divider, #2a2a2a);
  overflow: hidden;
}
.diff-bar-fill, .diff-fill {
  height: 100%;
  border-radius: 999px;
  background: var(--color-gold, #c9a24b); /* fallback */
}
.diff-bar-pct, .diff-pct {
  flex: 0 0 44px;
  text-align: right;
  font-variant-numeric: tabular-nums;
  color: var(--muted);
}
@media(max-width:560px){
  .diff-bar-label, .diff-label {
    flex-basis: 96px;
  }
}

/* Color Mapping (Green / Gold / Orange) based on parent contexts */
.beginner .diff-bar-fill,
.beginner .diff-fill,
.diff-easy .diff-bar-fill,
.diff-easy .diff-fill,
[id*="beginner"] .diff-bar-fill,
[id*="beginner"] .diff-fill {
  background: var(--success) !important;
}

.intermediate .diff-bar-fill,
.intermediate .diff-fill,
.inter .diff-bar-fill,
.inter .diff-fill,
.medium .diff-bar-fill,
.medium .diff-fill,
[id*="intermediate"] .diff-bar-fill,
[id*="intermediate"] .diff-fill {
  background: var(--color-gold) !important;
}

.advanced .diff-bar-fill,
.advanced .diff-fill,
.adv .diff-bar-fill,
.adv .diff-fill,
.hard .diff-bar-fill,
.hard .diff-fill,
[id*="advanced"] .diff-bar-fill,
[id*="advanced"] .diff-fill {
  background: var(--warning) !important;
}

/* --- Hamburger Menu Button --- */
.menu-toggle-btn {
  background: none;
  border: 1px solid var(--border);
  padding: 8px;
  border-radius: var(--radius-md);
  color: var(--text);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background-color var(--transition), border-color var(--transition);
}
.menu-toggle-btn:hover {
  background-color: var(--surface2);
  border-color: var(--primary);
}

/* --- Navigation Drawer --- */
.nav-drawer {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  z-index: 2000;
  visibility: hidden;
  transition: visibility var(--transition-slow);
}
.nav-drawer[aria-hidden="false"] {
  visibility: visible;
}
.nav-drawer-overlay {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.4);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  opacity: 0;
  transition: opacity var(--transition-slow);
}
.nav-drawer[aria-hidden="false"] .nav-drawer-overlay {
  opacity: 1;
}
.nav-drawer-content {
  position: absolute;
  top: 0;
  right: 0;
  width: 320px;
  max-width: 100%;
  height: 100%;
  background-color: var(--surface);
  border-left: 1px solid var(--border);
  box-shadow: var(--shadow-lg);
  display: flex;
  flex-direction: column;
  transform: translateX(100%);
  transition: transform var(--transition-slow);
  padding: var(--space-6);
  z-index: 2001;
}
.nav-drawer[aria-hidden="false"] .nav-drawer-content {
  transform: translateX(0);
}
.nav-drawer-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: var(--space-8);
}
.nav-drawer-logo {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  text-decoration: none;
}
.nav-drawer-logo-text {
  font-family: var(--font-display);
  font-size: var(--text-lg);
  font-weight: 800;
  color: var(--text);
}
.nav-drawer-close-btn {
  background: none;
  border: 1px solid var(--border);
  padding: 6px;
  border-radius: var(--radius-md);
  color: var(--text);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background-color var(--transition), border-color var(--transition);
}
.nav-drawer-close-btn:hover {
  background-color: var(--surface2);
  border-color: var(--error);
  color: var(--error);
}
.nav-drawer-menu {
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
}
.nav-drawer-link {
  display: flex;
  align-items: center;
  gap: var(--space-4);
  padding: var(--space-3) var(--space-4);
  border-radius: var(--radius-lg);
  font-size: var(--text-sm);
  font-weight: 700;
  color: var(--text);
  text-decoration: none;
  transition: background-color var(--transition), color var(--transition);
}
.nav-drawer-link:hover {
  background-color: var(--surface2);
  color: var(--primary);
}
.nav-drawer-link .icon-svg,
.nav-drawer-link svg {
  width: 18px;
  height: 18px;
  flex-shrink: 0;
}
.nav-drawer-divider {
  height: 1px;
  background-color: var(--border);
  margin: var(--space-6) 0;
}
.nav-drawer-footer {
  margin-top: auto;
}
.nav-drawer-section-title {
  font-size: var(--text-xs);
  color: var(--muted);
  text-transform: uppercase;
  font-weight: 800;
  margin-bottom: var(--space-4);
}
.nav-drawer-settings {
  display: flex;
  flex-direction: column;
  gap: var(--space-4);
}
.drawer-theme-toggle {
  display: flex;
  align-items: center;
  gap: var(--space-4);
  background: none;
  border: 1px solid var(--border);
  padding: var(--space-3) var(--space-4);
  border-radius: var(--radius-lg);
  color: var(--text);
  font-size: var(--text-sm);
  font-weight: 700;
  cursor: pointer;
  width: 100%;
  text-align: left;
  transition: background-color var(--transition);
}
.drawer-theme-toggle:hover {
  background-color: var(--surface2);
}
.drawer-theme-toggle svg {
  flex-shrink: 0;
}
.drawer-lang-toggle {
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
}
.lang-label {
  font-size: var(--text-xs);
  color: var(--muted);
  font-weight: 700;
}

/* -------------------------------------------------------------
   PEAK GRID & PEAK CARD (Key Points Horizontal Layout) [B]
   ------------------------------------------------------------- */
.peak-grid {
  display: flex;
  flex-direction: column;
  gap: var(--space-3, 12px);
  margin: var(--space-4, 16px) 0;
}

.peak-card {
  display: flex;
  align-items: center;
  gap: var(--space-4, 16px);
  padding: var(--space-3, 12px) var(--space-4, 16px);
  background-color: var(--surface2);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
  transition: transform var(--transition), box-shadow var(--transition);
}

.peak-card:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
  border-color: var(--primary);
}

.peak-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.25rem;
  width: 28px;
  height: 28px;
  background-color: var(--bg);
  border-radius: var(--radius-full);
  flex-shrink: 0;
}

.peak-icon svg {
  width: 16px;
  height: 16px;
  fill: currentColor;
}

.peak-elev {
  font-size: var(--text-xs);
  font-weight: 700;
  padding: 2px 8px;
  background-color: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-full);
  font-variant-numeric: tabular-nums;
  flex-shrink: 0;
  text-align: center;
  min-width: 60px;
}

.peak-name {
  font-size: var(--text-sm);
  font-weight: 800;
  color: var(--text);
  flex-shrink: 0;
  min-width: 100px;
}

.peak-desc {
  font-size: var(--text-sm);
  color: var(--muted);
  line-height: 1.5;
  margin: 0;
  flex-grow: 1;
}

/* Lightbox Map Container Styling [D] */
.lightbox-map-wrap {
  width: 100%;
  max-width: 480px;
  height: 220px;
  margin: var(--space-4) auto 0;
  border-radius: var(--radius-lg);
  border: 1px solid var(--border);
  overflow: hidden;
  box-shadow: var(--shadow-md);
  display: none;
}

.lightbox-map {
  width: 100%;
  height: 100%;
}

.lightbox-geo-btn {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  margin-top: var(--space-4);
  padding: var(--space-2) var(--space-4);
  background-color: var(--primary);
  color: #ffffff;
  border: none;
  border-radius: var(--radius-full);
  font-size: var(--text-xs);
  font-weight: 700;
  cursor: pointer;
  transition: background-color var(--transition);
}

.lightbox-geo-btn:hover {
  background-color: var(--primary-hover);
}

@media (max-width: 640px) {
  .peak-card {
    flex-wrap: wrap;
    gap: var(--space-2) var(--space-3);
  }
  .peak-desc {
    flex-basis: 100%;
    margin-top: var(--space-2);
    border-top: 1px dashed var(--border);
    padding-top: var(--space-2);
  }
  .peak-name {
    min-width: auto;
  }
}




