/*
  Alert 07 — Compact Status Alert — standalone HTML/CSS/JS
  implementation. No build step, no framework, no external dependency:
  copy index.html, this file, and script.js into any project as-is.
*/

:root {
  --alert-accent: #39ff14;
  --alert-fg: oklch(0.17 0 0);
  --alert-muted: oklch(0.48 0 0);
  --alert-border: oklch(0.91 0 0);
  --alert-soft: oklch(0.955 0 0);
  --alert-ink-hover: oklch(0.32 0 0);
}

.alert07 {
  display: inline-flex;
  max-width: 100%;
  height: 2rem;
  align-items: center;
  gap: 0.25rem;
  border: 1px solid var(--alert-border);
  border-radius: 9999px;
  background-color: #ffffff;
  padding: 0 0.25rem 0 0.625rem;
  font-family:
    Inter, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif, "Apple Color Emoji",
    "Segoe UI Emoji";
}

/* Status dot: amber while unsaved, a hollow ring while saving, neon once
   saved (ringed in ink so it reads on white), red on failure. */
.alert07__dot {
  width: 0.5rem;
  height: 0.5rem;
  flex-shrink: 0;
  border-radius: 9999px;
  transition:
    background-color 220ms ease-out,
    box-shadow 220ms ease-out;
}

.alert07[data-status="unsaved"] .alert07__dot {
  background-color: oklch(0.78 0.15 75);
}

.alert07[data-status="saving"] .alert07__dot {
  background-color: transparent;
  box-shadow: inset 0 0 0 1.5px oklch(0.6 0 0);
}

.alert07[data-status="saved"] .alert07__dot {
  background-color: var(--alert-accent);
  box-shadow: 0 0 0 1.5px var(--alert-fg);
}

.alert07[data-status="error"] {
  border-color: oklch(0.86 0.06 25);
}

.alert07[data-status="error"] .alert07__dot {
  background-color: oklch(0.58 0.2 27);
}

.alert07[data-status="error"] .alert07__message {
  color: oklch(0.5 0.19 27);
}

.alert07__line {
  min-width: 0;
  margin: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  padding: 0 0.25rem;
  font-size: 0.75rem;
  line-height: 1rem;
  font-weight: 500;
  font-variant-numeric: tabular-nums;
  color: var(--alert-fg);
}

/* Each new status slides up into place — the row itself never resizes
   its height. */
.alert07__message {
  display: inline-block;
  animation: alert07-in 200ms cubic-bezier(0.3, 0.8, 0.25, 1) both;
}

.alert07__discard,
.alert07__save {
  display: flex;
  height: 1.5rem;
  flex-shrink: 0;
  align-items: center;
  border: 0;
  border-radius: 9999px;
  font-family: inherit;
  font-size: 0.75rem;
  cursor: pointer;
  outline: none;
  transition:
    background-color 150ms,
    color 150ms;
}

.alert07__discard {
  background: none;
  padding: 0 0.5rem;
  font-weight: 500;
  color: var(--alert-muted);
}

.alert07__discard[hidden] {
  display: none;
}

.alert07__discard:hover {
  background-color: var(--alert-soft);
  color: var(--alert-fg);
}

.alert07__save {
  gap: 0.375rem;
  background-color: var(--alert-fg);
  padding: 0 0.625rem;
  font-weight: 600;
  color: #ffffff;
}

.alert07__save:hover {
  background-color: var(--alert-ink-hover);
}

.alert07__save[aria-disabled="true"],
.alert07__save[aria-disabled="true"]:hover {
  cursor: default;
  background-color: var(--alert-soft);
  color: var(--alert-muted);
}

.alert07__discard:focus-visible,
.alert07__save:focus-visible {
  outline: 2px solid var(--alert-fg);
  outline-offset: 1px;
}

.alert07__spinner {
  width: 0.625rem;
  height: 0.625rem;
  border: 1.5px solid currentColor;
  border-right-color: transparent;
  border-radius: 9999px;
  animation: alert07-spin 700ms linear infinite;
}

.alert07__spinner[hidden],
.alert07__kbd[hidden] {
  display: none;
}

.alert07__kbd {
  display: none;
  border-radius: 0.25rem;
  background-color: rgba(255, 255, 255, 0.15);
  padding: 0 0.25rem;
  font-family: inherit;
  font-size: 10px;
  line-height: 1rem;
  font-weight: 500;
  color: rgba(255, 255, 255, 0.75);
}

@media (min-width: 640px) {
  .alert07__kbd:not([hidden]) {
    display: inline;
  }
}

@keyframes alert07-in {
  from {
    opacity: 0;
    transform: translateY(40%);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes alert07-spin {
  to {
    transform: rotate(360deg);
  }
}

@media (prefers-reduced-motion: reduce) {
  .alert07__dot {
    transition: none;
  }
  .alert07__message,
  .alert07__spinner {
    animation: none;
  }
}

/*
  Page layout — the canvas this resource is presented on. Adjust or drop it
  when placing the resource inside your own layout.
*/

*,
*::before,
*::after {
  box-sizing: border-box;
}
body {
  margin: 0;
  line-height: 1.5;
  font-family:
    Inter, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  background: linear-gradient(to bottom, #fafafa, #f4f4f5);
}
p {
  margin: 0;
}
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}
.alert07-layout {
  display: flex;
  align-items: flex-start;
  justify-content: center;
  padding: 2rem 1rem;
}
.alert07-layout__editor {
  width: 100%;
  max-width: 45rem;
  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 16px 40px -16px rgba(0, 0, 0, 0.14);
}
.alert07-layout__toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem 1rem;
  border-bottom: 1px solid oklch(0.97 0 0);
  padding: 0.625rem 1rem;
}
.alert07-layout__crumbs {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 13px;
  color: oklch(0.556 0 0);
}
.alert07-layout__crumbs strong {
  font-weight: 500;
  color: oklch(0.205 0 0);
}
.alert07-layout__body {
  padding: 1.25rem 1rem;
}
.alert07-layout__title,
.alert07-layout__text {
  width: 100%;
  border: 0;
  background: transparent;
  padding: 0;
  font-family: inherit;
  outline: none;
}
.alert07-layout__title {
  font-size: 1.5rem;
  line-height: 2rem;
  font-weight: 600;
  letter-spacing: -0.025em;
  color: oklch(0.205 0 0);
}
.alert07-layout__text {
  margin-top: 0.75rem;
  resize: none;
  font-size: 15px;
  line-height: 1.625;
  color: oklch(0.439 0 0);
}
.alert07-layout__title:focus-visible,
.alert07-layout__text:focus-visible {
  outline: 2px solid oklch(0.556 0 0);
  outline-offset: 4px;
}
@media (min-width: 640px) {
  .alert07-layout {
    padding: 2.5rem;
  }
  .alert07-layout__body {
    padding: 1.75rem 2rem;
  }
}
