.desk .space-head {
  margin-bottom: 32px;
}

.desk .space-head__trigger {
  max-width: calc(100% + 22px);
  margin-left: -22px;
}

.desk__collections {
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.desk__toggle .bi-check-lg {
  display: none;
}

.desk__toggle[aria-pressed="true"] {
  background: light-dark(var(--cover), var(--on-ground));
  color: light-dark(var(--on-cover), var(--ground));

  &:hover {
    background: light-dark(var(--cover-hover), var(--on-ground-dim));
    color: light-dark(var(--on-cover), var(--ground));
  }

  & .bi-check-lg {
    display: inline-block;
  }

  & .bi-arrow-down-up {
    display: none;
  }
}

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

.outline {
  --row: var(--tray);
  --row-hover: var(--tray-hover);
  --hairline: var(--tray-hairline);
  --dashed: var(--tray-dashed);
}

.outline {
  position: relative;
  border-radius: var(--radius-tile);
  background: var(--card);
  color: var(--ink);
  box-shadow: 0 0 0 1px var(--card-edge);
  scroll-margin-top: calc(var(--header-height) + 16px);
}

.bundle {
  scroll-margin-top: calc(var(--header-height) + 60px);
}

.outline__head {
  display: flex;
  gap: 12px;
  align-items: center;
  padding: 22px 24px 14px 30px;
  cursor: pointer;
}

.outline__head:hover .outline__chev {
  background: var(--card-hover);
  color: var(--ink);
}

.bundle__head:hover .bundle__chev {
  background: var(--card);
  color: var(--ink);
}

.desk[data-ordering] :is(.outline__head, .bundle__head) {
  cursor: auto;
}

.outline--collapsed .outline__head {
  padding-bottom: 22px;
}

.outline__grip,
.outline__chev {
  display: grid;
  flex: none;
  place-items: center;
  width: 36px;
  height: 36px;
  padding: 0;
  border: 0;
  border-radius: var(--radius-pill);
  background: transparent;
  color: var(--ink-lede);
  cursor: pointer;

  &:hover,
  &:focus-visible {
    background: var(--card-hover);
    color: var(--ink);
  }
}

.outline__pin {
  position: sticky;
  top: var(--header-height);
  z-index: 3;
  height: 44px;
  margin-bottom: -44px;
  padding: 0 30px;
  overflow: hidden;
  border-bottom: 1px solid var(--hairline);
  background: var(--card);
  font: 700 16px/44px var(--font-display);
  letter-spacing: -0.01em;
  color: var(--ink);
  text-overflow: ellipsis;
  white-space: nowrap;
  visibility: hidden;
  opacity: 0;
  transition: opacity var(--transition-fast), visibility var(--transition-fast);
}

.outline--pinned .outline__pin {
  visibility: visible;
  opacity: 1;
}

.outline--collapsed .outline__pin {
  display: none;
}

.outline__grip {
  height: 28px;
  cursor: grab;
}

.outline__chev {
  rotate: 180deg;
  transition: rotate 0.45s var(--ease-slide), background-color var(--transition-fast);
}

.outline__chev[aria-expanded="false"] {
  rotate: 0deg;
}

.outline__heading {
  flex: 1;
  min-width: 0;
}

.outline__name {
  font: 700 34px/1.1 var(--font-display);
  letter-spacing: -0.035em;
  color: var(--ink);
  overflow-wrap: anywhere;
}

.outline__desc {
  max-width: var(--measure);
  margin-top: 5px;
  font: 500 15px/1.35 var(--font-display);
  color: var(--ink-lede);
}

.outline__actions {
  display: flex;
  flex: none;
  gap: 6px;
  align-items: center;
}

.pill {
  display: inline-flex;
  gap: 7px;
  align-items: center;
  height: 38px;
  padding: 0 15px 0 12px;
  border: 0;
  border-radius: var(--radius-pill);
  background: transparent;
  box-shadow: inset 0 0 0 1.5px var(--hairline);
  color: var(--ink);
  font: 600 14px/1 var(--font-display);
  white-space: nowrap;
  cursor: pointer;

  &:hover {
    background: var(--card-hover);
    box-shadow: inset 0 0 0 1.5px var(--dashed);
  }

  & .bi {
    font-size: 13px;
  }
}

.pill--icon {
  justify-content: center;
  width: 38px;
  padding: 0;
  box-shadow: none;

  &:hover {
    box-shadow: none;
  }
}

.outline__rows {
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 0 18px 18px;
}

.outline--collapsed .outline__rows {
  display: none;
}

.outline__rows:has(.entry, .bundle) .outline__empty {
  display: none;
}

.outline__drag-hint {
  display: none;
}

.desk[data-ordering] .outline__drag-hint {
  display: inline;
}

.entry {
  position: relative;
  display: flex;
  gap: 12px;
  align-items: center;
  min-height: 50px;
  padding: 0 8px 0 12px;
  border-radius: 14px;

  &:hover {
    background: var(--card-hover);
  }
}

.entry--landed {
  animation: entry-landed 1.6s ease-out;
}

@keyframes entry-landed {
  from {
    background: color-mix(in srgb, var(--accent) 10%, transparent);
  }
}

.entry__grip,
.bundle__grip {
  position: relative;
  z-index: 1;
  display: grid;
  flex: none;
  place-items: center;
  height: 28px;
  padding: 0;
  border: 0;
  border-radius: var(--radius-pill);
  background: transparent;
  color: var(--ink-lede);
  cursor: grab;

  &:hover,
  &:focus-visible {
    background: var(--card);
    color: var(--ink);
  }
}

.entry__grip:focus-visible,
.bundle__grip:focus-visible,
.outline__grip:focus-visible {
  outline: 3px solid var(--accent);
  outline-offset: 1px;
}

.entry__title {
  flex: 1;
  min-width: 0;
  font: 500 16px/1.3 var(--font-display);
  color: var(--ink);
  text-decoration: none;
  overflow-wrap: anywhere;

  &::after {
    position: absolute;
    inset: 0;
    content: "";
  }

  &:hover {
    color: var(--ink);
  }
}

.desk[data-ordering] .entry__title::after {
  display: none;
}

.entry--draft .entry__title {
  color: var(--draft-ink);
}

.entry__when {
  flex: none;
  font: 500 13px/1 var(--font-display);
  color: var(--ink-lede);
  text-align: right;
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
}

.entry__flag {
  color: var(--ink);
}

.entry__dots {
  display: grid;
  flex: none;
  place-items: center;
  width: 32px;
  height: 32px;
  padding: 0;
  border: 0;
  border-radius: var(--radius-pill);
  background: transparent;
  color: var(--ink-lede);
  cursor: pointer;

  &:hover,
  &:focus-visible {
    background: var(--card);
    color: var(--ink);
  }
}

.entry:hover .entry__dots,
.entry:has(.menu--open) .entry__dots {
  background: var(--card);
  color: var(--ink);
}

.bundle {
  position: relative;
  margin: 8px 0;
}

.bundle__sheet {
  padding: 8px 8px 6px;
  border-radius: var(--radius-row);
  background: var(--row);
  transition: box-shadow var(--transition-fast);
}

.bundle--target > .bundle__sheet {
  box-shadow: inset 0 0 0 3px var(--ink);
}

.bundle__head {
  display: flex;
  gap: 12px;
  align-items: center;
  min-height: 44px;
  padding: 0 9px 0 12px;
  cursor: pointer;
}

.bundle__chev {
  display: grid;
  flex: none;
  place-items: center;
  width: 30px;
  height: 30px;
  padding: 0;
  border: 0;
  border-radius: var(--radius-pill);
  background: transparent;
  color: var(--ink-lede);
  font-size: 12px;
  cursor: pointer;
  rotate: 180deg;
  transition: rotate 0.45s var(--ease-slide), background-color var(--transition-fast);

  &:hover,
  &:focus-visible {
    background: var(--card);
    color: var(--ink);
  }
}

.bundle__chev[aria-expanded="false"] {
  rotate: 0deg;
}

.bundle--collapsed .bundle__rows {
  display: none;
}

.bundle--collapsed .bundle__head {
  padding-block: 6px;
}

.bundle__heading {
  display: flex;
  flex: 1;
  flex-direction: column;
  gap: 3px;
  min-width: 0;
}

.bundle__name {
  font: 700 17px/1.2 var(--font-display);
  letter-spacing: -0.015em;
  color: var(--ink);
  overflow-wrap: anywhere;
}

.bundle__titles {
  display: none;
  overflow: hidden;
  font: 500 14px/1.3 var(--font-display);
  color: var(--ink-lede);
  text-overflow: ellipsis;
  white-space: nowrap;
}

.bundle--collapsed .bundle__titles {
  display: block;
}

.bundle__head .pill {
  height: 32px;
  box-shadow: inset 0 0 0 1.5px var(--dashed);
  font-size: 13px;

  &:hover {
    background: var(--card);
  }
}

.bundle__rows {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-height: 12px;
  padding-bottom: 2px;
}

.bundle__rows .entry {
  min-height: 48px;

  &:hover {
    background: var(--card);
  }
}

.bundle__rows .entry:hover .entry__dots {
  background: var(--row);
}

.outline__grip,
.entry__grip,
.bundle__grip {
  width: 0;
  margin-right: -12px;
  overflow: hidden;
  visibility: hidden;
  opacity: 0;
  transition: width 0.35s var(--ease-slide), margin-right 0.35s var(--ease-slide),
              opacity 0.25s ease, visibility 0.35s;
}

.desk[data-ordering] .bundle--collapsed .bundle__rows {
  display: flex;
}

.desk[data-ordering] .bundle--collapsed .bundle__titles,
.desk[data-ordering] .bundle__chev {
  display: none;
}

.desk[data-ordering] .outline__grip,
.desk[data-ordering] .entry__grip,
.desk[data-ordering] .bundle__grip {
  width: 20px;
  margin-right: -6px;
  visibility: visible;
  opacity: 1;
}

@media (prefers-reduced-motion: reduce) {
  .outline__grip,
  .entry__grip,
  .bundle__grip {
    transition: none;
  }
}

.desk .sortable-ghost {
  opacity: 0.3;
}

.sortable-fallback.entry {
  background: var(--card);
  box-shadow: var(--cover-shadow);
  rotate: -1deg;
}

.sortable-fallback.bundle .bundle__sheet,
.sortable-fallback.outline {
  box-shadow: var(--cover-shadow);
}

.results {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.results__row {
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 16px 20px;
  border-radius: var(--radius-row);
  background: var(--card);
  color: var(--ink);
  box-shadow: 0 0 0 1px var(--card-edge);
  text-decoration: none;

  &:hover {
    background: var(--tray);
    color: var(--ink);
  }
}

.results__crumb {
  font: 600 13px/1.2 var(--font-display);
  color: var(--ink-lede);
}

.results__title {
  font: 700 18px/1.3 var(--font-display);

  & mark {
    padding: 0 2px;
    border-radius: 3px;
    background: color-mix(in srgb, var(--accent) 45%, transparent);
    color: inherit;
  }
}

.results__title--draft {
  color: var(--draft-ink);
}

.results__desc {
  max-width: var(--measure);
  font: 400 15px/1.45 var(--font-display);
  color: var(--ink-lede);
}

@media (hover: none), (width < 640px) {
  .desk__toggle {
    display: none !important;
  }
}

@media (width < 640px) {
  .desk__collections {
    gap: 14px;
  }

  .outline__grip {
    margin-right: -6px;
  }

  .desk[data-ordering] .outline__grip {
    margin-right: 0;
  }

  .outline {
    border-radius: 24px;
  }

  .outline__head {
    flex-wrap: wrap;
    gap: 0 6px;
    align-items: flex-start;
    padding: 14px 8px 8px 20px;
  }

  .outline__heading {
    display: contents;
  }

  .outline__pin {
    padding-inline: 20px;
  }

  .outline__name {
    flex: 1;
    align-self: center;
    min-width: 0;
  }

  .outline__desc {
    flex-basis: 100%;
    order: 5;
    margin-top: 0;
    padding: 0 8px 6px 0;
  }

  .outline__chev {
    width: 44px;
    height: 44px;
  }

  .outline__name {
    font-size: 26px;
  }

  .outline__desc {
    font-size: 14px;
  }

  .pill {
    justify-content: center;
    width: 44px;
    height: 44px;
    padding: 0;
  }

  .pill__label {
    display: none;
  }

  .outline__rows {
    padding: 0 8px 12px;
  }

  .entry {
    flex-wrap: wrap;
    row-gap: 0;
    min-height: 52px;
    padding: 6px 0 6px 12px;
  }

  .entry__title {
    flex: 1 1 calc(100% - 56px);
    font-size: 15px;
  }

  .entry__when {
    flex-basis: 100%;
    order: 4;
    padding-bottom: 4px;
    font-size: 12px;
    text-align: left;
  }

  .entry__dots,
  .bundle__chev {
    width: 44px;
    height: 44px;
  }

  .entry__dots {
    order: 3;
  }

  .bundle__head {
    padding: 0 0 0 12px;
  }

  .bundle__head .pill {
    width: 44px;
    height: 44px;
  }
}
