/*
 * The website plugins (components/Plugins.tsx, public/js/lib/plugins.js): the video-call and assistant buttons at the
 * bottom left (the floating buttons of Fabs are at the bottom right), the assistant's panel and the cookie notice.
 * Loaded only on pages that show one of them. The colours are the site's own (site.css), so the dark theme follows.
 */

app-plugins {
  display: contents;
}

/* ── the buttons ── */

.lnp-dock {
  position: fixed;
  left: 24px;
  bottom: calc(24px + env(safe-area-inset-bottom));
  /* level with the floating buttons: under the header and its drawer, over the page */
  z-index: 40;
}

/* (lifted by public/js/lib/plugins.js above a section's own controls, as the floating buttons are) */
.lnp-dock__stack {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 10px;
  transform: translateY(calc(-1 * var(--lift, 0px)));
  transition: transform 0.25s ease, opacity 0.2s, visibility 0.2s;
}
.lnp-dock.is-away .lnp-dock__stack {
  opacity: 0;
  visibility: hidden;
}
/* (the assistant's panel open: it takes the corner, its own button closes it) */
.lnp-dock.is-covered {
  visibility: hidden;
}

.lnp-dock__item {
  position: relative;
  display: flex;
  align-items: center;
}

.lnp-btn {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  height: 52px;
  min-width: 52px;
  padding: 0 14px;
  border: 1px solid var(--edge-strong, #ddd5d1);
  border-radius: 999px;
  background: var(--surface, #fff);
  color: var(--ink, #171312);
  font: inherit;
  font-size: 14px;
  font-weight: 600;
  box-shadow: 0 6px 18px rgba(23, 19, 18, 0.14);
  cursor: pointer;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}
.lnp-btn:hover {
  transform: translateY(-1px);
  box-shadow: 0 10px 24px rgba(23, 19, 18, 0.18);
}
.lnp-btn:focus-visible {
  outline: 2px solid var(--red, #d71a21);
  outline-offset: 3px;
}
.lnp-btn[aria-busy='true'] {
  cursor: progress;
  opacity: 0.75;
}
.lnp-btn svg {
  width: 22px;
  height: 22px;
  flex: none;
  fill: none;
  stroke: var(--red, #d71a21);
  stroke-width: 1.7;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.lnp-hello {
  position: absolute;
  left: 0;
  bottom: calc(100% + 10px);
  width: max-content;
  max-width: min(280px, calc(100vw - 48px));
  margin: 0;
  padding: 10px 12px;
  border: 1px solid var(--edge-strong, #ddd5d1);
  border-radius: 12px;
  background: var(--surface, #fff);
  color: var(--ink, #171312);
  font-size: 13px;
  line-height: 1.45;
  box-shadow: 0 6px 18px rgba(23, 19, 18, 0.14);
  cursor: pointer;
}
.lnp-hello[hidden] {
  display: none;
}

/* ── the assistant's panel ── */

.lnp-panel {
  position: fixed;
  left: 24px;
  bottom: calc(24px + env(safe-area-inset-bottom));
  z-index: 45;
  display: flex;
  flex-direction: column;
  width: min(380px, calc(100vw - 32px));
  height: min(600px, calc(100vh - 48px));
  height: min(600px, calc(100dvh - 48px));
  border: 1px solid var(--edge-strong, #ddd5d1);
  border-radius: 16px;
  background: var(--surface, #fff);
  box-shadow: 0 18px 48px rgba(23, 19, 18, 0.24);
  overflow: hidden;
}
.lnp-panel[hidden] {
  display: none;
}
.lnp-panel__head {
  display: flex;
  align-items: baseline;
  gap: 8px;
  padding: 12px 12px 12px 16px;
  border-bottom: 1px solid var(--line, rgba(23, 19, 18, 0.1));
  color: var(--ink, #171312);
}
.lnp-panel__sub {
  flex: 1;
  color: var(--muted, #6d6460);
  font-size: 13px;
}
.lnp-panel__close {
  display: grid;
  place-items: center;
  width: 36px;
  height: 36px;
  border: 0;
  border-radius: 50%;
  background: transparent;
  color: var(--ink, #171312);
  cursor: pointer;
}
.lnp-panel__close:hover {
  background: var(--surface-2, #f6f2ef);
}
.lnp-panel__close:focus-visible {
  outline: 2px solid var(--red, #d71a21);
  outline-offset: 1px;
}
.lnp-panel__close svg {
  width: 18px;
  height: 18px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
}
.lnp-panel__body {
  flex: 1;
  min-height: 0;
}
.lnp-panel__body iframe {
  display: block;
  width: 100%;
  height: 100%;
  border: 0;
  background: var(--surface, #fff);
}

/* ── the cookie notice ── */

.lnp-consent {
  position: fixed;
  left: 50%;
  bottom: calc(24px + env(safe-area-inset-bottom));
  /* over the floating buttons (they step up while it shows), under the header's drawer and the popups */
  z-index: 45;
  display: flex;
  align-items: center;
  gap: 16px;
  width: min(720px, calc(100vw - 32px));
  padding: 14px 16px;
  border: 1px solid var(--edge-strong, #ddd5d1);
  border-radius: 14px;
  background: var(--surface, #fff);
  color: var(--ink, #171312);
  box-shadow: 0 12px 32px rgba(23, 19, 18, 0.18);
  transform: translateX(-50%);
}
.lnp-consent[hidden] {
  display: none;
}
.lnp-consent__text {
  flex: 1;
  margin: 0;
  font-size: 14px;
  line-height: 1.5;
}
.lnp-consent__text a {
  color: inherit;
  text-decoration: underline;
}
.lnp-consent__actions {
  display: flex;
  gap: 8px;
  flex: none;
}
.lnp-consent__actions button {
  min-height: 40px;
  padding: 0 16px;
  border-radius: 999px;
  font: inherit;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
}
.lnp-consent__actions button:focus-visible {
  outline: 2px solid var(--red, #d71a21);
  outline-offset: 2px;
}
.lnp-consent__min {
  border: 1px solid var(--edge-strong, #ddd5d1);
  background: transparent;
  color: var(--ink, #171312);
}
.lnp-consent__ok {
  border: 1px solid var(--red, #d71a21);
  background: var(--red, #d71a21);
  color: #fff;
}

/* while the notice shows, the buttons of both corners step up above it */
.lnp-consent-open .lnp-dock {
  bottom: calc(24px + env(safe-area-inset-bottom) + var(--lnp-consent-h, 0px));
}
.lnp-consent-open app-fabs .fabs {
  bottom: calc(24px + env(safe-area-inset-bottom) + var(--lnp-consent-h, 0px));
}

@media (max-width: 720px) {
  .lnp-dock {
    left: 16px;
    bottom: calc(16px + env(safe-area-inset-bottom));
  }
  /* round buttons only: their names are read out, not shown */
  .lnp-btn {
    width: 52px;
    padding: 0;
    justify-content: center;
  }
  .lnp-btn__label {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip: rect(0 0 0 0);
    white-space: nowrap;
  }
  .lnp-panel {
    left: 16px;
    bottom: calc(16px + env(safe-area-inset-bottom));
    height: min(640px, calc(100vh - 32px));
    height: min(640px, calc(100dvh - 32px));
  }
  .lnp-consent {
    bottom: calc(12px + env(safe-area-inset-bottom));
    flex-direction: column;
    align-items: stretch;
    gap: 10px;
  }
  .lnp-consent__actions button {
    flex: 1;
  }
  .lnp-consent-open .lnp-dock {
    bottom: calc(16px + env(safe-area-inset-bottom) + var(--lnp-consent-h, 0px));
  }
  .lnp-consent-open app-fabs .fabs {
    bottom: calc(16px + env(safe-area-inset-bottom) + var(--lnp-consent-h, 0px));
  }
}

@media (prefers-reduced-motion: reduce) {
  .lnp-btn,
  .lnp-dock__stack {
    transition: none;
  }
  .lnp-btn:hover {
    transform: none;
  }
}

@media print {
  app-plugins {
    display: none;
  }
}
