/* ===== CSS Reset & Base ===== */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --color-bg: #0f1a0f;
  --color-surface: #1a2e1a;
  --color-surface-alt: #243824;
  --color-border: #3a5a3a;
  --color-text: #e8f0e8;
  --color-text-muted: #8aaa8a;
  --color-accent: #4ade80;
  --color-accent-dark: #22c55e;
  --color-accent-glow: rgba(74, 222, 128, 0.15);
  --color-warning: #fbbf24;
  --color-error: #f87171;
  --font-sans: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, sans-serif;
  --font-mono: 'SF Mono', SFMono-Regular, Consolas, 'Liberation Mono', Menlo, monospace;
  --radius: 12px;
  --radius-sm: 8px;
  --shadow: 0 4px 24px rgba(0, 0, 0, 0.3);
  --shadow-lg: 0 8px 40px rgba(0, 0, 0, 0.4);
  --transition: 0.2s ease;
  --max-width: 1100px;
}

html { 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;
}

a { color: var(--color-accent); text-decoration: none; transition: color var(--transition); }
a:hover, a:focus-visible { color: var(--color-accent-dark); text-decoration: underline; }

img, svg { display: block; max-width: 100%; }

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

.skip-link {
  position: absolute;
  top: -100%;
  left: 20px;
  background: var(--color-accent);
  color: #000;
  padding: 8px 16px;
  border-radius: var(--radius-sm);
  font-weight: 600;
  z-index: 100;
}
.skip-link:focus { top: 10px; }

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

/* ===== Header ===== */
.site-header {
  background: var(--color-surface);
  border-bottom: 1px solid var(--color-border);
  padding: 16px 0;
  position: sticky;
  top: 0;
  z-index: 50;
}

.site-header .container {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.logo {
  display: flex;
  align-items: center;
  gap: 10px;
  color: var(--color-accent);
  font-weight: 700;
  font-size: 1.1rem;
  text-decoration: none;
}
.logo:hover, .logo:focus-visible { color: var(--color-accent-dark); text-decoration: none; }
.logo svg { flex-shrink: 0; }

.site-nav ul {
  display: flex;
  list-style: none;
  gap: 24px;
}

.site-nav a {
  color: var(--color-text-muted);
  font-weight: 500;
  padding: 4px 0;
  border-bottom: 2px solid transparent;
  transition: color var(--transition), border-color var(--transition);
}

.site-nav a:hover,
.site-nav a:focus-visible,
.site-nav a[aria-current="page"] {
  color: var(--color-accent);
  border-bottom-color: var(--color-accent);
  text-decoration: none;
}

/* ===== Hero ===== */
.hero {
  padding: 60px 0 40px;
  text-align: center;
  background: linear-gradient(180deg, var(--color-surface) 0%, var(--color-bg) 100%);
}

.hero h1 {
  font-size: clamp(1.8rem, 4vw, 2.8rem);
  font-weight: 800;
  line-height: 1.2;
  margin-bottom: 12px;
  color: var(--color-text);
}

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

/* ===== Section Styles ===== */
.section-title {
  font-size: 1.5rem;
  font-weight: 700;
  margin-bottom: 8px;
}

.section-intro {
  color: var(--color-text-muted);
  margin-bottom: 24px;
  max-width: 640px;
}

section { padding: 48px 0; }

section:nth-child(even) {
  background: var(--color-surface);
}

/* ===== Estimator ===== */
.estimator-layout {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 32px;
  align-items: start;
}

.estimator-controls {
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.control-group {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.control-label {
  font-weight: 600;
  font-size: 0.9rem;
  color: var(--color-text-muted);
}

.control-select {
  appearance: none;
  background: var(--color-surface-alt);
  border: 1px solid var(--color-border);
  color: var(--color-text);
  padding: 12px 16px;
  border-radius: var(--radius-sm);
  font-size: 1rem;
  font-family: var(--font-sans);
  cursor: pointer;
  transition: border-color var(--transition), box-shadow var(--transition);
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath d='M2 4l4 4 4-4' fill='none' stroke='%238aaa8a' stroke-width='2'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 14px center;
  padding-right: 40px;
}

.control-select:focus {
  outline: none;
  border-color: var(--color-accent);
  box-shadow: 0 0 0 3px var(--color-accent-glow);
}

.result-card {
  background: var(--color-surface-alt);
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  padding: 28px;
  box-shadow: var(--shadow);
}

.result-card-title {
  font-size: 1.1rem;
  font-weight: 600;
  margin-bottom: 16px;
  color: var(--color-text-muted);
}

.result-total {
  display: flex;
  align-items: baseline;
  gap: 8px;
  margin-bottom: 4px;
}

.result-number {
  font-size: 3.5rem;
  font-weight: 800;
  color: var(--color-accent);
  line-height: 1;
  font-variant-numeric: tabular-nums;
}

.result-unit {
  font-size: 1.2rem;
  color: var(--color-text-muted);
  font-weight: 500;
}

.result-range {
  color: var(--color-text-muted);
  font-size: 0.95rem;
  margin-bottom: 24px;
}

.breakdown-table {
  width: 100%;
  border-collapse: collapse;
  margin-bottom: 24px;
  font-size: 0.95rem;
}

.breakdown-table th,
.breakdown-table td {
  padding: 10px 12px;
  text-align: left;
}

.breakdown-table tbody tr { border-bottom: 1px solid var(--color-border); }
.breakdown-table tbody tr:last-child { border-bottom: none; }
.breakdown-table tfoot tr { border-top: 2px solid var(--color-border); }
.breakdown-table tfoot th,
.breakdown-table tfoot td { font-weight: 700; color: var(--color-accent); }

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

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 10px 20px;
  border-radius: var(--radius-sm);
  font-size: 0.9rem;
  font-weight: 600;
  font-family: var(--font-sans);
  cursor: pointer;
  border: 1px solid transparent;
  transition: all var(--transition);
}

.btn-primary {
  background: var(--color-accent);
  color: #000;
}
.btn-primary:hover, .btn-primary:focus-visible {
  background: var(--color-accent-dark);
  color: #000;
  text-decoration: none;
}

.btn-secondary {
  background: transparent;
  color: var(--color-text);
  border-color: var(--color-border);
}
.btn-secondary:hover, .btn-secondary:focus-visible {
  background: var(--color-surface-alt);
  border-color: var(--color-accent);
  text-decoration: none;
}

.copy-feedback {
  margin-top: 10px;
  font-size: 0.85rem;
  color: var(--color-accent);
  min-height: 1.2em;
}

/* ===== Scenarios ===== */
.scenario-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 20px;
}

.scenario-card {
  background: var(--color-surface-alt);
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  padding: 24px;
  transition: border-color var(--transition), box-shadow var(--transition);
}

.scenario-card:hover {
  border-color: var(--color-accent);
  box-shadow: var(--shadow);
}

.scenario-card h3 {
  font-size: 1.05rem;
  font-weight: 700;
  margin-bottom: 8px;
}

.scenario-card p {
  color: var(--color-text-muted);
  font-size: 0.95rem;
  margin-bottom: 4px;
}

.scenario-total {
  margin-top: 12px;
  padding-top: 12px;
  border-top: 1px solid var(--color-border);
}

/* ===== Common Mistakes ===== */
.mistake-list {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px;
}

.mistake-item {
  background: var(--color-surface-alt);
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  padding: 24px;
  border-left: 4px solid var(--color-warning);
}

.mistake-item h3 {
  font-size: 1rem;
  font-weight: 700;
  margin-bottom: 8px;
}

.mistake-item p {
  color: var(--color-text-muted);
  font-size: 0.95rem;
}

/* ===== Edge Cases ===== */
.edge-list {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.edge-list li {
  background: var(--color-surface-alt);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-sm);
  padding: 16px 20px;
  font-size: 0.95rem;
  color: var(--color-text-muted);
}

.edge-list li strong { color: var(--color-text); }

/* ===== Printable Card ===== */
.print-card {
  background: var(--color-surface-alt);
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  padding: 28px;
  margin-bottom: 20px;
  overflow-x: auto;
}

.print-card-header {
  margin-bottom: 20px;
}

.print-card-header h3 {
  font-size: 1.2rem;
  font-weight: 700;
}

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

.print-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.85rem;
}

.print-table th,
.print-table td {
  padding: 10px 12px;
  text-align: left;
  border-bottom: 1px solid var(--color-border);
}

.print-table thead th {
  background: var(--color-surface);
  font-weight: 700;
  color: var(--color-accent);
  white-space: nowrap;
}

.print-table tbody tr:hover {
  background: var(--color-surface);
}

.print-card-note {
  margin-top: 16px;
  font-size: 0.85rem;
  color: var(--color-text-muted);
  font-style: italic;
}

/* ===== FAQ ===== */
.faq-list {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.faq-item {
  background: var(--color-surface-alt);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-sm);
  padding: 20px 24px;
}

.faq-item dt {
  font-size: 1rem;
  margin-bottom: 6px;
}

.faq-item dd {
  color: var(--color-text-muted);
  font-size: 0.95rem;
}

/* ===== Assumptions ===== */
.last-updated {
  margin-top: 16px;
  font-size: 0.85rem;
  color: var(--color-text-muted);
}

/* ===== Footer ===== */
.site-footer {
  background: var(--color-surface);
  border-top: 1px solid var(--color-border);
  padding: 40px 0 24px;
  margin-top: auto;
}

.footer-grid {
  display: flex;
  justify-content: space-between;
  gap: 32px;
  flex-wrap: wrap;
  margin-bottom: 24px;
}

.footer-brand p {
  color: var(--color-text-muted);
  font-size: 0.9rem;
  max-width: 320px;
}

.footer-brand strong {
  color: var(--color-text);
  font-size: 1rem;
}

.footer-nav ul {
  display: flex;
  list-style: none;
  gap: 20px;
  flex-wrap: wrap;
}

.footer-nav a {
  color: var(--color-text-muted);
  font-size: 0.9rem;
}

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

.footer-legal {
  font-size: 0.8rem;
  color: var(--color-text-muted);
  text-align: center;
  padding-top: 20px;
  border-top: 1px solid var(--color-border);
}

/* ===== Print Styles ===== */
@media print {
  body { background: #fff; color: #000; }
  .site-header, .site-footer, .result-actions, .btn, .hero, .assumptions, .common-mistakes, .edge-cases, .faq, .scenarios { display: none; }
  .print-card { border: 2px solid #000; padding: 20px; }
  .print-table th, .print-table td { border: 1px solid #000; padding: 8px; }
  .print-table thead th { background: #eee; }
  .estimator { padding: 0; }
  .result-card { border: 1px solid #000; }
  .result-number { color: #000; }
  .breakdown-table tfoot th, .breakdown-table tfoot td { color: #000; }
}

/* ===== Responsive ===== */
@media (max-width: 900px) {
  .estimator-layout { grid-template-columns: 1fr; }
  .scenario-grid { grid-template-columns: 1fr; }
  .mistake-list { grid-template-columns: 1fr; }
}

@media (max-width: 600px) {
  .hero { padding: 40px 0 28px; }
  .hero h1 { font-size: 1.6rem; }
  .result-number { font-size: 2.5rem; }
  .result-card { padding: 20px; }
  section { padding: 32px 0; }
  .site-nav ul { gap: 14px; }
  .site-nav a { font-size: 0.9rem; }
  .result-actions { flex-direction: column; }
  .btn { width: 100%; }
}

/* ===== Focus Visible ===== */
*:focus-visible {
  outline: 2px solid var(--color-accent);
  outline-offset: 2px;
}

/* ===== Selection ===== */
::selection {
  background: var(--color-accent);
  color: #000;
}



/* 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;
}
