/*
 * « Votre avis sur MABIDO » (FeedbackTab.tsx, ticket #64): a tab fixed on the side, on every page with the new bar.
 * Mabido's colours (lime, ink, cream). Right edge half-way down (left in Arabic and Hebrew: logical properties);
 * under 1 000 px, a small tongue with a star only (its name stays for screen readers).
 * Everything is scoped under .fbt (it sits outside .hv2 and .iap).
 */
.fbt {
  --fb-ink: #0c0f0e;
  --fb-cream: #f5eee9;
  --fb-mist: #cfd8d2;
  --fb-lime: #a3ff47;
  --fb-line: rgba(163, 255, 71, 0.45);
  position: fixed;
  top: 50%;
  inset-inline-end: 0;
  z-index: 75;
  transform: translateY(-50%);
  font-family: 'DM Sans', system-ui, -apple-system, 'Segoe UI', sans-serif;
  -webkit-font-smoothing: antialiased;
  line-height: 1.3;
  /* the box itself takes no click: once the tab has slid out of the way, the link or the button under it gets the
     click (20/10/2026: the empty box still caught it) */
  pointer-events: none;
}
.fbt .fbt__tab,
.fbt .fbt__panel {
  pointer-events: auto;
}
.fbt *,
.fbt *::before,
.fbt *::after {
  box-sizing: border-box;
}

/* The tab: vertical label read from bottom to top, the star above it */
.fbt .fbt__tab {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  margin: 0;
  padding: 12px 7px;
  width: 36px;
  border: 0;
  border-start-start-radius: 10px;
  border-end-start-radius: 10px;
  background: var(--fb-lime);
  color: var(--fb-ink);
  font: inherit;
  font-size: 13.5px;
  font-weight: 800;
  letter-spacing: 0;
  cursor: pointer;
  box-shadow: 0 10px 26px -10px rgba(0, 0, 0, 0.55), 0 0 0 1px rgba(12, 15, 14, 0.35);
  transition: transform 0.25s ease, opacity 0.25s ease, background-color 0.2s;
}
.fbt .fbt__tab:hover {
  background: #b8ff73;
}
.fbt .fbt__l {
  writing-mode: vertical-rl;
  transform: rotate(180deg);
  white-space: nowrap;
}
.fbt .fbt__star {
  flex: none;
  width: 15px;
  height: 15px;
  fill: currentColor;
}
/* ink ring inside a lime ring: visible on the dark and on the cream pages */
.fbt .fbt__tab:focus-visible,
.fbt .fbt__x:focus-visible,
.fbt .fbt__btn:focus-visible {
  outline: 3px solid var(--fb-ink);
  outline-offset: 2px;
  box-shadow: 0 0 0 7px var(--fb-lime);
}
.fbt.is-open .fbt__tab {
  background: #b8ff73;
}

/* Something important passes under the tab (FeedbackTab.tsx, watchAside): it slides out of the screen and comes back
   once it has gone by. Never while its panel is open or while it has the keyboard focus. */
.fbt[data-aside]:not(.is-open) .fbt__tab:not(:focus-visible) {
  opacity: 0;
  transform: translateX(110%);
  pointer-events: none;
}
[dir='rtl'] .fbt[data-aside]:not(.is-open) .fbt__tab:not(:focus-visible) {
  transform: translateX(-110%);
}

/* The panel, beside the tab */
.fbt .fbt__panel {
  position: absolute;
  top: 50%;
  inset-inline-end: calc(100% + 10px);
  width: min(300px, calc(100vw - 36px - 24px));
  padding: 18px 18px 18px;
  border: 1px solid var(--fb-line);
  border-radius: 14px;
  background: var(--fb-ink);
  color: var(--fb-cream);
  box-shadow: 0 24px 50px -18px rgba(0, 0, 0, 0.7);
  transform: translateY(-50%);
  animation: fbt-in 0.2s ease-out both;
}
.fbt .fbt__panel[hidden] {
  display: none;
}
@keyframes fbt-in {
  from {
    opacity: 0;
    transform: translateY(-50%) translateX(8px);
  }
  to {
    opacity: 1;
    transform: translateY(-50%);
  }
}
[dir='rtl'] .fbt .fbt__panel {
  animation-name: fbt-in-rtl;
}
@keyframes fbt-in-rtl {
  from {
    opacity: 0;
    transform: translateY(-50%) translateX(-8px);
  }
  to {
    opacity: 1;
    transform: translateY(-50%);
  }
}
.fbt .fbt__q {
  margin: 0 0 6px;
  margin-inline-end: 30px;
  font-size: 17px;
  font-weight: 800;
  line-height: 1.25;
  color: var(--fb-cream);
}
.fbt .fbt__s {
  margin: 0 0 14px;
  font-size: 13.5px;
  line-height: 1.45;
  color: var(--fb-mist);
}
.fbt .fbt__btn,
.fbt .fbt__btn:visited {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  width: 100%;
  min-height: 44px;
  padding: 10px 14px;
  border-radius: 999px;
  background: var(--fb-lime);
  color: var(--fb-ink);
  font-size: 14.5px;
  font-weight: 800;
  text-align: center;
  text-decoration: none;
}
.fbt .fbt__btn:hover {
  background: #b8ff73;
  color: var(--fb-ink);
}
.fbt .fbt__x {
  position: absolute;
  top: 8px;
  inset-inline-end: 8px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  padding: 0;
  border: 0;
  border-radius: 999px;
  background: transparent;
  color: var(--fb-cream);
  cursor: pointer;
}
.fbt .fbt__x:hover {
  background: rgba(255, 255, 255, 0.08);
}
.fbt .fbt__x svg {
  width: 15px;
  height: 15px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
}
.fbt .fbt__sr {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
}

/* Phone and tablet: the margin beside the text is narrow, so the tab is only a small tongue with its star. */
@media (max-width: 999px) {
  .fbt .fbt__tab {
    width: 26px;
    height: 48px;
    padding: 0;
    justify-content: center;
    border-start-start-radius: 9px;
    border-end-start-radius: 9px;
  }
  .fbt .fbt__l {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip: rect(0 0 0 0);
    white-space: nowrap;
  }
  .fbt .fbt__star {
    width: 14px;
    height: 14px;
  }
  .fbt .fbt__panel {
    inset-inline-end: calc(100% + 8px);
    width: min(300px, calc(100vw - 26px - 24px));
  }
}

@media (prefers-reduced-motion: reduce) {
  .fbt .fbt__tab {
    transition: opacity 0.2s;
  }
  .fbt[data-aside]:not(.is-open) .fbt__tab:not(:focus-visible),
  [dir='rtl'] .fbt[data-aside]:not(.is-open) .fbt__tab:not(:focus-visible) {
    transform: none;
  }
  .fbt .fbt__panel,
  [dir='rtl'] .fbt .fbt__panel {
    animation: none;
  }
}

@media print {
  .fbt {
    display: none;
  }
}
