/* The look of the current org chart, drawn over nested lists: each
   <ul> is a row of reports, each <li> draws its part of the lines. */
:root {
  --page: #f4f3ef;
  --ink: #1c1d22;
  --muted: #7b7d86;
  --faint: #8a8b93;
  --border: #e6e4dd;
  --line: #c9c8c1;
  --card: #ffffff;
  --badge: #eaf0fd;
  --badge-ink: #37496f;
  --open: #3b6fe0;
  --shadow: 0 1px 2px rgba(28, 29, 34, 0.05), 0 8px 24px rgba(28, 29, 34, 0.06);
}
@media (prefers-color-scheme: dark) {
  :root {
    --page: #17181c;
    --ink: #ecebe6;
    --muted: #9a9ca5;
    --faint: #868891;
    --border: #2c2e34;
    --line: #4a4c53;
    --card: #202227;
    --badge: #263553;
    --badge-ink: #bcd0f7;
    --open: #7ea4f4;
    --shadow: none;
  }
}
body {
  margin: 0;
  color: var(--ink);
  background: var(--page);
  font-family: "Helvetica Neue", Helvetica, Arial, sans-serif;
  -webkit-font-smoothing: antialiased;
}
header {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  justify-content: space-between;
  gap: 16px 32px;
  padding: 26px 40px 18px;
  border-bottom: 1px solid var(--border);
}
h1 {
  margin: 0;
  font-size: 23px;
  font-weight: 700;
  letter-spacing: -0.01em;
}
.summary {
  margin: 5px 0 0;
  font-size: 13px;
  color: var(--muted);
}
.search {
  width: 200px;
  height: 30px;
  box-sizing: border-box;
  padding: 0 10px;
  border: 1px solid var(--border);
  border-radius: 8px;
  font: inherit;
  font-size: 13px;
  color: var(--ink);
  background: var(--card);
}
.search:focus-visible {
  outline: 2px solid var(--open);
  outline-offset: 2px;
}
/* While searching, search.js marks the tree; cards that match get
   .match and are outlined, the rest fade back. Only their content
   fades, so the lines behind the cards stay hidden. */
.tree.searching .person:not(.match) > * {
  opacity: 0.3;
}
.tree.searching .person:not(.match) {
  border-color: var(--border);
  box-shadow: none;
}
.tree.searching .person.match {
  box-shadow:
    0 0 0 2px var(--open),
    var(--shadow);
}
.legend {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 12.5px;
  color: var(--muted);
}
.legend::before {
  content: "";
  width: 11px;
  height: 11px;
  border-radius: 50%;
  background: var(--open);
}
/* The page is the header plus a canvas that fills the rest of the
   window and scrolls both ways; zoom.js zooms it with the wheel and
   pans it by dragging. */
body {
  display: flex;
  flex-direction: column;
  height: 100vh;
}
header {
  flex: none;
}
.chart {
  flex: 1;
  overflow: auto;
  padding: 48px 40px 80px;
  cursor: grab;
}
/* Panning is by dragging, so the scrollbars only take space. */
.chart {
  scrollbar-width: none;
}
.chart::-webkit-scrollbar {
  display: none;
}
.chart.dragging {
  cursor: grabbing;
  user-select: none;
}
.controls {
  display: flex;
  align-items: center;
  gap: 20px;
}
.zoom {
  display: flex;
  align-items: center;
  gap: 6px;
}
.zoom button {
  min-width: 30px;
  height: 30px;
  padding: 0 9px;
  border: 1px solid var(--border);
  border-radius: 8px;
  font: inherit;
  font-size: 14px;
  color: var(--muted);
  background: var(--card);
  cursor: pointer;
}
.zoom button:hover {
  color: var(--ink);
}
.zoom button:focus-visible {
  outline: 2px solid var(--open);
  outline-offset: 2px;
  color: var(--ink);
}
.zoom-level {
  width: 42px;
  font-size: 12px;
  text-align: center;
  color: var(--muted);
}
/* zoom.js scales .scaler and sizes .frame to the scaled tree, so the
   page scrolls over what is actually visible. */
.frame {
  width: max-content;
  margin: 0 auto;
}
.scaler {
  width: max-content;
  transform-origin: top left;
}
/* The people without a manager sit in one row on top, joined by a
   line; the reports of all of them hang below as one row. */
.tree {
  display: flex;
  flex-direction: column;
  align-items: center;
  width: max-content;
  margin: 0 auto;
}
.roots {
  position: relative;
  display: flex;
  align-items: center;
  gap: 32px;
}
/* Runs under the cards, so it only shows in the gaps between them. */
.roots::before {
  content: "";
  position: absolute;
  top: 50%;
  left: 0;
  right: 0;
  border-top: 1.6px solid var(--line);
}
.root {
  position: relative;
}
/* The person the rest of the company reports to. */
.lead .person {
  width: 230px;
  padding-top: 18px;
  border-color: var(--ink);
  box-shadow:
    0 2px 4px rgba(28, 29, 34, 0.08),
    0 14px 34px rgba(28, 29, 34, 0.12);
}
.lead .avatar {
  width: 76px;
  height: 76px;
  font-size: 25px;
}
.lead strong {
  font-size: 16px;
}
.tree ul {
  position: relative;
  display: flex;
  justify-content: center;
  margin: 0;
  padding: 32px 0 0;
  list-style: none;
}
/* Line down from a manager to the row of their reports. */
.tree ul::before {
  content: "";
  position: absolute;
  top: 0;
  left: 50%;
  height: 32px;
  border-left: 1.6px solid var(--line);
}
.tree li {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 32px 9px 0;
}
/* Each report draws its half of the horizontal line and a line up. */
.tree li::before,
.tree li::after {
  content: "";
  position: absolute;
  top: 0;
  width: 50%;
  height: 32px;
  border-top: 1.6px solid var(--line);
}
.tree li::before {
  right: 50%;
}
.tree li::after {
  left: 50%;
  border-left: 1.6px solid var(--line);
}
.tree li:first-child::before,
.tree li:last-child::after {
  border: 0;
}
.tree li:last-child::before {
  border-right: 1.6px solid var(--line);
}
/* A single report needs no horizontal line, only the line down. It keeps the
   same gap above it, so it starts as low as the reports next to it. */
.tree li:only-child::before {
  display: none;
}
.tree li:only-child::after {
  border-top: 0;
  border-left: 1.6px solid var(--line);
}
.person {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  box-sizing: border-box;
  width: 208px;
  padding: 16px 14px 14px;
  border: 1px solid var(--border);
  border-radius: 14px;
  background: var(--card);
  box-shadow: var(--shadow);
  text-align: center;
}
/* Tall enough for a badge, so a card with one does not push its reports
   lower than the reports of the cards next to it. */
.tree .person {
  min-height: 170px;
}
/* Lines are stacked by the flex column, so a <br> would only add a gap. */
.person br {
  display: none;
}
/* The hue comes from the name, so a person keeps the same colour. */
.avatar {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 66px;
  height: 66px;
  margin-bottom: 6px;
  border-radius: 50%;
  box-shadow: 0 0 0 1px var(--border);
  font-size: 22px;
  font-weight: 600;
  letter-spacing: 0.02em;
  color: hsl(var(--hue, 220) 35% 32%);
  background: hsl(var(--hue, 220) 55% 88%);
}
img.avatar {
  object-fit: cover;
  background: var(--border);
}
.person.open .avatar {
  color: var(--open);
  background: var(--page);
  box-shadow: inset 0 0 0 1.5px var(--open);
  font-weight: 400;
}
.person strong {
  font-size: 14.5px;
  letter-spacing: -0.01em;
  line-height: 1.2;
}
.person small {
  font-size: 12px;
  line-height: 1.35;
  color: var(--muted);
}
.badge {
  margin-top: 4px;
  padding: 2px 9px;
  border-radius: 20px;
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--badge-ink);
  background: var(--badge);
}
.note {
  font-size: 11px;
  line-height: 1.3;
  font-style: italic;
  color: var(--faint);
}
/* E-mail and phone on the card itself, only on paper, where the
   detail cannot be opened. */
.contact {
  display: none;
}
/* An open position: nobody sits in this card yet. The page colour, not
   transparent, still hides the line under the cards of the top row. */
.person.open {
  border: 1.5px dashed var(--open);
  background: var(--page);
  box-shadow: none;
}
.open-tag {
  padding: 2px 9px;
  border-radius: 20px;
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: #fff;
  background: var(--open);
}
/* A card is a button that opens the person's detail. */
button.person {
  font: inherit;
  color: inherit;
  cursor: pointer;
}
button.person:hover {
  border-color: var(--line);
}
button.person:focus-visible {
  outline: 2px solid var(--open);
  outline-offset: 3px;
}
/* The detail of one person, opened over the chart. */
.detail {
  width: min(340px, calc(100vw - 32px));
  box-sizing: border-box;
  padding: 28px 24px 24px;
  border: 1px solid var(--border);
  border-radius: 16px;
  color: var(--ink);
  background: var(--card);
  box-shadow: 0 24px 64px rgba(28, 29, 34, 0.25);
  text-align: center;
}
.detail::backdrop {
  background: rgba(28, 29, 34, 0.55);
}
.detail .avatar {
  margin: 0 auto 10px;
}
.detail h2 {
  margin: 0;
  font-size: 18px;
}
.detail-role {
  margin: 4px 0 0;
  font-size: 13px;
  color: var(--muted);
}
.detail .note {
  margin: 6px 0 0;
  font-size: 12px;
}
.detail-close {
  position: absolute;
  top: 10px;
  right: 10px;
  width: 30px;
  height: 30px;
  border: 0;
  border-radius: 8px;
  font-size: 20px;
  line-height: 1;
  color: var(--muted);
  background: transparent;
  cursor: pointer;
}
.detail-close:hover {
  color: var(--ink);
  background: var(--page);
}
/* Rows of label and value: department, e-mail, phone, Slack. */
.detail-info {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 8px 16px;
  margin: 20px 0 0;
  padding-top: 16px;
  border-top: 1px solid var(--border);
  font-size: 13px;
  text-align: left;
}
.detail-info dt {
  color: var(--muted);
}
.detail-info dd {
  margin: 0;
  overflow-wrap: anywhere;
}
.detail-info a {
  color: var(--open);
  text-decoration: none;
}
.detail-info a:hover {
  text-decoration: underline;
}
/* Phones: the wide tree turns into an indented list of compact
   cards. Zoom is off; the inline sizes zoom.js sets are overridden. */
@media screen and (max-width: 767px) {
  .tree .person {
    min-height: 0;
  }
  header {
    padding: 20px 16px 14px;
  }
  .controls {
    flex-wrap: wrap;
    width: 100%;
  }
  .search {
    flex: 1;
    width: auto;
  }
  .zoom {
    display: none;
  }
  .chart {
    padding: 16px 16px 48px;
    cursor: auto;
  }
  .frame,
  .scaler {
    width: auto !important;
    height: auto !important;
    transform: none !important;
  }
  .tree {
    display: block;
    width: auto;
  }
  .roots {
    flex-direction: column;
    align-items: stretch;
    gap: 8px;
  }
  .roots::before,
  .tree ul::before,
  .tree li::before,
  .tree li::after {
    display: none;
  }
  .tree ul {
    display: block;
    margin-left: 21px;
    padding: 0 0 0 14px;
    border-left: 1.6px solid var(--line);
  }
  .roots + ul {
    margin-top: 8px;
  }
  .tree li,
  .tree li:only-child {
    display: block;
    padding: 8px 0 0;
  }
  /* A card is a row: initials on the left, the text stacked on the
     right. */
  .person,
  .lead .person {
    display: grid;
    grid-template-columns: 44px 1fr;
    column-gap: 12px;
    row-gap: 2px;
    align-items: center;
    justify-items: start;
    width: 100%;
    padding: 10px 12px;
    text-align: left;
  }
  .person > .avatar,
  .lead .avatar {
    grid-row: 1 / span 4;
    width: 44px;
    height: 44px;
    margin: 0;
    font-size: 16px;
  }
  .person > :not(.avatar) {
    grid-column: 2;
  }
  .badge,
  .open-tag {
    margin: 2px 0 0;
  }
}
/* zoom.js sets .printing just before printing, so the tree is
   measured with the contacts it will have on paper. */
.printing .contact {
  display: block;
  font-size: 10px;
  line-height: 1.4;
  color: var(--muted);
}
/* Printing (the onboarding checklist prints the chart): landscape
   A4, light colours, no controls, contacts on the cards. zoom.js
   scales the tree to the page width just before printing. */
@page {
  size: A4 landscape;
  margin: 10mm;
}
@media print {
  :root {
    --page: #ffffff;
    --ink: #1c1d22;
    --muted: #7b7d86;
    --faint: #8a8b93;
    --border: #e6e4dd;
    --line: #c9c8c1;
    --card: #ffffff;
    --badge: #eaf0fd;
    --badge-ink: #37496f;
    --open: #3b6fe0;
    --shadow: none;
  }
  * {
    print-color-adjust: exact;
    -webkit-print-color-adjust: exact;
  }
  body {
    display: block;
    height: auto;
  }
  header {
    padding: 0 0 12px;
    border-bottom: 0;
  }
  .controls,
  .detail {
    display: none;
  }
  .chart {
    overflow: visible;
    padding: 0;
  }
  /* A transform only shrinks how the tree looks, so the page breaks
     would still see its full height; zoom shrinks the layout too.
     zoom.js puts the scale for paper into --print-zoom. */
  .frame {
    width: auto !important;
    height: auto !important;
  }
  .scaler {
    margin: 0 auto;
    transform: none !important;
    zoom: var(--print-zoom, 1);
  }
  .person {
    break-inside: avoid;
  }

  /* A search left open on screen must not fade the paper copy. */
  .tree.searching .person:not(.match) > * {
    opacity: 1;
  }
  .tree.searching .person.match {
    box-shadow: none;
  }
}
