/*
  Alert 02 — Form Error Summary — 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.47 0 0);
  --alert-border: oklch(0.91 0 0);
  --alert-error: oklch(0.52 0.19 27);
  --alert-error-soft: oklch(0.96 0.025 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;
}

.alert02 {
  overflow: hidden;
  border: 1px solid var(--alert-border);
  border-radius: 0.75rem;
  background-color: #ffffff;
  outline: none;
  font-family:
    Inter, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif, "Apple Color Emoji",
    "Segoe UI Emoji";
}

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

.alert02__head {
  display: flex;
  align-items: flex-start;
  gap: 0.75rem;
  padding: 1rem 1rem 0.875rem;
}

/* Remaining count sits on a red-tinted tile; when nothing is left the tile
   turns near-black with a neon check. */
.alert02__count {
  display: flex;
  width: 2.5rem;
  height: 2.5rem;
  flex-shrink: 0;
  align-items: center;
  justify-content: center;
  border-radius: 0.5rem;
  background-color: var(--alert-error-soft);
  font-size: 15px;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  color: var(--alert-error);
  transition:
    background-color 220ms ease-out,
    color 220ms ease-out;
}

.alert02__count svg {
  width: 1rem;
  height: 1rem;
}

.alert02[data-done] .alert02__count {
  background-color: oklch(0.18 0 0);
  color: var(--alert-accent);
}

.alert02__intro {
  min-width: 0;
  flex: 1;
}

.alert02__title {
  margin: 0;
  font-size: 15px;
  line-height: 1.25rem;
  font-weight: 600;
  color: var(--alert-fg);
}

.alert02__guidance {
  margin: 0.125rem 0 0;
  font-size: 0.875rem;
  line-height: 1.25rem;
  color: var(--alert-muted);
}

.alert02__guidance[hidden] {
  display: none;
}

.alert02__segments {
  display: flex;
  gap: 0.25rem;
  margin-top: 0.625rem;
}

.alert02__segment {
  height: 0.25rem;
  flex: 1;
  border-radius: 9999px;
  background-color: oklch(0.9 0.03 25);
  transition: background-color 260ms ease-out;
}

.alert02__segment[data-resolved] {
  background-color: oklch(0.2 0 0);
}

.alert02[data-done] .alert02__segment {
  background-color: var(--alert-accent);
}

.alert02__list {
  margin: 0;
  padding: 0.375rem;
  list-style: none;
  border-top: 1px solid var(--alert-border);
}

.alert02__issue {
  display: flex;
  align-items: flex-start;
  gap: 0.75rem;
  border-radius: 0.5rem;
  padding: 0.5rem 0.625rem;
}

/* Open issues show an empty ring; fixed ones fill with a neon check that
   pops in once. */
.alert02__mark {
  display: flex;
  width: 1.25rem;
  height: 1.25rem;
  flex-shrink: 0;
  align-items: center;
  justify-content: center;
  margin-top: 0.125rem;
  border-radius: 9999px;
  box-shadow: inset 0 0 0 1.5px oklch(0.85 0.05 25);
  transition:
    background-color 220ms ease-out,
    box-shadow 220ms ease-out;
}

.alert02__check {
  width: 0.75rem;
  height: 0.75rem;
  color: var(--alert-accent);
  opacity: 0;
  transform: scale(0.4);
  transition:
    opacity 180ms ease-out,
    transform 260ms cubic-bezier(0.3, 1.4, 0.5, 1);
}

.alert02__issue[data-resolved] .alert02__mark {
  background-color: oklch(0.18 0 0);
  box-shadow: none;
}

.alert02__issue[data-resolved] .alert02__check {
  opacity: 1;
  transform: scale(1);
}

.alert02__text {
  min-width: 0;
  flex: 1;
  font-size: 0.875rem;
  line-height: 1.25rem;
}

.alert02__link {
  border-radius: 0.125rem;
  font-weight: 500;
  color: var(--alert-error);
  text-decoration: underline;
  text-decoration-thickness: 1px;
  text-underline-offset: 3px;
  outline: none;
  transition: color 200ms ease-out;
}

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

.alert02__issue[data-resolved] .alert02__link {
  color: var(--alert-muted);
  text-decoration-color: oklch(0.8 0 0);
}

.alert02__message {
  display: block;
  color: var(--alert-muted);
}

@media (prefers-reduced-motion: reduce) {
  .alert02__count,
  .alert02__segment,
  .alert02__link,
  .alert02__mark,
  .alert02__check {
    transition: 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;
}
.alert02-layout {
  display: flex;
  align-items: flex-start;
  justify-content: center;
  padding: 2rem 1rem;
}
.alert02-layout__form {
  width: 100%;
  max-width: 42.5rem;
  border: 1px solid rgba(0, 0, 0, 0.05);
  border-radius: 1rem;
  background: #ffffff;
  padding: 1rem;
  box-shadow:
    0 1px 2px rgba(0, 0, 0, 0.04),
    0 16px 40px -16px rgba(0, 0, 0, 0.14);
}
.alert02-layout__heading {
  margin-bottom: 1rem;
  font-size: 15px;
  font-weight: 600;
  color: oklch(0.205 0 0);
}
.alert02-layout__layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 1.25rem;
}
.alert02-layout__fields {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 0.75rem;
}
.alert02-layout__label {
  display: block;
  margin-bottom: 0.25rem;
  font-size: 0.75rem;
  line-height: 1rem;
  font-weight: 500;
  color: oklch(0.371 0 0);
}
.alert02-layout__input {
  width: 100%;
  height: 2.5rem;
  border: 1px solid oklch(0.922 0 0);
  border-radius: 0.5rem;
  background: #ffffff;
  padding: 0 0.75rem;
  font-family: inherit;
  font-size: 0.875rem;
  color: oklch(0.205 0 0);
  outline: none;
  transition:
    border-color 150ms,
    box-shadow 150ms;
}
.alert02-layout__input:focus-visible {
  border-color: oklch(0.205 0 0);
  box-shadow: 0 0 0 2px rgba(23, 23, 23, 0.15);
}
.alert02-layout__input[aria-invalid="true"] {
  border-color: #ffa2a2;
}
.alert02-layout__input[aria-invalid="true"]:focus-visible {
  border-color: #fb2c36;
}
.alert02-layout__error {
  margin-top: 0.25rem;
  font-size: 0.75rem;
  line-height: 1rem;
  color: #c10007;
}
@media (min-width: 640px) {
  .alert02-layout {
    padding: 2.5rem;
  }
  .alert02-layout__form {
    padding: 1.5rem;
  }
  .alert02-layout__layout {
    grid-template-columns: minmax(0, 1.15fr) minmax(0, 1fr);
    align-items: start;
  }
}
