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

:root {
  --color-bg: #f5f3ef;
  --color-surface: #ffffff;
  --color-text: #2c2a26;
  --color-text-muted: #5e5a52;
  --color-accent: #b85c1a;
  --color-accent-hover: #944a15;
  --color-border: #d9d3c7;
  --color-low: #8b6f4e;
  --color-mid: #b85c1a;
  --color-high: #2d6a4f;
  --font-sans: system-ui, -apple-system, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
  --font-mono: 'SF Mono', 'Cascadia Code', 'Consolas', monospace;
  --radius: 6px;
  --shadow-sm: 0 1px 3px rgba(0,0,0,0.06);
  --shadow-md: 0 4px 12px rgba(0,0,0,0.08);
  --max-width: 960px;
}

html {
  font-size: 16px;
  scroll-behavior: smooth;
}

body {
  font-family: var(--font-sans);
  background: var(--color-bg);
  color: var(--color-text);
  line-height: 1.6;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

.site-header {
  background: var(--color-surface);
  border-bottom: 1px solid var(--color-border);
  padding: 0.75rem 1rem;
  position: sticky;
  top: 0;
  z-index: 10;
}

.header-inner {
  max-width: var(--max-width);
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  flex-wrap: wrap;
}

.logo {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  text-decoration: none;
  color: var(--color-text);
  font-weight: 700;
  font-size: 1.1rem;
}

.logo svg {
  color: var(--color-accent);
  flex-shrink: 0;
}

.site-nav {
  display: flex;
  gap: 1.25rem;
  flex-wrap: wrap;
}

.site-nav a {
  text-decoration: none;
  color: var(--color-text-muted);
  font-size: 0.9rem;
  font-weight: 500;
  transition: color 0.15s;
}

.site-nav a:hover,
.site-nav a:focus-visible {
  color: var(--color-accent);
}

main {
  flex: 1;
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 2rem 1rem;
  width: 100%;
}

.hero {
  text-align: center;
  padding: 2rem 0 1.5rem;
}

.hero h1 {
  font-size: 2rem;
  color: var(--color-text);
  margin-bottom: 0.5rem;
  letter-spacing: -0.02em;
}

.hero-sub {
  font-size: 1.05rem;
  color: var(--color-text-muted);
  max-width: 600px;
  margin: 0 auto;
}

.calculator-section {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  padding: 1.5rem;
  margin-bottom: 2rem;
  box-shadow: var(--shadow-sm);
}

.calc-container h2 {
  font-size: 1.4rem;
  margin-bottom: 0.25rem;
}

.calc-intro {
  color: var(--color-text-muted);
  margin-bottom: 1.25rem;
  font-size: 0.95rem;
}

.calc-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 1rem;
  margin-bottom: 1rem;
}

.calc-field {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}

.calc-field label {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--color-text-muted);
}

.calc-field input,
.calc-field select {
  padding: 0.55rem 0.65rem;
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  font-size: 0.95rem;
  font-family: var(--font-sans);
  background: var(--color-bg);
  color: var(--color-text);
  transition: border-color 0.15s;
}

.calc-field input:focus,
.calc-field select:focus {
  outline: none;
  border-color: var(--color-accent);
  box-shadow: 0 0 0 2px rgba(184,92,26,0.15);
}

.calc-actions {
  display: flex;
  gap: 0.75rem;
  flex-wrap: wrap;
  margin-bottom: 1.5rem;
}

.btn {
  padding: 0.55rem 1rem;
  border-radius: var(--radius);
  font-size: 0.9rem;
  font-weight: 600;
  cursor: pointer;
  border: 1px solid var(--color-border);
  background: var(--color-surface);
  color: var(--color-text);
  transition: background 0.15s, border-color 0.15s;
}

.btn:hover {
  background: var(--color-bg);
}

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

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

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

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

.calc-results {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
  margin-bottom: 1.5rem;
}

.result-card {
  background: var(--color-bg);
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  padding: 1rem;
}

.result-card h3 {
  font-size: 1rem;
  margin-bottom: 0.75rem;
}

.result-range {
  display: flex;
  gap: 0.75rem;
  flex-wrap: wrap;
}

.range-item {
  flex: 1;
  min-width: 80px;
  text-align: center;
  padding: 0.5rem;
  border-radius: var(--radius);
  background: var(--color-surface);
  border: 1px solid var(--color-border);
}

.range-label {
  display: block;
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--color-text-muted);
  margin-bottom: 0.25rem;
}

.range-value {
  font-size: 1.3rem;
  font-weight: 700;
}

.range-item.low .range-value { color: var(--color-low); }
.range-item.mid .range-value { color: var(--color-mid); }
.range-item.high .range-value { color: var(--color-high); }

.result-note {
  font-size: 0.85rem;
  color: var(--color-text-muted);
  margin-top: 0.75rem;
}

.pathway-steps {
  list-style: none;
  padding: 0;
  margin-top: 0.5rem;
}

.pathway-steps li {
  padding: 0.35rem 0;
  border-bottom: 1px solid var(--color-border);
  font-size: 0.9rem;
}

.pathway-steps li:last-child {
  border-bottom: none;
}

.saved-scenarios {
  margin-top: 1rem;
  border-top: 1px solid var(--color-border);
  padding-top: 1rem;
}

.saved-scenarios h3 {
  font-size: 1rem;
  margin-bottom: 0.5rem;
}

#scenarioList {
  list-style: none;
  margin-bottom: 0.75rem;
}

#scenarioList li {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0.4rem 0;
  border-bottom: 1px solid var(--color-border);
  font-size: 0.9rem;
}

#scenarioList li button {
  background: none;
  border: none;
  color: var(--color-accent);
  cursor: pointer;
  font-weight: 600;
  font-size: 0.85rem;
}

.scenario-walkthrough,
.clause-reference,
.state-regs,
.letter-builder,
.tactics-reference {
  margin-bottom: 2.5rem;
}

.scenario-walkthrough h2,
.clause-reference h2,
.state-regs h2,
.letter-builder h2,
.tactics-reference h2 {
  font-size: 1.4rem;
  margin-bottom: 0.25rem;
}

.section-intro {
  color: var(--color-text-muted);
  margin-bottom: 1.25rem;
  font-size: 0.95rem;
}

.scenario-cards {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 1rem;
}

.scenario-card {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  padding: 1.25rem;
  box-shadow: var(--shadow-sm);
}

.scenario-card h3 {
  font-size: 1.05rem;
  margin-bottom: 0.5rem;
  color: var(--color-accent);
}

.scenario-card p {
  font-size: 0.9rem;
  color: var(--color-text-muted);
}

.ad-slot {
  text-align: center;
  margin: 2rem 0;
  min-height: 120px;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 1px dashed var(--color-border);
  border-radius: var(--radius);
  background: var(--color-surface);
}

.clause-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 1rem;
}

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

.clause-card h3 {
  font-size: 1rem;
  margin-bottom: 0.4rem;
}

.clause-card p {
  font-size: 0.9rem;
  color: var(--color-text-muted);
}

.reg-table {
  width: 100%;
  border-collapse: collapse;
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: var(--shadow-sm);
}

.reg-table th,
.reg-table td {
  padding: 0.65rem 0.85rem;
  text-align: left;
  border-bottom: 1px solid var(--color-border);
  font-size: 0.9rem;
}

.reg-table th {
  background: var(--color-bg);
  font-weight: 700;
  font-size: 0.85rem;
  text-transform: uppercase;
  letter-spacing: 0.03em;
}

.reg-table tr:last-child td {
  border-bottom: none;
}

.reg-note {
  font-size: 0.85rem;
  color: var(--color-text-muted);
  margin-top: 0.75rem;
}

.letter-form {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 1rem;
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  padding: 1.25rem;
  margin-bottom: 1rem;
}

.letter-field {
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
}

.letter-field.full-width {
  grid-column: 1 / -1;
}

.letter-field label {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--color-text-muted);
}

.letter-field input,
.letter-field textarea {
  padding: 0.5rem 0.6rem;
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  font-size: 0.9rem;
  font-family: var(--font-sans);
  background: var(--color-bg);
  color: var(--color-text);
}

.letter-field textarea {
  resize: vertical;
}

.letter-actions {
  grid-column: 1 / -1;
  display: flex;
  gap: 0.75rem;
}

.letter-output {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  padding: 1.25rem;
}

.letter-output h3 {
  font-size: 1rem;
  margin-bottom: 0.75rem;
}

.letter-output pre {
  white-space: pre-wrap;
  font-family: var(--font-mono);
  font-size: 0.85rem;
  background: var(--color-bg);
  padding: 1rem;
  border-radius: var(--radius);
  border: 1px solid var(--color-border);
}

.tactics-list {
  list-style: none;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 0.75rem;
}

.tactics-list li {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  padding: 0.85rem 1rem;
  font-size: 0.9rem;
  box-shadow: var(--shadow-sm);
}

.site-footer {
  background: var(--color-surface);
  border-top: 1px solid var(--color-border);
  padding: 1.25rem 1rem;
  margin-top: auto;
}

.footer-inner {
  max-width: var(--max-width);
  margin: 0 auto;
  text-align: center;
  font-size: 0.85rem;
  color: var(--color-text-muted);
}

.footer-inner a {
  color: var(--color-accent);
  text-decoration: none;
}

.footer-inner a:hover {
  text-decoration: underline;
}

.footer-meta {
  margin-top: 0.5rem;
}

@media (max-width: 600px) {
  .calc-results {
    grid-template-columns: 1fr;
  }

  .header-inner {
    flex-direction: column;
    align-items: flex-start;
  }

  .hero h1 {
    font-size: 1.5rem;
  }

  .calc-grid {
    grid-template-columns: 1fr;
  }

  .letter-form {
    grid-template-columns: 1fr;
  }

  .scenario-cards,
  .clause-grid {
    grid-template-columns: 1fr;
  }

  .tactics-list {
    grid-template-columns: 1fr;
  }
}



/* Factory-injected deployment helpers. The AI owns the site design above this block. */
.ad-unit {
  width: min(100%, 720px);
  min-height: 120px;
  margin: 24px auto;
  display: block;
}

.legal-page {
  width: min(900px, calc(100% - 32px));
  margin: 40px auto;
}

.factory-fallback-nav {
  width: min(900px, calc(100% - 32px));
  margin: 24px auto 0;
  display: flex;
  flex-wrap: wrap;
  gap: 10px 16px;
  align-items: center;
  font-size: 0.95rem;
}

.factory-fallback-nav a {
  color: inherit;
  text-decoration: none;
  border-bottom: 1px solid currentColor;
}
