/* =====================================================================
 *  Shared design system for the Tools site.
 *  Kiwi-green accent, neutral cream backgrounds, generous whitespace.
 * =================================================================== */

:root {
  color-scheme: light;
  --bg: #ffffff;
  --bg-cream: #fafaf6;
  --panel: #f7f7f2;
  --panel-2: #efeee7;
  --border: #e2e0d8;
  --text: #1a1a17;
  --muted: #6b6a63;
  --accent: #5a7d3a;          /* kiwi green */
  --accent-dark: #466028;
  --accent-soft: #e6efd8;
  --accent-soft-2: #f1f6e6;
  --danger: #b33a2a;
  --warn: #b8860b;
  --radius: 8px;
  --radius-lg: 12px;
  --shadow: 0 1px 2px rgba(0,0,0,0.04), 0 4px 12px rgba(0,0,0,0.04);
  --shadow-lg: 0 4px 16px rgba(0,0,0,0.08);
  --mono: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  background: var(--bg-cream);
  color: var(--text);
  line-height: 1.45;
  font-size: 15px;
  min-height: 100vh;
}

/* ---- Header / nav ---- */
.site-header {
  background: white;
  border-bottom: 1px solid var(--border);
  padding: 10px 0;
  position: sticky;
  top: 0;
  z-index: 50;
}
.site-header-inner {
  max-width: 1100px;
  margin: 0 auto;
  padding: 0 20px;
  display: flex;
  align-items: center;
  gap: 14px;
}
.brand {
  display: flex;
  align-items: center;
  gap: 8px;
  font-weight: 700;
  font-size: 17px;
  color: var(--text);
  text-decoration: none;
}
.brand .logo {
  width: 28px; height: 28px;
  border-radius: 6px;
  background: var(--accent);
  display: inline-flex;
  align-items: center; justify-content: center;
  color: white;
  font-weight: 700;
  font-size: 14px;
}
.nav { display: flex; gap: 4px; margin-left: 8px; }
.nav a {
  color: var(--muted);
  text-decoration: none;
  padding: 6px 10px;
  border-radius: 6px;
  font-size: 14px;
}
.nav a:hover { background: var(--panel); color: var(--text); }
.nav a.active { color: var(--accent-dark); background: var(--accent-soft); font-weight: 600; }
.spacer { flex: 1; }

/* ---- Main containers ---- */
.container { max-width: 920px; margin: 0 auto; padding: 24px 20px; }
.container-wide { max-width: 1100px; margin: 0 auto; padding: 24px 20px; }
.page-title {
  display: flex; align-items: center; gap: 12px;
  margin-bottom: 16px;
}
.page-title h1 { margin: 0; font-size: 24px; }
.page-title .subtitle { color: var(--muted); font-size: 14px; }

/* ---- Typography ---- */
h1, h2, h3, h4 { margin: 0 0 8px 0; line-height: 1.25; }
h1 { font-size: 22px; }
h2 { font-size: 18px; }
h3 { font-size: 16px; }
p { margin: 0 0 8px 0; }
.muted { color: var(--muted); font-size: 13px; }
.kbd { font-family: var(--mono); background: var(--panel-2); border: 1px solid var(--border); border-radius: 3px; padding: 1px 5px; font-size: 12px; }

/* ---- Buttons ---- */
button, .btn {
  font: inherit;
  cursor: pointer;
  border: 1px solid var(--border);
  background: white;
  color: var(--text);
  padding: 8px 12px;
  border-radius: var(--radius);
  transition: background 0.15s, border-color 0.15s;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  text-decoration: none;
}
button:hover, .btn:hover { background: var(--panel); }
button.primary, .btn.primary {
  background: var(--accent);
  border-color: var(--accent);
  color: white;
}
button.primary:hover, .btn.primary:hover { background: var(--accent-dark); border-color: var(--accent-dark); }
button.danger, .btn.danger { color: var(--danger); border-color: #e9c0b9; }
button.danger:hover, .btn.danger:hover { background: #fbebe7; }
button.ghost, .btn.ghost { background: transparent; border-color: transparent; color: var(--muted); }
button.ghost:hover, .btn.ghost:hover { background: var(--panel); color: var(--text); }
button.small, .btn.small { padding: 4px 10px; font-size: 13px; }
button.icon, .btn.icon {
  width: 32px; height: 32px;
  padding: 0;
  justify-content: center;
}
button:disabled { opacity: 0.5; cursor: not-allowed; }

/* ---- Inputs ---- */
input[type="text"], input[type="email"], input[type="tel"], input[type="date"], input[type="number"], input[type="url"], select, textarea {
  font: inherit;
  width: 100%;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 8px 10px;
  background: white;
  color: var(--text);
}
textarea { resize: vertical; min-height: 60px; line-height: 1.5; }
input:focus, textarea:focus, select:focus { outline: 2px solid var(--accent-soft); border-color: var(--accent); }
.field { margin-bottom: 12px; }
.label { display: block; font-weight: 600; margin-bottom: 4px; font-size: 12px; color: var(--muted); text-transform: uppercase; letter-spacing: 0.05em; }

/* ---- Cards / panels ---- */
.section {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 16px 18px;
  margin-bottom: 16px;
}
.section h2 { display: flex; align-items: center; gap: 8px; }
.card {
  background: white;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 14px 16px;
  margin-bottom: 10px;
  transition: border-color 0.15s, box-shadow 0.15s;
}
.card.clickable { cursor: pointer; }
.card.clickable:hover { border-color: var(--accent); box-shadow: var(--shadow); }

/* ---- Layout helpers ---- */
.row { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.col { display: flex; flex-direction: column; gap: 8px; }
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; }
@media (max-width: 600px) {
  .grid-2, .grid-3 { grid-template-columns: 1fr; }
}

/* ---- Bullets ---- */
.bullets { list-style: disc; padding-left: 22px; margin: 6px 0; }
.bullets li { margin-bottom: 4px; }
.bullet-row { display: flex; gap: 6px; align-items: flex-start; margin-bottom: 4px; }
.bullet-row textarea { min-height: 36px; }
.bullet-row .drag { color: var(--muted); user-select: none; padding-top: 8px; }

/* ---- Collapsible ---- */
.collapsible {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: white;
  margin-bottom: 8px;
  overflow: hidden;
}
.collapsible > header {
  display: flex; align-items: center; gap: 8px;
  padding: 10px 12px;
  cursor: pointer;
  background: white;
}
.collapsible > header:hover { background: var(--panel); }
.collapsible.open > header { border-bottom: 1px solid var(--border); background: var(--panel-2); }
.collapsible > .body { padding: 12px; display: none; }
.collapsible.open > .body { display: block; }
.chev { transition: transform 0.15s; }
.collapsible.open .chev { transform: rotate(90deg); }

/* ---- Tags ---- */
.tag {
  display: inline-block;
  font-size: 11px;
  padding: 2px 8px;
  border-radius: 999px;
  background: var(--accent-soft);
  color: var(--accent-dark);
  font-weight: 500;
}
.tag.neutral { background: var(--panel-2); color: var(--muted); }
.tag.warn { background: #fdf3d9; color: var(--warn); }

/* ---- Empty state ---- */
.empty {
  text-align: center; padding: 50px 20px;
  color: var(--muted); font-size: 14px;
  border: 1px dashed var(--border); border-radius: var(--radius);
  background: white;
}

/* ---- Help tip ---- */
.help-tip {
  background: var(--accent-soft-2);
  border-left: 3px solid var(--accent);
  padding: 10px 14px;
  border-radius: 4px;
  font-size: 13px;
  margin-bottom: 14px;
  color: var(--text);
}

/* ---- Toast ---- */
.toast {
  position: fixed; bottom: 20px; left: 50%; transform: translateX(-50%);
  background: var(--text); color: white;
  padding: 10px 16px; border-radius: var(--radius);
  font-size: 14px;
  box-shadow: var(--shadow-lg);
  z-index: 1000;
  opacity: 0;
  transition: opacity 0.2s;
  pointer-events: none;
  max-width: 80vw;
}
.toast.show { opacity: 1; }
.toast.error { background: var(--danger); }

/* ---- Spinner ---- */
.spinner {
  display: inline-block;
  width: 14px; height: 14px;
  border: 2px solid var(--muted);
  border-top-color: transparent;
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }
@keyframes pulse { 0%,100% { opacity: 1; } 50% { opacity: 0.35; } }

/* ---- Mic button (used in trip reports) ---- */
.mic-btn {
  display: inline-flex; align-items: center; gap: 6px;
  background: white;
  border: 1px solid var(--border);
  color: var(--text);
  padding: 6px 12px;
  border-radius: 999px;
  font-size: 13px;
  cursor: pointer;
}
.mic-btn:hover { background: var(--panel); }
.mic-btn.recording { background: var(--danger); border-color: var(--danger); color: white; }
.mic-btn.recording .dot { animation: pulse 1.2s infinite; }
.dot { width: 8px; height: 8px; border-radius: 50%; background: currentColor; display: inline-block; }

/* ---- Footer ---- */
.site-footer {
  margin-top: 50px;
  padding: 30px 20px;
  border-top: 1px solid var(--border);
  text-align: center;
  color: var(--muted);
  font-size: 13px;
}

/* ---- Misc ---- */
hr.soft { border: none; border-top: 1px solid var(--border); margin: 16px 0; }
details > summary { cursor: pointer; padding: 6px 0; user-select: none; color: var(--muted); font-size: 13px; }

/* Mobile adjustments */
@media (max-width: 600px) {
  .container, .container-wide { padding: 16px 14px; }
  .site-header-inner { padding: 0 14px; }
  .section { padding: 14px; }
  .nav { display: none; }
  .nav.mobile-open { display: flex; flex-direction: column; position: absolute; top: 100%; left: 0; right: 0; background: white; border-top: 1px solid var(--border); padding: 8px; }
}
