/* ---- The pill (js/dock-pill.js) ----
 * The dock, slimmed down to one line: the same folders and Thoughts stack
 * (css/dock.css draws them), small, each with its name, and a dot under
 * the list you're on that glides between them. No magnify, but they keep
 * the dock's small touches: hover opens them, a press sinks them, a click
 * on the homepage bounces them, the archive puffs dust (js/folder-dust.js).
 * On the homepage it floats at the bottom of the screen (the floating
 * tab's class, css/view-tab.css), and every other page floats it in the
 * same spot (js/dock-pill.js builds it there).
 */
.dir-pill {
  --dock-icon: 1.75rem; /* the dock's folders, small (css/dock.css) */
  --pill-bottom: 3.75rem; /* how far up it floats */
  display: flex;
  align-items: center;
  gap: 1.25rem;
  padding: 0.625rem 1.25rem 0.75rem;
  border-radius: 999px;
  /* The dock's styling (its sheen, bright top edge, rims and shadow),
     but solid: what its frosted tint looked like over the page */
  background: linear-gradient(180deg, #ffffff 0%, #f5f4f4 100%);
  -webkit-backdrop-filter: none; /* nothing shows through, so no blur (the floating tab's) */
  backdrop-filter: none;
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.9),
    inset 0 0 0 0.5px rgba(255, 255, 255, 0.5),
    0 0 0 0.5px rgba(0, 0, 0, 0.14),
    0 12px 32px rgba(0, 0, 0, 0.16),
    0 3px 8px rgba(0, 0, 0, 0.08);
}
/* Phones and tablets: lower, since Safari's toolbar or the home bar
   already adds room under it. Touch screens of any width count, as an
   iPad on its side is over 991px (`any-pointer`: with a keyboard case too). */
@media screen and (max-width: 991px), screen and (any-pointer: coarse) {
  .dir-pill {
    --pill-bottom: 1.5rem;
  }
}
html.is-dark .dir-pill {
  background: linear-gradient(180deg, #25282c 0%, #181b20 100%);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.14),
    inset 0 0 0 0.5px rgba(255, 255, 255, 0.1),
    0 0 0 0.5px rgba(0, 0, 0, 0.6),
    0 12px 32px rgba(0, 0, 0, 0.5),
    0 3px 8px rgba(0, 0, 0, 0.3);
}
.dir-pill_item {
  position: relative; /* its icon's offsetLeft is measured from here */
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0;
  border: 0;
  background: none;
  font: inherit;
  color: var(--black-4);
  text-decoration: none;
  cursor: pointer;
  transition: color 0.2s ease;
}
.dir-pill_item:hover,
.dir-pill_item.is-current {
  color: var(--black);
}
.dir-pill_label {
  font-size: 0.875rem; /* the nav is 1rem */
  line-height: 1;
  letter-spacing: -0.01em;
}
/* The Thoughts stack sits level with the folders */
.dir-pill .dock_notes {
  margin-bottom: 0;
  flex: none;
  /* its bottom sheets tip out past its box at the sides, so
   leave them room before the divider and the name */
  margin-inline: 0.25rem;
}
.dir-pill .dock_folder {
  flex: none;
}
/* The dock's hover (css/dock.css): a folder's flap tips open and
 its pieces lift; the Thoughts sheets spread up into a column */
@media (hover: hover) {
  .dir-pill_item:hover .folder.is-front {
    transform: rotateX(-28deg);
    transition: transform 0.45s cubic-bezier(0.34, 1.56, 0.64, 1);
  }
  .dir-pill_item:hover .folder.is-contents {
    translate: 0 -12%;
    transition: translate 0.6s cubic-bezier(0.22, 1, 0.36, 1);
  }
  .dir-pill_item.is-thoughts:hover .dock_note {
    transition:
      translate 0.6s cubic-bezier(0.34, 1.56, 0.64, 1) var(--note-delay, 0ms),
      rotate 0.6s cubic-bezier(0.34, 1.56, 0.64, 1) var(--note-delay, 0ms);
  }
  .dir-pill_item.is-thoughts:hover .dock_note:nth-child(1) { translate: 0 0; rotate: -4deg; }
  .dir-pill_item.is-thoughts:hover .dock_note:nth-child(2) { translate: 0 -13%; rotate: 3deg; --note-delay: 40ms; }
  .dir-pill_item.is-thoughts:hover .dock_note:nth-child(3) { translate: 0 -26%; rotate: -1deg; --note-delay: 80ms; }
}
/* A press sinks the icon a little, like the dock's */
.dir-pill_item > :first-child {
  transform-origin: 50% 100%;
  transition: scale 0.25s cubic-bezier(0.34, 1.56, 0.64, 1);
}
.dir-pill_item:active > :first-child {
  scale: 0.9;
  transition-duration: 0.12s;
  transition-timing-function: ease-out;
}
.dir-pill_divider {
  align-self: stretch;
  width: var(--divider-width);
  margin: 0.125rem 0;
  background: rgba(0, 0, 0, 0.16);
}
html.is-dark .dir-pill_divider {
  background: rgba(255, 255, 255, 0.16);
}
/* The dot under the one you're on, in its folder's color (the
 dock's --dot colors), gliding between them */
.dir-pill_item[data-dir-to="work"] { --dot: #f2c230; }
.dir-pill_item[data-dir-to="archive"] { --dot: #c76ce6; }
.dir-pill_item.is-thoughts { --dot: var(--black); }
.dir-pill_dot {
  position: absolute;
  bottom: 0.25rem;
  left: 0;
  width: 4px;
  height: 4px;
  margin-left: -2px;
  border-radius: 50%;
  translate: var(--x, 0px) 0;
  background: var(--c, transparent);
  opacity: 0;
  transition: translate 0.5s cubic-bezier(0.65, 0, 0.35, 1), background-color 0.5s ease;
}
.dir-pill_dot.is-on {
  opacity: 1;
}
@media (prefers-reduced-motion: reduce) {
  .dir-pill_dot {
    transition: none;
  }
}

/* The homepage's: centered where the old dock's middle was (84px up; it
   was 120px tall, 1.5rem off the bottom) */
.view-tab.dir-pill {
  bottom: calc(var(--pill-bottom) + env(safe-area-inset-bottom));
}

/* ---- Floating at the bottom of the screen ----
   Thoughts, About and project pages, in the homepage's spot. They
   sit outside .page-wrapper (js/dock-pill.js), and sink away near the
   footer (html.footer-near, js/site-footer.js), like css/view-tab.css's. */
.dir-pill.is-floating {
  position: fixed;
  left: 0;
  right: 0;
  bottom: calc(var(--pill-bottom) + env(safe-area-inset-bottom));
  z-index: 5; /* over the page (About's business cards, css/business-cards.css) */
  width: fit-content;
  margin-inline: auto;
  transition:
    opacity 0.25s ease,
    translate 0.6s cubic-bezier(0.34, 1.3, 0.64, 1),
    scale 0.6s cubic-bezier(0.34, 1.3, 0.64, 1);
}
/* Project pages above 991px: under the left column, centered on the
   panel (js/dock-pill.js measures it) */
@media screen and (min-width: 992px) {
  .dir-pill.is-floating.is-left {
    left: var(--pill-left, 0px);
    right: auto;
    margin-inline: 0;
  }
}
/* Thoughts: under an open note (css/thoughts.css, z-index 5) */
.dir-pill.is-floating.is-under-note {
  z-index: 4;
}
html.footer-near .dir-pill.is-floating {
  opacity: 0;
  translate: 0 calc(100% + var(--pill-bottom) + 1rem + env(safe-area-inset-bottom));
  scale: 0.94;
  pointer-events: none;
  transition:
    opacity 0.15s ease-in 0.3s,
    translate 0.45s cubic-bezier(0.45, -0.2, 0.7, 0.1),
    scale 0.45s cubic-bezier(0.45, -0.2, 0.7, 0.1);
}
@media (prefers-reduced-motion: reduce) {
  html.footer-near .dir-pill.is-floating {
    translate: none;
    scale: none;
  }
}
/* Arriving from a page with the pill, it's already on screen: it slides
   over instead of fading up (js/dock-pill.js) */
.dir-pill.is-sliding {
  animation: none !important;
}
/* Page load: fades up after the page's text (css/page-intro.css) */
html.page-intro .dir-pill.is-floating {
  animation: page-intro var(--intro-ms) var(--intro-ease) backwards;
  animation-delay: calc(2 * var(--intro-gap));
}
