/*
  Alert 04 — Action 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.16 0 0);
  --alert-muted: oklch(0.48 0 0);
  --alert-border: oklch(0.92 0 0);
  --alert-border-strong: oklch(0.86 0 0);
  --alert-panel: oklch(0.985 0 0);
  --alert-ink: oklch(0.17 0 0);
  --alert-ink-hover: oklch(0.28 0 0);
  --alert-danger: oklch(0.52 0.19 27);
  --alert-danger-soft: oklch(0.965 0.02 25);
}

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

/* The root is the size container the layout responds to. */
.alert04 {
  container-type: inline-size;
  overflow: hidden;
  border: 1px solid var(--alert-border);
  border-radius: 1rem;
  background-color: #ffffff;
  font-family:
    Inter, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif, "Apple Color Emoji",
    "Segoe UI Emoji";
}

.alert04 p,
.alert04 dl,
.alert04 dd {
  margin: 0;
}

.alert04[data-state="resolved"] .alert04__decision,
.alert04[data-state="open"] .alert04__success {
  display: none;
}

.alert04__decision {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
}

.alert04__content {
  padding: 1.25rem;
}

.alert04__eyebrow {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.75rem;
  line-height: 1rem;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--alert-danger);
}

.alert04__eyebrow-dot {
  width: 0.375rem;
  height: 0.375rem;
  border-radius: 9999px;
  background-color: var(--alert-danger);
}

.alert04__title {
  margin-top: 0.375rem !important;
  font-size: 1.125rem;
  line-height: 1.375;
  font-weight: 600;
  letter-spacing: -0.025em;
  text-wrap: balance;
  color: var(--alert-fg);
}

.alert04__facts {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.75rem 1.5rem;
  margin-top: 1rem !important;
}

.alert04__fact {
  min-width: 0;
}

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

.alert04__fact dd {
  margin-top: 0.125rem;
  font-size: 0.875rem;
  line-height: 1.25rem;
  font-weight: 500;
  font-variant-numeric: tabular-nums;
  overflow-wrap: break-word;
  color: var(--alert-fg);
}

.alert04__grace {
  margin-top: 1rem;
}

.alert04__grace-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 0.75rem;
  font-size: 0.75rem;
  line-height: 1rem;
}

.alert04__grace-left {
  font-weight: 500;
  color: var(--alert-fg);
}

.alert04__grace-end {
  color: var(--alert-muted);
}

.alert04__days {
  display: flex;
  gap: 3px;
  margin-top: 0.375rem;
}

/* Grace period: elapsed days are solid ink, remaining days a soft red. */
.alert04__day {
  height: 0.375rem;
  flex: 1;
  border-radius: 9999px;
  background-color: oklch(0.9 0.04 25);
}

.alert04__day[data-used] {
  background-color: oklch(0.22 0 0);
}

.alert04__failed {
  margin-top: 1rem !important;
  border-radius: 0.5rem;
  background-color: var(--alert-danger-soft);
  padding: 0.5rem 0.75rem;
  font-size: 0.875rem;
  line-height: 1.25rem;
  color: var(--alert-danger);
}

.alert04__failed[hidden] {
  display: none;
}

.alert04__actions {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  border-top: 1px solid var(--alert-border);
  background-color: var(--alert-panel);
  padding: 1rem;
}

.alert04__primary,
.alert04__retry {
  display: flex;
  width: 100%;
  height: 2.75rem;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  border-radius: 0.5rem;
  padding: 0 0.75rem;
  font-family: inherit;
  font-size: 0.875rem;
  font-weight: 600;
  white-space: nowrap;
  cursor: pointer;
  outline: none;
  transition:
    background-color 150ms,
    color 150ms;
}

.alert04__primary {
  border: 0;
  background-color: var(--alert-ink);
  color: #ffffff;
}

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

.alert04__retry {
  border: 1px solid var(--alert-border-strong);
  background-color: #ffffff;
  color: var(--alert-fg);
}

.alert04__retry:hover {
  background-color: var(--alert-panel);
}

.alert04__retry[aria-disabled="true"] {
  cursor: progress;
  color: var(--alert-muted);
}

.alert04__primary:focus-visible,
.alert04__retry:focus-visible,
.alert04__link:focus-visible {
  outline: 2px solid var(--alert-ink);
  outline-offset: 2px;
}

.alert04__spinner {
  width: 0.875rem;
  height: 0.875rem;
  border: 2px solid currentColor;
  border-right-color: transparent;
  border-radius: 9999px;
  animation: alert04-spin 700ms linear infinite;
}

.alert04__spinner[hidden] {
  display: none;
}

.alert04__link {
  align-self: center;
  margin-bottom: -0.25rem;
  padding: 0.25rem 0;
  border-radius: 0.125rem;
  font-size: 0.75rem;
  line-height: 1rem;
  font-weight: 500;
  color: var(--alert-muted);
  text-decoration: underline;
  text-decoration-color: var(--alert-border-strong);
  text-underline-offset: 3px;
}

.alert04__link:hover {
  color: var(--alert-fg);
}

/* The confirmation settles in from slightly below. */
.alert04__success {
  display: flex;
  align-items: flex-start;
  gap: 0.875rem;
  padding: 1.25rem;
  outline: none;
  animation: alert04-resolve 320ms cubic-bezier(0.3, 0.8, 0.25, 1) both;
}

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

.alert04__success-mark {
  display: flex;
  width: 2.5rem;
  height: 2.5rem;
  flex-shrink: 0;
  align-items: center;
  justify-content: center;
  border-radius: 0.75rem;
  background-color: var(--alert-ink);
  color: var(--alert-accent);
}

.alert04__success-mark svg {
  width: 1.125rem;
  height: 1.125rem;
}

.alert04__success-text {
  min-width: 0;
  flex: 1;
}

.alert04__success-title {
  font-size: 1rem;
  line-height: 1.5rem;
  font-weight: 600;
  color: var(--alert-fg);
}

.alert04__success-message {
  margin-top: 0.125rem !important;
  font-size: 0.875rem;
  line-height: 1.625;
  color: var(--alert-muted);
}

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

@keyframes alert04-resolve {
  from {
    opacity: 0;
    transform: translateY(6px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@container (min-width: 36rem) {
  .alert04__decision {
    grid-template-columns: minmax(0, 1fr) 15.5rem;
  }
  .alert04__content {
    padding-right: 1.5rem;
  }
  .alert04__actions {
    justify-content: center;
    border-top: 0;
    border-left: 1px solid var(--alert-border);
    padding: 1.25rem;
  }
  .alert04__primary,
  .alert04__retry {
    height: 2.5rem;
  }
}

@media (prefers-reduced-motion: reduce) {
  /* The "Retrying…" label carries the busy state, so the ring can stay still. */
  .alert04__success,
  .alert04__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,
h2 {
  margin: 0;
}
.alert04-layout {
  display: flex;
  align-items: flex-start;
  justify-content: center;
  padding: 2rem 1rem;
}
.alert04-layout__page {
  width: 100%;
  max-width: 47.5rem;
}
.alert04-layout__head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 0.75rem;
  margin-bottom: 0.75rem;
  padding: 0 0.25rem;
}
.alert04-layout__heading {
  font-size: 15px;
  font-weight: 600;
  color: oklch(0.205 0 0);
}
.alert04-layout__plan {
  font-size: 0.75rem;
  line-height: 1rem;
  color: oklch(0.556 0 0);
}
.alert04-layout__page .alert04 {
  box-shadow:
    0 1px 2px rgba(0, 0, 0, 0.04),
    0 16px 40px -16px rgba(0, 0, 0, 0.14);
}
.alert04-layout__methods {
  margin-top: 1rem;
  border: 1px solid rgba(0, 0, 0, 0.05);
  border-radius: 1rem;
  background: #ffffff;
  padding: 1rem 1.25rem;
}
.alert04-layout__methods-title {
  font-size: 0.875rem;
  line-height: 1.25rem;
  font-weight: 600;
  color: oklch(0.205 0 0);
  outline: none;
}
.alert04-layout__methods-title:focus-visible {
  text-decoration: underline;
}
.alert04-layout__methods-card {
  margin-top: 0.25rem;
  font-size: 0.75rem;
  line-height: 1rem;
  color: oklch(0.556 0 0);
}
@media (min-width: 640px) {
  .alert04-layout {
    padding: 2.5rem;
  }
}
