/* Crash report page — builds on landing.css tokens (Material 3 Expressive). */

.crash {
  width: min(760px, 100% - var(--gutter) * 2);
  margin: 0 auto;
  padding: clamp(40px, 7vw, 88px) 0 clamp(64px, 9vw, 112px);
}
.crash-report {
  display: grid;
  gap: 12px;
}
body.has-fallback .crash-report {
  display: none;
}
.label--coral {
  color: var(--on-coral-container);
}
:root[data-theme-state="dark"] .label--coral {
  color: #ffb4ab;
}
.crash__head {
  margin-bottom: 20px;
}
.crash__title {
  margin: 0 0 16px;
  font-size: clamp(38px, 6vw, 64px);
  line-height: 1.05;
  letter-spacing: -0.03em;
  font-weight: 760;
  font-variation-settings: "ROND" 100;
  text-wrap: balance;
}
.crash__lead {
  margin: 0;
  max-width: 620px;
  font-size: clamp(17px, 1.9vw, 19px);
  color: var(--on-surface-variant);
  text-wrap: pretty;
}
.crash-privacy {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  margin-top: 24px;
  padding: 16px 20px;
  border-radius: var(--r-xl);
  background: var(--secondary-container);
  color: var(--on-secondary-container);
  font-size: 15.5px;
}
.crash-privacy .ms {
  font-size: 22px;
  margin-top: 1px;
}

/* What happened */
.crash-summary {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  gap: 16px;
  align-items: start;
  padding: 22px;
  border-radius: var(--r-2xl);
  background: var(--coral-container);
  color: var(--on-coral-container);
}
.crash-summary .shape-icon {
  --c-bg: var(--surface-lowest);
  --c-ink: #c62828;
}
:root[data-theme-state="dark"] .crash-summary .shape-icon {
  --c-bg: var(--on-coral-container);
  --c-ink: var(--coral-container);
}
.crash-summary__body {
  display: grid;
  gap: 8px;
  min-width: 0;
}
.crash-summary__label {
  font-size: 13.5px;
  font-weight: 700;
  opacity: 0.8;
  font-variation-settings: "ROND" 100;
}
.crash-summary__name {
  font: 600 15px/1.5 var(--font-mono);
  overflow-wrap: anywhere;
}
.crash-summary__chips {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}
.crash-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 30px;
  padding: 0 12px 0 8px;
  border-radius: var(--r-s);
  background: color-mix(in srgb, var(--surface-lowest) 55%, transparent);
  font-size: 13px;
  font-weight: 600;
}
.crash-chip .ms {
  font-size: 17px;
}
.crash-chip:has(span:empty) {
  display: none;
}

/* Cards */
.crash-card {
  border-radius: var(--r-2xl);
  background: var(--card);
  box-shadow: inset 0 0 0 1px var(--card-edge);
}
.crash-form {
  display: grid;
  gap: 20px;
  padding: 24px;
}

/* M3 outlined text field */
.field {
  display: grid;
  gap: 6px;
}
.field__label {
  font-size: 15px;
  font-weight: 650;
  font-variation-settings: "ROND" 100;
}
.field textarea {
  width: 100%;
  min-height: 120px;
  padding: 14px 16px;
  border: 0;
  border-radius: var(--r-l);
  background: transparent;
  color: var(--on-surface);
  box-shadow: inset 0 0 0 1px var(--outline);
  font: 400 16px/1.55 var(--font-sans);
  resize: vertical;
  transition: box-shadow 0.2s var(--emph);
}
.field textarea::placeholder {
  color: var(--on-surface-variant);
  opacity: 0.75;
}
.field textarea:hover {
  box-shadow: inset 0 0 0 1px var(--on-surface);
}
.field textarea:focus {
  outline: none;
  box-shadow: inset 0 0 0 2px var(--primary);
}
.field textarea:disabled {
  opacity: 0.6;
}
.field__support {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  padding: 0 4px;
  font-size: 13px;
  color: var(--on-surface-variant);
}
.field__count {
  font-variant-numeric: tabular-nums;
}

.crash-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}
.crash-actions .btn[disabled] {
  opacity: 0.55;
  cursor: progress;
  box-shadow: none;
}
.crash-form.is-done .crash-actions,
.crash-form.is-done .field__support {
  display: none;
}

/* Status banner */
.crash-status {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 18px;
  border-radius: var(--r-xl);
  font-size: 15.5px;
  font-weight: 550;
  background: var(--surface-high);
}
.crash-status[hidden] {
  display: none;
}
.crash-status__icon {
  position: relative;
  display: grid;
  place-items: center;
  width: 32px;
  height: 32px;
  flex-shrink: 0;
}
.crash-status__spinner {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  fill: var(--primary);
  display: none;
}
.crash-status__glyph {
  font-size: 24px;
}
.crash-status[data-kind="pending"] .crash-status__spinner {
  display: block;
}
.crash-status[data-kind="success"] {
  background: var(--primary-container);
  color: var(--on-primary-container);
}
.crash-status[data-kind="error"] {
  background: var(--coral-container);
  color: var(--on-coral-container);
}

/* What gets submitted */
.crash-details {
  overflow: hidden;
}
.crash-details summary {
  list-style: none;
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  gap: 14px;
  align-items: center;
  padding: 18px 20px;
  cursor: pointer;
}
.crash-details summary::-webkit-details-marker {
  display: none;
}
.crash-details summary .shape-icon {
  width: 48px;
  height: 48px;
}
.crash-details__title {
  display: grid;
  gap: 2px;
}
.crash-details__title b {
  font-size: 17px;
  font-variation-settings: "ROND" 100;
}
.crash-details__title span {
  font-size: 14px;
  color: var(--on-surface-variant);
}
.crash-details__chevron {
  display: grid;
  place-items: center;
  width: 40px;
  height: 40px;
  border-radius: 20px;
  background: var(--surface-high);
  font-size: 24px;
  transition: transform 0.5s var(--spring), border-radius 0.5s var(--spring-fast);
}
.crash-details[open] .crash-details__chevron {
  transform: rotate(180deg);
  border-radius: var(--r-m);
}
.crash-details__lead {
  margin: 0;
  padding: 0 24px 16px;
  font-size: 15px;
  color: var(--on-surface-variant);
}
.crash-meta {
  display: grid;
  gap: 3px;
  margin: 0 20px;
}
.crash-meta div {
  display: grid;
  grid-template-columns: 150px minmax(0, 1fr);
  gap: 12px;
  padding: 11px 16px;
  border-radius: var(--r-s);
  background: var(--surface-low);
  font-size: 14.5px;
}
:root[data-theme-state="dark"] .crash-meta div {
  background: var(--surface-high);
}
.crash-meta div:first-child {
  border-radius: var(--r-l) var(--r-l) var(--r-s) var(--r-s);
}
.crash-meta div:last-child {
  border-radius: var(--r-s) var(--r-s) var(--r-l) var(--r-l);
}
.crash-meta dt {
  color: var(--on-surface-variant);
  font-weight: 600;
}
.crash-meta dd {
  margin: 0;
  font-family: var(--font-mono);
  font-size: 13.5px;
  overflow-wrap: anywhere;
}
.crash-stack {
  display: grid;
  gap: 8px;
  padding: 16px 20px 20px;
}
.crash-stack__label {
  font-size: 14px;
  font-weight: 650;
  color: var(--on-surface-variant);
}
.crash-stack pre {
  margin: 0;
  max-height: 320px;
  overflow: auto;
  padding: 14px 16px;
  white-space: pre;
  font-size: 12.5px;
  line-height: 1.7;
  scrollbar-width: thin;
  scrollbar-color: color-mix(in srgb, var(--on-surface) 24%, transparent) transparent;
}

/* Invalid link empty state */
.crash-empty {
  display: grid;
  justify-items: center;
  text-align: center;
  padding: clamp(24px, 6vw, 64px) 0;
}
.crash-empty[hidden] {
  display: none;
}
.crash-empty__art {
  position: relative;
  display: grid;
  place-items: center;
  width: 148px;
  height: 148px;
  margin-bottom: 24px;
  color: var(--on-coral-container);
}
.crash-empty__art svg {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  fill: var(--coral-container);
  animation: spin 40s linear infinite;
}
.crash-empty__art .ms {
  position: relative;
  font-size: 56px;
}
.crash-empty .crash__lead {
  margin-inline: auto;
}
.crash-empty__actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 10px;
  margin-top: 32px;
}

.crash-footer {
  padding: 28px 0;
}
.crash-footer .footer__legal {
  margin: 0;
  padding: 0;
  border: 0;
}

@media (max-width: 720px) {
  .crash-meta div {
    grid-template-columns: minmax(0, 1fr);
    gap: 2px;
  }
  .crash-actions .btn {
    flex: 1 1 auto;
  }
  .crash-form {
    padding: 18px;
  }
}

/* Keep the footer at the bottom on short pages */
.crash-page .page {
  display: flex;
  flex-direction: column;
  min-height: 100svh;
}
.crash-page main {
  flex: 1;
}
