/* Point A “site bar” credit — fixed corner widget (homepage, pilot, partner, iframe hub) */
@import url("https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600&display=swap");

.sitebar-badge {
  --badge-height: 44px;
  --badge-padding: 6px;
  --badge-radius: 999px;

  --shell-bg-top: #fafaf8;
  --shell-bg-bot: #ececea;
  --shell-border: rgba(0, 0, 0, 0.08);
  --shell-inner-top: rgba(255, 255, 255, 0.9);
  --shell-inner-bot: rgba(0, 0, 0, 0.05);
  --shell-text: #9a9a96;

  --pill-width: 108px;
  --pill-text: #f0f0ee;

  --pill-hl: rgba(255, 255, 255, 0.14);    /* top-left highlight */
  --pill-mid: #1a1a1a;                     /* main body */
  --pill-shadow: rgba(0, 0, 0, 0.85);      /* bottom-right shadow direction */

  --sitebar-transition: 240ms cubic-bezier(0.22, 1, 0.36, 1);

  position: fixed;
  /* Inset from device edges + safe areas so nothing sits under the home indicator / display radius.
     Slightly larger base padding than pre–safe-area (16px) shifts the whole badge inward without
     squashing the pill (requires viewport-fit=cover on <meta viewport>). */
  right: calc(24px + env(safe-area-inset-right, 0px));
  bottom: calc(20px + env(safe-area-inset-bottom, 0px));
  z-index: 90;

  /* Safari shrink-to-fit for position:fixed + inline-flex can under-estimate width; the shell
     then ends narrower than label+gap+pill and the pill spills past the viewport (body overflow-x
     clips). max-content locks the box to the real intrinsic width. */
  width: max-content;
  display: inline-flex;
  align-items: center;
  justify-content: flex-start;
  gap: 8px;
  height: var(--badge-height);
  padding: var(--badge-padding);
  padding-left: 14px;
  /* Extra right inset keeps the pill's rounded corner in the shell's straight zone (Safari clips
     nested rounded corners when they sit in the outer capsule's curve + overflow:hidden). */
  padding-right: 10px;
  box-sizing: border-box;

  background: linear-gradient(180deg, var(--shell-bg-top) 0%, var(--shell-bg-bot) 100%);
  border: 1px solid var(--shell-border);
  border-radius: var(--badge-radius);
  text-decoration: none;
  user-select: none;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  /* Do NOT clip: Safari under-estimates the shell's intrinsic width vs. flex children, so
     overflow:hidden chops the pill to e.g. "Poir". The pill already sits inside 6px padding
     so its corners are in the shell's straight zone — no clip needed. */
  overflow: visible;
  isolation: isolate;
  box-shadow:
    0 10px 24px rgba(0, 0, 0, 0.08),
    0 3px 8px rgba(0, 0, 0, 0.05),
    inset 0 1px 0 var(--shell-inner-top),
    inset 0 -1px 0 var(--shell-inner-bot);
  transition:
    transform var(--sitebar-transition),
    box-shadow var(--sitebar-transition),
    background var(--sitebar-transition);
}

.sitebar-badge__label,
.sitebar-badge__pill {
  position: relative;
  z-index: 1;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  line-height: 1;
  white-space: nowrap;
}

.sitebar-badge__label {
  flex-shrink: 0;
  padding-inline: 4px;
  color: var(--shell-text);
  font-size: 12.5px;
  font-weight: 500;
  letter-spacing: -0.005em;
  transition: color var(--sitebar-transition);
}

/* Black pill — diagonal shading: light top-left → dark bottom-right */
.sitebar-badge__pill {
  /* Explicit width + flex:none: Safari's max-content on an inline-flex parent doesn't always
     respect a child's flex-basis, under-sizing the shell. width is honored reliably. */
  flex: none;
  width: var(--pill-width);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  height: calc(var(--badge-height) - (var(--badge-padding) * 2));
  border-radius: calc(var(--badge-radius) - 6px);
  background:
    /* corner highlight + shadow blend */
    radial-gradient(120% 160% at 0% 0%, rgba(255, 255, 255, 0.22) 0%, rgba(255, 255, 255, 0) 55%),
    radial-gradient(140% 160% at 100% 100%, rgba(0, 0, 0, 0.55) 0%, rgba(0, 0, 0, 0) 60%),
    linear-gradient(135deg, #2a2a2a 0%, #151515 45%, #060606 100%);
  color: var(--pill-text);
  font-size: 13px;
  font-weight: 500;
  letter-spacing: 0.01em;
  box-shadow:
    0 1px 0 rgba(255, 255, 255, 0.04) inset,        /* top edge catch */
    0 -1px 0 rgba(0, 0, 0, 0.6) inset,              /* bottom edge shade */
    0 8px 16px rgba(0, 0, 0, 0.22),                 /* drop */
    0 1px 2px rgba(0, 0, 0, 0.35);
  transition:
    background var(--sitebar-transition),
    color var(--sitebar-transition),
    box-shadow var(--sitebar-transition),
    transform var(--sitebar-transition);
}

/* Whole badge hover: tiny settle */
.sitebar-badge:hover {
  transform: translateY(0.5px);
  box-shadow:
    0 8px 20px rgba(0, 0, 0, 0.07),
    0 2px 6px rgba(0, 0, 0, 0.04),
    inset 0 1px 0 rgba(255, 255, 255, 0.85),
    inset 0 -1px 0 rgba(0, 0, 0, 0.06);
}

.sitebar-badge:hover .sitebar-badge__label {
  color: #8a8a86;
}

/* Pill hover: flip to LIGHT neumorphic — debossed / pushed into the shell */
.sitebar-badge:hover .sitebar-badge__pill {
  color: #2a2a2a;
  transform: none;
  background: linear-gradient(180deg, #ececea 0%, #f4f4f2 100%);
  box-shadow:
    /* neumorphic deboss — balanced: dark from top-left, softer light from bottom-right */
    inset 2px 2px 5px rgba(0, 0, 0, 0.14),
    inset -2px -2px 5px rgba(255, 255, 255, 0.55),
    inset 0 0 0 1px rgba(0, 0, 0, 0.05),
    0 0 0 1px rgba(0, 0, 0, 0.03);
}

.sitebar-badge:active .sitebar-badge__pill {
  transform: none;
  box-shadow:
    inset 3px 3px 6px rgba(0, 0, 0, 0.18),
    inset -2px -2px 5px rgba(255, 255, 255, 0.5),
    inset 0 0 0 1px rgba(0, 0, 0, 0.06);
}

@media (max-width: 420px) {
  .sitebar-badge {
    --badge-height: 40px;
    --pill-width: 94px;
    gap: 6px;
    padding-left: 12px;
    right: calc(18px + env(safe-area-inset-right, 0px));
    bottom: calc(16px + env(safe-area-inset-bottom, 0px));
  }

  .sitebar-badge__label { font-size: 11.5px; }
  .sitebar-badge__pill  { font-size: 12px; }
}

@media (prefers-reduced-motion: reduce) {
  .sitebar-badge,
  .sitebar-badge__label,
  .sitebar-badge__pill {
    transition: none;
  }

  .sitebar-badge:hover,
  .sitebar-badge:hover .sitebar-badge__pill,
  .sitebar-badge:active .sitebar-badge__pill {
    transform: none;
  }
}
