/* Art50Guard — Executive Compliance SaaS Stylesheet
 * Adaptive Light/Dark theme via CSS custom properties & color-scheme.
 * Engineered for WCAG 2.1 AA/AAA contrast, >=13px typography, and clear :focus-visible rings.
 */

:root {
  color-scheme: light dark;
  --bg: #f8fafc;
  --surface: #ffffff;
  --surface-subtle: #f1f5f9;
  --ink: #0f172a;
  --ink-muted: #475569;
  --border: #dbe3ee;
  --accent: #1d4ed8;
  --accent-hover: #1e40af;
  --accent-soft: #eff6ff;
  --accent-ink: #1e3a8a;
  --ok-bg: #dcfce7;
  --ok-fg: #166534;
  --warn-bg: #fef9c3;
  --warn-fg: #854d0e;
  --high-bg: #ffedd5;
  --high-fg: #9a3412;
  --crit-bg: #fee2e2;
  --crit-fg: #991b1b;
  --code-bg: #0f172a;
  --code-fg: #f8fafc;
  --shadow-sm: 0 1px 2px rgba(15, 23, 42, 0.05);
  --shadow-md: 0 12px 30px rgba(15, 23, 42, 0.08);
  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 16px;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0b1120;
    --surface: #111827;
    --surface-subtle: #1e293b;
    --ink: #f8fafc;
    --ink-muted: #cbd5e1;
    --border: #2c3b52;
    --accent: #3b82f6;
    --accent-hover: #2563eb;
    --accent-soft: #172554;
    --accent-ink: #bfdbfe;
    --ok-bg: #14532d;
    --ok-fg: #dcfce7;
    --warn-bg: #713f12;
    --warn-fg: #fef9c3;
    --high-bg: #7c2d12;
    --high-fg: #ffedd5;
    --crit-bg: #7f1d1d;
    --crit-fg: #fee2e2;
    --code-bg: #020617;
    --code-fg: #e2e8f0;
    --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.35);
    --shadow-md: 0 14px 36px rgba(0, 0, 0, 0.45);
  }
}

:root[data-theme="dark"] {
  color-scheme: dark;
  --bg: #0b1120;
  --surface: #111827;
  --surface-subtle: #1e293b;
  --ink: #f8fafc;
  --ink-muted: #cbd5e1;
  --border: #2c3b52;
  --accent: #3b82f6;
  --accent-hover: #2563eb;
  --accent-soft: #172554;
  --accent-ink: #bfdbfe;
  --ok-bg: #14532d;
  --ok-fg: #dcfce7;
  --warn-bg: #713f12;
  --warn-fg: #fef9c3;
  --high-bg: #7c2d12;
  --high-fg: #ffedd5;
  --crit-bg: #7f1d1d;
  --crit-fg: #fee2e2;
  --code-bg: #020617;
  --code-fg: #e2e8f0;
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.35);
  --shadow-md: 0 14px 36px rgba(0, 0, 0, 0.45);
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Inter, Roboto, Helvetica, Arial, sans-serif;
  font-size: 16px;
  line-height: 1.6;
  color: var(--ink);
  background-color: var(--bg);
}

a {
  color: var(--accent);
  text-underline-offset: 3px;
}

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

:focus-visible {
  outline: 3px solid var(--accent);
  outline-offset: 2px;
}

.skip-link {
  position: absolute;
  left: -9999px;
  top: 12px;
  z-index: 1000;
  background: var(--accent);
  color: #ffffff;
  padding: 10px 16px;
  border-radius: var(--radius-sm);
  font-weight: 700;
  text-decoration: none;
}

.skip-link:focus-visible {
  left: 12px;
}

.container {
  max-width: 1120px;
  margin: 0 auto;
  padding: 0 20px;
}

/* Header & Navigation */
.site-header {
  position: sticky;
  top: 0;
  z-index: 50;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  box-shadow: var(--shadow-sm);
}

.header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  min-height: 68px;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  text-decoration: none;
  color: var(--ink);
  font-weight: 800;
  font-size: 1.125rem;
  letter-spacing: -0.02em;
}

.brand-mark {
  width: 32px;
  height: 32px;
  border-radius: 8px;
  background: var(--accent);
  color: #ffffff;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.nav-links {
  display: flex;
  align-items: center;
  gap: 20px;
  flex-wrap: wrap;
}

.nav-links a {
  color: var(--ink-muted);
  text-decoration: none;
  font-weight: 600;
  font-size: 0.9375rem;
}

.nav-links a:hover {
  color: var(--ink);
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 10px;
}

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  border-radius: var(--radius-sm);
  border: 1px solid transparent;
  padding: 10px 18px;
  font-size: 0.9375rem;
  font-weight: 600;
  cursor: pointer;
  text-decoration: none;
  transition: background-color 140ms ease, border-color 140ms ease, transform 120ms ease;
}

.btn:active {
  transform: translateY(1px);
}

.btn-primary {
  background: var(--accent);
  color: #ffffff;
}

.btn-primary:hover {
  background: var(--accent-hover);
  color: #ffffff;
}

.btn-secondary {
  background: var(--surface);
  color: var(--ink);
  border-color: var(--border);
}

.btn-secondary:hover {
  background: var(--surface-subtle);
  color: var(--ink);
}

.btn-danger-outline {
  background: var(--surface);
  color: var(--crit-fg);
  border-color: var(--crit-bg);
}

.btn-ok-outline {
  background: var(--surface);
  color: var(--ok-fg);
  border-color: var(--ok-bg);
}

.btn-sm {
  padding: 7px 12px;
  font-size: 0.875rem;
}

/* Hero Section */
.hero {
  padding: 56px 0 36px;
}

.deadline-pill {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 6px 14px;
  border-radius: 999px;
  background: var(--accent-soft);
  color: var(--accent-ink);
  border: 1px solid var(--border);
  font-size: 0.875rem;
  font-weight: 600;
  margin-bottom: 18px;
}

.hero h1 {
  font-size: clamp(2rem, 4vw, 3rem);
  line-height: 1.15;
  letter-spacing: -0.03em;
  margin: 0 0 16px;
  max-width: 820px;
}

.hero-lead {
  font-size: 1.125rem;
  color: var(--ink-muted);
  max-width: 740px;
  margin: 0 0 24px;
}

.hero-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin-bottom: 24px;
}

.trust-strip {
  display: flex;
  flex-wrap: wrap;
  gap: 18px;
  font-size: 0.875rem;
  color: var(--ink-muted);
  padding-top: 16px;
  border-top: 1px solid var(--border);
}

.trust-strip span {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

/* Panels & Sections */
.section {
  padding: 40px 0;
}

.section-head {
  margin-bottom: 24px;
}

.section-head h2 {
  font-size: 1.75rem;
  letter-spacing: -0.02em;
  margin: 0 0 8px;
}

.section-head p {
  margin: 0;
  color: var(--ink-muted);
  max-width: 720px;
}

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 24px;
  box-shadow: var(--shadow-sm);
}

/* Live Interactive Scanner */
.scanner-card {
  box-shadow: var(--shadow-md);
}

.fixture-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 14px 16px;
  background: var(--surface-subtle);
  border-radius: var(--radius-md);
  margin-bottom: 20px;
}

.fixture-bar-label {
  font-weight: 700;
  font-size: 0.9375rem;
}

.fixture-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.form-grid {
  display: grid;
  gap: 16px;
}

.field label {
  display: block;
  font-weight: 600;
  font-size: 0.9375rem;
  margin-bottom: 6px;
}

.field-hint {
  display: block;
  font-size: 0.875rem;
  color: var(--ink-muted);
  margin-top: 4px;
}

.input,
.textarea {
  width: 100%;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--bg);
  color: var(--ink);
  padding: 10px 12px;
  font-size: 0.9375rem;
  font-family: inherit;
}

.textarea {
  min-height: 160px;
  resize: vertical;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 0.875rem;
  line-height: 1.45;
}

.whitelabel-details {
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 12px 14px;
  background: var(--surface-subtle);
}

.whitelabel-details summary {
  cursor: pointer;
  font-weight: 600;
  font-size: 0.9375rem;
}

.whitelabel-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 12px;
  margin-top: 12px;
}

.scanner-submit-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-top: 4px;
}

.status-line {
  font-size: 0.9375rem;
  color: var(--ink-muted);
  min-height: 24px;
}

.status-line.is-error {
  color: var(--crit-fg);
  font-weight: 600;
}

/* Results Dashboard */
.results-shell {
  margin-top: 28px;
  padding-top: 24px;
  border-top: 1px solid var(--border);
}

.results-shell[hidden] {
  display: none;
}

.scorecard-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(210px, 1fr));
  gap: 16px;
  margin-bottom: 20px;
}

.metric-box {
  background: var(--surface-subtle);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 16px;
}

.metric-label {
  font-size: 0.875rem;
  color: var(--ink-muted);
  font-weight: 600;
}

.metric-big {
  font-size: 2rem;
  font-weight: 800;
  line-height: 1.15;
  margin: 6px 0 4px;
}

.meter {
  height: 8px;
  border-radius: 999px;
  background: var(--border);
  overflow: hidden;
  margin-top: 8px;
}

.meter-fill {
  height: 100%;
  background: var(--accent);
  border-radius: 999px;
  transition: width 260ms ease;
}

.pill {
  display: inline-block;
  padding: 3px 10px;
  border-radius: 999px;
  font-size: 0.8125rem;
  font-weight: 700;
  letter-spacing: 0.02em;
}

.pill-CRITICAL { background: var(--crit-bg); color: var(--crit-fg); }
.pill-HIGH { background: var(--high-bg); color: var(--high-fg); }
.pill-MEDIUM { background: var(--warn-bg); color: var(--warn-fg); }
.pill-LOW, .pill-PASS { background: var(--ok-bg); color: var(--ok-fg); }

.results-toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 16px;
}

.filter-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.filter-tab {
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--ink);
  border-radius: 999px;
  padding: 6px 14px;
  font-size: 0.875rem;
  font-weight: 600;
  cursor: pointer;
}

.filter-tab[aria-pressed="true"] {
  background: var(--accent);
  color: #ffffff;
  border-color: var(--accent);
}

.findings-list {
  display: grid;
  gap: 12px;
}

.finding-item {
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 16px;
  background: var(--surface);
}

.finding-item.is-fail {
  border-left: 4px solid var(--crit-fg);
}

.finding-item.is-pass {
  border-left: 4px solid var(--ok-fg);
}

.finding-top {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 6px;
}

.finding-code {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-weight: 700;
  color: var(--accent);
  margin-right: 8px;
  font-size: 0.875rem;
}

.finding-law {
  font-size: 0.875rem;
  color: var(--ink-muted);
  margin: 0 0 8px;
}

.finding-copy {
  margin: 0 0 6px;
  font-size: 0.9375rem;
}

.fix-wrap {
  margin-top: 10px;
  background: var(--code-bg);
  color: var(--code-fg);
  border-radius: var(--radius-sm);
  padding: 12px;
}

.fix-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 6px;
  font-size: 0.8125rem;
  color: #93c5fd;
  font-weight: 700;
}

.fix-wrap pre {
  margin: 0;
  overflow-x: auto;
  white-space: pre-wrap;
  word-break: break-word;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 0.8125rem;
  line-height: 1.5;
}

/* 18 Rules Grid */
.two-col {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
  gap: 20px;
}

.rule-list {
  margin: 12px 0 0;
  padding-left: 20px;
}

.rule-list li {
  margin-bottom: 8px;
  font-size: 0.9375rem;
}

/* Pricing Grid */
.pricing-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(270px, 1fr));
  gap: 20px;
  align-items: stretch;
}

.price-card {
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 18px;
}

.price-card.is-featured {
  border: 2px solid var(--accent);
  box-shadow: var(--shadow-md);
}

.price-tag {
  font-size: 2.25rem;
  font-weight: 800;
  letter-spacing: -0.03em;
  margin: 8px 0 4px;
}

.price-tag span {
  font-size: 0.9375rem;
  font-weight: 500;
  color: var(--ink-muted);
}

.check-list {
  list-style: none;
  padding: 0;
  margin: 14px 0 0;
  display: grid;
  gap: 8px;
}

.check-list li {
  font-size: 0.9375rem;
  color: var(--ink);
}

/* Native Dialog */
dialog.modal-dialog {
  width: min(960px, 94vw);
  max-height: 90vh;
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  background: var(--surface);
  color: var(--ink);
  padding: 0;
  box-shadow: var(--shadow-md);
}

dialog.modal-dialog::backdrop {
  background: rgba(2, 6, 23, 0.65);
  backdrop-filter: blur(2px);
}

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 16px 20px;
  border-bottom: 1px solid var(--border);
}

.modal-header h2 {
  margin: 0;
  font-size: 1.125rem;
}

.modal-body {
  padding: 18px 20px;
  overflow: auto;
}

.report-frame {
  width: 100%;
  height: 68vh;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: #ffffff;
}

/* Legal & Prose Pages */
.prose {
  max-width: 820px;
  margin: 0 auto;
}

.prose h1 {
  font-size: 2rem;
  margin-top: 0;
}

.prose h2 {
  font-size: 1.25rem;
  margin-top: 28px;
}

.notice-box {
  background: var(--accent-soft);
  border: 1px solid var(--border);
  border-left: 4px solid var(--accent);
  border-radius: var(--radius-sm);
  padding: 14px 16px;
  margin: 18px 0;
}

/* Footer */
.site-footer {
  margin-top: 48px;
  background: var(--surface);
  border-top: 1px solid var(--border);
  padding: 36px 0;
  font-size: 0.875rem;
  color: var(--ink-muted);
}

.footer-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 24px;
  margin-bottom: 24px;
}

.footer-links {
  list-style: none;
  padding: 0;
  margin: 8px 0 0;
  display: grid;
  gap: 6px;
}

.footer-bottom {
  padding-top: 18px;
  border-top: 1px solid var(--border);
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 12px;
}

/* SEO Guide Tables, Code Figures & Native Accordions */
.table-scroll {
  overflow-x: auto;
  margin: 18px 0;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
}

.guide-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.9375rem;
  background: var(--surface);
}

.guide-table caption {
  text-align: left;
  font-weight: 700;
  padding: 12px 16px;
  background: var(--surface-subtle);
  border-bottom: 1px solid var(--border);
  color: var(--ink);
}

.guide-table th,
.guide-table td {
  text-align: left;
  padding: 12px 16px;
  border-bottom: 1px solid var(--border);
  vertical-align: top;
}

.guide-table thead th {
  background: var(--surface-subtle);
  font-weight: 700;
  font-size: 0.875rem;
  color: var(--ink);
}

.guide-table tbody tr:last-child th,
.guide-table tbody tr:last-child td {
  border-bottom: none;
}

.code-figure {
  margin: 18px 0;
  background: var(--code-bg);
  color: var(--code-fg);
  border-radius: var(--radius-md);
  padding: 14px 16px;
  border: 1px solid var(--border);
}

.code-figure figcaption {
  font-size: 0.8125rem;
  font-weight: 700;
  color: #93c5fd;
  margin-bottom: 8px;
}

.code-figure pre {
  margin: 0;
  overflow-x: auto;
  white-space: pre-wrap;
  word-break: break-word;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 0.875rem;
  line-height: 1.5;
}

.faq-list {
  display: grid;
  gap: 12px;
  margin-top: 16px;
}

.faq-item {
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  background: var(--surface-subtle);
  padding: 14px 16px;
}

.faq-item summary {
  cursor: pointer;
  font-weight: 700;
  font-size: 1rem;
  color: var(--ink);
}

.faq-item[open] summary {
  margin-bottom: 10px;
}

.faq-item p {
  margin: 0;
  color: var(--ink-muted);
}

.cta-band {
  margin-top: 28px;
  padding: 24px;
  border-radius: var(--radius-lg);
  background: var(--accent-soft);
  border: 1px solid var(--border);
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.cta-band h2 {
  margin: 0 0 6px;
  font-size: 1.375rem;
}

.cta-band p {
  margin: 0;
  color: var(--ink-muted);
  max-width: 600px;
}

@media (max-width: 760px) {
  .nav-links {
    display: none;
  }
  .hero {
    padding-top: 32px;
  }
}
