/* ==========================================================================
   Modal
   Figma source: Modal / Grey takeover (3462:38660).
   Flat grey takeover (#919191 in Figma — implemented as a black scrim at
   43% over white, same rendered colour, so it works over any content),
   white dialog with 16px radius, 32px padding, 24px title, X close,
   option cards side by side.
   ========================================================================== */

.modal-scrim {
  position: fixed;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(0, 0, 0, 0.43); /* renders as Figma's #919191 over white */
  padding: var(--space-4);
}

/* the [hidden] attribute must win over display:flex (JS toggles it to close) */
.modal-scrim[hidden] { display: none; }

.modal {
  width: 620px;
  max-width: 100%;
  background: var(--color-surface);
  border-radius: var(--radius-lg);
  padding: 32px 30px 40px;
}

.modal__head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  padding-bottom: 32px;
}

.modal__title {
  font-size: var(--text-heading);
  font-weight: var(--weight-regular);
  line-height: 1.2;
}

.modal__close {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  padding: 0;
  border: none;
  background: none;
  border-radius: var(--radius-md);
  color: var(--color-border-strong);
  cursor: pointer;
}

.modal__close > svg {
  width: 16px;
  height: 16px;
}

.modal__options {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--space-4);
}

.modal-option {
  display: flex;
  align-items: flex-start;
  gap: var(--space-3);
  padding: var(--space-4);
  border: var(--border-width) solid var(--color-border);
  border-radius: var(--radius-md);
  background: var(--color-surface);
  text-align: left;
  font: inherit;
  color: inherit;
  cursor: pointer;
}

.modal-option > svg {
  flex: none;
  width: 18px;
  height: 18px;
  margin-top: 2px;
}

.modal-option__title {
  font-size: var(--text-base);
  line-height: var(--leading-body);
}

.modal-option__hint {
  font-size: var(--text-xs);
  line-height: var(--leading-footnote);
  color: var(--color-text-muted);
}

/* provisional */
.modal-option:hover {
  background: var(--color-bg-subtle-light);
}

@media (max-width: 640px) {
  .modal__options { grid-template-columns: 1fr; }
}

/* ---- ARE YOU SURE? (Peter, 14 Aug 2026) ------------------------------------
   The guard on the seven actions that cannot be undone (docs/ACTION-AUDIT.md).
   Narrower than the takeover modal — it is a sentence and two buttons, not a
   page — and it SAYS what is about to happen rather than asking the user to
   imagine it. Built by window.uiConfirmAction in ui.js. */
.modal--confirm { width: 460px; padding: 28px 28px 24px; }
.modal--confirm .modal__head { padding-bottom: 16px; }
.modal--confirm .modal__title { font-size: var(--text-section); line-height: 1.3; }
.confirm__lines {
  margin: 0;
  padding: 0 0 0 18px;
  list-style: disc;
  display: flex;
  flex-direction: column;
  gap: 8px;
  font-size: var(--text-base);
  line-height: 1.5;
  color: var(--color-text-muted);
}
.confirm__lines:empty { display: none; }
.confirm__actions {
  display: flex;
  justify-content: flex-end;
  align-items: center;
  gap: var(--space-3);
  margin-top: 28px;
}
@media (max-width: 480px) {
  .modal--confirm { padding: 22px 20px 20px; }
  .confirm__actions { flex-direction: column-reverse; align-items: stretch; }
}
