/* Public Audit App — stylesheet (Phase 6B).
   Mobile-first: base rules target small screens; @media (min-width) rules
   progressively enhance for larger ones. This tool audits OTHER sites for
   mobile-friendliness, so it would be a real credibility problem if it
   weren't itself comfortably usable on a phone. */

:root {
  --color-bg: #ffffff;
  --color-text: #1a1a1a;
  --color-muted: #5a5a5a;
  --color-border: #d9d9d9;
  --color-accent: #0a5ea6;
  --color-accent-contrast: #ffffff;
  --color-critical: #b3261e;
  --color-high: #b35c00;
  --color-medium: #7a6a00;
  --color-low: #3a5a40;
  --color-banner-partial-bg: #fff6e0;
  --color-banner-partial-border: #d9a441;
  --color-banner-error-bg: #fdecea;
  --color-banner-error-border: #d9534f;
  --radius: 8px;
  --max-width: 760px;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --color-bg: #14171a;
    --color-text: #f2f2f2;
    --color-muted: #a8a8a8;
    --color-border: #3a3f44;
    --color-accent: #6cb2f0;
    --color-accent-contrast: #0a1620;
    --color-critical: #ff6b63;
    --color-high: #ffb04d;
    --color-medium: #e0cf5c;
    --color-low: #7fd39a;
    --color-banner-partial-bg: #3a3320;
    --color-banner-partial-border: #d9a441;
    --color-banner-error-bg: #3a2222;
    --color-banner-error-border: #d9534f;
  }
}
:root[data-theme="dark"] {
  --color-bg: #14171a;
  --color-text: #f2f2f2;
  --color-muted: #a8a8a8;
  --color-border: #3a3f44;
  --color-accent: #6cb2f0;
  --color-accent-contrast: #0a1620;
  --color-critical: #ff6b63;
  --color-high: #ffb04d;
  --color-medium: #e0cf5c;
  --color-low: #7fd39a;
  --color-banner-partial-bg: #3a3320;
  --color-banner-partial-border: #d9a441;
  --color-banner-error-bg: #3a2222;
  --color-banner-error-border: #d9534f;
}

* {
  box-sizing: border-box;
}

html {
  -webkit-text-size-adjust: 100%;
}

body {
  margin: 0;
  background: var(--color-bg);
  color: var(--color-text);
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  line-height: 1.5;
  overflow-wrap: break-word; /* long evidence-derived text never breaks the layout, real content or not */
}

.container {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 0 16px;
}

/* Skip link — visible only on keyboard focus */
.skip-link {
  position: absolute;
  left: -999px;
  top: 0;
  background: var(--color-accent);
  color: var(--color-accent-contrast);
  padding: 8px 16px;
  z-index: 10;
}
.skip-link:focus {
  left: 8px;
  top: 8px;
}

.site-header {
  border-bottom: 1px solid var(--color-border);
  padding: 12px 0;
}
.brand {
  font-weight: 700;
  font-size: 1.1rem;
  text-decoration: none;
  color: inherit;
  margin: 0;
}

main {
  padding: 24px 16px 48px;
}

h1 {
  font-size: 1.6rem;
  margin: 0 0 8px;
}
h2 {
  font-size: 1.25rem;
  margin: 24px 0 8px;
}
h3 {
  font-size: 1.05rem;
  margin: 20px 0 8px;
}

.disclaimer,
.hint {
  color: var(--color-muted);
  font-size: 0.9rem;
}

.submit-section {
  margin-top: 24px;
  padding: 16px;
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
}

.field {
  margin-bottom: 16px;
}
.field label {
  display: block;
  font-weight: 600;
  margin-bottom: 4px;
}
.field input[type="text"],
.field input[type="url"],
.field input[type="email"],
.field input[type="tel"] {
  width: 100%;
  padding: 10px 12px;
  font-size: 1rem;
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  background: var(--color-bg);
  color: var(--color-text);
}
.field input[type="text"]:focus,
.field input[type="url"]:focus,
.field input[type="email"]:focus,
.field input[type="tel"]:focus,
.field input[type="checkbox"]:focus-visible,
button:focus-visible,
a:focus-visible {
  outline: 3px solid var(--color-accent);
  outline-offset: 2px;
}

.field-error {
  color: var(--color-critical);
  font-weight: 600;
  margin-top: 6px;
}

button {
  font-size: 1rem;
  font-weight: 600;
  padding: 10px 20px;
  border-radius: var(--radius);
  border: none;
  background: var(--color-accent);
  color: var(--color-accent-contrast);
  cursor: pointer;
  min-height: 44px; /* comfortable touch target on mobile */
}
button:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}
button:hover:not(:disabled) {
  filter: brightness(1.08);
}

.site-footer {
  border-top: 1px solid var(--color-border);
  color: var(--color-muted);
  font-size: 0.85rem;
  padding: 16px 0 32px;
}

/* --- Status / progress / result panels (audit.html) --- */

#status-region {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap; /* visually hidden but still announced by assistive tech via aria-live */
}

#progress-panel,
#ceiling-panel,
#error-panel,
#result-panel {
  margin-top: 16px;
}

.banner {
  padding: 12px 16px;
  border-radius: var(--radius);
  border: 1px solid;
  margin-bottom: 16px;
}
.banner--partial {
  background: var(--color-banner-partial-bg);
  border-color: var(--color-banner-partial-border);
}
.banner--error {
  background: var(--color-banner-error-bg);
  border-color: var(--color-banner-error-border);
}

.score-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 12px;
}
@media (min-width: 480px) {
  .score-grid {
    grid-template-columns: repeat(4, 1fr);
  }
}
.score-card {
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  padding: 12px;
  text-align: center;
}
.score-value {
  font-size: 1.6rem;
  font-weight: 700;
}
.score-label {
  color: var(--color-muted);
  font-size: 0.85rem;
  margin-top: 4px;
}

.plain-list {
  padding-left: 1.2em;
  margin: 0;
}
.plain-list li {
  margin-bottom: 6px;
}

.findings {
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.finding-group {
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  padding: 8px 12px;
}
.finding-group summary {
  cursor: pointer;
  font-weight: 600;
}
.finding-group--critical summary {
  color: var(--color-critical);
}
.finding-group--high summary {
  color: var(--color-high);
}
.finding-group--medium summary {
  color: var(--color-medium);
}
.finding-group--low summary {
  color: var(--color-low);
}
.finding {
  margin-top: 10px;
  padding-top: 10px;
  border-top: 1px solid var(--color-border);
}
.finding:first-of-type {
  border-top: none;
  padding-top: 0;
}
.finding-observation {
  font-weight: 600;
  margin: 0 0 4px;
}
.finding-impact {
  color: var(--color-muted);
  margin: 0;
}

.empty {
  color: var(--color-muted);
  font-style: italic;
}

.back-link {
  margin-top: 32px;
}

/* Very long, unbroken evidence-derived strings (e.g. a URL with no
   spaces) must never force horizontal scrolling on the page. */
.result-header h2,
.finding-observation,
.finding-impact,
.summary {
  overflow-wrap: break-word;
  word-break: break-word;
}

/* --- Phase 7: lead form, consultation CTA, legal links --- */

.field input[aria-invalid="true"] {
  border-color: var(--color-critical);
}

.optional {
  font-weight: 400;
  color: var(--color-muted);
}

.field--checkbox {
  display: flex;
  align-items: flex-start;
  gap: 10px;
}
.field--checkbox input[type="checkbox"] {
  flex: none;
  width: 20px;
  height: 20px;
  margin: 2px 0 0;
}
.field--checkbox label {
  font-weight: 400;
  margin: 0;
}

.notice {
  color: var(--color-muted);
  font-size: 0.9rem;
  margin: 0 0 16px;
}

.submit-section button[type="submit"] {
  width: 100%;
}
@media (min-width: 480px) {
  .submit-section button[type="submit"] {
    width: auto;
  }
}

a {
  color: var(--color-accent);
}

.progress-title {
  font-weight: 600;
  font-size: 1.1rem;
}

.cta {
  margin-top: 32px;
  padding: 16px;
  border: 1px solid var(--color-accent);
  border-radius: var(--radius);
}
.cta h2 {
  margin-top: 0;
}
.cta-status {
  font-weight: 600;
  margin: 12px 0 0;
}

.legal-links a {
  color: inherit;
}

.placeholder-warning {
  font-weight: 700;
}
