/* Unified shell — sidebar + layout for all pages (except landing) */

/* Hide site header/footer when shell is active */
.has-shell .site-header,
.has-shell .site-footer,
.has-shell > header,
.has-shell > footer { display: none; }

/* Shell layout — full viewport */
.app-shell { display: flex; min-height: 100vh; }
.app-sidebar {
  width: 240px; flex-shrink: 0; padding: var(--space-16) var(--space-12);
  border-right: 1px solid var(--line); background: transparent;
  font-family: var(--font-sans);
  transition: width 0.2s ease;
  position: sticky; top: 0; height: 100vh; overflow-y: auto;
  display: flex; flex-direction: column;
}
.app-sidebar.collapsed { width: 56px; }
.app-content { flex: 1; min-width: 0; padding: var(--space-32) var(--space-48); overflow-y: auto; }

@media (max-width: 768px) {
  .app-shell { flex-direction: column; }
  .app-sidebar { width: 100% !important; height: auto; position: static; border-right: none; border-bottom: 1px solid var(--line); padding: var(--space-12) var(--space-16); flex-direction: row; flex-wrap: wrap; align-items: center; overflow-y: visible; }
  .app-content { padding: var(--space-24) var(--space-16); }
  .sidebar-toggle { display: none !important; }
  .has-shell .site-header,
  .has-shell .site-footer,
  .has-shell > header,
  .has-shell > footer { display: block; }
  .app-shell { min-height: auto; }
}

/* Sidebar header with logo */
.sidebar-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: var(--space-24); padding: var(--space-4) var(--space-8); }
.sidebar-brand {
  font-size: 16px; font-weight: 800; font-family: "Castoro Titling", var(--font-serif);
  color: var(--text); white-space: nowrap; overflow: hidden; text-decoration: none;
  letter-spacing: 0.02em;
}
.sidebar-brand:hover { opacity: 0.7; text-decoration: none; }
.collapsed .sidebar-brand { display: none; }
.collapsed .sidebar-header { justify-content: center; margin-bottom: var(--space-16); }
.sidebar-toggle {
  width: 28px; height: 28px; border: none; background: transparent; cursor: pointer;
  color: var(--text-muted); display: flex; align-items: center; justify-content: center;
  border-radius: var(--radius-sm); flex-shrink: 0;
  transition: background var(--dur-fast), color var(--dur-fast);
}
.sidebar-toggle:hover { background: var(--surface-muted); color: var(--text); }
.sidebar-toggle svg { width: 18px; height: 18px; }

/* Sidebar CTA button */
.sidebar-cta {
  display: flex; align-items: center; gap: 10px; padding: 10px 12px; margin: var(--space-16) 0;
  background: var(--accent); color: #fff; border-radius: var(--radius-sm);
  font-size: 14px; font-weight: 600; font-family: var(--font-sans);
  text-decoration: none; white-space: nowrap; overflow: hidden;
  transition: background 0.16s;
}
.sidebar-cta:hover { background: #2a2a2a; text-decoration: none; }
.sidebar-cta-icon { width: 20px; height: 20px; min-width: 20px; flex-shrink: 0; display: inline-flex; align-items: center; justify-content: center; }
.sidebar-cta-icon svg { width: 18px; height: 18px; }
.collapsed .sidebar-cta .nav-label { display: none; }
.collapsed .sidebar-cta { justify-content: center; padding: 10px; }

/* Sidebar bottom area */
.sidebar-bottom { margin-top: auto; padding-top: var(--space-16); border-top: 1px solid var(--line); }

/* Sidebar nav */
.sidebar-label {
  font-size: 11px; font-weight: 600; color: var(--text-muted); letter-spacing: 0.06em;
  margin-bottom: var(--space-4); padding: 0 var(--space-8);
  font-family: var(--font-sans); white-space: nowrap; overflow: hidden;
}
.collapsed .sidebar-label { font-size: 0; }
.sidebar-nav { display: flex; flex-direction: column; gap: 2px; margin-bottom: var(--space-16); }
.sidebar-nav a {
  display: flex; align-items: center; gap: 10px; padding: 8px 10px; font-size: 14px;
  border-radius: var(--radius-sm); color: var(--text-muted); text-decoration: none;
  transition: background var(--dur-fast), color var(--dur-fast);
  font-family: var(--font-sans); white-space: nowrap; overflow: hidden;
}
.sidebar-nav a:hover { background: var(--surface-muted); color: var(--text); text-decoration: none; }
.sidebar-nav a.active { background: var(--accent-soft); color: var(--text); font-weight: 600; }
.sidebar-nav a .nav-icon { width: 20px; height: 20px; min-width: 20px; min-height: 20px; flex-shrink: 0; display: inline-flex; align-items: center; justify-content: center; overflow: hidden; }
.sidebar-nav a .nav-icon svg, .sidebar-nav a .nav-icon > svg { width: 18px !important; height: 18px !important; display: block; }
.sidebar-nav a .nav-label { overflow: hidden; text-overflow: ellipsis; }
.collapsed .sidebar-nav a .nav-label { display: none; }
.collapsed .sidebar-nav a { justify-content: center; padding: 8px; }

.sidebar-secondary { display: flex; flex-direction: column; gap: 2px; }
.sidebar-secondary a {
  display: flex; align-items: center; gap: 10px; font-size: 13px; color: var(--text-muted);
  text-decoration: none; padding: 6px 10px; border-radius: var(--radius-sm);
  font-family: var(--font-sans); white-space: nowrap; overflow: hidden;
  transition: background var(--dur-fast), color var(--dur-fast);
}
.sidebar-secondary a:hover { background: var(--surface-muted); color: var(--text); text-decoration: none; }
.sidebar-secondary a .nav-icon { width: 20px; height: 20px; min-width: 20px; min-height: 20px; flex-shrink: 0; display: inline-flex; align-items: center; justify-content: center; overflow: hidden; }
.sidebar-secondary a .nav-icon svg, .sidebar-secondary a .nav-icon > svg { width: 16px !important; height: 16px !important; display: block; }
.sidebar-secondary a .nav-label { overflow: hidden; text-overflow: ellipsis; }
.collapsed .sidebar-secondary a .nav-label { display: none; }
.collapsed .sidebar-secondary a { justify-content: center; padding: 8px; }

.sidebar-helper { font-size: 12px; color: var(--text-muted); line-height: 1.6; padding: 0 var(--space-8); margin-top: var(--space-16); font-family: var(--font-sans); }
.collapsed .sidebar-helper { display: none; }

@media (max-width: 768px) {
  .sidebar-nav { flex-direction: row; flex-wrap: wrap; gap: var(--space-8); }
  .sidebar-nav a .nav-icon { display: none; }
  .sidebar-secondary { flex-direction: row; flex-wrap: wrap; }
  .sidebar-secondary a .nav-icon { display: none; }
  .sidebar-helper { display: none; }
  .sidebar-header { display: none; }
  .sidebar-bottom { margin-top: 0; padding-top: 0; border-top: none; }
  .sidebar-cta { margin: var(--space-8) 0; padding: 8px 14px; font-size: 13px; }
  .sidebar-cta-icon { display: none; }
}
