/* Interaction fixes after QA (redactor, lightbox, picker, dialogs, team
   controls, header sign-out). Loaded last so it can refine earlier rules.

   Full-screen dialogs use inset: 0 and height: 100%, never 100vh: on
   Android Chrome and iPhone Safari 100vh is the height with the browser
   bars hidden, so a 100vh dialog puts its bottom buttons under the bars. */

/* ------------------------------------------------------------ confirm dialog */

/* The list scrolls; the title stays on top and the buttons stay on screen. */
.dialog { max-height: calc(100vh - 32px); max-height: calc(100dvh - 32px); }
.dialog[open] { display: flex; flex-direction: column; overflow: hidden; }
.dialog__icon, .dialog__title, .dialog__actions { flex-shrink: 0; }
.dialog__body { flex: 1 1 auto; min-height: 0; overflow-y: auto; overscroll-behavior: contain; margin: 0 -24px; padding: 0 24px 2px; }
.dialog__list { gap: 12px; }
.dialog__item { display: flex; flex-direction: column; gap: 2px; }
.dialog__where { font-size: 0.8125rem; font-weight: 700; color: var(--text-3); }
@media (max-height: 500px) {
  .dialog { padding: 16px 20px; }
  .dialog__icon { display: none; }
  .dialog__body { margin: 0 -20px; padding: 0 20px 2px; }
  .dialog__actions { margin-top: 12px; }
}

/* ------------------------------------------------------------ lightbox */

.lightbox { position: fixed; inset: 0; width: 100%; height: 100%; max-width: none; max-height: none; overflow: hidden; }
/* minmax(0, 1fr): a long caption wraps instead of widening the viewer. */
.lightbox[open] { grid-template-columns: minmax(0, 1fr); }
.lightbox__bar { min-width: 0; padding-left: max(16px, env(safe-area-inset-left)); padding-right: max(12px, env(safe-area-inset-right)); }
.lightbox__bar-actions { min-width: 0; }
.lightbox__stage { overflow: hidden; touch-action: none; }
.lightbox__img { transform-origin: 0 0; -webkit-user-drag: none; -webkit-touch-callout: none; }
.lightbox__img.is-animating { transition: transform 0.22s var(--ease); }
.lightbox:not(.is-zoomed) .lightbox__img { cursor: zoom-in; }
.lightbox.is-zoomed .lightbox__stage { cursor: grab; }
.lightbox.is-zoomed .lightbox__stage:active { cursor: grabbing; }
.lightbox__footer { min-width: 0; }
.lightbox__caption { overflow-wrap: anywhere; min-width: 0; }
.lightbox__zoom { background: rgba(255, 255, 255, 0.12); }
.lightbox__prev { left: max(10px, env(safe-area-inset-left)); }
.lightbox__next { right: max(10px, env(safe-area-inset-right)); }
@media (max-width: 399px) {
  .lightbox__open-text { display: none; }
  .lightbox__open { width: 44px; padding: 0; justify-content: center; }
}

/* ------------------------------------------------------------ redaction tool */

.redactor { position: fixed; inset: 0; width: 100%; height: 100%; max-width: none; max-height: none; overflow: hidden; }
.redactor[open] { grid-template-columns: minmax(0, 1fr); grid-template-rows: auto minmax(0, 1fr) auto auto; }
.redactor__head {
  gap: 6px;
  padding: max(10px, env(safe-area-inset-top)) max(16px, env(safe-area-inset-right)) 8px max(16px, env(safe-area-inset-left));
}
.redactor__headline { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 6px 12px; }
.redactor__help { font-size: 0.875rem; line-height: 1.45; }
.redactor__hint { font-weight: 600; color: #E2E8F0; }
.redactor__zoom {
  display: inline-flex; gap: 2px; padding: 2px; border-radius: 12px;
  background: rgba(255, 255, 255, 0.08); border: 1px solid rgba(255, 255, 255, 0.2);
}
.redactor__zoom-btn {
  min-width: 44px; height: 44px; padding: 0 10px; border: 0; border-radius: 10px;
  background: transparent; color: #E2E8F0; font-weight: 700; font-size: 0.9375rem; font-variant-numeric: tabular-nums;
}
.redactor__zoom-btn[aria-pressed="true"] { background: #F1F5F9; color: #0B0F19; }
.redactor__zoom-btn:focus-visible { outline: 3px solid #93B1FF; outline-offset: 1px; }
.redactor__stage { position: relative; display: block; padding: 0; overflow: hidden; background: #05070D; touch-action: none; }
/* The canvas fills the stage; the view decides what part of the image it
   shows, so zooming never builds a canvas too big for a phone. */
.redactor__canvas {
  position: absolute; inset: 0; width: 100%; height: 100%;
  border-radius: 0; box-shadow: none; background: transparent; touch-action: none; cursor: crosshair;
}
.redactor__error { margin: 8px 16px 0; overflow-wrap: anywhere; }
.redactor__bar {
  flex-wrap: nowrap; align-items: center;
  padding: 10px max(12px, env(safe-area-inset-right)) max(12px, env(safe-area-inset-bottom)) max(12px, env(safe-area-inset-left));
}
/* The smallest phones keep the title and zoom buttons on one row. */
@media (max-width: 359px) {
  .redactor__headline { column-gap: 8px; }
  .redactor__title { font-size: 1rem; }
}
@media (max-height: 640px) { .redactor__help { font-size: 0.8125rem; } }
/* Phones: Undo and Clear become icons (they keep their aria-labels), so
   the bar is one row and the picture gets the height. */
@media (max-width: 479px) {
  .redactor__tools .btn { width: 44px; padding: 0; }
  .redactor__tools .btn__label { display: none; }
  .redactor__actions .btn { padding-inline: 14px; }
}
/* Landscape phones: the controls move to a column on the right and the
   picture gets the full height. */
@media (orientation: landscape) and (max-height: 500px) {
  .redactor[open] {
    grid-template-columns: minmax(0, 1fr) 216px;
    grid-template-rows: auto minmax(0, 1fr) auto;
    grid-template-areas: "stage head" "stage error" "stage bar";
  }
  .redactor__stage { grid-area: stage; margin-left: env(safe-area-inset-left); }
  .redactor__head { grid-area: head; padding: max(8px, env(safe-area-inset-top)) max(12px, env(safe-area-inset-right)) 6px 12px; }
  .redactor__headline { flex-direction: column; align-items: stretch; }
  .redactor__title { font-size: 1rem; }
  .redactor__zoom { display: flex; }
  .redactor__zoom-btn { flex: 1; }
  .redactor__help { display: none; }
  .redactor__error { grid-area: error; align-self: start; margin: 4px 12px; font-size: 0.875rem; }
  .redactor__bar {
    grid-area: bar; flex-direction: column; align-items: stretch; gap: 8px; border-top: 0;
    padding: 6px max(12px, env(safe-area-inset-right)) max(8px, env(safe-area-inset-bottom)) 12px;
  }
  .redactor__tools .btn { width: 44px; padding: 0; }
  .redactor__tools .btn__label { display: none; }
  .redactor__actions { margin-left: 0; }
  .redactor__actions .btn { flex: 1; padding-inline: 10px; }
}

/* ------------------------------------------------------------ screenshot picker */

/* The layout follows the picker's own width (a phone, or the narrow team
   panel on a desktop), not the window's. */
.picker { container: picker / inline-size; }
.picker__zone.is-full { opacity: 1; cursor: default; border-style: solid; background: var(--surface-3); }
/* A narrow picker (small phones, reply forms) gives the words the room. */
@container picker (max-width: 319px) {
  .picker__zone { gap: 10px; padding: 14px; }
  .picker__zone-icon { display: none; }
}
.picker__zone.is-full .picker__hint { color: var(--text-2); font-weight: 600; }
/* Cards, two or more to a row: a thumbnail with Remove on its corner,
   then Hide private info, then the caption. */
.picker__list { grid-template-columns: repeat(auto-fill, minmax(118px, 1fr)); gap: 8px; }
.picker__item { flex-direction: column; gap: 8px; padding: 8px; }
.picker__media { position: relative; min-width: 0; }
.picker__thumb { width: 100%; height: auto; aspect-ratio: 4 / 3; }
.picker__remove {
  position: absolute; top: 0; right: 0; display: flex; align-items: center; justify-content: center;
  width: 44px; height: 44px; padding: 0; border: 0; border-radius: 10px; background: transparent; color: #FFFFFF;
}
.picker__remove-disc {
  display: inline-flex; align-items: center; justify-content: center; width: 32px; height: 32px; border-radius: 50%;
  background: rgba(15, 23, 42, 0.8); box-shadow: 0 0 0 1px rgba(255, 255, 255, 0.45);
}
.picker__remove:focus-visible { outline: none; }
.picker__remove:focus-visible .picker__remove-disc { outline: 3px solid var(--focus); outline-offset: 1px; }
.picker__body { gap: 6px; }
.picker__name { padding-top: 0; font-size: 0.8125rem; line-height: 1.35; }
.picker__label, .picker__meta { white-space: nowrap; }
.picker__body .picker__redact {
  align-self: stretch; gap: 6px; padding: 6px 8px; font-size: 0.8125rem; line-height: 1.25;
  white-space: normal; text-align: center;
}
.picker__redact .icon { flex-shrink: 0; }
@container picker (max-width: 279px) { .picker__redact .icon { display: none; } }
@container picker (min-width: 560px) {
  .picker__list { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
  .picker__item { flex-direction: row; gap: 12px; padding: 10px; }
  .picker__media { flex-shrink: 0; width: 112px; }
  .picker__thumb { width: 112px; height: 112px; aspect-ratio: auto; }
  .picker__name { font-size: 0.875rem; }
  .picker__body .picker__redact { align-self: flex-start; padding: 8px 12px; font-size: 0.875rem; }
}

/* ------------------------------------------------------------ screenshot grid */

/* Phone-shaped proof screenshots keep their own shape (centred, up to most
   of the screen) instead of sitting small in a wide box. */
.shot-grid--lg .shot__open--portrait { aspect-ratio: var(--shot-ratio, 3 / 4); max-height: min(70vh, 640px); }

/* ------------------------------------------------------------ team controls */

.team__contact {
  display: flex; flex-direction: column; align-items: flex-start; gap: 6px;
  margin-top: 6px; padding-top: 10px; border-top: 1px solid rgba(30, 78, 216, 0.2);
}
.team__contact-line { display: flex; flex-direction: column; gap: 2px; color: var(--text); font-size: 0.9375rem; }
.team__contact-label { font-size: 0.8125rem; font-weight: 700; color: var(--text-2); }
.team__contact-values { display: flex; flex-wrap: wrap; gap: 0 14px; }
.team__contact-link { display: inline-flex; align-items: center; gap: 6px; min-height: 44px; font-weight: 700; overflow-wrap: anywhere; }
.team__contact-link .icon { flex-shrink: 0; }
.team__contact-text { overflow-wrap: anywhere; }
.team__contact-none { color: var(--text-2); }
/* Wide screens show the contact and Copy link in the details card. */
@media (min-width: 960px) { .team__contact { display: none; } }

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

.resolution__confirmed:disabled {
  opacity: 1; cursor: default; box-shadow: none;
  background: var(--st-fixed-bg); color: var(--st-fixed-ink); border-color: rgba(22, 163, 74, 0.35);
}

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

.draft-note {
  display: grid; grid-template-columns: auto minmax(0, 1fr); grid-template-areas: "icon text" ". actions"; gap: 4px 10px;
  padding: 12px 10px 6px 14px; border-radius: var(--radius-lg);
  background: var(--brand-wash); color: var(--text); border: 1px solid rgba(30, 78, 216, 0.25);
}
.draft-note__icon { grid-area: icon; color: var(--brand-ink); padding-top: 1px; }
.draft-note__text { grid-area: text; }
.draft-note__actions { grid-area: actions; display: flex; align-items: center; justify-content: flex-end; gap: 4px; }
@media (min-width: 560px) {
  .draft-note { grid-template-columns: auto minmax(0, 1fr) auto; grid-template-areas: "icon text actions"; align-items: center; padding: 6px 6px 6px 14px; }
}

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

.attention__head { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 10px 16px; }
.attention__tabs { display: flex; flex-wrap: wrap; gap: 8px; }
.attention__tab { padding: 0 14px; }

/* ------------------------------------------------------------ header sign-out */

/* A visible sign-out on phones too, next to the team shield. Narrow
   headers make room by dropping the brand name, then the Report label
   (which stays readable to screen readers). */
.admin-signout { display: inline-flex; padding: 0; border-left: 1px solid rgba(30, 78, 216, 0.18); border-radius: 0 10px 10px 0; }
@media (max-width: 419px) { .site-header.is-admin .brand__name, .site-header.is-admin .brand__tag { display: none; } }
@media (max-width: 339px) {
  .site-header.is-admin .site-header__report { padding-inline: 12px; }
  .site-header.is-admin .site-header__report .btn__label {
    position: absolute; width: 1px; height: 1px; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap;
  }
}

/* ------------------------------------------------------------ misc */

.toast__text { min-width: 0; overflow-wrap: anywhere; }

/* Hover looks only where a mouse can hover (a tap leaves :hover stuck). */
@media (hover: hover) {
  .redactor__zoom-btn:hover:not([aria-pressed="true"]) { background: rgba(255, 255, 255, 0.14); }
  .picker__remove:hover .picker__remove-disc { background: #B42318; }
}
