/* ===== SIDEBAR LOGOS ===== */
.sidebar-logos {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 1.5rem;
}

.sidebar-logos a {
  display: block;
}

.sidebar-logos svg {
  display: block;
  width: 100%;
  height: 50px;
}

.sidebar-logos a:first-child svg {
  height: 52px;
}

[data-theme="dark"] .sidebar-logos svg path {
  fill: var(--white);
}

/* ===== SIDEBAR LAYOUT ===== */
.sidebar {
  position: relative;
  z-index: 5;
  display: flex;
  flex-direction: column;
  gap: calc(var(--padding) / 2);
  position: sticky;
  top: var(--padding);
  /* max-height: calc(100vh - var(--padding) * 2); */
  overflow-y: auto;
  font-family: var(--font-heading);
}

.sidebar-nav {
  display: flex;
  flex-direction: column;
  background: linear-gradient(
    to bottom,
    var(--background),
    color-mix(in srgb, var(--accent-base) 20%, var(--background))
  );
  padding: 0.5rem;
  border-radius: var(--border-radius);
}

.sidebar-btn {
  display: flex;
  justify-content: center;
  align-items: center;
  padding: 0.5rem 0;
  font-size: var(--h4-size);
  text-transform: uppercase;
  border: solid var(--border-size) var(--border);
  border-radius: var(--border-radius);
  margin-top: 0.5rem;
  line-height: 1;
}

.sidebar-btn:first-of-type {
  margin-top: 0;
}

.sidebar-btn[aria-current],
.sidebar-btn.active {
  color: var(--sidebar-accent-text);
  background-color: var(--sidebar-accent);
  border-color: var(--sidebar-accent);
}

[data-theme="dark"] .sidebar-btn:hover {
  color: var(--accent-text);
}

/* ===== SIDEBAR DIVIDER ===== */
.sidebar-divider-wrapper {
  display: flex;
  justify-content: center;
}

.sidebar-divider {
  --divider-width: 40%;
  --divider-height: 0.6rem;
  width: var(--divider-width);
  height: var(--divider-height);
  display: flex;
  align-items: stretch;
  justify-content: center;
  color: var(--sidebar-accent);
}

.sidebar-divider-notch {
  height: 100%;
  width: auto;
  display: block;
  flex-shrink: 0;
}

.sidebar-divider-bar {
  flex: 1;
  background-color: currentColor;
}

/* ===== SIDEBAR META SECTIONS ===== */

.meta-head {
  background-color: var(--sidebar-accent);
  border-radius: var(--border-radius) var(--border-radius) 0 0;
  padding: 1rem;
  color: var(--sidebar-accent-text);
}

.sidebar-title {
  font: normal var(--h2-size) var(--font-heading);
  line-height: 1.1;
  margin: 0;
  text-transform: none;
}

.meta-head h3 {
  margin-top: 0.5rem;
}

.person-sidebar .meta-head {
  padding: 0;
  border: solid var(--border-size) var(--border);
  border-top: 0;
  border-bottom: 0;
  padding-top: 1rem;
}

.person-sidebar .meta-head .sidebar-title,
.person-sidebar .meta-head p {
  /*  padding-top: 1rem; */
  padding: 0 1rem;
}

.meta-head p {
  line-height: 1.2;
  margin-top: 0.5rem;
}

.meta {
  display: flex;
  flex-direction: column;
  border: solid var(--border-size) var(--border);
  border-radius: 0 0 var(--border-radius) var(--border-radius);
}

.meta-group {
  padding: 1rem;
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}

.meta-group a {
  text-decoration: underline;
  word-break: break-word;
  overflow-wrap: break-word;
}

.meta-group:not(:last-child) {
  border-bottom: solid var(--border-size) var(--border);
}

.coordinator-list {
  list-style: none;
  margin: 0;
  padding: 0;
}

/* ===== PORTRAIT ===== */
.sidebar-portrait {
  display: block;
  width: 100%;
  aspect-ratio: 3 / 4;
  margin-top: 0.5rem;
  padding: 0.5rem;
}

.sidebar-portrait img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: var(--border-radius);
}

.page-link {
  padding: 0.4rem 0.3rem 0.4rem 0;
  background: linear-gradient(to left, var(--accent-base), color-mix(in srgb, var(--accent-base), transparent 100%));
  text-decoration: none !important;
}

/* ===== FILTER SECTIONS ===== */
.projects-sidebar,
.reports-sidebar {
  background-color: var(--sidebar-accent);
  border-radius: var(--border-radius);
  padding: 1rem;
  color: var(--sidebar-accent-text);
}

.filter-section {
  margin-top: 1.5rem;
}

.filter-section:first-child {
  margin-top: 0;
}

.filter-heading {
  margin-bottom: 0.75rem;
}

.filter-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.filter-chip {
  display: inline-block;
  font-family: var(--font-heading);
  font-size: var(--h5-size);
  padding: 0.1rem 0.4rem;
  border: var(--border-size) solid var(--sidebar-accent-text);
  border-radius: var(--border-radius);
  color: var(--sidebar-accent-text);
  background: transparent;
  width: fit-content;
  cursor: pointer;
}

.filter-chip:hover {
  background-color: var(--sidebar-accent-text);
  border-color: var(--sidebar-accent-text);
  color: var(--sidebar-accent);
}

.filter-chip.active {
  background-color: var(--sidebar-accent-text);
  border-color: var(--sidebar-accent-text);
  color: var(--sidebar-accent);
}

/* ===== SECTION NAVIGATION ===== */
.section-nav {
  background-color: var(--sidebar-accent);
  border-radius: 0 0 var(--border-radius) var(--border-radius);
  padding: 0 1rem 1rem 1rem;
  color: var(--sidebar-accent-text);
}

.section-nav::before {
  content: "";
  display: block;
  height: 1px;
  background-color: var(--sidebar-accent-text);
  opacity: 0.3;
  margin: 0 -1rem;
  padding: 0;
}

.section-nav .filter-chips {
  margin-top: 1rem;
}

/* Remove bottom border-radius from sidebar when followed by section-nav */
.projects-sidebar:has(+ .section-nav) {
  border-radius: var(--border-radius) var(--border-radius) 0 0;
}

/* ===== COURSE SIDEBAR (merged nav + meta) ===== */
.course-sidebar-wrapper {
  display: flex;
  flex-direction: column;
}

.course-sidebar-nav {
  background-color: var(--sidebar-accent);
  border-radius: var(--border-radius) var(--border-radius) 0 0;
  padding: 1rem;
  color: var(--sidebar-accent-text);
}

.course-sidebar-meta .meta-head {
  border-radius: 0;
  border-top: var(--border-size) solid
    color-mix(in srgb, var(--sidebar-accent-text) 30%, transparent);
}

.course-sidebar-meta .meta {
  border-radius: 0 0 var(--border-radius) var(--border-radius);
}

/* ===== FIELDS TRIANGLE ===== */
.fields-triangle {
  padding: 1rem;
  border: var(--border-size) solid var(--border);
  border-bottom: none;
}

.fields-triangle .sidebar-heading {
  margin-bottom: -1rem;
}

.triangle-svg {
  display: block;
  width: 100%;
  max-width: 200px;
  height: auto;
  margin: 0 auto;
  color: var(--text);
}

.triangle-label {
  font-family: var(--font-heading);
  font-size: 14px;
  fill: currentColor;
}

/* ===== FEATURE HERO BUTTONS (Home page only) ===== */
.feature-hero-buttons {
  margin-top: 1rem;
}

.feature-hero-button {
  background: var(--sidebar-accent);
  color: var(--sidebar-accent-text);
  border-color: var(--sidebar-accent);
}

.feature-hero-button:hover {
  background: var(--accent);
  color: var(--accent-text);
  border-color: var(--accent);
}

/* ===== PAGE CONTEXT (hidden on desktop, visible on mobile) ===== */
.sidebar-page-context {
  display: none;
}

/* ===== RESPONSIVE ===== */
@media (max-width: 768px) {
  .sidebar {
    position: static;
    top: auto;
  }

  .sidebar-nav {
    background: none;
    padding: 0;
  }

  .sidebar-nav-links {
    display: none;
  }

  .sidebar-btn {
    padding: 0.666rem 0;
  }

  .sidebar-nav[data-menu-open="true"] .sidebar-nav-links {
    display: flex;
    flex-direction: column;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    width: 100vw;
    height: fit-content;
    padding-top: calc(var(--padding) + 2.9rem);
    padding-left: calc(var(--padding) / 2);
    padding-right: calc(var(--padding) / 2);
    padding-bottom: calc(var(--padding) / 2);
    background: linear-gradient(
      to bottom,
      var(--background),
      color-mix(in srgb, var(--accent-base) 20%, var(--background))
    );
    z-index: 50;
    overflow: hidden;
  }

  .sidebar-nav[data-menu-open="true"] .sidebar-nav-links > :not(.sidebar-btn):not(.feature-hero-buttons) {
    display: none;
  }

  .sidebar-page-context {
    display: flex;
    flex-direction: column;
  }

  .sidebar-logos {
    position: relative;
    z-index: 51; /* above the overlay's z-index: 50 */
    justify-content: flex-start;
    gap: 1rem;
  }

  .sidebar-logos svg {
    height: 40px;
  }

  .sidebar-logos a:first-child svg {
    height: 42px;
  }
}
