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

:root {
  --green-900: #1b4332;
  --green-800: #2d6a4f;
  --green-600: #40916c;
  --green-400: #52b788;
  --green-200: #95d5b2;
  --green-100: #d8f3dc;
  --green-50: #f0faf4;
  --amber-500: #e9a23b;
  --amber-100: #fef3cd;
  --red-600: #c44536;
  --gray-900: #1a1a2e;
  --gray-700: #3d3d56;
  --gray-500: #6b6b80;
  --gray-300: #c4c4d0;
  --gray-100: #f0f0f5;
  --white: #ffffff;
  --font-sans: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, sans-serif;
  --font-mono: 'SF Mono', 'Fira Code', monospace;
  --radius: 12px;
  --radius-sm: 8px;
  --shadow: 0 2px 12px rgba(0,0,0,0.08);
  --shadow-lg: 0 8px 32px rgba(0,0,0,0.12);
  --max-width: 1160px;
}

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

body {
  font-family: var(--font-sans);
  color: var(--gray-900);
  background: var(--gray-100);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

a { color: var(--green-800); text-decoration: underline; text-underline-offset: 2px; }
a:hover { color: var(--green-600); }

img { max-width: 100%; height: auto; display: block; }

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

.skip-link {
  position: absolute;
  top: -100%;
  left: 16px;
  background: var(--green-800);
  color: var(--white);
  padding: 8px 16px;
  border-radius: var(--radius-sm);
  z-index: 1000;
  text-decoration: none;
}
.skip-link:focus { top: 16px; }

/* ===== Header ===== */
.site-header {
  background: var(--white);
  border-bottom: 1px solid var(--gray-300);
  position: sticky;
  top: 0;
  z-index: 100;
  box-shadow: 0 1px 4px rgba(0,0,0,0.06);
}

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

.logo {
  display: flex;
  align-items: center;
  gap: 10px;
  text-decoration: none;
  color: var(--green-900);
  font-weight: 700;
  font-size: 1.1rem;
  flex-shrink: 0;
}

.main-nav ul {
  display: flex;
  list-style: none;
  gap: 4px;
}

.main-nav a {
  display: block;
  padding: 8px 12px;
  text-decoration: none;
  color: var(--gray-700);
  font-size: 0.9rem;
  border-radius: var(--radius-sm);
  transition: background 0.15s;
}

.main-nav a:hover {
  background: var(--green-100);
  color: var(--green-900);
}

.nav-toggle {
  display: none;
  flex-direction: column;
  gap: 4px;
  background: none;
  border: none;
  cursor: pointer;
  padding: 8px;
}

.nav-toggle span {
  display: block;
  width: 22px;
  height: 2px;
  background: var(--gray-700);
  border-radius: 2px;
}

/* ===== Hero ===== */
.hero {
  background: linear-gradient(135deg, var(--green-900) 0%, var(--green-800) 50%, var(--green-600) 100%);
  color: var(--white);
  padding: 80px 0;
  text-align: center;
}

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

.hero-sub {
  font-size: 1.15rem;
  opacity: 0.9;
  max-width: 560px;
  margin: 0 auto 32px;
}

/* ===== Buttons ===== */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 12px 24px;
  border-radius: var(--radius-sm);
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
  border: 2px solid transparent;
  transition: all 0.15s;
  text-decoration: none;
}

.btn-primary {
  background: var(--amber-500);
  color: var(--gray-900);
  border-color: var(--amber-500);
}

.btn-primary:hover {
  background: #d4922f;
  border-color: #d4922f;
  color: var(--gray-900);
}

.btn-secondary {
  background: var(--white);
  color: var(--green-800);
  border-color: var(--green-400);
}

.btn-secondary:hover {
  background: var(--green-100);
}

.btn-sm {
  padding: 6px 14px;
  font-size: 0.85rem;
}

/* ===== Planner Section ===== */
.planner-section {
  padding: 60px 0;
}

.planner-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 40px;
  align-items: start;
}

.planner-inputs h2,
.planner-results h2 {
  font-size: 1.4rem;
  margin-bottom: 24px;
  color: var(--green-900);
}

.presets {
  margin-bottom: 24px;
}

.preset-buttons {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 8px;
}

.field-label {
  display: block;
  font-weight: 600;
  font-size: 0.9rem;
  color: var(--gray-700);
  margin-bottom: 4px;
}

.input-group {
  margin-bottom: 20px;
}

.input-group label {
  display: block;
  font-weight: 600;
  font-size: 0.9rem;
  color: var(--gray-700);
  margin-bottom: 6px;
}

.input-group input[type="number"],
.input-group select {
  width: 100%;
  padding: 10px 14px;
  border: 2px solid var(--gray-300);
  border-radius: var(--radius-sm);
  font-size: 1rem;
  background: var(--white);
  transition: border-color 0.15s;
}

.input-group input[type="number"]:focus,
.input-group select:focus {
  outline: none;
  border-color: var(--green-400);
  box-shadow: 0 0 0 3px rgba(82,183,136,0.2);
}

.input-group input[type="range"] {
  width: 100%;
  margin-top: 4px;
  accent-color: var(--green-600);
}

.input-group output {
  display: inline-block;
  font-weight: 700;
  color: var(--green-800);
  margin-left: 8px;
}

.hint {
  display: block;
  font-size: 0.8rem;
  color: var(--gray-500);
  margin-top: 4px;
}

.actions-row {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  margin-top: 24px;
}

/* ===== Results Panel ===== */
.planner-results {
  background: var(--white);
  border-radius: var(--radius);
  padding: 32px;
  box-shadow: var(--shadow);
  position: sticky;
  top: 80px;
}

.result-box {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 16px;
  margin-bottom: 28px;
}

.result-stat {
  text-align: center;
  padding: 16px 8px;
  background: var(--green-50);
  border-radius: var(--radius-sm);
}

.result-value {
  display: block;
  font-size: 1.6rem;
  font-weight: 800;
  color: var(--green-800);
  line-height: 1.2;
}

.result-label {
  display: block;
  font-size: 0.78rem;
  color: var(--gray-500);
  margin-top: 4px;
}

/* ===== Yield Table ===== */
.yield-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.9rem;
  margin-top: 12px;
}

.yield-table th {
  text-align: left;
  padding: 8px 10px;
  background: var(--green-50);
  color: var(--green-900);
  font-weight: 600;
  font-size: 0.82rem;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.yield-table td {
  padding: 8px 10px;
  border-bottom: 1px solid var(--gray-100);
}

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

/* ===== Planting Calendar ===== */
.planting-calendar {
  margin-top: 28px;
}

.planting-calendar h3,
.effort-meter h3,
.verdict h3,
.crop-breakdown h3 {
  font-size: 1rem;
  color: var(--green-900);
  margin-bottom: 12px;
}

.calendar-months {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 8px;
}

.cal-month {
  padding: 8px;
  border-radius: var(--radius-sm);
  font-size: 0.8rem;
  text-align: center;
  font-weight: 600;
}

.cal-month.active { background: var(--green-200); color: var(--green-900); }
.cal-month.plant { background: var(--amber-100); color: #7a5200; }
.cal-month.idle { background: var(--gray-100); color: var(--gray-500); }

/* ===== Effort Meter ===== */
.effort-meter { margin-top: 28px; }

.meter-bar {
  height: 12px;
  background: var(--gray-100);
  border-radius: 6px;
  overflow: hidden;
}

.meter-fill {
  height: 100%;
  border-radius: 6px;
  transition: width 0.4s ease, background 0.4s;
  width: 0%;
}

.meter-label {
  font-size: 0.85rem;
  color: var(--gray-500);
  margin-top: 8px;
}

/* ===== Verdict ===== */
.verdict {
  margin-top: 28px;
  padding: 20px;
  background: var(--green-50);
  border-radius: var(--radius-sm);
  border-left: 4px solid var(--green-600);
}

.verdict p {
  font-size: 0.95rem;
  color: var(--gray-700);
}

/* ===== How It Works ===== */
.how-section {
  padding: 60px 0;
  background: var(--white);
}

.how-section h2 {
  text-align: center;
  font-size: 1.6rem;
  color: var(--green-900);
  margin-bottom: 40px;
}

.how-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 24px;
}

.how-card {
  text-align: center;
  padding: 24px 16px;
}

.how-num {
  width: 40px;
  height: 40px;
  background: var(--green-800);
  color: var(--white);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 800;
  font-size: 1.1rem;
  margin: 0 auto 16px;
}

.how-card h3 {
  font-size: 1rem;
  color: var(--green-900);
  margin-bottom: 8px;
}

.how-card p {
  font-size: 0.9rem;
  color: var(--gray-500);
}

/* ===== Scenarios ===== */
.scenarios-section {
  padding: 60px 0;
}

.scenarios-section h2 {
  font-size: 1.6rem;
  color: var(--green-900);
  margin-bottom: 8px;
}

.section-sub {
  color: var(--gray-500);
  margin-bottom: 32px;
}

.scenario-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 24px;
}

.scenario-card {
  background: var(--white);
  border-radius: var(--radius);
  padding: 24px;
  box-shadow: var(--shadow);
}

.scenario-card h3 {
  font-size: 1.1rem;
  color: var(--green-900);
  margin-bottom: 12px;
}

.scenario-card dl {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 4px 16px;
  font-size: 0.9rem;
  margin-bottom: 12px;
}

.scenario-card dt { color: var(--gray-500); }
.scenario-card dd { font-weight: 600; color: var(--gray-900); }
.scenario-card p { font-size: 0.9rem; color: var(--gray-700); }

/* ===== Mistakes ===== */
.mistakes-section {
  padding: 60px 0;
  background: var(--white);
}

.mistakes-section h2 {
  font-size: 1.6rem;
  color: var(--green-900);
  margin-bottom: 32px;
}

.mistakes-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 24px;
}

.mistake-card {
  padding: 20px;
  background: #fff5f5;
  border-radius: var(--radius-sm);
  border-left: 4px solid var(--red-600);
}

.mistake-card h3 {
  font-size: 1rem;
  color: var(--red-600);
  margin-bottom: 8px;
}

.mistake-card p {
  font-size: 0.9rem;
  color: var(--gray-700);
}

/* ===== FAQs ===== */
.faqs-section {
  padding: 60px 0;
}

.faqs-section h2 {
  font-size: 1.6rem;
  color: var(--green-900);
  margin-bottom: 32px;
}

.faq-list {
  display: grid;
  gap: 20px;
}

.faq-list dt {
  font-weight: 700;
  color: var(--green-900);
  font-size: 1rem;
  margin-bottom: 6px;
}

.faq-list dd {
  color: var(--gray-700);
  font-size: 0.95rem;
  padding-left: 16px;
  border-left: 3px solid var(--green-200);
}

/* ===== Footer ===== */
.site-footer {
  background: var(--green-900);
  color: var(--green-200);
  padding: 48px 0 24px;
}

.footer-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 32px;
  margin-bottom: 32px;
}

.footer-grid strong {
  display: block;
  color: var(--white);
  margin-bottom: 8px;
  font-size: 0.9rem;
}

.footer-grid p,
.footer-grid a {
  font-size: 0.85rem;
  color: var(--green-200);
}

.footer-grid ul { list-style: none; }
.footer-grid li { margin-bottom: 4px; }

.footer-note {
  font-size: 0.8rem;
  color: var(--green-400);
  text-align: center;
  padding-top: 24px;
  border-top: 1px solid rgba(255,255,255,0.1);
}

/* ===== Toast ===== */
.toast {
  position: fixed;
  bottom: 24px;
  right: 24px;
  background: var(--green-900);
  color: var(--white);
  padding: 12px 20px;
  border-radius: var(--radius-sm);
  font-size: 0.9rem;
  box-shadow: var(--shadow-lg);
  z-index: 200;
  opacity: 0;
  transform: translateY(10px);
  transition: all 0.3s;
  pointer-events: none;
}

.toast.show {
  opacity: 1;
  transform: translateY(0);
}

/* ===== Print ===== */
@media print {
  .site-header, .site-footer, .actions-row, .presets, .nav-toggle { display: none !important; }
  .planner-grid { grid-template-columns: 1fr; }
  .planner-results { position: static; box-shadow: none; border: 1px solid #ccc; }
  body { background: white; color: black; }
  .hero { background: none; color: black; padding: 20px 0; }
  .hero h1 { color: black; }
}

/* ===== Responsive ===== */
@media (max-width: 900px) {
  .planner-grid { grid-template-columns: 1fr; }
  .planner-results { position: static; }
  .how-grid { grid-template-columns: repeat(2, 1fr); }
  .scenario-grid { grid-template-columns: 1fr; }
  .mistakes-grid { grid-template-columns: repeat(2, 1fr); }
  .footer-grid { grid-template-columns: repeat(2, 1fr); }
  .result-box { grid-template-columns: 1fr 1fr 1fr; }
}

@media (max-width: 640px) {
  .main-nav { display: none; }
  .main-nav.open { display: block; position: absolute; top: 60px; left: 0; right: 0; background: var(--white); border-bottom: 1px solid var(--gray-300); padding: 12px 20px; }
  .main-nav.open ul { flex-direction: column; }
  .nav-toggle { display: flex; }
  .hero { padding: 48px 0; }
  .how-grid { grid-template-columns: 1fr; }
  .mistakes-grid { grid-template-columns: 1fr; }
  .footer-grid { grid-template-columns: 1fr; }
  .result-box { grid-template-columns: 1fr; }
  .calendar-months { grid-template-columns: repeat(3, 1fr); }
  .preset-buttons { flex-direction: column; }
}

/* ===== Focus styles ===== */
*:focus-visible {
  outline: 3px solid var(--green-400);
  outline-offset: 2px;
}

/* ===== Range input fix ===== */
input[type="range"] {
  -webkit-appearance: none;
  appearance: none;
  height: 6px;
  background: var(--gray-300);
  border-radius: 3px;
}

input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 20px;
  height: 20px;
  background: var(--green-600);
  border-radius: 50%;
  cursor: pointer;
}

input[type="range"]::-moz-range-thumb {
  width: 20px;
  height: 20px;
  background: var(--green-600);
  border-radius: 50%;
  cursor: pointer;
  border: none;
}


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