/* <liquid-dock> — mobile glass bottom bar (companion to liquid-sidebar).
   Light DOM, requires tokens.css. Hidden on desktop. */

liquid-dock {
  display: block;
  position: fixed;
  left: 12px;
  right: 12px;
  bottom: calc(12px + env(safe-area-inset-bottom)); /* clear the home indicator */
  height: 72px;
  z-index: 900;
  font-family: inherit; /* keep the app font (Plus Jakarta Sans), not the Inside-SG Trebuchet */
}

@media (min-width: 768px) {
  liquid-dock {
    display: none !important;
  }
}

.ldk-float {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  height: 72px; /* driven by JS spring */
  transform-origin: 50% 100%; /* hop squash/stretch anchors at the base */
}

/* Standout: deep two-tier shadow lifts the dock off busy content.
   On the sibling layer because clip-path clips an element's own shadow. */
.ldk-shadow {
  position: absolute;
  inset: 0;
  border-radius: var(--radius-panel);
  box-shadow:
    0 16px 40px rgb(0 0 0 / 0.35),
    0 3px 10px rgb(0 0 0 / 0.28);
}

/* Same engine split as the sidebar: this layer carries clip-path +
   backdrop-filter for Chromium/Firefox; removed by JS on WebKit, where
   .ldk-panel's blur works through the clipped wrapper instead. */
.ldk-blur {
  position: absolute;
  inset: 0;
  -webkit-backdrop-filter: blur(16px);
  backdrop-filter: blur(16px);
}

.ldk-clip {
  position: relative;
  height: 100%;
  /* clip-path driven by JS */
}

/* Accent fill rendered in the notch cutout — clipped by JS to the
   notch's exact shape so it stretches with the droplet morph */
.ldk-notch {
  position: absolute;
  inset: 0;
  background: var(--accent);
  pointer-events: none;
}

.ldk-panel {
  height: 100%;
  border-radius: var(--radius-panel);
  background: var(--ink);
  background: color-mix(in srgb, var(--ink) 80%, transparent);
  /* hairline glass-edge highlight, inset so the clip doesn't shave it */
  box-shadow: inset 0 0 0 1px rgb(255 255 255 / 0.14);
  -webkit-backdrop-filter: blur(16px);
  backdrop-filter: blur(16px);
  color: var(--canvas);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

/* --- expanded sheet --- */

.ldk-sheet {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  /* horizontal padding only: vertical space lives on .ldk-header, so the
     collapsed sheet truly occupies 0px and the row isn't pushed down */
  padding: 0 16px;
  opacity: 0;
  transition: opacity 140ms ease-in;
}
liquid-dock[data-open] .ldk-sheet {
  opacity: 1;
  transition: opacity 220ms ease-out 80ms;
}

.ldk-header {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 20px 4px 14px;
}

.ldk-logo {
  width: 36px;
  height: 36px;
  flex-shrink: 0;
  border-radius: 12px;
  display: grid;
  place-items: center;
  color: #fff;
  border: 2px solid var(--accent);
  overflow: hidden;
  box-sizing: border-box;
}
.ldk-logo svg { width: 16px; height: 16px; }
.ldk-logo .lsb-avatar { width: 100%; height: 100%; object-fit: cover; }
.ldk-logo .lsb-avatar-initial { font-size: 15px; font-weight: 700; color: #fff; line-height: 1; }

.ldk-brand { line-height: 1.25; }
.ldk-brand-name { display: block; font-size: 15px; font-weight: 600; }
.ldk-brand-sub { display: block; font-size: 11px; opacity: 0.5; }

.ldk-list {
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding-bottom: 22px; /* keeps Sign Out clear of the collapse caret */
}

.ldk-item {
  display: flex;
  align-items: center;
  /* 20px lines label starts up with the sheet header's brand text
     (36px logo + 10px gap vs 18px icons) */
  gap: 20px;
  border-radius: 999px;
  padding: 11px 12px;
  font-size: 15px;
  font-weight: 500;
  text-decoration: none;
  color: color-mix(in srgb, var(--canvas) 60%, transparent);
  /* cascade in with the open spring */
  opacity: 0;
  transform: translateY(10px);
  transition: opacity 100ms ease-in, transform 100ms ease-in;
}
liquid-dock[data-open] .ldk-item {
  opacity: 1;
  transform: none;
  transition: opacity 200ms ease-out, transform 200ms ease-out;
  transition-delay: calc(60ms + var(--ldk-i, 0) * 22ms);
}
@media (prefers-reduced-motion: reduce) {
  .ldk-item { transition-duration: 1ms; transition-delay: 0ms !important; }
}
.ldk-item:active {
  background: color-mix(in srgb, var(--item-accent, var(--accent)) 22%, transparent);
}
.ldk-item.lsb-active {
  color: #fff;
  font-weight: 600;
}

/* Placeholder nav items: dimmed and inert — no navigation, no active state.
   These never carry data-mobile, so they don't reach the collapsed row. */
.ldk-item[data-placeholder] {
  opacity: 0.45;
  pointer-events: none;
}
.ldk-item.lsb-active .ldk-icon {
  color: var(--item-accent, var(--accent));
}

.ldk-icon {
  width: 18px;
  height: 18px;
  flex-shrink: 0;
  display: grid;
  place-items: center;
}
.ldk-icon svg { width: 18px; height: 18px; }
.ldk-icon img {
  width: 18px;
  height: 18px;
  border-radius: 3px;
  object-fit: cover;
  display: block;
}
/* easyLink image icons on white chips, as in the sidebar */
.ldk-item.lsb-easylink .ldk-icon {
  width: 28px;
  height: 28px;
  margin: -5px;
  padding: 5px;
  box-sizing: border-box;
  background: #fff;
  border-radius: 7px;
}

/* Edit-mode toggle states (set by editor.js) */
#dock-editor-toggle.is-on .ldk-icon,
#dock-editor-toggle.is-on .ldk-label {
  color: #fbbf24;
}

/* --- grabber + icon row --- */

.ldk-handle {
  flex-shrink: 0;
  height: 18px;
  display: grid;
  place-items: center;
  background: none;
  border: 0;
  padding: 0;
  cursor: pointer;
  transition: height 200ms ease;
}
/* Bigger collapse target while open — Sign Out sits right above it */
liquid-dock[data-open] .ldk-handle {
  height: 34px;
}
.ldk-handle span {
  width: 36px;
  height: 4px;
  border-radius: 2px;
  background: rgb(255 255 255 / 0.25);
}

.ldk-row {
  flex-shrink: 0;
  height: 54px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 0 8px 14px; /* lifts icons clear of the bottom-edge notch */
  transition: height 220ms ease, opacity 140ms ease, padding 220ms ease;
  overflow: hidden;
}
/* Decorative when collapsed; folds away when the menu opens */
liquid-dock[data-open] .ldk-row {
  height: 0;
  padding-top: 0;
  padding-bottom: 0;
  opacity: 0;
}
liquid-dock:not([data-open]) .ldk-float {
  cursor: pointer;
}

.ldk-tab {
  width: 44px;
  height: 44px;
  display: grid;
  place-items: center;
  color: color-mix(in srgb, var(--canvas) 60%, transparent);
}
.ldk-tab .ldk-icon,
.ldk-tab .ldk-icon svg {
  width: 24px;
  height: 24px;
}
.ldk-tab.lsb-active {
  color: var(--item-accent, var(--accent));
}

.ldk-scrim {
  position: fixed;
  inset: 0;
  background: rgb(0 0 0 / 0.45);
}

/* Sign-out: a menu-item-styled submit button in a bare POST form, last in the
   expanded list. */
.ldk-signout-form { margin: 0; }
.ldk-signout {
  width: 100%;
  background: none;
  border: 0;
  cursor: pointer;
  font: inherit;
  text-align: left;
}

/* --- pre-upgrade state: styled icon row so there is no flash --- */

@media (max-width: 767px) {
  liquid-dock:not(:defined) {
    display: flex;
    align-items: center;
    justify-content: space-around;
    background: var(--ink, #1c1b1a);
    background: color-mix(in srgb, var(--ink, #1c1b1a) 80%, transparent);
    -webkit-backdrop-filter: blur(16px);
    backdrop-filter: blur(16px);
    border-radius: var(--radius-panel, 24px);
    overflow: hidden;
  }
  liquid-dock:not(:defined) > a {
    display: grid;
    place-items: center;
    width: 44px;
    height: 44px;
    font-size: 0; /* hide label text until the component builds */
    color: color-mix(in srgb, var(--canvas, #f6f3ee) 60%, transparent);
  }
  liquid-dock:not(:defined) > a svg {
    width: 24px;
    height: 24px;
  }
  liquid-dock:not(:defined) > a[data-footer],
  liquid-dock:not(:defined) > a:not([data-mobile]) {
    display: none;
  }
  liquid-dock:not(:defined) > a.lsb-active {
    color: var(--accent, #ff5c33);
  }
}

/* ── Masquerade ("viewing as") — menu item + collapsed-row cue ─────────────── */
.ldk-masq {
  background: rgb(245 158 11 / 0.14);
  border-radius: 12px;
  color: #b45309;
  border: 0;
  font: inherit;
  cursor: pointer;
  text-align: left;
  width: 100%;
}
.ldk-masq .ldk-icon { color: #d97706; }
.ldk-masq .ldk-label b { font-weight: 700; }
.ldk-masq-cue .ldk-icon { color: #d97706; }

/* Masquerade: pulsing amber ring on the sheet-header avatar (same cue as the
   rail); the collapsed icon-row eye cue remains the always-visible signal. */
@keyframes masq-pulse-dock {
  0%   { box-shadow: 0 0 0 0 rgb(245 158 11 / 0.65); }
  70%  { box-shadow: 0 0 0 8px rgb(245 158 11 / 0); }
  100% { box-shadow: 0 0 0 0 rgb(245 158 11 / 0); }
}
liquid-dock[masq-name] .ldk-logo {
  border-color: #f59e0b;
  animation: masq-pulse-dock 2s ease-out infinite;
}
@media (prefers-reduced-motion: reduce) {
  liquid-dock[masq-name] .ldk-logo {
    animation: none;
    box-shadow: 0 0 0 3px rgb(245 158 11 / 0.55);
  }
}
