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

:root {
  --green-900: #1a3a1a;
  --green-800: #2D5F2D;
  --green-700: #3a7a3a;
  --green-600: #4a9a4a;
  --green-100: #e8f5e8;
  --green-50: #f4fbf4;
  --amber-500: #E8A317;
  --amber-100: #fef7e0;
  --red-600: #c0392b;
  --red-50: #fdf0ef;
  --gray-900: #1a1a1a;
  --gray-700: #3d3d3d;
  --gray-500: #6b6b6b;
  --gray-300: #c4c4c4;
  --gray-200: #e0e0e0;
  --gray-100: #f5f5f5;
  --white: #ffffff;
  --radius: 8px;
  --radius-lg: 12px;
  --shadow-sm: 0 1px 3px rgba(0,0,0,0.08);
  --shadow-md: 0 4px 12px rgba(0,0,0,0.1);
  --shadow-lg: 0 8px 24px rgba(0,0,0,0.12);
  --font: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, sans-serif;
  --max-width: 1200px;
}

html { scroll-behavior: smooth; }
body {
  font-family: var(--font);
  color: var(--gray-900);
  background: var(--white);
  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-900); }

.container { max-width: var(--max-width); margin: 0 auto; padding: 0 20px; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0,0,0,0); border: 0; }
.skip-link { position: absolute; top: -100%; left: 16px; background: var(--green-800); color: #fff; padding: 8px 16px; border-radius: 0 0 var(--radius) var(--radius); z-index: 100; text-decoration: none; }
.skip-link:focus { top: 0; }

/* ===== Header ===== */
.site-header {
  background: var(--white);
  border-bottom: 1px solid var(--gray-200);
  position: sticky;
  top: 0;
  z-index: 50;
  box-shadow: var(--shadow-sm);
}
.header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 56px;
}
.logo {
  display: flex;
  align-items: center;
  gap: 8px;
  text-decoration: none;
  color: var(--green-900);
  font-weight: 700;
  font-size: 1.15rem;
}
.logo:hover { color: var(--green-800); }
.site-nav {
  display: flex;
  gap: 20px;
}
.site-nav a {
  text-decoration: none;
  color: var(--gray-700);
  font-size: 0.9rem;
  font-weight: 500;
  padding: 4px 0;
  border-bottom: 2px solid transparent;
  transition: color 0.15s, border-color 0.15s;
}
.site-nav a:hover { color: var(--green-800); border-bottom-color: var(--green-600); }

/* ===== Hero ===== */
.hero-section {
  background: linear-gradient(135deg, var(--green-900) 0%, var(--green-800) 60%, var(--green-700) 100%);
  color: #fff;
  padding: 64px 0 56px;
}
.hero-content { max-width: 640px; }
.hero-content h1 {
  font-size: 2.4rem;
  line-height: 1.2;
  font-weight: 800;
  margin-bottom: 16px;
}
.hero-sub {
  font-size: 1.1rem;
  opacity: 0.9;
  margin-bottom: 28px;
  line-height: 1.5;
}
.hero-actions { display: flex; gap: 12px; flex-wrap: wrap; }

/* ===== Buttons ===== */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 10px 20px;
  border-radius: var(--radius);
  font-size: 0.9rem;
  font-weight: 600;
  cursor: pointer;
  border: 2px solid transparent;
  transition: background 0.15s, color 0.15s, border-color 0.15s, box-shadow 0.15s;
  text-decoration: none;
  line-height: 1.4;
}
.btn-primary { background: var(--amber-500); color: var(--gray-900); border-color: var(--amber-500); }
.btn-primary:hover { background: #d4920f; border-color: #d4920f; color: var(--gray-900); }
.btn-secondary { background: var(--white); color: var(--gray-700); border-color: var(--gray-300); }
.btn-secondary:hover { border-color: var(--green-600); color: var(--green-800); }
.btn-ghost { background: transparent; color: #fff; border-color: rgba(255,255,255,0.4); }
.btn-ghost:hover { border-color: #fff; background: rgba(255,255,255,0.1); color: #fff; }
.btn-danger { background: var(--white); color: var(--red-600); border-color: var(--gray-300); }
.btn-danger:hover { border-color: var(--red-600); background: var(--red-50); }
.btn-sm { padding: 6px 12px; font-size: 0.8rem; }

/* ===== Planner Section ===== */
.planner-section { padding: 48px 0; }
.planner-layout {
  display: grid;
  grid-template-columns: 1fr 320px;
  gap: 32px;
  align-items: start;
}
.planner-controls {
  display: flex;
  gap: 16px;
  flex-wrap: wrap;
  margin-bottom: 24px;
  padding: 20px;
  background: var(--green-50);
  border-radius: var(--radius-lg);
  border: 1px solid var(--green-100);
}
.control-group { display: flex; flex-direction: column; gap: 4px; min-width: 160px; flex: 1; }
.label { font-size: 0.8rem; font-weight: 600; color: var(--gray-700); text-transform: uppercase; letter-spacing: 0.04em; }
.select, .input {
  padding: 8px 12px;
  border: 1px solid var(--gray-300);
  border-radius: var(--radius);
  font-size: 0.9rem;
  font-family: var(--font);
  background: var(--white);
  color: var(--gray-900);
  transition: border-color 0.15s, box-shadow 0.15s;
}
.select:focus, .input:focus { outline: none; border-color: var(--green-600); box-shadow: 0 0 0 3px rgba(74,154,74,0.2); }
.input-with-suffix { display: flex; align-items: center; gap: 4px; }
.input-with-suffix .input { flex: 1; }
.input-suffix { font-size: 0.85rem; color: var(--gray-500); font-weight: 600; min-width: 24px; }

/* ===== Gear Table ===== */
.gear-table-wrap { margin-bottom: 24px; }
.gear-table { width: 100%; border-collapse: collapse; font-size: 0.9rem; }
.gear-table thead th {
  text-align: left;
  padding: 10px 12px;
  background: var(--gray-100);
  color: var(--gray-700);
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  border-bottom: 2px solid var(--gray-200);
}
.gear-table tbody td { padding: 8px 12px; border-bottom: 1px solid var(--gray-200); vertical-align: middle; }
.gear-table tbody tr:hover { background: var(--green-50); }
.col-item { min-width: 160px; }
.col-category { min-width: 120px; }
.col-weight { min-width: 80px; }
.col-qty { min-width: 50px; }
.col-action { width: 40px; text-align: center; }
.gear-table input, .gear-table select {
  width: 100%;
  padding: 6px 8px;
  border: 1px solid var(--gray-200);
  border-radius: 4px;
  font-size: 0.85rem;
  font-family: var(--font);
}
.gear-table input:focus, .gear-table select:focus { outline: none; border-color: var(--green-600); }
.item-heavy { background: var(--amber-100); }
.item-heavy td:first-child { position: relative; }
.item-heavy td:first-child::before {
  content: "";
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  width: 3px;
  background: var(--amber-500);
  border-radius: 0 2px 2px 0;
}
.empty-state { text-align: center; padding: 32px; color: var(--gray-500); font-style: italic; display: none; }
.empty-state.visible { display: block; }

/* ===== Add Gear Form ===== */
.add-gear-form {
  background: var(--gray-100);
  border-radius: var(--radius-lg);
  padding: 24px;
  margin-bottom: 20px;
}
.section-subtitle { font-size: 1.05rem; font-weight: 700; margin-bottom: 16px; color: var(--gray-900); }
.form-row { display: flex; gap: 12px; align-items: flex-end; flex-wrap: wrap; }
.form-field { display: flex; flex-direction: column; gap: 4px; flex: 1; min-width: 120px; }
.form-field-sm { flex: 0 0 80px; min-width: 80px; }
.form-field-actions { flex: 0 0 auto; min-width: auto; }

/* ===== Action Bar ===== */
.action-bar { display: flex; gap: 10px; flex-wrap: wrap; margin-bottom: 12px; }
.save-confirm, .share-confirm { font-size: 0.85rem; color: var(--green-800); font-weight: 600; }

/* ===== Sidebar ===== */
.planner-sidebar { position: relative; }
.sidebar-sticky { position: sticky; top: 72px; display: flex; flex-direction: column; gap: 16px; }
.summary-card {
  background: var(--white);
  border: 1px solid var(--gray-200);
  border-radius: var(--radius-lg);
  padding: 20px;
  box-shadow: var(--shadow-sm);
}
.sidebar-title { font-size: 0.95rem; font-weight: 700; color: var(--gray-900); margin-bottom: 12px; }
.total-weight-display { text-align: center; padding: 12px 0; }
.total-number { font-size: 2.8rem; font-weight: 800; color: var(--green-800); line-height: 1; }
.total-unit { font-size: 1.1rem; color: var(--gray-500); font-weight: 600; }
.total-label { text-align: center; font-size: 0.8rem; color: var(--gray-500); margin-top: 4px; }

/* Target comparison */
.target-comparison { margin-top: 16px; }
.target-bar {
  height: 10px;
  background: var(--gray-200);
  border-radius: 5px;
  overflow: hidden;
  margin-bottom: 8px;
}
.target-fill {
  height: 100%;
  border-radius: 5px;
  background: var(--green-600);
  transition: width 0.3s ease, background 0.3s;
  width: 0%;
}
.target-fill.over-target { background: var(--red-600); }
.target-fill.near-target { background: var(--amber-500); }
.target-text { font-size: 0.82rem; color: var(--gray-500); text-align: center; }

/* Category list */
.category-list { list-style: none; display: flex; flex-direction: column; gap: 8px; }
.category-list li {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 0.85rem;
  padding: 6px 0;
  border-bottom: 1px solid var(--gray-100);
}
.category-list li:last-child { border-bottom: none; }
.cat-name { color: var(--gray-700); }
.cat-weight { font-weight: 700; color: var(--gray-900); }
.cat-bar {
  height: 4px;
  background: var(--gray-200);
  border-radius: 2px;
  margin-top: 4px;
  overflow: hidden;
}
.cat-bar-fill { height: 100%; background: var(--green-600); border-radius: 2px; transition: width 0.3s; }
.category-empty { color: var(--gray-500); font-style: italic; font-size: 0.85rem; }

/* Targets list */
.targets-list { display: flex; flex-direction: column; gap: 8px; }
.target-row { display: flex; justify-content: space-between; font-size: 0.85rem; }
.target-row dt { color: var(--gray-700); }
.target-row dd { font-weight: 700; color: var(--gray-900); }

/* Heavy items */
.heavy-list { list-style: none; display: flex; flex-direction: column; gap: 6px; }
.heavy-list li {
  display: flex;
  justify-content: space-between;
  font-size: 0.85rem;
  padding: 4px 0;
}
.heavy-list li .h-name { color: var(--gray-700); }
.heavy-list li .h-weight { font-weight: 700; color: var(--amber-500); }
.heavy-empty { color: var(--gray-500); font-style: italic; font-size: 0.85rem; }

/* ===== Info Sections ===== */
.info-section { padding: 56px 0; }
.info-section-alt { background: var(--green-50); }
.section-title {
  font-size: 1.6rem;
  font-weight: 800;
  color: var(--gray-900);
  margin-bottom: 32px;
  text-align: center;
}
.info-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 24px; }
.info-grid-2 { grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); }
.info-card {
  background: var(--white);
  border: 1px solid var(--gray-200);
  border-radius: var(--radius-lg);
  padding: 24px;
  box-shadow: var(--shadow-sm);
}
.info-section-alt .info-card { border-color: var(--green-100); }
.info-icon {
  width: 36px;
  height: 36px;
  background: var(--green-800);
  color: #fff;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 800;
  font-size: 0.9rem;
  margin-bottom: 12px;
}
.info-card h3 { font-size: 1rem; font-weight: 700; margin-bottom: 8px; color: var(--gray-900); }
.info-card p { font-size: 0.9rem; color: var(--gray-700); line-height: 1.55; }

/* ===== Tips ===== */
.tips-layout { display: grid; grid-template-columns: 1fr 1fr; gap: 32px; }
.tips-column h3 { font-size: 1.05rem; font-weight: 700; margin-bottom: 16px; }
.tips-list { list-style: none; display: flex; flex-direction: column; gap: 10px; }
.tips-list li { font-size: 0.9rem; color: var(--gray-700); padding-left: 24px; position: relative; line-height: 1.5; }
.tips-list li::before {
  content: "";
  position: absolute;
  left: 0;
  top: 7px;
  width: 10px;
  height: 10px;
  border-radius: 50%;
}
.tips-list-bad li::before { background: var(--red-600); }
.tips-list-good li::before { background: var(--green-600); }

/* ===== FAQ ===== */
.faq-list { display: flex; flex-direction: column; gap: 0; max-width: 720px; margin: 0 auto; }
.faq-item {
  border: 1px solid var(--gray-200);
  border-radius: var(--radius);
  overflow: hidden;
  margin-bottom: 8px;
}
.faq-item summary {
  padding: 16px 20px;
  font-weight: 600;
  font-size: 0.95rem;
  cursor: pointer;
  list-style: none;
  display: flex;
  align-items: center;
  gap: 12px;
  background: var(--white);
  transition: background 0.15s;
}
.faq-item summary::-webkit-details-marker { display: none; }
.faq-item summary::after {
  content: "+";
  margin-left: auto;
  font-size: 1.2rem;
  font-weight: 400;
  color: var(--gray-500);
  transition: transform 0.2s;
}
.faq-item[open] summary::after { content: "−"; }
.faq-item summary:hover { background: var(--green-50); }
.faq-item p { padding: 0 20px 16px; font-size: 0.9rem; color: var(--gray-700); line-height: 1.55; }

/* ===== Footer ===== */
.site-footer {
  background: var(--green-900);
  color: rgba(255,255,255,0.8);
  padding: 40px 0 32px;
  font-size: 0.85rem;
}
.footer-inner { display: flex; flex-direction: column; gap: 20px; }
.footer-brand .logo-text { color: #fff; font-size: 1.1rem; font-weight: 700; }
.footer-tagline { margin-top: 6px; opacity: 0.7; font-size: 0.85rem; }
.footer-nav { display: flex; gap: 20px; flex-wrap: wrap; }
.footer-nav a { color: rgba(255,255,255,0.8); text-decoration: none; }
.footer-nav a:hover { color: #fff; text-decoration: underline; }
.footer-meta { opacity: 0.5; font-size: 0.78rem; }

/* ===== Print ===== */
@media print {
  .site-header, .site-footer, .planner-controls, .add-gear-form, .action-bar, .planner-sidebar, .hero-section, .info-section { display: none !important; }
  .planner-layout { display: block; }
  .gear-table { font-size: 0.8rem; }
  body { color: #000; }
}

/* ===== Responsive ===== */
@media (max-width: 900px) {
  .planner-layout { grid-template-columns: 1fr; }
  .planner-sidebar { order: -1; }
  .sidebar-sticky { position: static; flex-direction: row; flex-wrap: wrap; }
  .summary-card { flex: 1; min-width: 220px; }
  .hero-content h1 { font-size: 1.8rem; }
  .tips-layout { grid-template-columns: 1fr; gap: 24px; }
}

@media (max-width: 600px) {
  .header-inner { flex-direction: column; height: auto; padding: 10px 0; gap: 8px; }
  .site-nav { gap: 14px; }
  .hero-section { padding: 40px 0 36px; }
  .hero-content h1 { font-size: 1.5rem; }
  .planner-controls { flex-direction: column; }
  .form-row { flex-direction: column; align-items: stretch; }
  .form-field, .form-field-sm, .form-field-actions { min-width: auto; flex: none; }
  .gear-table { font-size: 0.8rem; }
  .gear-table thead { display: none; }
  .gear-table tbody tr { display: flex; flex-wrap: wrap; gap: 6px; padding: 10px 0; border-bottom: 1px solid var(--gray-200); }
  .gear-table tbody td { border: none; padding: 2px 6px; }
  .col-item { flex: 1 1 100%; }
  .col-category { flex: 1 1 45%; }
  .col-weight { flex: 0 0 80px; }
  .col-qty { flex: 0 0 50px; }
  .col-action { flex: 0 0 36px; }
  .sidebar-sticky { flex-direction: column; }
  .info-grid { grid-template-columns: 1fr; }
  .info-grid-2 { 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;
}
