/* result.css: the result pages (js/views/result.js, js/views/shared.js).
   Only .result-* and .share-* classes. Tokens, .card, .notice, .btn, .input, .stack and the other shared
   classes come from base.css; the document itself (.doc-*) is styled by document.css.
   Mobile first: everything is laid out for a 320px wide screen first and only widened afterwards. */

/* ---------- page skeleton ---------- */
.result-page,
.result-head {
  min-width: 0;
}

/* ---------- risk card ----------
   The base .notice--risk already gives the red frame and tint. This makes it the loudest thing on the page:
   a halo, a larger title with a round "!" mark, and the help text in its own white box. */
.result-risk {
  padding: 16px;
  border-width: 2px;
  box-shadow: 0 0 0 4px rgba(198, 40, 40, 0.14), 0 10px 24px rgba(164, 22, 26, 0.12);
}

.result-risk .notice__title {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 0 0 12px;
  font-size: 1.3125rem;
  line-height: 1.3;
}

/* the round "!" mark: an aria-hidden element, so its generated glyph is never read out */
.result-risk__icon {
  flex: 0 0 auto;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 30px;
  height: 30px;
  border-radius: 50%;
  background: var(--err);
  color: #fff;
  font-size: 1.125rem;
  font-weight: 800;
  line-height: 1;
}

.result-risk__icon::before {
  content: "!";
}

.result-risk p {
  margin: 0 0 10px;
}

.result-risk p:last-child {
  margin-bottom: 0;
}

.result-risk__help {
  padding: 10px 12px;
  border-left: 4px solid var(--err);
  border-radius: 8px;
  background: #fff;
  color: var(--risk-ink);
  font-size: 1.0625rem;
  line-height: 1.7;
}

/* ---------- header card ---------- */
.result-summary {
  border-top: 4px solid var(--primary);
}

.result-title {
  margin: 0 0 6px;
  font-size: clamp(1.375rem, 1.1rem + 1.4vw, 1.75rem);
  line-height: 1.3;
  overflow-wrap: anywhere;
}

.result-time {
  margin: 0;
  font-size: 0.9375rem;
}

.result-figures {
  display: flex;
  flex-wrap: wrap;
  gap: 6px 28px;
  margin-top: 14px;
  padding-top: 14px;
  border-top: 1px solid var(--line);
}

.result-figure {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 2px 6px;
  min-width: 0;
  margin: 0;
}

.result-figure__label {
  color: var(--muted);
  font-size: 0.9375rem;
}

.result-figure__value {
  color: var(--primary-ink);
  font-size: 1.5rem;
  line-height: 1.3;
  overflow-wrap: anywhere;
}

/* ---------- caveat line and notices under the header ---------- */
.result-caveat {
  margin: 0;
  padding: 0 4px;
  line-height: 1.6;
}

.result-help {
  color: var(--text);
}

/* ---------- fallback body (no result document) ---------- */
.result-fallback {
  gap: 14px;
}

.result-fallback__title {
  margin: 0;
  padding-left: 0.6em;
  border-left: 4px solid var(--primary);
  font-size: 1.0625rem;
}

.result-fallback__link {
  margin: 0;
}

.result-explanations {
  display: grid;
  gap: 0.75em;
}

.result-explanations p {
  margin: 0;
  line-height: 1.75;
}

/* scrollable region: the table may be wider than a phone screen */
.result-table-wrap {
  overflow-x: auto;
  overscroll-behavior-x: contain;
  -webkit-overflow-scrolling: touch;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--panel);
}

.result-table {
  width: 100%;
  min-width: 280px;
  border-collapse: collapse;
  font-size: 0.9375rem;
  line-height: 1.55;
}

.result-table th,
.result-table td {
  padding: 9px 12px;
  border-bottom: 1px solid #eee7df;
  text-align: left;
  vertical-align: top;
}

.result-table thead th {
  background: #fcfaf6;
  color: #44515f;
  font-weight: 700;
  white-space: nowrap;
}

.result-table tbody th {
  min-width: 5em;
  font-weight: 600;
}

.result-table td.preline {
  min-width: 14em;
}

.result-table tbody tr:last-child > * {
  border-bottom: 0;
}

/* ---------- credential reminder ---------- */
.result-credential p {
  margin: 0 0 0.6em;
}

.result-credential p:last-child {
  margin-bottom: 0;
}

.result-credential__action {
  margin-top: 0.75em;
}

.result-credential__link {
  display: inline-flex;
  align-items: center;
  min-height: var(--tap);
  font-weight: 600;
}

/* ---------- share and delete panel ---------- */
.share-title,
.share-subtitle {
  margin: 0;
}

.share-subtitle {
  font-size: 1rem;
}

.share-box {
  min-width: 0;
}

.share-box p {
  margin: 0;
}

/* read-only field: tapping or focusing it selects the whole link */
.share-url {
  background-color: #faf8f3;
  text-overflow: ellipsis;
}

/* Buttons keep their natural width and wrap into rows (two or three on a 320px phone, one row on wide
   screens); each row is stretched to the full width, so a lone last button never looks lost. */
.share-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.share-actions .btn {
  flex: 1 1 auto;
  min-width: 0;
  padding-right: 12px;
  padding-left: 12px;
}

/* a lone button: full width on phones, natural width otherwise */
.share-single {
  display: flex;
}

.share-single .btn {
  width: 100%;
}

.share-feedback {
  margin: 0;
  color: var(--text);
  font-weight: 600;
}

/* "Updating the share settings…" / "Deleting…" while a request runs. A live region that is visually hidden
   (by .visually-hidden) while idle, so it takes no room. */
.share-status {
  display: flex;
  align-items: center;
  gap: 10px;
  color: var(--text);
  font-weight: 600;
}

.share-zone {
  padding-top: 16px;
  border-top: 1px dashed var(--line);
}

.share-zone p {
  margin: 0;
}

.share-zone--danger .share-subtitle {
  color: var(--risk-ink);
}

/* ---------- missing / gone / deleted cards ---------- */
.result-state {
  max-width: 520px;
  margin-right: auto;
  margin-left: auto;
  padding-top: 24px;
  padding-bottom: 24px;
  text-align: center;
}

.result-state .result-title {
  margin: 0;
}

.result-state p {
  margin: 0;
}

.result-state__actions {
  justify-content: center;
}

/* ---------- shared view ---------- */
.share-banner p {
  margin: 0;
}

.share-cta {
  border-top: 4px solid var(--accent);
}

.share-cta__title {
  margin: 0;
  font-size: 1.125rem;
}

.share-cta p {
  margin: 0;
}

/* ---------- wider screens ---------- */
@media (min-width: 480px) {
  .share-single .btn {
    width: auto;
  }

  .result-risk {
    padding: 18px 20px;
  }
}

@media (min-width: 600px) {
  .result-figures {
    gap: 6px 40px;
  }

  .result-state {
    padding-top: 32px;
    padding-bottom: 32px;
  }
}

/* ---------- accessibility and print ---------- */
@media (forced-colors: active) {
  .result-risk__icon {
    border: 2px solid CanvasText;
  }

  .result-risk {
    border-color: CanvasText;
  }
}

@media print {
  .share-panel,
  .share-cta,
  .result-credential,
  .result-state__actions,
  .result-fallback__link,
  .result-token-link {
    display: none !important;
  }

  .result-risk {
    box-shadow: none;
  }
}
