/* Departments (departments.html): a mind map with ROOM 211 in the middle,
   departments around it and their areas at the ends of the branches, then
   who leads what. Read only. Tokens from styles.css; each branch takes its
   department's categorical color (--branch) for its lines and dot. */
.dept-page {
  max-width: calc(1320px + 2 * var(--space-6));
}

.dept-title {
  margin-bottom: var(--space-2);
}

.dept-intro {
  margin: 0 0 var(--space-8);
  color: var(--color-ink-muted);
  font-size: var(--text-lg);
}

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
}

/* The map */
.mind {
  position: relative;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr);
  align-items: center;
  column-gap: var(--space-12);
  padding: var(--space-8) var(--space-6);
  border: 1px solid var(--color-card-border);
  border-radius: var(--radius-lg);
  background: var(--color-surface);
  box-shadow: var(--shadow-rest);
}

.mind-lines {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  overflow: visible;
  pointer-events: none;
}

.mind-line {
  fill: none;
  stroke-linecap: round;
  transition: opacity var(--motion);
}

.mind-line.is-main {
  stroke-width: 2.5;
}

.mind-line.is-leaf {
  stroke-width: 1.5;
  opacity: 0.75;
}

.mind-side {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: var(--space-8);
}

.mind-center {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  padding: var(--space-5) var(--space-6);
  border-radius: var(--radius-lg);
  background: var(--color-accent);
  box-shadow: var(--shadow-raised);
  color: var(--color-on-accent);
  text-align: center;
}

.mind-center-name {
  font-family: var(--font-display);
  font-size: var(--text-section);
  font-weight: 700;
  letter-spacing: -0.01em;
  white-space: nowrap;
}

.mind-center-sub {
  font-size: var(--text-xs);
  opacity: 0.85;
}

.mind-branch {
  display: flex;
  align-items: center;
  gap: var(--space-12);
  transition: opacity var(--motion);
}

.is-right .mind-branch {
  flex-direction: row-reverse;
}

.mind-dept {
  flex: none;
  width: 196px;
  padding: var(--space-3) var(--space-4);
  border: 1px solid var(--color-card-border);
  border-radius: var(--radius-md);
  background: var(--color-surface);
  box-shadow: var(--shadow-rest);
  transition: border-color var(--motion), box-shadow var(--motion);
}

.mind-branch.is-active .mind-dept {
  border-color: var(--branch);
  box-shadow: var(--shadow-raised);
}

.mind-dept-name {
  display: flex;
  align-items: baseline;
  gap: var(--space-2);
  margin: 0 0 var(--space-2);
  font-size: var(--text-md);
  font-weight: 600;
  line-height: 1.25;
}

.mind-dept-name::before {
  content: "";
  flex: none;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--branch);
  transform: translateY(-1px);
}

.mind-dept-lead {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  color: var(--color-ink-muted);
  font-size: var(--text-sm);
}

.mind-areas {
  display: flex;
  flex: 1;
  flex-direction: column;
  gap: var(--space-2);
  min-width: 0;
  margin: 0;
  padding: 0;
  list-style: none;
}

.is-left .mind-areas {
  align-items: flex-end;
  text-align: right;
}

.is-right .mind-areas {
  align-items: flex-start;
}

.mind-area {
  position: relative;
  max-width: 100%;
  padding: 6px var(--space-3);
  border-radius: var(--radius-sm);
  background: var(--color-auto);
  font-size: var(--text-sm);
  line-height: 1.3;
}

/* One branch in front, the others quiet */
.mind.is-focused .mind-branch:not(.is-active),
.mind.is-focused .mind-line:not(.is-active) {
  opacity: 0.25;
}

/* Medium screens: tighter, so the areas keep room for their names */
@media (max-width: 1240px) {
  .mind {
    column-gap: var(--space-6);
    padding: var(--space-6) var(--space-4);
  }

  .mind-branch {
    gap: var(--space-6);
  }

  .mind-dept {
    width: 156px;
    padding: var(--space-2) var(--space-3);
  }

  .mind-center {
    padding: var(--space-4);
  }

  .mind-center-name {
    font-size: var(--text-lg);
  }

  .mind-area {
    padding: 5px var(--space-2);
    font-size: var(--text-xs);
  }
}

/* Narrow screens: the same branches as a tree from top to bottom */
@media (max-width: 900px) {
  .mind-side.is-left {
    order: 1;
  }

  .mind {
    display: flex;
    flex-direction: column;
    align-items: stretch;
    gap: var(--space-6);
    padding: var(--space-5) var(--space-4);
  }

  .mind-center {
    align-self: center;
    order: -1;
  }

  .mind-side {
    gap: var(--space-6);
  }

  .mind-branch,
  .is-right .mind-branch {
    flex-direction: column-reverse;
    align-items: stretch;
    gap: var(--space-3);
  }

  .mind-dept {
    width: auto;
  }

  .is-left .mind-areas,
  .is-right .mind-areas {
    align-items: flex-start;
    margin-left: var(--space-4);
    padding-left: var(--space-4);
    border-left: 2px solid var(--branch);
    text-align: left;
  }
}

/* Who leads what */
.dept-leads {
  margin-top: var(--space-12);
}

.dept-section-title {
  margin: 0 0 var(--space-4);
  font-family: var(--font-display);
  font-size: var(--text-section);
  font-weight: 600;
  letter-spacing: -0.01em;
}

.dept-lead-list {
  border: 1px solid var(--color-card-border);
  border-radius: var(--radius-lg);
  background: var(--color-surface);
  box-shadow: var(--shadow-rest);
}

.dept-lead-row {
  display: grid;
  grid-template-columns: auto minmax(160px, 220px) 1fr;
  align-items: center;
  gap: var(--space-3) var(--space-4);
  padding: var(--space-4) var(--space-6);
  border-top: 1px solid var(--color-line);
}

.dept-lead-row:first-child {
  border-top: 0;
}

.dept-lead-row-text {
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.dept-lead-name {
  font-size: var(--text-md);
  font-weight: 600;
}

.dept-lead-of {
  color: var(--color-ink-muted);
  font-size: var(--text-sm);
}

.dept-chips {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-2);
  margin: 0;
  padding: 0;
  list-style: none;
}

.dept-chips li {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: var(--space-1) var(--space-3);
  border-radius: var(--radius-pill);
  background: var(--color-sunken);
  font-size: var(--text-sm);
  font-weight: 500;
}

.dept-swatch {
  width: 8px;
  height: 8px;
  border-radius: 50%;
}

@media (max-width: 620px) {
  .dept-lead-row {
    grid-template-columns: auto 1fr;
    padding: var(--space-4);
  }

  .dept-chips {
    grid-column: 1 / -1;
  }
}
