/* Layout — aligné sur Layout.tsx + Sidebar.tsx (Tailwind) */

.therion-sidebar-overlay {
  display: none;
  position: fixed;
  top: 4rem;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgb(0 0 0 / 0.5);
  z-index: 20;
}

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

@media (min-width: 768px) {
  .therion-sidebar-overlay {
    display: none !important;
  }
}

.therion-layout {
  min-height: calc(100vh - 4rem);
}

.therion-layout__main {
  min-width: 0;
  padding-bottom: max(5.5rem, calc(3rem + env(safe-area-inset-bottom, 0px)));
}

/* Mon espace : fond Tailwind gray-50 (#f9fafb) comme Layout React — enfant direct (pas :has(), plus fiable) */
.therion-layout__main > main.companion-main,
.therion-layout__main > main#companion-root {
  background-color: #f9fafb;
  min-height: calc(100vh - 4rem);
}

@media (min-width: 768px) {
  .therion-layout__main {
    margin-left: 14rem;
    padding-bottom: 0;
    padding-left: 0.5rem; /* avoid any overlap with sidebar visuals */
  }
}

/* Sidebar */
.therion-sidebar {
  position: fixed;
  top: 4rem;
  left: 0;
  z-index: 30;
  width: min(20rem, 80vw);
  height: calc(100vh - 4rem);
  display: flex;
  flex-direction: column;
  background: var(--primary-800);
  color: var(--primary-50);
  box-shadow: 0 20px 25px -5px rgb(0 0 0 / 0.15);
  transform: translateX(-100%);
  transition: transform 0.3s ease-in-out;
}

@media (min-width: 768px) {
  .therion-sidebar {
    background: #f9fafb;
    color: #111827;
    box-shadow: none;
  }
}

@media (min-width: 768px) {
  .therion-sidebar {
    width: 14rem;
    transform: translateX(0);
  }
}

.therion-sidebar.is-open {
  transform: translateX(0);
}

.therion-sidebar__logo-wrap {
  display: none;
  flex-direction: column;
  align-items: center;
  padding: 1.5rem 1rem;
  flex-shrink: 0;
}

@media (min-width: 768px) {
  .therion-sidebar__logo-wrap {
    display: flex;
  }
}

.therion-sidebar__logo-ring {
  width: min(220px, 40vw);
  height: min(220px, 40vw);
  border-radius: 50%;
  background: linear-gradient(135deg, #f8f8f8 0%, #eaeaea 100%);
  box-shadow: 0 10px 15px -3px rgb(0 0 0 / 0.1);
  display: flex;
  align-items: center;
  justify-content: center;
}

.therion-sidebar__logo-img {
  width: min(200px, 36vw);
  height: min(200px, 36vw);
  object-fit: cover;
  border-radius: 50%;
  background: transparent;
}

.therion-sidebar__tagline {
  margin: 1rem 0 0;
  font-size: 0.875rem;
  font-style: italic;
  color: #4b5563;
  text-align: center;
  padding: 0 1rem;
}

.therion-sidebar__nav {
  flex: 1;
  overflow-y: auto;
  overscroll-behavior: contain;
  -webkit-overflow-scrolling: touch;
  padding-bottom: 1rem;
  min-height: 0;
}

.therion-sidebar__stack {
  padding: 1rem 0.75rem 0;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

@media (min-width: 640px) {
  .therion-sidebar__stack {
    padding-left: 0.75rem;
    padding-right: 0.75rem;
  }
}

.therion-sidebar__block {
  border-radius: 0.75rem;
  padding: 0.4rem;
}

.therion-sidebar__block--dark {
  background: var(--primary-800);
  color: var(--primary-50);
}

@media (min-width: 768px) {
  .therion-sidebar__block--dark {
    background: var(--primary-800);
    color: var(--primary-50);
  }
}

.therion-sidebar__block--gray {
  background: #e5e7eb;
  color: #111827;
}

.therion-sidebar__link {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.65rem 0.8rem;
  font-size: 0.875rem;
  font-weight: 600;
  border-radius: 0.5rem;
  text-decoration: none;
  color: inherit;
  transition: background 0.15s;
}

.therion-sidebar__link--home {
  color: var(--primary-50);
}

.therion-sidebar__link--home:hover {
  background: var(--primary-700);
}

.therion-sidebar__link--home.is-active {
  background: var(--primary-700);
  color: var(--primary-50);
}

.therion-sidebar__accordion-btn {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.65rem 0.8rem;
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--primary-50);
  background: transparent;
  border: none;
  border-radius: 0.5rem;
  cursor: pointer;
  font-family: inherit;
  transition: background 0.15s;
}

.therion-sidebar__accordion-btn:hover {
  background: var(--primary-700);
}

.therion-sidebar__accordion-btn--gray {
  color: #111827;
}

.therion-sidebar__accordion-btn--gray:hover {
  background: #d1d5db;
}

.therion-sidebar__chev--open {
  display: none;
}

.therion-sidebar__accordion.is-open .therion-sidebar__chev--open {
  display: inline-flex;
}

.therion-sidebar__accordion.is-open .therion-sidebar__chev--closed {
  display: none;
}

.therion-sidebar__accordion:not(.is-open) .therion-sidebar__panel {
  display: none;
}

.therion-sidebar__list {
  list-style: none;
  margin: 0.25rem 0 0;
  padding: 0;
}

.therion-sidebar__list > li {
  margin: 0;
}

.therion-sidebar__sublink {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.55rem 0.4rem;
  font-size: 0.875rem;
  font-weight: 500;
  border-radius: 0.5rem;
  text-decoration: none;
  color: var(--primary-100);
  transition: background 0.15s, color 0.15s;
}

.therion-sidebar__sublink:hover {
  background: var(--primary-700);
  color: var(--primary-50);
}

.therion-sidebar__sublink.is-active {
  background: var(--primary-700);
  color: var(--primary-50);
}

.therion-sidebar__sublink--gray {
  color: #374151;
}

.therion-sidebar__sublink--gray:hover {
  background: #d1d5db;
  color: #111827;
}

.therion-sidebar__sublink--gray.is-active {
  background: var(--primary-600);
  color: #fff;
}

.therion-sidebar__cat {
  margin-top: 0.5rem;
}

.therion-sidebar__cat-label {
  padding: 0.25rem 0.8rem;
  margin-left: 0.5rem;
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--primary-200);
}

.therion-sidebar__svgimg {
  flex-shrink: 0;
  filter: invert(1);
  opacity: 0.9;
}

.therion-sidebar__sublink--gray .therion-sidebar__svgimg {
  filter: none;
  opacity: 1;
}

.therion-lucide {
  flex-shrink: 0;
}

/* Mobile bottom nav */
.therion-mobnav {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  z-index: 30;
  display: flex;
  background: var(--primary-700);
  border-top: 1px solid var(--primary-600);
}

@media (min-width: 1024px) {
  .therion-mobnav {
    display: none;
  }
}

.therion-mobnav__inner {
  display: flex;
  align-items: center;
  justify-content: space-around;
  width: 100%;
  min-height: 3.5rem;
  padding: 0 0.5rem;
}

.therion-mobnav__item {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-width: 0;
  height: 100%;
  padding: 0.25rem;
  color: var(--primary-200);
  text-decoration: none;
  transition: color 0.15s;
  background: none;
  border: none;
  cursor: pointer;
  font: inherit;
}

.therion-mobnav__item:hover {
  color: var(--primary-50);
}

.therion-mobnav__item.is-active {
  color: var(--primary-50);
}

.therion-mobnav__img {
  flex-shrink: 0;
  filter: invert(1);
  opacity: 0.9;
}

.therion-mobnav__item.is-active .therion-mobnav__img {
  opacity: 1;
}

.therion-mobnav__lucide {
  flex-shrink: 0;
}

.therion-mobnav__item.is-active .therion-mobnav__lucide {
  stroke-width: 2.5;
}

/* Footer room for bottom nav */
.therion-footer--with-mobnav {
  padding-bottom: max(6rem, calc(4rem + env(safe-area-inset-bottom, 0px)));
}

@media (min-width: 1024px) {
  .therion-footer--with-mobnav {
    padding-bottom: 2.5rem;
  }
}
