/* bugchip.css — the report button that sits in the lower right of every page.
 *
 * It is a piece of glass: the page shows through it, the light bends. Pressed,
 * it gives under the finger; released, it springs back. Opening, the panel
 * grows out of the chip itself rather than arriving from somewhere else, so
 * the thing you touched is visibly the thing that opened.
 *
 * Depends on motion.css for the easing vocabulary; every var() has a literal
 * fallback so the chip is still correct on a page that forgot to load it.
 */

.bugchip {
  position: fixed; z-index: 9400;
  right: calc(14px + env(safe-area-inset-right));
  /* Home docks the nav spine at the bottom and it owns z-index 9600 — a chip
     parked at bottom:14px is under it and cannot be tapped. --bnav-clear is
     the spine's own height (safe area included); pages without a spine never
     define it and fall back to the bare inset. */
  bottom: calc(14px + var(--bnav-clear, env(safe-area-inset-bottom, 0px)));
  width: 52px; height: 52px; border-radius: 50%;
  display: grid; place-items: center;
  border: 1px solid rgba(255, 255, 255, .40);
  background:
    linear-gradient(155deg, rgba(255,255,255,.34), rgba(255,255,255,.06) 46%, rgba(42,27,13,.10)),
    rgba(42, 27, 13, .30);
  backdrop-filter: blur(16px) saturate(180%);
  -webkit-backdrop-filter: blur(16px) saturate(180%);
  box-shadow:
    0 8px 22px rgba(42, 27, 13, .26),
    0 1px 0 rgba(255, 255, 255, .48) inset,
    0 -8px 14px rgba(42, 27, 13, .10) inset;
  color: #FDFCF7;
  cursor: pointer; padding: 0;
  -webkit-tap-highlight-color: transparent;
  transition:
    transform 420ms var(--ease-spring, cubic-bezier(.34,1.56,.64,1)),
    box-shadow 300ms var(--ease-smooth, ease),
    opacity 300ms var(--ease-smooth, ease);
}
.bugchip svg { width: 23px; height: 23px; display: block; pointer-events: none; }

/* squish: the glass compresses and the shadow pulls in under it */
.bugchip.press {
  transform: scale(.86);
  transition-duration: 110ms;
  transition-timing-function: var(--ease-exit, cubic-bezier(.4,0,.8,.4));
  box-shadow:
    0 3px 8px rgba(42, 27, 13, .30),
    0 1px 0 rgba(255, 255, 255, .34) inset,
    0 -4px 10px rgba(42, 27, 13, .16) inset;
}
@media (hover: hover) {
  .bugchip:hover { transform: translateY(-2px) scale(1.04); }
  .bugchip:hover.press { transform: scale(.86); }
}
/* while the panel is open the chip stays down, as the thing it grew out of */
.bugchip.open { transform: scale(.72); opacity: .5; }
.bugchip[hidden] { display: none; }

/* --- the panel ---------------------------------------------------------- */
.bugveil {
  /* above the nav spine (9600) — a sheet with the nav punched through it
     reads as broken, and the spine's blur would fight the veil's */
  position: fixed; inset: 0; z-index: 9700;
  background: rgba(42, 27, 13, .40);
  backdrop-filter: blur(3px); -webkit-backdrop-filter: blur(3px);
  display: flex; align-items: flex-end; justify-content: flex-end;
  padding: 14px;
  animation: bcVeilIn 260ms var(--ease-smooth, ease-out) both;
}
@keyframes bcVeilIn { from { opacity: 0; } to { opacity: 1; } }
.bugveil[hidden] { display: none; }
.bugveil.closing { animation: bcVeilOut 200ms var(--ease-exit, ease-in) both; }
@keyframes bcVeilOut { to { opacity: 0; } }

.bugpanel {
  /* grows out of the chip: the origin is the corner the chip lives in */
  transform-origin: calc(100% - 26px) calc(100% - 26px);
  width: 100%; max-width: 420px; max-height: min(86dvh, 720px);
  overflow-y: auto; overscroll-behavior: contain;
  background: var(--pg-card, #FFFDF8);
  border: 1px solid var(--pg-rule-strong, rgba(42,27,13,.20));
  border-radius: 18px;
  box-shadow: 0 24px 60px rgba(42, 27, 13, .30);
  padding: 18px 18px calc(18px + env(safe-area-inset-bottom));
  animation: bcPanelIn 460ms var(--ease-emph, cubic-bezier(.16,1.05,.3,1)) both;
}
@keyframes bcPanelIn {
  from { opacity: 0; transform: scale(.24) translate(18px, 22px); }
  to   { opacity: 1; transform: none; }
}
.bugveil.closing .bugpanel {
  animation: bcPanelOut 200ms var(--ease-exit, cubic-bezier(.4,0,.8,.4)) both;
}
@keyframes bcPanelOut {
  to { opacity: 0; transform: scale(.28) translate(18px, 22px); }
}

.bugpanel h2 {
  font-family: var(--pg-head, Fraunces, Georgia, serif);
  font-size: 19px; font-weight: 600; margin: 0 0 2px;
  color: var(--pg-ink, #2A1B0D); letter-spacing: -.01em;
}
.bugpanel .bc-lede {
  font-size: 12.5px; line-height: 1.5; margin: 0 0 14px;
  color: var(--pg-mute, #6E6257);
}
.bugpanel label {
  display: block; font-family: var(--pg-mono, "JetBrains Mono", monospace);
  font-size: 10.5px; letter-spacing: .10em; text-transform: uppercase;
  color: var(--pg-mute, #6E6257); margin: 12px 0 5px;
}
.bugpanel input[type="text"], .bugpanel textarea, .bugpanel select {
  width: 100%; box-sizing: border-box;
  background: var(--pg-sunk, #F7F3EA);
  border: 1px solid var(--pg-rule, rgba(42,27,13,.14));
  border-radius: 10px; padding: 10px 11px;
  font: inherit; font-size: 14px; color: var(--pg-ink, #2A1B0D);
}
.bugpanel textarea { min-height: 96px; resize: vertical; line-height: 1.5; }
.bugpanel input[type="text"]:focus, .bugpanel textarea:focus, .bugpanel select:focus {
  outline: none; border-color: var(--pg-primary, #2D5016);
  box-shadow: 0 0 0 3px rgba(45, 80, 22, .14);
}

.bc-shots { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 6px; }
/* the input has to be in the document for iOS to open the picker, but it is
   never the control the person sees — the doors are */
.bc-file { position: absolute; width: 1px; height: 1px; opacity: 0; pointer-events: none; }
.bc-shot {
  position: relative; width: 68px; height: 68px; border-radius: 10px;
  overflow: hidden; border: 1px solid var(--pg-rule, rgba(42,27,13,.14));
  animation: m-pop-in 340ms var(--ease-spring, ease-out) both;
}
.bc-shot img { width: 100%; height: 100%; object-fit: cover; display: block; }
.bc-shot button {
  position: absolute; top: 3px; right: 3px; width: 20px; height: 20px;
  border-radius: 50%; border: none; padding: 0; line-height: 1;
  background: rgba(42, 27, 13, .70); color: #fff; font-size: 13px;
}
.bc-shot .bc-shot-x { font-size: 13px; }
.bc-shots.busy { opacity: .55; pointer-events: none; }
.bc-gallery { margin: 10px 0 2px; }
.bc-gallery .bc-shot { width: 84px; height: 84px; display: block; }

.bc-add {
  width: 68px; height: 68px; border-radius: 10px;
  border: 1px dashed var(--pg-rule-strong, rgba(42,27,13,.28));
  background: var(--pg-sunk, #F7F3EA); color: var(--pg-mute, #6E6257);
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 3px; padding: 0;
  font-family: var(--pg-mono, "JetBrains Mono", monospace);
  font-size: 9.5px; letter-spacing: .06em; text-transform: uppercase;
}
.bc-add .bc-add-plus { font-size: 19px; line-height: 1; font-family: inherit; }
.bc-add[disabled] { opacity: .4; }

.bc-context {
  margin-top: 12px; padding: 9px 11px; border-radius: 9px;
  background: var(--pg-sunk, #F7F3EA);
  border: 1px solid var(--pg-rule, rgba(42,27,13,.14));
  font-family: var(--pg-mono, monospace); font-size: 10.5px; line-height: 1.6;
  color: var(--pg-mute, #6E6257); word-break: break-all;
}

.bc-actions { display: flex; gap: 8px; margin-top: 16px; }
.bc-actions button {
  border-radius: 10px; padding: 10px 16px; font-size: 14px;
  border: 1px solid var(--pg-rule-strong, rgba(42,27,13,.20));
  background: transparent; color: var(--pg-soft, #4A3B2C);
}
.bc-actions button.primary {
  background: var(--pg-primary, #2D5016);
  border-color: var(--pg-primary, #2D5016);
  color: var(--pg-on-primary, #FDFCF7); font-weight: 600; flex: 1;
}
.bc-actions button[disabled] { opacity: .55; }

.bc-note { font-size: 12.5px; margin-top: 10px; line-height: 1.5; }
.bc-note.err { color: var(--pg-danger, #B5503E); }

/* the sent state replaces the form in place */
.bc-sent { text-align: center; padding: 12px 4px 4px; }
.bc-sent .tick {
  width: 46px; height: 46px; margin: 0 auto 12px; border-radius: 50%;
  background: var(--pg-primary, #2D5016); color: var(--pg-on-primary, #FDFCF7);
  display: grid; place-items: center; font-size: 22px;
  animation: m-pop-in 460ms var(--ease-spring, ease-out) both;
}
.bc-sent h3 {
  font-family: var(--pg-head, Fraunces, Georgia, serif);
  font-size: 17px; margin: 0 0 6px; color: var(--pg-ink, #2A1B0D);
}
.bc-sent p { font-size: 13px; color: var(--pg-mute, #6E6257); margin: 0 0 4px; line-height: 1.55; }
.bc-sent .bc-id { font-family: var(--pg-mono, monospace); font-size: 11px; }

/* --- answered: the chip goes transparent green --------------------------- *
 * The whole point of the green is that it finds you. It is still glass —
 * the page reads through it — but the light coming through has turned.
 * It stays until you've looked at what you filed, then goes back to brown. */
.bugchip.answered {
  border-color: rgba(168, 214, 140, .62);
  background:
    linear-gradient(155deg, rgba(214,244,192,.44), rgba(148,205,110,.14) 46%, rgba(31,74,20,.14)),
    rgba(45, 110, 30, .28);
  box-shadow:
    0 8px 24px rgba(31, 74, 20, .30),
    0 0 0 0 rgba(122, 190, 90, .48),
    0 1px 0 rgba(232, 255, 214, .55) inset,
    0 -8px 14px rgba(31, 74, 20, .12) inset;
  animation: bcAnswered 2.6s var(--ease-smooth, ease-in-out) infinite;
}
@keyframes bcAnswered {
  0%, 100% { box-shadow:
    0 8px 24px rgba(31,74,20,.30), 0 0 0 0 rgba(122,190,90,.48),
    0 1px 0 rgba(232,255,214,.55) inset, 0 -8px 14px rgba(31,74,20,.12) inset; }
  60%      { box-shadow:
    0 8px 24px rgba(31,74,20,.30), 0 0 0 11px rgba(122,190,90,0),
    0 1px 0 rgba(232,255,214,.55) inset, 0 -8px 14px rgba(31,74,20,.12) inset; }
}
@media (prefers-reduced-motion: reduce) { .bugchip.answered { animation: none; } }

/* the count, riding the rim */
.bc-dot {
  position: absolute; top: -1px; right: -1px;
  width: 13px; height: 13px; border-radius: 50%;
  background: #7ABE5A; border: 2px solid var(--pg-card, #FFFDF8);
  animation: m-pop-in 380ms var(--ease-spring, ease-out) both;
}
.bc-dot[hidden] { display: none; }

/* --- tabs ---------------------------------------------------------------- */
.bc-tabs { display: flex; gap: 4px; margin: -4px 0 14px; }
.bc-tabs button {
  flex: 1; position: relative; border-radius: 9px; padding: 7px 4px;
  border: 1px solid transparent; background: transparent;
  font-size: 11.5px; color: var(--pg-mute, #6E6257);
  transition: background 200ms var(--ease-smooth, ease), color 200ms var(--ease-smooth, ease);
}
.bc-tabs button.on {
  background: var(--pg-sunk, #F7F3EA);
  border-color: var(--pg-rule, rgba(42,27,13,.14));
  color: var(--pg-ink, #2A1B0D); font-weight: 600;
}
.bc-tabs button.flag::after {
  content: ""; position: absolute; top: 4px; right: 6px;
  width: 6px; height: 6px; border-radius: 50%; background: #7ABE5A;
}

/* --- your list ----------------------------------------------------------- */
.bc-list { display: flex; flex-direction: column; gap: 7px; }
.bc-row {
  display: block; width: 100%; text-align: left;
  border-radius: 11px; padding: 10px 11px;
  border: 1px solid var(--pg-rule, rgba(42,27,13,.14));
  background: var(--pg-sunk, #F7F3EA);
  transition: transform 220ms var(--ease-spring, ease), border-color 200ms ease;
}
.bc-row:active { transform: scale(.985); }
@media (hover: hover) { .bc-row:hover { border-color: var(--pg-rule-strong, rgba(42,27,13,.28)); } }
.bc-row-top { display: flex; align-items: flex-start; gap: 8px; }
.bc-title {
  flex: 1; font-size: 13.5px; line-height: 1.4; color: var(--pg-ink, #2A1B0D);
}
.bc-row-sub {
  font-family: var(--pg-mono, monospace); font-size: 10.5px;
  color: var(--pg-mute, #6E6257); margin-top: 5px; letter-spacing: .03em;
}
.bc-status {
  flex: none; border-radius: 999px; padding: 3px 8px; white-space: nowrap;
  font-family: var(--pg-mono, monospace); font-size: 9.5px;
  letter-spacing: .07em; text-transform: uppercase;
  background: rgba(42, 27, 13, .10); color: var(--pg-soft, #4A3B2C);
}
.bc-status.s-in_progress { background: rgba(198, 150, 42, .20); color: #7A5A12; }
.bc-status.s-needs_info  { background: rgba(181, 80, 62, .18);  color: #8C3A2B; }
.bc-status.s-resolved    { background: rgba(122, 190, 90, .26); color: #2F5A1C; }
.bc-status.s-closed,
.bc-status.s-infeasible  { background: rgba(42, 27, 13, .08); color: var(--pg-mute, #6E6257); }

/* --- one report, and its thread ------------------------------------------ */
.bc-back {
  border: none; background: transparent; padding: 0 0 10px;
  font-size: 12px; color: var(--pg-mute, #6E6257);
}
.bc-one .bc-row-top { margin-bottom: 10px; }
.bc-one .bc-title { font-size: 15px; font-weight: 600; }
.bc-thread { display: flex; flex-direction: column; gap: 8px; margin-top: 12px; }
.bc-msg {
  border-radius: 11px; padding: 9px 11px;
  background: var(--pg-sunk, #F7F3EA);
  border: 1px solid var(--pg-rule, rgba(42,27,13,.14));
  animation: m-rise-in 320ms var(--ease-emph, ease-out) both;
}
/* theirs sits left and reads as the answer; yours sits right, tinted */
.bc-msg.mine {
  margin-left: 22px;
  background: rgba(45, 80, 22, .07);
  border-color: rgba(45, 80, 22, .18);
}
.bc-msg-who {
  font-family: var(--pg-mono, monospace); font-size: 9.5px;
  letter-spacing: .07em; text-transform: uppercase;
  color: var(--pg-mute, #6E6257); margin-bottom: 4px;
}
.bc-msg-text { font-size: 13.5px; line-height: 1.55; color: var(--pg-ink, #2A1B0D); white-space: pre-wrap; }

/* the beta mark that rides beside the wordmark */
.bb-beta {
  font-family: var(--pg-mono, "JetBrains Mono", monospace);
  font-size: .52em; letter-spacing: .10em; text-transform: uppercase;
  color: var(--pg-mute, #6E6257); opacity: .85;
  margin-left: .45em; vertical-align: .30em; font-weight: 500;
  white-space: nowrap;
}
