/* SodCalc - Mobile-first, zero external resources */
:root {
  --primary: #2d6a4f;
  --primary-light: #40916c;
  --primary-dark: #1b4332;
  --accent: #e9c46a;
  --accent-dark: #d4a837;
  --bg: #f8faf7;
  --bg-card: #ffffff;
  --text: #1a1a1a;
  --text-light: #6b7280;
  --border: #d1d5db;
  --border-light: #e5e7eb;
  --success: #059669;
  --warning: #d97706;
  --danger: #dc2626;
  --danger-bg: #fef2f2;
  --radius: 8px;
  --radius-sm: 6px;
  --radius-lg: 12px;
  --shadow: 0 1px 3px rgba(0,0,0,0.1);
  --shadow-lg: 0 4px 12px rgba(0,0,0,0.1);
  --max-width: 800px;
}

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

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

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  line-height: 1.6;
  color: var(--text);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
}

a { color: var(--primary); text-decoration: none; }
a:hover { text-decoration: underline; }

/* Navigation */
.nav {
  background: var(--bg-card);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 100;
}
.nav-inner {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 0 1rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 56px;
}
.nav-logo {
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--primary-dark);
}
.nav-logo:hover { text-decoration: none; color: var(--primary); }
.nav-toggle {
  display: block;
  background: none;
  border: none;
  font-size: 1.5rem;
  cursor: pointer;
  padding: 0.5rem;
  color: var(--text);
  line-height: 1;
}
.nav-menu {
  display: none;
  position: absolute;
  top: 56px;
  left: 0;
  right: 0;
  background: var(--bg-card);
  border-bottom: 1px solid var(--border);
  padding: 0.5rem 1rem 1rem;
  flex-direction: column;
  gap: 0.25rem;
}
.nav-menu.open { display: flex; }
.nav-menu a {
  display: block;
  padding: 0.5rem 0.75rem;
  border-radius: var(--radius);
  color: var(--text);
  font-size: 0.938rem;
}
.nav-menu a:hover { background: var(--bg); text-decoration: none; }

/* Language selector */
.lang-select { position: relative; margin-left: 0.25rem; }
.lang-btn {
  background: none; border: 1px solid var(--border); border-radius: var(--radius);
  padding: 0.375rem 0.625rem; font-size: 0.813rem; font-weight: 600;
  color: var(--primary); cursor: pointer; min-width: 44px; text-align: center;
}
.lang-btn:hover { background: var(--bg); }
.lang-dropdown {
  display: none; position: absolute; top: 100%; right: 0; margin-top: 0.25rem;
  background: #fff; border: 1px solid var(--border); border-radius: var(--radius);
  box-shadow: var(--shadow); min-width: 140px; z-index: 100; padding: 0.25rem 0;
}
.lang-dropdown.open { display: block; }
.lang-dropdown a {
  display: block; padding: 0.5rem 0.875rem; font-size: 0.875rem; color: var(--text);
  text-decoration: none; white-space: nowrap;
}
.lang-dropdown a:hover { background: var(--bg); }

@media (min-width: 640px) {
  .nav-toggle { display: none; }
  .nav-menu {
    display: flex;
    position: static;
    flex-direction: row;
    border: none;
    padding: 0;
    gap: 0.125rem;
  }
}

/* Container */
.container {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 1.5rem 1rem 3rem;
}
@media (min-width: 640px) {
  .container { padding: 2rem 1.5rem 4rem; }
}

/* Typography */
h1 { font-size: 1.75rem; font-weight: 700; color: var(--primary-dark); margin-bottom: 0.75rem; line-height: 1.3; }
h2 { font-size: 1.35rem; font-weight: 600; color: var(--primary-dark); margin: 2rem 0 0.75rem; }
h3 { font-size: 1.125rem; font-weight: 600; margin: 1.5rem 0 0.5rem; }
p { margin-bottom: 1rem; }
ul, ol { margin-bottom: 1rem; padding-left: 1.5rem; }
li { margin-bottom: 0.375rem; }

/* Cards */
.card {
  background: var(--bg-card);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-lg);
  padding: 1.25rem;
  margin-bottom: 1.25rem;
  box-shadow: var(--shadow);
}
@media (max-width: 480px) {
  .card { overflow-x: auto; -webkit-overflow-scrolling: touch; }
}

/* Hero section */
.hero {
  text-align: center;
  padding: 2rem 0 1.5rem;
}
.hero h1 {
  font-size: 2rem;
  margin-bottom: 0.5rem;
}
.hero p {
  font-size: 1.125rem;
  color: var(--text-light);
  max-width: 600px;
  margin: 0 auto 1.5rem;
}
@media (min-width: 640px) {
  .hero h1 { font-size: 2.25rem; }
}

/* Steps flow */
.steps {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}
.step-card {
  display: flex;
  align-items: flex-start;
  gap: 0.875rem;
  background: var(--bg-card);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-lg);
  padding: 1rem 1.125rem;
  box-shadow: var(--shadow);
  transition: border-color 0.15s;
}
.step-card { text-decoration: none; }
.step-card:hover { border-color: var(--primary-light); }
.step-number {
  flex-shrink: 0;
  width: 2.25rem;
  height: 2.25rem;
  background: var(--primary);
  color: white;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 1rem;
}
.step-card h3 { margin: 0 0 0.125rem; font-size: 1.063rem; }
.step-card p { margin: 0; font-size: 0.875rem; color: var(--text-light); }
.step-card .badge {
  display: inline-block;
  font-size: 0.75rem;
  padding: 0.125rem 0.5rem;
  border-radius: 1rem;
  background: var(--bg);
  color: var(--text-light);
  margin-top: 0.25rem;
}

/* Calculator input */
.calc-form {
  display: flex;
  flex-direction: column;
  gap: 0.875rem;
}
.calc-row {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}
@media (min-width: 480px) {
  .calc-row { flex-direction: row; gap: 0.75rem; }
  .calc-row > * { flex: 1; }
}
.calc-group { display: flex; flex-direction: column; gap: 0.25rem; }
.calc-group label {
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--text);
}
.calc-group input,
.calc-group select {
  height: 48px;
  padding: 0 0.75rem;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  font-size: 1rem;
  font-family: inherit;
  background: var(--bg-card);
  color: var(--text);
  -webkit-appearance: none;
  appearance: none;
}
.calc-group select {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8'%3E%3Cpath d='M1 1l5 5 5-5' stroke='%236b7280' fill='none' stroke-width='1.5'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 0.75rem center;
  padding-right: 2.25rem;
}
.calc-group input:focus,
.calc-group select:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(45,106,79,0.15);
}
.calc-group .hint {
  font-size: 0.8rem;
  color: var(--text-light);
}
.unit-toggle {
  display: inline-flex;
  background: var(--bg);
  border-radius: var(--radius);
  overflow: hidden;
  margin-bottom: 0.25rem;
}
.unit-toggle button {
  padding: 0.375rem 0.75rem;
  border: none;
  background: none;
  font-size: 0.813rem;
  font-family: inherit;
  cursor: pointer;
  color: var(--text-light);
}
.unit-toggle button.active {
  background: var(--primary);
  color: white;
  font-weight: 600;
}

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  height: 48px;
  padding: 0 1.5rem;
  border: none;
  border-radius: var(--radius);
  font-size: 1rem;
  font-weight: 600;
  font-family: inherit;
  cursor: pointer;
  transition: background 0.15s, transform 0.1s;
}
.btn:active { transform: scale(0.98); }
.btn-primary {
  background: var(--accent);
  color: var(--text);
}
.btn-primary:hover { background: var(--accent-dark); }
.btn-secondary {
  background: var(--bg);
  color: var(--primary);
  border: 1px solid var(--border);
}
.btn-secondary:hover { background: var(--border-light); }

/* Results */
.results {
  display: none;
  margin-top: 0.5rem;
}
.results.visible { display: block; }
.result-card {
  background: linear-gradient(135deg, var(--primary-dark), var(--primary));
  color: white;
  border-radius: var(--radius-lg);
  padding: 1.5rem;
  margin-bottom: 1rem;
}
.result-card h3, .result-card .result-heading { margin: 0 0 0.75rem; font-size: 0.938rem; text-transform: uppercase; letter-spacing: 0.05em; opacity: 0.85; color: white; font-weight: 600; }
.result-value {
  font-size: 2.5rem;
  font-weight: 800;
  line-height: 1.1;
}
.result-label {
  font-size: 0.875rem;
  opacity: 0.8;
  margin-top: 0.25rem;
}
.result-secondary {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  margin-top: 0.5rem;
}
.result-item {
  background: rgba(255,255,255,0.12);
  border-radius: var(--radius);
  padding: 0.75rem 1rem;
  min-width: 100px;
}
.result-item .val { font-size: 1.25rem; font-weight: 700; }
.result-item .lbl { font-size: 0.75rem; opacity: 0.75; }

/* Checklist */
.checklist {
  padding: 0.25rem 0;
}
.checklist-title {
  font-size: 0.938rem;
  font-weight: 700;
  margin-bottom: 0.5rem;
  display: flex;
  align-items: center;
  gap: 0.375rem;
}
.checklist-item {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.75rem 0.625rem;
  border-bottom: 1px solid var(--border-light);
  cursor: pointer;
  user-select: none;
  border-radius: var(--radius-sm);
  margin-bottom: 0.125rem;
  transition: background 0.2s, border-color 0.2s;
  min-height: 52px;
}
.checklist-item:last-child { border-bottom: none; }
.checklist-item:hover { background: rgba(45,106,79,0.04); }
.checklist-item input[type="checkbox"] {
  flex-shrink: 0;
  width: 1.75rem;
  height: 1.75rem;
  accent-color: var(--success);
  cursor: pointer;
}
.checklist-item.checked {
  background: rgba(45,106,79,0.08);
  border-bottom-color: transparent;
}
.checklist-item.checked label { text-decoration: line-through; color: var(--text-light); }
.checklist-link {
  display: inline-block;
  font-size: 0.813rem;
  margin-top: 0.5rem;
  color: var(--primary);
}

/* Warning tip */
.warning-tip {
  background: var(--danger-bg);
  border-left: 3px solid var(--danger);
  padding: 0.75rem 1rem;
  border-radius: 0 var(--radius) var(--radius) 0;
  margin-bottom: 1rem;
  font-size: 0.9rem;
}
.warning-tip strong { color: var(--danger); }

/* FAQ */
.faq-item {
  border-bottom: 1px solid var(--border-light);
  padding: 0.75rem 0;
}
.faq-item:last-child { border-bottom: none; }
.faq-q {
  font-weight: 600;
  margin-bottom: 0.25rem;
  cursor: pointer;
  display: flex;
  justify-content: space-between;
  align-items: center;
}
.faq-q::after {
  content: '+';
  font-size: 1.25rem;
  color: var(--text-light);
}
.faq-a {
  font-size: 0.938rem;
  color: var(--text-light);
  max-height: 0;
  overflow: hidden;
  transition: max-height 0.3s ease, margin 0.3s ease;
}
.faq-item.open .faq-a {
  max-height: 300px;
  margin-top: 0.5rem;
}
.faq-item.open .faq-q::after { content: '\2013'; }

/* Homepage specific */
.home-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 1rem;
  margin-top: 1.5rem;
}
@media (min-width: 600px) {
  .home-grid { grid-template-columns: 1fr 1fr; }
}
.home-card {
  background: var(--bg-card);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-lg);
  padding: 1.25rem;
  box-shadow: var(--shadow);
}
.home-card h3 { margin-top: 0; font-size: 1.063rem; }
.home-card p { font-size: 0.9rem; margin-bottom: 0; }
.home-card ul { margin: 0.5rem 0 0; padding-left: 1.25rem; }
.home-card ul li { font-size: 0.875rem; margin-bottom: 0.25rem; }

.card h2:first-child, .card h3:first-child { margin-top: 0; }
.section-links {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin: 1rem 0;
}
.section-link {
  display: inline-flex;
  align-items: center;
  gap: 0.375rem;
  padding: 0.5rem 1rem;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 2rem;
  font-size: 0.875rem;
  color: var(--text);
  transition: border-color 0.15s;
}
.section-link:hover { border-color: var(--primary); text-decoration: none; }

/* Sod vs Seed decision tool */
.svs-questions {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.svs-option {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.875rem 1rem;
  margin-bottom: 0.5rem;
  cursor: pointer;
  background: var(--bg);
  border: 2px solid var(--border-light);
  border-radius: var(--radius);
  transition: border-color 0.15s, background 0.15s;
  font-size: 0.938rem;
}
.svs-option:hover {
  border-color: var(--primary-light);
  background: var(--bg-card);
}
.svs-option:has(input:checked) {
  border-color: var(--primary);
  background: rgba(45,106,79,0.06);
}
.svs-option input[type="radio"] {
  accent-color: var(--primary);
  min-width: 22px;
  min-height: 22px;
}

/* Breadcrumb */
.breadcrumb {
  font-size: 0.813rem;
  color: var(--text-light);
  margin-bottom: 1rem;
}
.breadcrumb a { color: var(--text-light); }
.breadcrumb span { color: var(--text); }

/* Table */
.data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.875rem;
  margin: 0.75rem 0;
}
.data-table th {
  text-align: left;
  padding: 0.5rem 0.75rem;
  background: var(--bg);
  font-weight: 600;
  border-bottom: 2px solid var(--border);
}
.data-table td {
  padding: 0.5rem 0.75rem;
  border-bottom: 1px solid var(--border-light);
}
.data-table tr:last-child td { border-bottom: none; }

/* Footer */
.footer {
  border-top: 1px solid var(--border);
  padding: 2rem 1rem;
  text-align: center;
  color: var(--text-light);
  font-size: 0.813rem;
}
.footer-inner {
  max-width: var(--max-width);
  margin: 0 auto;
}
.footer a { color: var(--text-light); text-decoration: underline; }
.footer-links {
  display: flex;
  gap: 1rem;
  justify-content: center;
  margin-bottom: 0.75rem;
  flex-wrap: wrap;
}

/* Utility */
.mt-1 { margin-top: 1rem; }
.mt-2 { margin-top: 2rem; }
.mb-2 { margin-bottom: 2rem; }
.text-center { text-align: center; }
.text-sm { font-size: 0.875rem; }
.text-light { color: var(--text-light); }
.hidden { display: none; }

/* Screen reader only */
.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;
}

/* Skip navigation link */
.skip-link {
  position: absolute;
  top: -100px;
  left: 0;
  background: var(--primary);
  color: white;
  padding: 0.5rem 1rem;
  z-index: 200;
  font-weight: 600;
  border-radius: 0 0 var(--radius) 0;
  transition: top 0.15s;
}
.skip-link:focus {
  top: 0;
  text-decoration: none;
}

/* Print styles */
@media print {
  .nav, .footer, .btn, .back-to-top { display: none; }
  body { background: white; }
  .container { max-width: none; padding: 0; }
}

/* Back to top floating button */
.back-to-top {
  position: fixed;
  bottom: 1.5rem;
  right: 1rem;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: var(--primary);
  color: white;
  border: none;
  font-size: 1.25rem;
  cursor: pointer;
  z-index: 90;
  opacity: 0;
  transform: translateY(10px);
  transition: opacity 0.2s, transform 0.2s;
  pointer-events: none;
  box-shadow: 0 2px 8px rgba(0,0,0,0.2);
  display: flex;
  align-items: center;
  justify-content: center;
}
.back-to-top.visible {
  opacity: 1;
  transform: translateY(0);
  pointer-events: auto;
}
.back-to-top:active {
  background: var(--primary-dark);
  transform: translateY(0) scale(0.95);
}
@media (min-width: 640px) {
  .back-to-top { right: 1.5rem; bottom: 2rem; }
}

/* RTL support (Arabic) */
[dir="rtl"] { direction: rtl; text-align: right; }
[dir="rtl"] .nav-inner { flex-direction: row-reverse; }
[dir="rtl"] .nav-menu { text-align: right; }
[dir="rtl"] .lang-select { margin-left: 0; margin-right: 0.25rem; }
[dir="rtl"] .lang-dropdown { right: auto; left: 0; }
[dir="rtl"] .back-to-top { right: auto; left: 1rem; }
[dir="rtl"] .skip-link { left: auto; right: 0; border-radius: 0 0 0 var(--radius); }
[dir="rtl"] ul, [dir="rtl"] ol { padding-left: 0; padding-right: 1.5rem; }
[dir="rtl"] .warning-tip { border-left: none; border-right: 3px solid var(--danger); border-radius: var(--radius) 0 0 var(--radius); }
[dir="rtl"] .data-table th { text-align: right; }
[dir="rtl"] .data-table td { text-align: right; }
[dir="rtl"] .calc-group select { background-position: left 0.75rem center; padding-right: 0.75rem; padding-left: 2.25rem; }
[dir="rtl"] .home-card ul { padding-left: 0; padding-right: 1.25rem; }
@media (min-width: 640px) { [dir="rtl"] .back-to-top { right: auto; left: 1.5rem; } }