/*
  Modal 01 — Precision Confirmation Dialog — standalone HTML/CSS/JS.
  No build step, no framework, no external dependency: copy index.html,
  this file, and script.js into any project as-is.
*/

:root {
  --dialog-fg: oklch(0.17 0 0);
  --dialog-muted: oklch(0.52 0 0);
  --dialog-line: oklch(0.92 0 0);
  --dialog-soft: oklch(0.97 0 0);
  --dialog-accent: #39ff14;
  --dialog-mono: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, monospace;
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

body {
  margin: 0;
  display: flex;
  align-items: flex-start;
  justify-content: center;
  padding: 1.5rem;
  line-height: 1.5;
  font-family:
    Inter, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif, "Apple Color Emoji", "Segoe UI Emoji";
  background: linear-gradient(to bottom, #fafafa, #f4f4f5);
}

/* The editor surface the dialog belongs to. `isolation` + `transform` make
   this element the containing block for the dialog's fixed overlay, so the
   dim stays inside the card; remove both to let it cover the viewport. */
.modal01-editor {
  position: relative;
  isolation: isolate;
  width: 100%;
  max-width: 60rem;
  height: 34rem;
  overflow: hidden;
  border: 1px solid rgba(0, 0, 0, 0.05);
  border-radius: 1rem;
  background: #ffffff;
  box-shadow:
    0 1px 2px rgba(0, 0, 0, 0.04),
    0 18px 44px -20px rgba(0, 0, 0, 0.18);
  transform: translateZ(0);
}

.modal01-editor p {
  margin: 0;
}

.modal01-editor ul {
  margin: 0;
  padding: 0;
  list-style: none;
}

.modal01-editor__bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  border-bottom: 1px solid oklch(0.97 0 0);
  padding: 0.75rem 1.25rem;
}

.modal01-editor__brand {
  display: flex;
  min-width: 0;
  align-items: center;
  gap: 0.625rem;
}

.modal01-editor__mark {
  display: flex;
  width: 1.75rem;
  height: 1.75rem;
  flex-shrink: 0;
  align-items: center;
  justify-content: center;
  border-radius: 0.375rem;
  background: oklch(0.205 0 0);
  font-size: 11px;
  font-weight: 600;
  color: #ffffff;
}

.modal01-editor__crumb {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 0.875rem;
  line-height: 1.25rem;
  color: oklch(0.556 0 0);
}

.modal01-editor__crumb strong {
  font-weight: 500;
  color: oklch(0.205 0 0);
}

.modal01-editor__bar-actions {
  display: flex;
  flex-shrink: 0;
  align-items: center;
  gap: 0.5rem;
}

.modal01-editor__count {
  display: none;
  font-size: 0.75rem;
  line-height: 1rem;
  color: oklch(0.556 0 0);
}

.modal01-editor__publish {
  display: flex;
  height: 2.25rem;
  align-items: center;
  border: 0;
  border-radius: 0.5rem;
  background: oklch(0.205 0 0);
  padding: 0 0.875rem;
  font-family: inherit;
  font-size: 0.875rem;
  line-height: 1.25rem;
  font-weight: 600;
  color: #ffffff;
  cursor: pointer;
  outline: none;
  transition: background-color 150ms cubic-bezier(0.4, 0, 0.2, 1);
}

.modal01-editor__publish:hover {
  background: oklch(0.371 0 0);
}

.modal01-editor__publish:focus-visible {
  outline: 2px solid oklch(0.205 0 0);
  outline-offset: 2px;
}

.modal01-editor__body {
  display: grid;
  gap: 1rem;
  padding: 1.25rem;
}

.modal01-editor__changes {
  overflow: hidden;
  border: 1px solid oklch(0.97 0 0);
  border-radius: 0.75rem;
}

.modal01-editor__change {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  padding: 0.75rem 1rem;
}

.modal01-editor__change + .modal01-editor__change {
  border-top: 1px solid oklch(0.97 0 0);
}

.modal01-editor__page {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 0.875rem;
  line-height: 1.25rem;
  font-weight: 500;
  color: oklch(0.205 0 0);
}

.modal01-editor__detail {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 0.75rem;
  line-height: 1rem;
  color: oklch(0.556 0 0);
}

.modal01-editor__state {
  flex-shrink: 0;
  border-radius: 9999px;
  background: oklch(0.97 0 0);
  padding: 0.125rem 0.5rem;
  font-size: 11px;
  line-height: 1rem;
  font-weight: 500;
  color: oklch(0.439 0 0);
}

.modal01-editor__env {
  display: none;
  border: 1px solid oklch(0.97 0 0);
  border-radius: 0.75rem;
  background: oklch(0.985 0 0 / 0.6);
  padding: 1rem;
}

.modal01-editor__env-label {
  font-size: 11px;
  font-weight: 500;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: oklch(0.708 0 0);
}

.modal01-editor__env-name {
  margin-top: 0.5rem !important;
  font-size: 0.875rem;
  line-height: 1.25rem;
  font-weight: 500;
  color: oklch(0.205 0 0);
}

.modal01-editor__env-meta {
  margin-top: 0.25rem !important;
  font-size: 0.75rem;
  line-height: 1rem;
  color: oklch(0.556 0 0);
}

@media (min-width: 40rem) {
  .modal01-editor {
    height: 22.5rem;
  }
  .modal01-editor__count {
    display: inline;
  }
  .modal01-editor__body {
    grid-template-columns: minmax(0, 1fr) 13rem;
  }
  .modal01-editor__env {
    display: block;
  }
}

.modal01 {
  position: fixed;
  inset: 0;
  z-index: 50;
  overflow-y: auto;
  overscroll-behavior: contain;
  font-family:
    Inter, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif, "Apple Color Emoji",
    "Segoe UI Emoji";
}

.modal01[hidden] {
  display: none;
}

.modal01 p,
.modal01 h2,
.modal01 dl,
.modal01 dd,
.modal01 dt {
  margin: 0;
}

/* A quiet dim: the page stays readable behind, so it still reads as "this
   sits on top of my work", not "the app went dark". */
.modal01__backdrop {
  position: fixed;
  inset: 0;
  background-color: oklch(0.25 0 0 / 0.38);
  animation: modal01-backdrop-in 200ms ease-out both;
}

.modal01[data-state="closing"] .modal01__backdrop {
  animation: modal01-backdrop-out 160ms ease-in both;
}

/* A tall dialog scrolls with the overlay instead of running off the bottom
   of the screen. */
.modal01__positioner {
  position: relative;
  display: flex;
  min-height: 100%;
  align-items: center;
  justify-content: center;
  padding: 1rem;
}

.modal01__panel {
  position: relative;
  width: 100%;
  max-width: 28rem;
  border: 1px solid var(--dialog-line);
  border-radius: 1rem;
  background-color: #ffffff;
  padding: 1.5rem;
  box-shadow: 0 24px 60px -24px rgba(0, 0, 0, 0.35);
  animation: modal01-panel-in 220ms cubic-bezier(0.2, 0.9, 0.3, 1.1) both;
}

.modal01[data-state="closing"] .modal01__panel {
  animation: modal01-panel-out 160ms ease-in both;
}

.modal01__eyebrow {
  font-size: 11px;
  font-weight: 500;
  letter-spacing: 0.09em;
  text-transform: uppercase;
  color: var(--dialog-muted);
}

.modal01__title {
  margin-top: 0.5rem !important;
  font-size: 1.125rem;
  line-height: 1.5rem;
  font-weight: 600;
  letter-spacing: -0.025em;
  text-wrap: balance;
  color: var(--dialog-fg);
}

.modal01__description {
  margin-top: 0.375rem !important;
  font-size: 0.875rem;
  line-height: 1.25rem;
  color: var(--dialog-muted);
}

.modal01__details {
  margin-top: 1rem !important;
  overflow: hidden;
  border: 1px solid var(--dialog-line);
  border-radius: 0.75rem;
  background-color: oklch(0.97 0 0 / 0.6);
}

.modal01__row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.625rem 0.875rem;
}

.modal01__row + .modal01__row {
  border-top: 1px solid var(--dialog-line);
}

.modal01__row dt {
  font-size: 0.75rem;
  line-height: 1rem;
  color: var(--dialog-muted);
}

.modal01__row dd {
  display: flex;
  min-width: 0;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.75rem;
  line-height: 1rem;
  font-weight: 500;
  color: var(--dialog-fg);
}

.modal01__value {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-family: var(--dialog-mono);
}

/* The live target gets the accent, so the row that carries risk is the one
   thing that catches the eye. */
.modal01__live {
  width: 0.375rem;
  height: 0.375rem;
  flex-shrink: 0;
  border-radius: 9999px;
  background-color: var(--dialog-accent);
  box-shadow: 0 0 0 3px oklch(0.85 0.22 130 / 0.35);
}

.modal01__actions {
  display: flex;
  flex-direction: column-reverse;
  gap: 0.5rem;
  margin-top: 1.25rem;
}

.modal01__cancel,
.modal01__confirm {
  display: flex;
  height: 2.5rem;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  border-radius: 0.5rem;
  padding: 0 1rem;
  font-family: inherit;
  font-size: 0.875rem;
  line-height: 1.25rem;
  cursor: pointer;
  outline: none;
  transition: background-color 150ms cubic-bezier(0.4, 0, 0.2, 1);
}

.modal01__cancel {
  border: 1px solid var(--dialog-line);
  background-color: #ffffff;
  font-weight: 500;
  color: var(--dialog-fg);
}

.modal01__cancel:hover {
  background-color: var(--dialog-soft);
}

.modal01__confirm {
  border: 0;
  background-color: var(--dialog-fg);
  font-weight: 600;
  color: #ffffff;
}

.modal01__confirm:hover {
  background-color: oklch(0.3 0 0);
}

.modal01__confirm[aria-disabled="true"] {
  cursor: progress;
  background-color: var(--dialog-soft);
  color: var(--dialog-muted);
}

.modal01__cancel:focus-visible,
.modal01__confirm:focus-visible {
  outline: 2px solid var(--dialog-fg);
  outline-offset: 2px;
}

@keyframes modal01-backdrop-in {
  from {
    opacity: 0;
  }
}

@keyframes modal01-backdrop-out {
  to {
    opacity: 0;
  }
}

@keyframes modal01-panel-in {
  from {
    opacity: 0;
    transform: translateY(8px) scale(0.97);
  }
  to {
    opacity: 1;
    transform: none;
  }
}

@keyframes modal01-panel-out {
  to {
    opacity: 0;
    transform: translateY(4px) scale(0.985);
  }
}

@media (min-width: 40rem) {
  .modal01__actions {
    flex-direction: row;
    justify-content: flex-end;
  }
}

@media (prefers-reduced-motion: reduce) {
  .modal01__panel {
    animation-name: modal01-backdrop-in;
    animation-duration: 120ms;
  }
  .modal01[data-state="closing"] .modal01__panel {
    animation-name: modal01-backdrop-out;
  }
}
