/*
  Alert 08 — Progressive Diagnostics 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.92 0 0);
  --alert-soft: oklch(0.95 0 0);
  --alert-log: oklch(0.982 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;
}

/* The root is the size container the layout responds to. */
.alert08 {
  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";
}

.alert08 p,
.alert08 ol {
  margin: 0;
}

.alert08__summary {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  padding: 1rem;
}

.alert08__verdict {
  display: flex;
  min-width: 0;
  flex: 1;
  align-items: flex-start;
  gap: 0.75rem;
}

.alert08__tile {
  display: flex;
  width: 2.25rem;
  height: 2.25rem;
  flex-shrink: 0;
  align-items: center;
  justify-content: center;
  border-radius: 0.5rem;
  background-color: oklch(0.95 0.06 85);
  color: oklch(0.5 0.12 65);
}

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

.alert08[data-tone="error"] .alert08__tile {
  background-color: oklch(0.95 0.03 25);
  color: oklch(0.52 0.19 27);
}

.alert08[data-tone="success"] .alert08__tile {
  background-color: oklch(0.18 0 0);
  color: var(--alert-accent);
}

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

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

.alert08__meta {
  margin-top: 0.125rem !important;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-family: var(--alert-mono);
  font-size: 0.75rem;
  line-height: 1rem;
  color: var(--alert-muted);
}

.alert08__checks-row {
  display: flex;
  align-items: center;
  gap: 1rem;
}

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

/* Proportional check bar — passed (neon), warnings (amber), failed (red). */
.alert08__bar {
  display: flex;
  height: 0.375rem;
  overflow: hidden;
  border-radius: 9999px;
  background-color: var(--alert-soft);
}

.alert08__seg {
  display: block;
  height: 100%;
  transition: width 400ms cubic-bezier(0.3, 0.8, 0.25, 1);
}

.alert08__seg + .alert08__seg {
  box-shadow: inset 2px 0 0 #ffffff;
}

.alert08__seg--passed {
  background-color: var(--alert-accent);
}

.alert08__seg--warn {
  background-color: oklch(0.78 0.15 75);
}

.alert08__seg--fail {
  background-color: oklch(0.58 0.2 27);
}

.alert08__counts {
  display: flex;
  flex-wrap: wrap;
  gap: 0.125rem 0.75rem;
  margin-top: 0.375rem !important;
  white-space: nowrap;
  font-size: 0.75rem;
  line-height: 1rem;
  font-variant-numeric: tabular-nums;
  color: var(--alert-muted);
}

.alert08__counts strong {
  font-weight: 600;
  color: var(--alert-fg);
}

.alert08__toggle {
  display: flex;
  height: 2.25rem;
  flex-shrink: 0;
  align-items: center;
  gap: 0.375rem;
  border: 1px solid var(--alert-border);
  border-radius: 0.5rem;
  background-color: #ffffff;
  padding: 0 0.75rem;
  font-family: inherit;
  font-size: 13px;
  font-weight: 500;
  color: var(--alert-fg);
  cursor: pointer;
  outline: none;
  transition: background-color 150ms;
}

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

.alert08__toggle svg {
  width: 0.875rem;
  height: 0.875rem;
  transition: transform 200ms ease-out;
}

.alert08__toggle[aria-expanded="true"] svg {
  transform: rotate(180deg);
}

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

/* Disclosure: an animated height reveal. Collapsed details are also
   removed from the tab order and the accessibility tree via `visibility`. */
.alert08__details {
  display: grid;
  grid-template-rows: 0fr;
  visibility: hidden;
  transition:
    grid-template-rows 300ms cubic-bezier(0.3, 0.8, 0.25, 1),
    visibility 0s linear 300ms;
}

.alert08__details[data-expanded] {
  grid-template-rows: 1fr;
  visibility: visible;
  transition:
    grid-template-rows 300ms cubic-bezier(0.3, 0.8, 0.25, 1),
    visibility 0s;
}

.alert08__details-clip {
  min-height: 0;
  overflow: hidden;
}

.alert08__log {
  border-top: 1px solid var(--alert-border);
  background-color: var(--alert-log);
}

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

.alert08__log-title {
  font-family: var(--alert-mono);
  font-size: 11px;
  line-height: 1rem;
  letter-spacing: 0.025em;
  text-transform: uppercase;
  color: var(--alert-muted);
}

.alert08__copy {
  display: flex;
  height: 1.75rem;
  align-items: center;
  gap: 0.375rem;
  border: 0;
  border-radius: 0.375rem;
  background: none;
  padding: 0 0.5rem;
  font-family: inherit;
  font-size: 0.75rem;
  font-weight: 500;
  color: var(--alert-fg);
  cursor: pointer;
  outline: none;
  transition: background-color 150ms;
}

.alert08__copy:hover {
  background-color: #ffffff;
}

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

.alert08__copy svg {
  width: 0.875rem;
  height: 0.875rem;
}

.alert08__rows {
  padding: 0 0.5rem 0.5rem;
  list-style: none;
}

.alert08__row {
  display: grid;
  grid-template-columns: 3.25rem minmax(0, 1fr);
  gap: 0.125rem 0.75rem;
  border-radius: 0.5rem;
  padding: 0.5rem;
}

/* Log rows cascade in as the panel opens. */
.alert08__details[data-expanded] .alert08__row {
  animation: alert08-row 320ms cubic-bezier(0.3, 0.8, 0.25, 1) both;
}

.alert08__details[data-expanded] .alert08__row:nth-child(2) {
  animation-delay: 40ms;
}

.alert08__details[data-expanded] .alert08__row:nth-child(3) {
  animation-delay: 80ms;
}

.alert08__details[data-expanded] .alert08__row:nth-child(n + 4) {
  animation-delay: 120ms;
}

.alert08__tag {
  align-self: start;
  border-radius: 0.25rem;
  background-color: oklch(0.93 0 0);
  padding: 0 0.375rem;
  text-align: center;
  font-family: var(--alert-mono);
  font-size: 10px;
  line-height: 1.25rem;
  font-weight: 600;
  color: oklch(0.35 0 0);
}

.alert08__tag[data-severity="warning"] {
  background-color: oklch(0.94 0.07 85);
  color: oklch(0.47 0.12 65);
}

.alert08__tag[data-severity="error"] {
  background-color: oklch(0.94 0.035 25);
  color: oklch(0.5 0.19 27);
}

.alert08__message {
  min-width: 0;
  font-size: 13px;
  line-height: 1.25rem;
  color: var(--alert-fg);
}

.alert08__code {
  font-family: var(--alert-mono);
  font-size: 0.75rem;
  line-height: 1rem;
  color: var(--alert-muted);
}

.alert08__location {
  grid-column-start: 2;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-family: var(--alert-mono);
  font-size: 11px;
  line-height: 1.25rem;
  color: var(--alert-muted);
}

@keyframes alert08-row {
  from {
    opacity: 0;
    transform: translateY(-4px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@container (min-width: 32rem) {
  .alert08__row {
    grid-template-columns: 3.25rem minmax(0, 1fr) auto;
  }
  .alert08__location {
    grid-column-start: 3;
    text-align: right;
  }
}

@container (min-width: 36rem) {
  .alert08__summary {
    flex-direction: row;
    align-items: center;
    gap: 1.25rem;
  }
  .alert08__checks-row {
    width: 18rem;
    flex-shrink: 0;
  }
}

@media (prefers-reduced-motion: reduce) {
  .alert08__seg,
  .alert08__details,
  .alert08__details[data-expanded],
  .alert08__toggle svg {
    transition: none;
  }
  .alert08__details[data-expanded] .alert08__row {
    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;
}
.alert08-layout {
  display: flex;
  align-items: flex-start;
  justify-content: center;
  padding: 2rem 1rem;
}
.alert08-layout__page {
  width: 100%;
  max-width: 47.5rem;
}
.alert08-layout__head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 0.75rem;
  margin-bottom: 0.75rem;
  padding: 0 0.25rem;
}
.alert08-layout__heading {
  font-size: 15px;
  font-weight: 600;
  color: oklch(0.205 0 0);
}
.alert08-layout__site {
  font-size: 0.75rem;
  line-height: 1rem;
  color: oklch(0.556 0 0);
}
.alert08-layout__page .alert08 {
  box-shadow:
    0 1px 2px rgba(0, 0, 0, 0.04),
    0 16px 40px -16px rgba(0, 0, 0, 0.14);
}
.alert08-layout__history {
  margin: 1rem 0 0;
  padding: 0;
  list-style: none;
  overflow: hidden;
  border: 1px solid rgba(0, 0, 0, 0.05);
  border-radius: 1rem;
  background: #ffffff;
}
.alert08-layout__deploy {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.75rem 1rem;
}
.alert08-layout__deploy + .alert08-layout__deploy {
  border-top: 1px solid oklch(0.97 0 0);
}
.alert08-layout__commit {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 0.75rem;
  line-height: 1rem;
  color: oklch(0.708 0 0);
}
.alert08-layout__message {
  min-width: 0;
  flex: 1;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 0.875rem;
  line-height: 1.25rem;
  color: oklch(0.205 0 0);
}
.alert08-layout__when {
  flex-shrink: 0;
  font-size: 0.75rem;
  line-height: 1rem;
  color: oklch(0.556 0 0);
}
@media (min-width: 640px) {
  .alert08-layout {
    padding: 2.5rem;
  }
}
