/* ═══════════════════════════════════════════════════════════════════
   Presentations Shell — Top bar + collapsible sidebar for the
   standalone presentations site (separate from the main FCI website).
   ═══════════════════════════════════════════════════════════════════ */

/* Shell centering — on screens wider than --pres-shell-max the entire
   layout (sidebar + content + topbar inner) floats centered with equal
   whitespace on both sides. On narrower screens offset = 0 (no change). */
:root {
  --pres-shell-max: 1440px;
  --pres-shell-offset: max(0px, calc((100vw - var(--pres-shell-max)) / 2));
}


/* ─── TOP BAR ─────────────────────────────────────────────────── */

.pres-topbar {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: var(--z-sticky);
  height: var(--nav-height);
  padding: 0;
  background: var(--color-surface);
  border-bottom: 1px solid var(--color-rule);
}

.pres-topbar__inner {
  max-width: var(--pres-shell-max);
  margin: 0 auto;
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 var(--space-6);
}

.pres-topbar__left {
  display: flex;
  align-items: center;
  gap: var(--space-4);
}

/* FCI Logo — matches site-header style */
.pres-topbar__logo {
  font-family: var(--font-heading);
  font-size: 1.4rem;
  font-weight: var(--weight-extrabold);
  letter-spacing: var(--tracking-tight);
  color: var(--color-text-1);
  text-decoration: none;
  display: flex;
  gap: 1px;
}

.pres-topbar__logo .fk-f { color: var(--color-blue); }
.pres-topbar__logo .fk-c { color: var(--color-blue-mid); }
.pres-topbar__logo .fk-i { color: var(--color-sky); }

/* Sidebar toggle button */
.pres-topbar__sidebar-toggle {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  background: transparent;
  border: 1px solid var(--color-rule);
  border-radius: var(--radius-sm);
  color: var(--color-text-2);
  cursor: pointer;
  transition: var(--transition-base);
  flex-shrink: 0;
}

.pres-topbar__sidebar-toggle:hover {
  color: var(--color-text-1);
  background: var(--color-surface-hover);
  border-color: var(--color-text-3);
}

.pres-topbar__sidebar-toggle svg {
  width: 18px;
  height: 18px;
}

.pres-topbar__right {
  display: flex;
  align-items: center;
  gap: var(--space-5);
}

/* Brochure links (next to FCI Portal) */
.pres-topbar__brochure {
  display: flex;
  align-items: center;
  gap: var(--space-4);
}

.pres-topbar__brochure-link {
  font-family: var(--font-body);
  font-size: var(--text-sm);
  font-weight: var(--weight-medium);
  color: var(--color-text-2);
  text-decoration: none;
  display: flex;
  align-items: center;
  gap: var(--space-2);
  padding: 6px 12px;
  border: 1px solid var(--color-rule);
  border-radius: var(--radius-sm);
  transition: var(--transition-base);
}

.pres-topbar__brochure-link:hover {
  color: var(--color-text-1);
  border-color: var(--color-text-3);
  background: var(--color-surface-hover);
}

.pres-topbar__brochure-link svg {
  width: 14px;
  height: 14px;
  flex-shrink: 0;
}

.pres-topbar__divider {
  width: 1px;
  height: 24px;
  background: var(--color-rule);
}

/* FCI Portal link */
.pres-topbar__portal {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  text-decoration: none;
  border: 1px solid var(--color-rule);
  border-radius: var(--radius-md);
  padding: var(--space-2) var(--space-4);
}

.pres-topbar__portal-label {
  font-size: var(--text-sm);
  font-weight: var(--weight-medium);
  color: var(--color-text-2);
  transition: var(--transition-color);
}

.pres-topbar__portal-login {
  font-size: var(--text-xs);
  font-weight: var(--weight-semibold);
  color: var(--color-blue);
  transition: var(--transition-color);
}

.pres-topbar__portal:hover .pres-topbar__portal-label {
  color: var(--color-text-1);
}

.pres-topbar__portal:hover .pres-topbar__portal-login {
  color: var(--color-blue-light);
}

/* Theme toggle */
.pres-topbar__theme-toggle {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  background: transparent;
  border: none;
  border-radius: var(--radius-sm);
  color: var(--color-text-2);
  cursor: pointer;
  font-size: var(--text-lg);
  transition: var(--transition-base);
}

.pres-topbar__theme-toggle:hover {
  color: var(--color-text-1);
  background: var(--color-surface-hover);
}


/* ─── SIDEBAR ─────────────────────────────────────────────────── */

.pres-sidebar {
  position: fixed;
  top: var(--nav-height);
  left: var(--pres-shell-offset);
  bottom: 0;
  width: 280px;
  z-index: var(--z-dropdown);
  background: var(--color-surface);
  border-right: 1px solid var(--color-rule);
  overflow-y: auto;
  padding: var(--space-6) 0;
  transition: transform 0.25s ease, opacity 0.25s ease;
}

.pres-sidebar.is-collapsed {
  transform: translateX(-100%);
  opacity: 0;
  pointer-events: none;
}

/* Sidebar heading */
.pres-sidebar__heading {
  font-family: var(--font-body);
  font-size: var(--text-xs);
  font-weight: var(--weight-bold);
  letter-spacing: var(--tracking-widest);
  text-transform: uppercase;
  color: var(--color-text-3);
  padding: 0 var(--space-6) var(--space-3);
}

/* Domain (top-level section) */
.pres-sidebar__domain {
  margin-bottom: var(--space-1);
}

.pres-sidebar__domain-btn {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  width: 100%;
  padding: var(--space-3) var(--space-6);
  background: transparent;
  border: none;
  font-family: var(--font-heading);
  font-size: 0.9375rem;
  font-weight: var(--weight-semibold);
  color: var(--color-text-1);
  letter-spacing: var(--tracking-snug);
  cursor: pointer;
  text-align: left;
  transition: var(--transition-base);
}

/* Domain icon (inline SVG) */
.pres-sidebar__icon {
  width: 20px;
  height: 20px;
  flex-shrink: 0;
  opacity: 0.7;
  transition: opacity 0.2s ease;
}

.pres-sidebar__domain-btn:hover .pres-sidebar__icon {
  opacity: 1;
}

.pres-sidebar__domain-btn:hover {
  background: var(--color-surface-hover);
}

.pres-sidebar__domain-btn.is-active {
  color: var(--color-sky);
}

.pres-sidebar__caret {
  width: 16px;
  height: 16px;
  color: var(--color-text-3);
  transition: transform 0.2s ease;
  flex-shrink: 0;
  margin-left: auto;
}

.pres-sidebar__domain-btn.is-open .pres-sidebar__caret {
  transform: rotate(90deg);
}

/* Sub-items (hidden by default) */
.pres-sidebar__items {
  display: none;
  flex-direction: column;
  padding: var(--space-1) 0;
}

.pres-sidebar__domain.is-open .pres-sidebar__items {
  display: flex;
}

/* Sub-section heading (e.g. "Incident Response" under Firm Security) */
.pres-sidebar__sub-heading {
  font-family: var(--font-body);
  font-size: var(--text-xs);
  font-weight: var(--weight-bold);
  letter-spacing: var(--tracking-wider);
  text-transform: uppercase;
  color: var(--color-text-2);
  padding: var(--space-2) var(--space-6) var(--space-1) var(--space-10);
  margin-top: var(--space-2);
}

.pres-sidebar__link {
  display: block;
  padding: var(--space-2) var(--space-6) var(--space-2) var(--space-10);
  font-family: var(--font-body);
  font-size: var(--text-sm);
  font-weight: var(--weight-regular);
  color: var(--color-text-2);
  text-decoration: none;
  transition: var(--transition-base);
  border-left: 2px solid transparent;
}

.pres-sidebar__link:hover {
  color: var(--color-text-1);
  background: var(--color-surface-hover);
}

.pres-sidebar__link.is-active {
  color: var(--color-sky);
  border-left-color: var(--color-sky);
  background: rgba(14, 165, 233, 0.06);
}

/* Nested sub-items (deeper indent, smaller font) */
.pres-sidebar__link--nested {
  padding-left: calc(var(--space-10) + var(--space-5));
  font-size: var(--text-xs);
}

/* Sub-menu inside a domain (e.g. "Modern Stack" under Firm Security) */
.pres-sidebar__submenu {
  display: flex;
  flex-direction: column;
  width: 100%;
}

.pres-sidebar__submenu-btn {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  width: 100%;
  padding: var(--space-2) var(--space-6) var(--space-2) var(--space-10);
  border: none;
  background: none;
  cursor: pointer;
  font-family: var(--font-body);
  font-size: var(--text-sm);
  font-weight: var(--weight-regular);
  line-height: inherit;
  color: var(--color-text-2);
  text-align: left;
  border-left: 2px solid transparent;
  transition: var(--transition-base);
}

.pres-sidebar__submenu-btn:hover {
  color: var(--color-text-1);
  background: var(--color-surface-hover);
}

.pres-sidebar__submenu-btn .pres-sidebar__caret {
  width: 14px;
  height: 14px;
  margin-left: auto;
}

.pres-sidebar__submenu-btn.is-open .pres-sidebar__caret {
  transform: rotate(90deg);
}

.pres-sidebar__submenu-items {
  display: none;
  flex-direction: column;
}

.pres-sidebar__submenu.is-open .pres-sidebar__submenu-items {
  display: flex;
}

/* ─── SLIDE TOC (collapsible table of contents under a presentation link) ── */

.pres-sidebar__toc-toggle {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  padding: var(--space-2) var(--space-6) var(--space-2) var(--space-10);
  background: transparent;
  border: none;
  border-left: 2px solid transparent;
  font-family: var(--font-body);
  font-size: var(--text-sm);
  font-weight: var(--weight-regular);
  line-height: inherit;
  color: var(--color-text-2);
  text-decoration: none;
  cursor: pointer;
  text-align: left;
  transition: var(--transition-base);
}

/* Nested toc-toggle (inside a submenu like Modern Stack) must match nested links exactly */
.pres-sidebar__submenu-items .pres-sidebar__toc-toggle {
  padding-left: calc(var(--space-10) + var(--space-5));
  font-size: var(--text-xs);
  line-height: var(--leading-relaxed);
}

.pres-sidebar__toc-toggle:hover {
  color: var(--color-text-1);
  background: var(--color-surface-hover);
}

.pres-sidebar__toc-toggle.is-active {
  color: var(--color-sky);
  border-left-color: var(--color-sky);
  background: rgba(14, 165, 233, 0.06);
}

.pres-sidebar__toc-caret {
  width: 12px;
  height: 12px;
  color: var(--color-text-3);
  transition: transform 0.2s ease;
  flex-shrink: 0;
}

.pres-sidebar__toc-toggle.is-open .pres-sidebar__toc-caret {
  transform: rotate(90deg);
}

.pres-sidebar__toc {
  display: none;
  flex-direction: column;
  padding: var(--space-1) 0;
}

.pres-sidebar__toc.is-open {
  display: flex;
}

.pres-sidebar__toc-item {
  display: block;
  padding: 5px var(--space-6) 5px calc(var(--space-10) + var(--space-5));
  font-family: var(--font-body);
  font-size: var(--text-xs);
  font-weight: var(--weight-regular);
  color: var(--color-text-2);
  text-decoration: none;
  transition: var(--transition-base);
  border-left: 2px solid transparent;
  cursor: pointer;
  background: transparent;
  border-right: none;
  border-top: none;
  border-bottom: none;
  text-align: left;
  width: 100%;
}

.pres-sidebar__toc-item:hover {
  color: var(--color-text-1);
  background: var(--color-surface-hover);
}

.pres-sidebar__toc-item.is-current {
  color: var(--color-sky);
  border-left-color: var(--color-sky);
}


/* ─── MAIN CONTENT AREA ──────────────────────────────────────── */

.pres-main {
  margin-top: var(--nav-height);
  margin-left: calc(var(--pres-shell-offset) + 280px);
  margin-right: var(--pres-shell-offset);
  padding-left: var(--space-8);
  min-height: calc(100vh - var(--nav-height));
  background: var(--color-bg);
  transition: margin-left 0.25s ease, margin-right 0.25s ease;
}

.pres-main.is-expanded {
  margin-left: var(--pres-shell-offset);
}


/* ─── MOBILE BACKDROP ─────────────────────────────────────────── */

/* Hidden on desktop — no layout impact */
#sidebar-backdrop {
  display: none;
}

/* On mobile: show when sidebar is open (not collapsed).
   CSS reads sidebar state directly — no JavaScript needed. */
@media (max-width: 768px) {
  .pres-sidebar:not(.is-collapsed) + #sidebar-backdrop {
    display: block;
    position: fixed;
    inset: 0;
    top: var(--nav-height);
    z-index: calc(var(--z-dropdown) - 1);
    background: rgba(0, 0, 0, 0.45);
  }
}


/* ─── RESPONSIVE ──────────────────────────────────────────────── */

@media (max-width: 768px) {
  .pres-sidebar {
    width: 260px;
    left: 0;
  }

  .pres-main {
    margin-left: 0;
    margin-right: 0;
  }

  .pres-main.is-expanded {
    margin-left: 0;
  }

  .pres-sidebar:not(.is-collapsed) {
    box-shadow: var(--shadow-lg);
  }

  .pres-topbar__brochure-link span {
    display: none;
  }

  .pres-topbar__portal-label {
    display: none;
  }
}
