/* ==========================================================================
   THE GLASS DOCK
   The app's navigation: a pane of glass on the left edge, 5% of the window
   shut and 20% open. js/dock.js owns the markup under #dock; this file is
   the whole of its look.

   Widths are in vw, not %. The glass is position:fixed and its parts are
   nested inside it, so a % would be measured against a different box at each
   level; vw means the same thing everywhere, and the shell fills the window,
   so the column the page leaves for the glass matches it exactly.

   Every class is gd- because the app already owns .row, .empty and .grow.
   ========================================================================== */
.dock-slot { min-width: 0; }
.shell { transition: grid-template-columns .5s var(--ease-spring); }
/* Pinned, the page moves over and the glass stays open. Never on a phone,
   where 20% of the page would be the whole page. */
@media (min-width: 721px) {
  .dock-pinned .shell:not(.shell--nonav) { grid-template-columns: var(--dock-open) minmax(0, 1fr); }
}

/* Open over the page, a click anywhere else closes it. Transparent: the glass
   is the thing, and a dimmed page would read as a dialog, which this is not. */
.gd-scrim { position: fixed; inset: 0; z-index: 44; display: none; }
#dock.is-open:not(.is-pinned) .gd-scrim { display: block; }

/* ------------------------------------------------------------ the glass
   A lens the page shows through: blur and a lift of colour, a rim of light,
   and a sheen that follows the cursor. */
.gd {
  position: fixed; left: 6px; top: 6px; bottom: 6px; z-index: 45;
  width: calc(var(--dock-shut) - 12px);
  border-radius: 26px;
  background: linear-gradient(165deg, rgb(255 255 255 / .6), rgb(255 255 255 / .28) 55%, rgb(255 255 255 / .4));
  -webkit-backdrop-filter: blur(22px) saturate(1.9) brightness(1.04);
  backdrop-filter: blur(22px) saturate(1.9) brightness(1.04);
  border: 1px solid rgb(255 255 255 / .7);
  box-shadow: inset 0 1px 0 rgb(255 255 255 / .95), inset 0 -1px 0 rgb(28 27 23 / .05),
              0 22px 48px -24px rgb(28 27 23 / .38), 0 1px 2px rgb(28 27 23 / .06);
  transition: width .55s var(--ease-spring), border-radius .55s var(--ease-spring);
}
#dock.is-open .gd { width: calc(var(--dock-open) - 12px); border-radius: 30px; }
.gd::before {
  content: ''; position: absolute; inset: 0; border-radius: inherit; pointer-events: none; z-index: 0;
  background: radial-gradient(200px circle at var(--mx, 50%) var(--my, -10%), rgb(255 255 255 / .55), transparent 62%);
}
.gd::after {
  content: ''; position: absolute; inset: 0; border-radius: inherit; padding: 1.2px; pointer-events: none; z-index: 4;
  background: linear-gradient(140deg, rgb(255 255 255 / .95), rgb(255 255 255 / .05) 35%, rgb(255 255 255 / .05) 65%, rgb(255 255 255 / .8));
  -webkit-mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0);
  -webkit-mask-composite: xor;
  mask: linear-gradient(#000 0 0) content-box exclude, linear-gradient(#000 0 0);
}

/* -------------------------------------------------------------- the dock
   Always there, shut or open. The icons may swell out past the glass, as a
   dock's do; the brand keeps 22px under it for the icons below to part into. */
.gd-dock {
  position: absolute; left: 0; top: 0; bottom: 0; z-index: 2;
  width: calc(var(--dock-shut) - 14px);
  display: flex; flex-direction: column; align-items: center;
  padding: 10px 0;
}
.gd-brand {
  width: 32px; height: 32px; flex: none; margin-bottom: 22px;
  display: grid; place-items: center;
  border-radius: 10px; background: var(--ink);
  box-shadow: 0 6px 14px -6px rgb(28 27 23 / .5);
}
.gd-lens {
  position: absolute; left: 50%; top: 0; z-index: 0;
  width: 38px; height: 40px; margin-left: -19px;
  border-radius: 12px; pointer-events: none; opacity: 0;
  background: rgb(255 255 255 / .8);
  box-shadow: inset 0 1px 0 #fff, 0 6px 16px -6px rgb(28 27 23 / .3);
  transition: transform .45s var(--ease-spring), height .3s var(--ease-out), opacity .2s;
}
#dock.is-open .gd-lens { opacity: 1; }
/* Icons move with transforms only, so nothing under the pointer reflows: the
   ones above part upward, the ones below part downward. */
.gd-btn {
  position: relative; z-index: 1; flex: none;
  width: 38px; height: 40px;
  display: grid; place-items: center;
  border: 0; border-radius: 12px; background: transparent;
  color: var(--ink-3); cursor: pointer;
  transform: translateY(var(--ty, 0px));
  transition: transform .14s var(--ease-out), color var(--d-micro) var(--ease-both);
  -webkit-tap-highlight-color: transparent;
}
.gd-btn svg { transform: scale(var(--s, 1)); transition: transform .14s var(--ease-out); }
.gd-btn:hover, #dock.is-open .gd-btn.is-on { color: var(--ink); }
.gd-btn:focus-visible { outline: 2px solid var(--ink); outline-offset: -2px; }
/* The section you are in, whether the glass is open or not. */
.gd-btn.is-here::after {
  content: ''; position: absolute; left: -4px; top: 50%;
  width: 3px; height: 16px; margin-top: -8px;
  border-radius: 2px; background: var(--ink);
}
.gd-bd {
  position: absolute; top: calc(50% - 20px * var(--s, 1)); right: -4px;
  min-width: 18px; height: 17px; padding: 0 4px;
  border-radius: 9px; border: 2px solid rgb(255 255 255 / .9);
  background: var(--held); color: #fff;
  font: 500 9.5px/13px var(--font-mono); text-align: center;
  transition: top .14s var(--ease-out);
}
.gd-grow { flex: 1; }
.gd-sep { width: 20px; height: 1px; flex: none; margin: 6px 0; background: rgb(28 27 23 / .1); }
#dock.is-pinned .gd-pin { color: var(--ink); }
#dock.is-pinned .gd-pin::before { content: ''; position: absolute; inset: 3px; border-radius: 10px; background: rgb(28 27 23 / .08); }

/* ------------------------------------------------------------ the pages
   Whatever the icon under the pointer holds. Hidden, not just transparent,
   while shut: a link nobody can see must not take a Tab. */
.gd-panel {
  position: absolute; top: 0; bottom: 0; right: 0; z-index: 1;
  left: calc(var(--dock-shut) - 14px);
  overflow: hidden;
  opacity: 0; visibility: hidden; pointer-events: none;
  transition: opacity .16s ease, visibility 0s linear .16s;
}
#dock.is-open .gd-panel { opacity: 1; visibility: visible; pointer-events: auto; transition: opacity .16s ease .1s, visibility 0s; }
.gd-view { position: absolute; inset: 12px 10px 12px 4px; min-width: 150px; display: flex; flex-direction: column; }
.gd-view.in-down { animation: gdInDown .32s var(--ease-out) both; }
.gd-view.in-up { animation: gdInUp .32s var(--ease-out) both; }
.gd-view.out { animation: gdOut .18s ease both; pointer-events: none; }
@keyframes gdInDown { from { opacity: 0; transform: translateY(-14px); } to { opacity: 1; transform: none; } }
@keyframes gdInUp { from { opacity: 0; transform: translateY(14px); } to { opacity: 1; transform: none; } }
@keyframes gdOut { to { opacity: 0; } }

.gd-head { padding: 4px 6px 10px; }
.gd-head b { display: block; font-size: var(--t-lg); font-weight: 800; letter-spacing: -.02em; line-height: 1.2; color: var(--ink); }
.gd-head span { display: block; margin-top: 2px; font-size: var(--t-sm); line-height: 1.35; color: var(--muted); }
.gd-list { flex: 1; min-height: 0; overflow-y: auto; scrollbar-width: thin; }

.gd-row {
  display: grid; grid-template-columns: 30px minmax(0, 1fr) auto; gap: 9px; align-items: center;
  width: 100%; padding: 7px 6px;
  border: 0; border-radius: 11px; background: transparent;
  color: var(--ink); text-align: left; text-decoration: none; cursor: pointer;
}
.gd-list:not(.gd-list--live) > .gd-row { animation: gdRowIn .3s var(--ease-out) both; }
.gd-list > .gd-row:nth-child(2) { animation-delay: .03s; }
.gd-list > .gd-row:nth-child(3) { animation-delay: .06s; }
.gd-list > .gd-row:nth-child(4) { animation-delay: .09s; }
.gd-list > .gd-row:nth-child(5) { animation-delay: .12s; }
.gd-list > .gd-row:nth-child(6) { animation-delay: .15s; }
@keyframes gdRowIn { from { opacity: 0; transform: translateX(-6px); } to { opacity: 1; transform: none; } }
.gd-row:hover { background: rgb(255 255 255 / .6); }
.gd-row:focus-visible { outline: 2px solid var(--ink); outline-offset: -2px; }
.gd-ico {
  width: 30px; height: 30px; display: grid; place-items: center;
  border-radius: 9px; background: rgb(255 255 255 / .6); box-shadow: inset 0 1px 0 #fff;
  color: var(--ink-3);
}
.gd-row.is-here .gd-ico { background: var(--ink); color: var(--ground); box-shadow: none; }
.gd-txt { min-width: 0; }
.gd-t { display: block; font-size: var(--t-md); font-weight: 600; line-height: 1.25; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.gd-d {
  display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 2; overflow: hidden;
  font-size: var(--t-sm); line-height: 1.35; color: var(--muted);
}
/* Scoped to the glass: the page keeps its own quiet counts on its tabs. */
.gd-c { font: 500 var(--t-prov)/1 var(--font-mono); color: #fff; background: var(--held); border-radius: var(--r-pill); padding: 3px 7px; }
.gd mark { background: #F6E4B8; color: inherit; border-radius: 3px; }
.gd-kbd {
  font: 500 var(--t-prov)/1 var(--font-mono); color: var(--muted);
  border: 1px solid var(--divider); border-radius: var(--r-tag);
  padding: 3px 5px; background: var(--surface-2);
}

.gd-find {
  display: flex; align-items: center; gap: 8px; flex: none;
  height: 36px; margin: 0 2px 10px; padding: 0 10px;
  border: 1px solid rgb(255 255 255 / .8); border-radius: 11px;
  background: rgb(255 255 255 / .55); color: var(--quiet);
  box-shadow: inset 0 1px 2px rgb(28 27 23 / .06);
}
.gd-find:focus-within { border-color: var(--ink); }
.gd-find input { flex: 1; min-width: 0; border: 0; outline: 0; background: transparent; font: inherit; font-size: var(--t-md); color: var(--ink); }
.gd-lbl { padding: 6px 6px 4px; font-size: var(--t-prov); font-weight: 700; letter-spacing: .09em; text-transform: uppercase; color: var(--quiet); }
.gd-empty { margin: 0; padding: 8px 6px; font-size: var(--t-base); color: var(--muted); }

.gd-credit {
  display: block; flex: none; margin: 8px 2px 0; padding: 10px 10px 11px;
  border-radius: 12px; background: rgb(255 255 255 / .5); box-shadow: inset 0 1px 0 #fff;
  color: var(--ink); text-decoration: none;
}
.gd-credit:hover { background: rgb(255 255 255 / .7); }
.gd-credit-h { display: flex; justify-content: space-between; gap: 8px; margin-bottom: 7px; font-size: var(--t-sm); color: var(--muted); }
.gd-credit-h .mono { color: var(--ink); font-size: var(--t-prov); }
.gd-credit-bar { display: block; height: 5px; border-radius: var(--r-pill); background: rgb(28 27 23 / .08); overflow: hidden; }
.gd-credit-bar span { display: block; height: 100%; border-radius: var(--r-pill); background: var(--accent); }

/* No pin on a phone: moving the page over by 20% there leaves no page. */
@media (max-width: 720px) {
  .gd-pin { display: none; }
}

@media (prefers-reduced-motion: reduce) {
  .gd, .gd-lens, .gd-btn, .gd-btn svg, .gd-panel, .shell { transition: none; }
  .gd-view, .gd-row { animation: none; }
}
