/* =============================================================================
   Bugs & Feedback — layout and the pieces only this tool has.

   Everything visual that more than one tool needs lives in /ds/: the buttons,
   chips, fields, cards, banners, the modal frame, the toast, the empty state.
   What's left here is arrangement, plus two constructs this tool invented —
   the screenshot drop box (.bug-shot) and the report tile (.bug-card).

   No literal colors, radii, shadows or eases. A `#` in this file is a bug.
   ========================================================================== */

/* ------------------------------------------------------------------ page -- */

body {
  background: var(--color-bg-page);
  min-height: 100vh;
}

.bug-main {
  max-width: 1120px;
  margin: 0 auto;
  padding: var(--space-5) var(--container-pad) var(--space-8);
}

/* ---------------------------------------------------------------- header -- */

.bug-header {
  position: sticky; top: 0; z-index: var(--z-header);
  display: flex; align-items: center; gap: var(--space-3);
  padding: var(--space-3) var(--container-pad);
  background: var(--hb-paper);
  border-bottom: 1px solid var(--hb-line);
}

.bug-burger { display: flex; }

.bug-brand { display: flex; flex-direction: column; gap: 3px; min-width: 0; }
.bug-wordmark {
  font-size: var(--fs-ui-xl); font-weight: var(--fw-bold);
  letter-spacing: -0.01em; color: var(--hb-chalkboard);
  white-space: nowrap;
}

.bug-tabs { display: flex; gap: var(--space-2); margin-left: var(--space-4); }
.bug-header-spacer { flex: 1; }

.bug-me {
  font-size: var(--fs-ui-md); color: var(--hb-muted);
  max-width: 22ch; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}

@media (max-width: 760px) {
  .bug-tabs { display: none; }        /* the drawer carries them on phones */
  .bug-me { display: none; }
}

/* ------------------------------------------------------------------ gate -- */

.bug-gate {
  min-height: 100vh; display: flex; align-items: center; justify-content: center;
  padding: var(--space-5);
}
.bug-gate-card { max-width: 30rem; text-align: center; }
.bug-gate-card h1 { font-size: var(--fs-ui-xl); margin: var(--space-3) 0 var(--space-2); }
.bug-gate-card p { font-size: var(--fs-ui); color: var(--hb-ink-soft); line-height: 1.55; margin: 0 0 var(--space-3); }

/* ------------------------------------------------------------------ form -- */

.bug-form { max-width: 44rem; margin: 0 auto; display: flex; flex-direction: column; gap: var(--space-5); }

.bug-form-head h1 { font-size: var(--fs-h4, 1.5rem); margin: 0 0 var(--space-1); letter-spacing: -0.01em; }
.bug-form-head p { margin: 0; font-size: var(--fs-ui); color: var(--hb-ink-soft); }

.bug-form-field { min-width: 0; }

/* hb-fieldset stacks; the type picker is a row of two */
.bug-type { flex-direction: row; flex-wrap: wrap; align-items: center; gap: var(--space-2); }
.bug-type > legend { width: 100%; }

.bug-form-actions {
  display: flex; align-items: center; gap: var(--space-3); flex-wrap: wrap;
  border-top: 1px solid var(--hb-line); padding-top: var(--space-4);
}
.bug-form-who { flex: 1; font-size: var(--fs-ui-md); color: var(--hb-muted); }
.bug-form-who b { color: var(--hb-ink-soft); font-weight: var(--fw-semibold); }

@media (max-width: 560px) {
  .bug-form-actions > .hb-btn { width: 100%; }
}

/* ------------------------------------------------------- screenshot box -- */

.bug-shot { position: relative; }

/* Kept in the layout and focusable — the label is the visible control, so the
   input must still be reachable by keyboard and announced by its label. */
.bug-shot-file {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}
.bug-shot-file:focus-visible + .bug-shot-drop { box-shadow: var(--shadow-focus); border-color: var(--hb-agua); }

.bug-shot-drop {
  display: flex; flex-direction: column; align-items: center; gap: var(--space-1);
  padding: var(--space-5) var(--space-4); text-align: center; cursor: pointer;
  border: 1.5px dashed var(--color-border-strong); border-radius: var(--radius-card);
  background: var(--hb-cloud-soft); color: var(--hb-chalkboard);
  transition: background var(--dur-fast), border-color var(--dur-fast);
}
.bug-shot-drop:hover { background: var(--hb-agua-light); border-color: var(--hb-agua); }
.bug-shot-drop > b { font-size: var(--fs-ui); font-weight: var(--fw-semibold); }
.bug-shot-drop > span { font-size: var(--fs-ui-sm); color: var(--hb-muted); }
.bug-shot-icon { font-size: var(--fs-ui-xl); line-height: 1; }

.bug-shot.is-dragging .bug-shot-drop { background: var(--hb-agua-light); border-color: var(--hb-agua); }
.bug-shot.is-busy .bug-shot-drop { cursor: progress; }

.bug-shot.is-filled {
  display: grid; grid-template-columns: auto 1fr auto; align-items: center; gap: var(--space-3);
  padding: var(--space-3); border: 1px solid var(--hb-line); border-radius: var(--radius-card);
  background: var(--hb-cloud-soft);
}
.bug-shot-preview {
  width: 72px; height: 72px; object-fit: cover;
  border-radius: var(--radius-sm); border: 1px solid var(--hb-line); display: block;
}
.bug-shot-meta { min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.bug-shot-meta > b { font-size: var(--fs-ui-md); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.bug-shot-meta > span { font-size: var(--fs-ui-sm); color: var(--hb-muted); }
.bug-shot-actions { display: flex; gap: var(--space-2); }

/* ----------------------------------------------------------------- board -- */

.bug-board { display: flex; flex-direction: column; gap: var(--space-4); }

.bug-board-bar { display: flex; align-items: center; gap: var(--space-3); }
.bug-search { flex: 1; max-width: 26rem; }

.bug-filters { display: flex; flex-wrap: wrap; align-items: center; gap: var(--space-2); }
.bug-filter-gap { flex: 1; min-width: var(--space-4); }

.bug-grid {
  display: grid; gap: var(--space-4);
  grid-template-columns: repeat(auto-fill, minmax(17rem, 1fr));
  align-items: start;
}

/* ------------------------------------------------------------------ card -- */

.bug-card {
  display: flex; flex-direction: column; overflow: hidden;
  padding: 0; text-align: left; font: inherit; color: inherit;
  cursor: pointer; width: 100%;
  transition: transform var(--dur) var(--ease-bounce), box-shadow var(--dur);
}
.bug-card:hover { transform: translateY(-3px); box-shadow: var(--shadow-md); }
.bug-card:active { transform: scale(0.995); }

/* contain, not cover. A screenshot is evidence — cropping it to fill the box
   zooms into an unreadable fragment and hides the part that mattered. Letterboxed
   on the sunk surface reads as deliberate, and the whole shot stays recognisable. */
.bug-card-shot {
  width: 100%; height: 8.5rem; object-fit: contain;
  display: block; border-bottom: 1px solid var(--hb-line);
  background: var(--hb-cloud); padding: var(--space-2); box-sizing: border-box;
}

.bug-card-body {
  display: flex; flex-direction: column; gap: var(--space-2);
  padding: var(--space-4); min-width: 0;
}
.bug-card-chips { display: flex; flex-wrap: wrap; align-items: center; gap: var(--space-1); }

.bug-num {
  font-family: var(--font-mono); font-size: var(--fs-ui-xs);
  color: var(--hb-muted); margin-left: auto;
}

.bug-card-title {
  font-size: var(--fs-ui-lg); font-weight: var(--fw-semibold); line-height: 1.35;
  color: var(--hb-chalkboard);
}
.bug-card-steps {
  font-size: var(--fs-ui-md); color: var(--hb-ink-soft); line-height: 1.5;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
}
.bug-card-url {
  font-family: var(--font-mono); font-size: var(--fs-ui-xs); color: var(--hb-text-agua);
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}

/* --------------------------------------------------------------- byline -- */

.bug-by { display: flex; align-items: center; gap: var(--space-2); margin-top: auto; padding-top: var(--space-1); }
.bug-avatar {
  width: 26px; height: 26px; flex: none; border-radius: var(--radius-pill);
  display: flex; align-items: center; justify-content: center;
  background: var(--hb-petalo-light); color: var(--hb-petalo-ink);
  font-size: var(--fs-ui-2xs); font-weight: var(--fw-bold); letter-spacing: 0.02em;
}
.bug-by-text { display: flex; flex-direction: column; min-width: 0; line-height: 1.3; }
.bug-by-text > b { font-size: var(--fs-ui-md); font-weight: var(--fw-semibold); color: var(--hb-chalkboard);
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.bug-by-text > span { font-size: var(--fs-ui-xs); color: var(--hb-muted); }

/* ---------------------------------------------------------------- detail -- */

.bug-detail { display: flex; flex-direction: column; gap: var(--space-4); }
.bug-detail-chips { display: flex; flex-wrap: wrap; align-items: center; gap: var(--space-2); }
.bug-detail-field { min-width: 0; }

.bug-steps {
  margin: 0; font-size: var(--fs-ui); line-height: 1.6; color: var(--hb-chalkboard);
  white-space: pre-wrap; overflow-wrap: anywhere;
}
.bug-detail-none { margin: 0; font-size: var(--fs-ui-md); color: var(--hb-muted); font-style: italic; }
.bug-detail-link { font-size: var(--fs-ui-md); overflow-wrap: anywhere; }
.bug-detail-mono {
  margin: 0; font-family: var(--font-mono); font-size: var(--fs-ui-xs);
  color: var(--hb-ink-soft); line-height: 1.5; overflow-wrap: anywhere;
}

.bug-shots { display: flex; flex-wrap: wrap; gap: var(--space-2); }
.bug-shot-link { display: block; border-radius: var(--radius-sm); overflow: hidden; border: 1px solid var(--hb-line); }
.bug-shot-link img { display: block; max-width: 100%; max-height: 22rem; }

.bug-status-picker { display: flex; flex-wrap: wrap; gap: var(--space-2); }
