/*
  Alert 10 — Signature Undo 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.
*/

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

:root {
  --alert-accent: #39ff14;
  --alert-ink: oklch(0.16 0 0);
  --alert-ink-raised: oklch(0.24 0 0);
  --alert-on-ink: oklch(0.98 0 0);
  --alert-on-ink-muted: oklch(0.72 0 0);
  --alert-mono: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, monospace;
}

.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;
}

.alert10-root {
  font-family:
    Inter, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif, "Apple Color Emoji",
    "Segoe UI Emoji";
}

/* The card is the size container its layout responds to. */
.alert10 {
  container-type: inline-size;
  position: relative;
  overflow: hidden;
  border-radius: 1rem;
  background-color: var(--alert-ink);
  color: var(--alert-on-ink);
  font-family:
    Inter, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif, "Apple Color Emoji",
    "Segoe UI Emoji";
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.06),
    0 20px 48px -16px rgba(0, 0, 0, 0.45);
  animation: alert10-in 320ms cubic-bezier(0.2, 0.9, 0.3, 1.15) both;
}

.alert10[hidden] {
  display: none;
}

.alert10[data-state="closing"] {
  animation: alert10-out 200ms ease-in both;
}

.alert10 p {
  margin: 0;
}

.alert10__grid {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center;
  gap: 0.75rem;
  padding: 0.75rem 0.5rem 0.75rem 0.75rem;
}

.alert10__tile {
  display: flex;
  width: 2.25rem;
  height: 2.25rem;
  align-items: center;
  justify-content: center;
  border-radius: 0.75rem;
  background-color: var(--alert-ink-raised);
}

.alert10 svg {
  display: block;
  width: 1rem;
  height: 1rem;
}

.alert10__text {
  min-width: 0;
}

.alert10__title,
.alert10__detail {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.alert10__title {
  font-size: 0.875rem;
  line-height: 1.25rem;
  font-weight: 600;
}

.alert10__detail {
  font-size: 0.75rem;
  line-height: 1rem;
  color: var(--alert-on-ink-muted);
}

.alert10__close {
  grid-column-start: 3;
  grid-row-start: 1;
  display: flex;
  width: 2.25rem;
  height: 2.25rem;
  align-items: center;
  justify-content: center;
  border: 0;
  border-radius: 0.5rem;
  background: none;
  padding: 0;
  color: var(--alert-on-ink-muted);
  cursor: pointer;
  outline: none;
  transition:
    background-color 150ms,
    color 150ms;
}

.alert10__close:hover {
  background-color: var(--alert-ink-raised);
  color: var(--alert-on-ink);
}

.alert10__close:focus-visible {
  outline: 2px solid var(--alert-accent);
  outline-offset: -2px;
}

.alert10__actions {
  grid-column: span 3 / span 3;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  padding-right: 0.25rem;
}

.alert10__timer {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.75rem;
  line-height: 1rem;
  font-variant-numeric: tabular-nums;
  color: var(--alert-on-ink-muted);
}

.alert10__seconds {
  min-width: 2rem;
  font-family: var(--alert-mono);
}

.alert10__kbd {
  display: none;
  border: 1px solid rgba(255, 255, 255, 0.15);
  border-radius: 0.25rem;
  padding: 0 0.375rem;
  font-family: inherit;
  font-size: 11px;
  line-height: 1.25rem;
  color: var(--alert-on-ink-muted);
}

.alert10__undo {
  display: flex;
  height: 2.75rem;
  min-width: 7rem;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  border: 0;
  border-radius: 0.5rem;
  background-color: rgba(255, 255, 255, 0.06);
  padding: 0 1rem;
  font-family: inherit;
  font-size: 0.875rem;
  line-height: 1.25rem;
  font-weight: 600;
  color: var(--alert-accent);
  cursor: pointer;
  outline: none;
  transition: background-color 150ms;
}

.alert10__undo:hover {
  background-color: rgba(57, 255, 20, 0.15);
}

.alert10__undo:focus-visible {
  outline: 2px solid var(--alert-accent);
  outline-offset: 2px;
}

/* The signature: a neon edge that drains right to left as the undo window
   closes, with a soft glow beneath it. It pauses exactly when the timer
   does — on hover, on focus, or when paused. */
.alert10__edge {
  position: absolute;
  right: 0;
  bottom: 0;
  left: 0;
  height: 2px;
  background-color: var(--alert-accent);
  box-shadow: 0 0 12px 1px rgba(57, 255, 20, 0.55);
  transform-origin: left center;
  animation: alert10-drain var(--alert10-duration, 10000ms) linear both;
  animation-delay: var(--alert10-delay, 0ms);
}

.alert10[data-halted] .alert10__edge {
  animation-play-state: paused;
}

@keyframes alert10-drain {
  from {
    transform: scaleX(1);
  }
  to {
    transform: scaleX(0);
  }
}

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

@keyframes alert10-out {
  to {
    opacity: 0;
    transform: translateY(6px) scale(0.98);
  }
}

@keyframes alert10-fade-in {
  from {
    opacity: 0;
  }
}

@keyframes alert10-fade-out {
  to {
    opacity: 0;
  }
}

@container (min-width: 28rem) {
  .alert10__grid {
    grid-template-columns: auto minmax(0, 1fr) auto auto;
    column-gap: 0.5rem;
    padding-top: 0.625rem;
    padding-bottom: 0.625rem;
  }
  .alert10__text {
    padding-right: 0.5rem;
  }
  .alert10__close {
    grid-column-start: 4;
  }
  .alert10__actions {
    grid-column: 3 / span 1;
    grid-row-start: 1;
    gap: 0.5rem;
    padding-right: 0;
  }
  .alert10__undo {
    height: 2.25rem;
    min-width: 0;
    padding: 0 0.75rem;
  }
}

@container (min-width: 32rem) {
  .alert10__kbd {
    display: inline;
  }
}

/* Reduced motion: no movement and no draining edge — the seconds counter
   still says how long is left. Opacity fades stay so closing still ends. */
@media (prefers-reduced-motion: reduce) {
  .alert10 {
    animation: alert10-fade-in 120ms linear both;
  }
  .alert10[data-state="closing"] {
    animation: alert10-fade-out 120ms linear both;
  }
  .alert10__edge {
    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;
}
.alert10-layout {
  display: flex;
  align-items: flex-start;
  justify-content: center;
  padding: 2rem 1rem;
}
.alert10-layout__page {
  width: 100%;
  max-width: 40rem;
}
.alert10-layout__head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 0.75rem;
  margin-bottom: 0.75rem;
  padding: 0 0.25rem;
}
.alert10-layout__heading {
  font-size: 15px;
  font-weight: 600;
  color: oklch(0.205 0 0);
}
.alert10-layout__count {
  font-size: 0.75rem;
  line-height: 1rem;
  font-variant-numeric: tabular-nums;
  color: oklch(0.556 0 0);
}
.alert10-layout__list {
  margin: 0;
  padding: 0;
  list-style: none;
  overflow: hidden;
  border: 1px solid rgba(0, 0, 0, 0.05);
  border-radius: 1rem;
  background: #ffffff;
}
.alert10-layout__row {
  display: grid;
  grid-template-rows: 1fr;
  transition: grid-template-rows 300ms cubic-bezier(0, 0, 0.2, 1);
}
/* Hide only once collapsed; a restored row is visible (and focusable) at once. */
.alert10-layout__row[data-archived] {
  visibility: hidden;
  transition:
    grid-template-rows 300ms cubic-bezier(0, 0, 0.2, 1),
    visibility 300ms cubic-bezier(0, 0, 0.2, 1);
  grid-template-rows: 0fr;
}
.alert10-layout__clip {
  min-height: 0;
  overflow: hidden;
}
.alert10-layout__inner {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.75rem 1rem;
}
.alert10-layout__inner--divided {
  border-top: 1px solid oklch(0.97 0 0);
}
.alert10-layout__initial {
  display: flex;
  width: 2.25rem;
  height: 2.25rem;
  flex-shrink: 0;
  align-items: center;
  justify-content: center;
  border-radius: 0.5rem;
  background: oklch(0.97 0 0);
  font-size: 0.75rem;
  line-height: 1rem;
  font-weight: 600;
  color: oklch(0.439 0 0);
}
.alert10-layout__text {
  min-width: 0;
  flex: 1;
}
.alert10-layout__name,
.alert10-layout__meta {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.alert10-layout__name {
  font-size: 0.875rem;
  line-height: 1.25rem;
  font-weight: 500;
  color: oklch(0.205 0 0);
}
.alert10-layout__meta {
  font-size: 0.75rem;
  line-height: 1rem;
  color: oklch(0.556 0 0);
}
.alert10-layout__archive {
  display: flex;
  height: 2.25rem;
  flex-shrink: 0;
  align-items: center;
  gap: 0.375rem;
  border: 1px solid oklch(0.922 0 0);
  border-radius: 0.5rem;
  background: none;
  padding: 0 0.625rem;
  font-family: inherit;
  font-size: 0.75rem;
  line-height: 1rem;
  font-weight: 500;
  color: oklch(0.371 0 0);
  cursor: pointer;
  outline: none;
  transition: background-color 150ms;
}
.alert10-layout__archive:hover {
  background: oklch(0.985 0 0);
}
.alert10-layout__archive:focus-visible {
  outline: 2px solid oklch(0.205 0 0);
  outline-offset: 2px;
}
.alert10-layout__archive svg {
  display: block;
  width: 1rem;
  height: 1rem;
}
.alert10-layout__archive-label {
  display: none;
}
.alert10-layout__empty {
  padding: 1.5rem 1rem;
  text-align: center;
  font-size: 0.875rem;
  line-height: 1.25rem;
  color: oklch(0.556 0 0);
}
.alert10-layout__slot {
  margin-top: 1rem;
  min-height: 7rem;
}
.alert10-layout__slot .alert10 {
  max-width: 32rem;
  margin: 0 auto;
}
@media (min-width: 40rem) {
  .alert10-layout {
    padding: 2.5rem;
  }
  .alert10-layout__archive-label {
    display: inline;
  }
  .alert10-layout__slot {
    min-height: 4rem;
  }
}
@media (prefers-reduced-motion: reduce) {
  .alert10-layout__row {
    transition: none;
  }
}
