/**
 * Site shell — decor visibility + unified light sidebar (intro + learn).
 */

.skip-link {
  position: absolute;
  left: -9999px;
  top: 0.5rem;
  z-index: 10000;
  padding: 0.6rem 1rem;
  background: var(--text);
  color: #fff;
  font-weight: 700;
  border-radius: var(--radius-sm);
  text-decoration: none;
}

.skip-link:focus {
  left: 0.5rem;
}

body.mode-intro .site-global-footer {
  display: none;
}

.site-global-footer {
  text-align: center;
  padding: 1.25rem 1rem 2rem;
  border-top: 1px solid var(--border);
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 0.35rem 1rem;
}

.site-global-footer-mail,
.site-global-footer-link {
  font-size: 0.82rem;
  color: var(--muted);
  text-decoration: none;
}

.site-global-footer-mail:hover,
.site-global-footer-link:hover {
  color: var(--accent);
}

/* —— Ambient decor: hidden on intro (clean personal page) —— */
.geek-decor {
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.2s ease, visibility 0.2s ease;
}

body.mode-learn-lms .geek-decor {
  display: none;
}

/* —— Light sidebar (intro + course) —— */
body.mode-intro .global-sidebar,
body.mode-learn-lms .global-sidebar {
  background: var(--shell-sidebar-bg);
  border-right: 1px solid var(--shell-sidebar-border);
  box-shadow: none;
}

body.mode-intro .global-sidebar::before {
  background: linear-gradient(180deg, var(--accent), transparent 70%);
}

body.mode-learn-lms .global-sidebar::before {
  background: linear-gradient(180deg, var(--learn-accent), transparent 70%);
}

body.mode-intro .icon-rail-brand {
  background: var(--intro-blue, var(--accent));
  color: #fff;
  box-shadow: none;
}

body.mode-intro .icon-rail-brand::after {
  display: none;
}

body.mode-intro .icon-rail-brand.icon-rail-brand--home {
  width: auto;
  min-width: 3.25rem;
  height: auto;
  min-height: 2.5rem;
  padding: 0.45rem 0.5rem;
  font-family: var(--font);
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.02em;
  border-radius: 8px;
}

body.mode-learn-lms .icon-rail-brand {
  background: linear-gradient(145deg, var(--learn-accent), var(--learn-accent-dark));
  color: #fff;
}

body.mode-intro .icon-rail-item,
body.mode-learn-lms .icon-rail-item {
  color: var(--muted);
}

body.mode-intro .icon-rail-item:hover,
body.mode-learn-lms .icon-rail-item:hover {
  background: var(--surface2);
  color: var(--text);
}

body.mode-intro .icon-rail-item.active {
  color: var(--accent-hover);
  background: var(--accent-soft);
  border-color: rgba(8, 145, 178, 0.25);
  box-shadow: inset 3px 0 0 var(--accent);
}

body.mode-learn-lms .icon-rail-item.active {
  color: var(--learn-accent-dark);
  background: var(--learn-accent-soft);
  border-color: rgba(232, 93, 106, 0.25);
  box-shadow: inset 3px 0 0 var(--learn-accent);
}

body.mode-intro .sidebar-progress-wrap,
body.mode-learn-lms .sidebar-progress-wrap {
  border-top-color: var(--shell-sidebar-border);
}

body.mode-intro .sidebar-progress-wrap .progress-bar,
body.mode-learn-lms .sidebar-progress-wrap .progress-bar {
  background: var(--surface2);
}

body.mode-intro .sidebar-progress-label,
body.mode-learn-lms .sidebar-progress-label {
  color: var(--muted);
}

body.mode-learn-lms .sidebar-progress-wrap .progress-fill {
  background: linear-gradient(90deg, var(--learn-accent-dark), var(--learn-accent));
}

/* —— Light sidebar on meta doc pages (study guide, how-to, etc.) —— */
body.mode-meta-doc .global-sidebar {
  background: var(--shell-sidebar-bg);
  border-right: 1px solid var(--shell-sidebar-border);
  box-shadow: none;
}

body.mode-meta-doc .global-sidebar::before {
  background: linear-gradient(180deg, var(--accent), transparent 70%);
}

body.mode-meta-doc .icon-rail-brand {
  background: linear-gradient(145deg, var(--glow), var(--accent));
  color: #0f172a;
}

body.mode-meta-doc .icon-rail-item {
  color: var(--muted);
}

body.mode-meta-doc .icon-rail-item:hover {
  background: var(--surface2);
  color: var(--text);
}

body.mode-meta-doc .icon-rail-item.active {
  color: var(--accent-hover);
  background: var(--accent-soft);
  border-color: rgba(8, 145, 178, 0.25);
  box-shadow: inset 3px 0 0 var(--accent);
}

body.mode-meta-doc .sidebar-progress-wrap {
  border-top-color: var(--shell-sidebar-border);
}

/* —— Sidebar start CTA —— */
.sidebar-start-wrap {
  width: 100%;
  padding: 0 0.35rem 0.5rem;
  position: relative;
  z-index: 1;
}

.sidebar-start-lesson {
  width: 100%;
  padding: 0.55rem 0.5rem;
  border: none;
  border-radius: 10px;
  background: var(--learn-accent, var(--accent));
  color: #fff;
  font-family: var(--font);
  font-size: 0.9rem;
  font-weight: 700;
  line-height: 1.35;
  cursor: pointer;
}

.sidebar-start-lesson:hover {
  filter: brightness(1.05);
}

/* —— Mobile bottom tab bar —— */
.mobile-tab-bar {
  display: none;
}

@media (max-width: 768px) {
  .mobile-tab-bar {
    display: flex;
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 50;
    background: var(--surface);
    border-top: 1px solid var(--border);
    box-shadow: 0 -4px 20px rgba(15, 23, 42, 0.08);
    padding: 0.25rem 0.35rem calc(0.35rem + env(safe-area-inset-bottom, 0));
  }

  .mobile-tab {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.15rem;
    padding: 0.55rem 0.25rem;
    min-height: 3rem;
    border: none;
    background: transparent;
    color: var(--muted);
    font-family: var(--font);
    font-size: 0.84rem;
    font-weight: 600;
    line-height: 1.35;
    cursor: pointer;
    touch-action: manipulation;
    -webkit-tap-highlight-color: transparent;
  }

  .mobile-tab span:first-child {
    font-size: 1.15rem;
  }

  .mobile-tab.active {
    color: var(--accent-hover);
  }

  .mobile-tab--start {
    color: var(--learn-accent-dark, var(--accent-hover));
    font-weight: 700;
  }

  .global-sidebar {
    display: none;
  }

  .app-layout {
    padding-bottom: 4.25rem;
  }

  body.mode-learn-reading .mobile-tab-bar {
    display: none;
  }

  body.mode-learn-reading .app-layout {
    padding-bottom: 0;
  }

  .back-to-top {
    bottom: calc(4.5rem + env(safe-area-inset-bottom, 0));
  }

  .intro-site-link,
  .intro-site-cta,
  .intro-course-cta,
  .btn-primary,
  .intro-hero-cta-primary,
  .intro-hero-cta-secondary,
  .intro-daily-slot .btn.secondary {
    min-height: 44px;
    touch-action: manipulation;
    -webkit-tap-highlight-color: transparent;
  }
}

/* —— Loading skeleton —— */
.page-skeleton {
  padding: 1rem 0.5rem;
}

.page-skeleton-eyebrow {
  color: var(--muted);
  font-size: 0.95rem;
  margin: 0 0 0.75rem;
}

.page-skeleton-bar {
  height: 0.85rem;
  border-radius: 6px;
  background: linear-gradient(90deg, var(--surface2), var(--bg-subtle), var(--surface2));
  background-size: 200% 100%;
  animation: skeleton-shimmer 1.2s ease-in-out infinite;
  margin-bottom: 0.5rem;
}

.page-skeleton-bar--short {
  width: 55%;
}

@keyframes skeleton-shimmer {
  0% { background-position: 100% 0; }
  100% { background-position: -100% 0; }
}

.intro-hero-plain {
  margin: 0.5rem 0 0;
  font-size: 1rem;
  line-height: 1.5;
  color: var(--text-soft);
  max-width: 36rem;
}

/* —— Back to top —— */
.back-to-top {
  position: fixed;
  right: 1rem;
  bottom: calc(1rem + env(safe-area-inset-bottom, 0));
  z-index: 45;
  padding: 0.55rem 0.85rem;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--surface);
  color: var(--accent-hover);
  font-family: var(--font);
  font-size: 0.8125rem;
  font-weight: 700;
  line-height: 1;
  cursor: pointer;
  box-shadow: var(--shadow-md);
  transition: opacity 0.2s ease, transform 0.2s ease, border-color 0.15s ease;
}

.back-to-top:hover {
  border-color: var(--accent);
  transform: translateY(-2px);
}

.back-to-top[hidden] {
  display: none;
}

@media (max-width: 768px) {
  .back-to-top {
    right: 0.75rem;
    bottom: calc(4.75rem + env(safe-area-inset-bottom, 0));
  }
}

