/* /harden/ CSP builder. Layout and a few small pieces only; colours, forms,
   code blocks, badges and callouts come from shellproof.css. */

.harden-privacy { margin: 18px 0 0; }

/* ---------- builder layout ---------- */
.harden-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1.1fr);
  gap: 24px;
  align-items: start;
  margin-top: 32px;
}
.harden-out { display: grid; gap: 16px; min-width: 0; }
.harden-out .panel + .panel { margin-top: 0; }

/* On wide screens the output follows you down the form. It scrolls on its
   own when it's taller than the window, so nothing is out of reach. */
@media (min-width: 1001px) {
  .harden-out {
    position: sticky;
    top: calc(var(--nav-h) + 16px);
    max-height: calc(100vh - var(--nav-h) - 32px);
    overflow-y: auto;
    overscroll-behavior: contain;
  }
}
@media (max-width: 1000px) {
  .harden-grid { grid-template-columns: minmax(0, 1fr); }
}
/* The output sits below the long form on narrow screens. */
.harden-jump { margin: 14px 0 0; color: var(--fg-muted); }
@media (min-width: 1001px) { .harden-jump { display: none; } }
.harden-out { scroll-margin-top: calc(var(--nav-h) + 12px); }

/* ---------- form ---------- */
.harden-form { min-width: 0; }
.harden-seg { display: flex; width: 100%; border-radius: 14px; }
.harden-seg button { flex: 1 1 auto; }
.harden-summary { margin: 8px 0 0; }
.harden-group { display: block; margin: 26px 0 8px; }
.harden-help { margin: 0 0 16px; }

.dir-field { margin-bottom: 14px; }
.dir-field label,
.harden-label { display: block; font-size: 13px; color: var(--fg-muted); margin-bottom: 6px; }
.dir-field label code { color: var(--fg); }
.dir-input {
  min-height: 0;
  height: auto;
  padding: 9px 12px;
  line-height: 1.6;
  overflow-y: auto;
  resize: vertical;
}
.dir-input[aria-invalid="true"],
.input[aria-invalid="true"] { border-color: var(--sev-critical); }
.dir-input[aria-invalid="true"]:focus,
.input[aria-invalid="true"]:focus { box-shadow: 0 0 0 4px var(--sev-critical-bg); }
.dir-error { margin: 6px 0 0; font-size: 13px; line-height: 1.5; color: var(--sev-critical); }
.dir-error span { display: block; }
.dir-error span + span { margin-top: 4px; }
.dir-error code { white-space: normal; overflow-wrap: anywhere; }

.harden-more {
  margin: 4px 0 14px;
  padding: 10px 14px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--bg-subtle);
}
.harden-more summary { cursor: pointer; font-size: 14px; color: var(--fg-2); }
.harden-more[open] summary { margin-bottom: 14px; }
.harden-more .dir-field:last-child { margin-bottom: 4px; }

.harden-check { display: flex; gap: 10px; align-items: flex-start; font-size: 13.5px; line-height: 1.5; color: var(--fg-2); cursor: pointer; }
.harden-check input { flex: none; width: 16px; height: 16px; margin: 2px 0 0; accent-color: var(--fg); cursor: pointer; }

/* Inline code in this page wraps instead of pushing the layout sideways. */
.harden-help code,
.harden-check code,
.harden-summary code { white-space: normal; overflow-wrap: anywhere; }

/* ---------- output ---------- */
.out-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.out-name { margin: 8px 0 14px; font-size: 14px; color: var(--fg); overflow-wrap: anywhere; }
.out-status .callout { margin-bottom: 14px; }
.out-status .callout p { margin: 4px 0 0; }
.out-tabs { display: flex; width: 100%; margin-bottom: 14px; border-radius: 14px; }
.out-tabs button { flex: 1 1 auto; }
.out-panel .code { margin-bottom: 12px; }
.out-panel .code pre {
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  max-height: 440px;
  overflow-y: auto;
}
.out-body.stale .out-panel { opacity: 0.45; }
.out-title { margin-bottom: 14px; }

.out-notes,
.harden-notes { list-style: none; margin: 0; padding: 0; }
.out-notes li,
.harden-notes li { position: relative; padding: 4px 0 4px 18px; line-height: 1.5; }
.out-notes li { font-size: 13px; color: var(--fg-muted); }
.harden-notes li { font-size: 14px; color: var(--fg-2); }
.out-notes li::before,
.harden-notes li::before {
  content: ""; position: absolute; left: 2px; top: 12px;
  width: 6px; height: 6px; border-radius: 50%; background: var(--fg-faint);
}

.warn-list { list-style: none; margin: 0; padding: 0; }
.warn {
  display: grid;
  grid-template-columns: 76px minmax(0, 1fr);
  gap: 12px;
  align-items: start;
  padding: 10px 0;
  border-bottom: 1px solid var(--border);
  font-size: 14px;
  line-height: 1.5;
  color: var(--fg-2);
}
.warn:first-child { padding-top: 0; }
.warn:last-child { padding-bottom: 0; border-bottom: 0; }
.warn .badge { justify-self: start; margin-top: 1px; }
.warn code { white-space: normal; overflow-wrap: anywhere; }

.harden-sources { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.harden-sources li { font-size: 13px; line-height: 1.5; color: var(--fg-muted); overflow-wrap: anywhere; }
.harden-sources code { white-space: normal; overflow-wrap: anywhere; color: var(--fg); }

/* ---------- explanation ---------- */
.harden-prose { margin-top: 28px; }
.harden-prose h3:first-child { margin-top: 0; }
.harden-prose code { white-space: normal; overflow-wrap: anywhere; }
.harden-prose .code pre { white-space: pre-wrap; overflow-wrap: anywhere; }
.harden-prose .callout { margin: 24px 0; }
.harden-prose .callout p { font-size: 15px; line-height: 1.6; }

.harden-refs { font-size: 13px; color: var(--fg-muted); }
.harden-refs ol { margin: 10px 0 0; padding-left: 1.3em; }
.harden-refs li { margin: 4px 0; overflow-wrap: anywhere; }
.harden-refs code { white-space: normal; }

@media (max-width: 640px) {
  .warn { grid-template-columns: minmax(0, 1fr); gap: 6px; }
  .harden-form.panel,
  .harden-out .panel { padding: 18px 16px; }
}
