/* Karibu Groceries Limited — design system
   One stylesheet for every page. Plain CSS, no build step, so GitHub Pages serves it as-is. */

:root {
  /* Colour: field green + grain, on warm paper */
  --green-950: #10281e;
  --green-900: #163a2b;
  --green-800: #1d4a37;
  --green-700: #235c44;
  --green-100: #e3eee7;
  --grain-600: #a8681a;
  --grain-400: #d9a441;
  --grain-100: #f8eed8;
  --paper: #f6f4ee;
  --surface: #ffffff;
  --line: #e3dfd3;
  --line-strong: #cdc7b7;
  --ink: #1c2320;
  --ink-soft: #3a433f;
  --muted: #5a635f; /* 6.2:1 on paper */

  /* Type */
  --font-display: "Fraunces", Georgia, "Times New Roman", serif;
  --font-body: "Inter", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;

  /* Shape & depth */
  --radius: 10px;
  --radius-sm: 6px;
  --shadow: 0 1px 2px rgb(16 40 30 / 0.06), 0 4px 16px -6px rgb(16 40 30 / 0.12);
  --container: 1120px;
}

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

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

body {
  margin: 0;
  font-family: var(--font-body);
  font-size: 1rem;
  line-height: 1.6;
  color: var(--ink);
  background: var(--paper);
  -webkit-font-smoothing: antialiased;
}

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

a { color: var(--green-700); }
a:hover { color: var(--green-900); }

:focus-visible {
  outline: 3px solid var(--grain-400);
  outline-offset: 2px;
  border-radius: 4px;
}

h1, h2, h3 {
  font-family: var(--font-display);
  font-weight: 600;
  line-height: 1.15;
  letter-spacing: -0.01em;
  color: var(--green-950);
  margin: 0;
}

.skip-link {
  position: absolute;
  left: 1rem;
  top: -3rem;
  z-index: 100;
  padding: 0.5rem 1rem;
  background: var(--surface);
  color: var(--ink);
  border-radius: var(--radius-sm);
}
.skip-link:focus { top: 1rem; }

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

/* ---------- Header & navigation ---------- */
.site-header {
  background: var(--green-900);
  color: #f3efe2;
  position: sticky;
  top: 0;
  z-index: 50;
  border-bottom: 3px solid var(--grain-400);
}
.site-header .container {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  min-height: 4rem;
}

.wordmark {
  display: inline-flex;
  align-items: baseline;
  gap: 0.5rem;
  color: #fbf7ea;
  text-decoration: none;
  font-family: var(--font-display);
  font-size: 1.3rem;
  font-weight: 600;
  letter-spacing: -0.01em;
}
.wordmark:hover { color: #fff; }
.wordmark small {
  font-family: var(--font-body);
  font-size: 0.68rem;
  font-weight: 600;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--grain-400);
}

.nav-toggle {
  display: none;
  align-items: center;
  justify-content: center;
  width: 2.5rem;
  height: 2.5rem;
  background: transparent;
  border: 1px solid rgb(255 255 255 / 0.25);
  border-radius: var(--radius-sm);
  color: #fbf7ea;
  cursor: pointer;
}
.nav-toggle svg { width: 1.25rem; height: 1.25rem; }

.site-nav ul {
  display: flex;
  align-items: center;
  gap: 0.25rem;
  margin: 0;
  padding: 0;
  list-style: none;
}
.site-nav a {
  display: block;
  padding: 0.5rem 0.85rem;
  border-radius: var(--radius-sm);
  color: #d9e3dc;
  text-decoration: none;
  font-size: 0.95rem;
  font-weight: 500;
}
.site-nav a:hover { color: #fff; background: rgb(255 255 255 / 0.08); }
.site-nav a[aria-current="page"] { color: #fff; background: var(--green-700); }
.site-nav .nav-logout { margin-left: 0.5rem; border: 1px solid rgb(255 255 255 / 0.25); }

@media (max-width: 760px) {
  .nav-toggle { display: inline-flex; }
  .site-nav {
    display: none;
    position: absolute;
    left: 0;
    right: 0;
    top: 100%;
    background: var(--green-900);
    border-bottom: 3px solid var(--grain-400);
    padding: 0.5rem 1.25rem 1rem;
  }
  .site-nav.is-open { display: block; }
  .site-nav ul { flex-direction: column; align-items: stretch; }
  .site-nav .nav-logout { margin: 0.5rem 0 0; }
}

/* ---------- Page structure ---------- */
main { display: block; }

.page { padding: 2.5rem 0 4rem; }

.page-head { margin-bottom: 2rem; }
.eyebrow {
  margin: 0 0 0.5rem;
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--grain-600);
}
.page-head h1 { font-size: clamp(1.9rem, 4vw, 2.6rem); }
.page-head .lead { margin: 0.6rem 0 0; max-width: 44rem; color: var(--muted); font-size: 1.05rem; }

.section { margin-top: 3rem; }
.section > h2 { font-size: 1.5rem; margin-bottom: 1rem; }

.site-footer {
  border-top: 1px solid var(--line);
  padding: 1.5rem 0;
  color: var(--muted);
  font-size: 0.875rem;
}
.site-footer .container { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 0.5rem; }

/* ---------- Components ---------- */
.card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}
.card-pad { padding: 1.5rem; }
.card-title {
  margin: 0 0 1rem;
  font-family: var(--font-body);
  font-size: 1rem;
  font-weight: 600;
  color: var(--ink);
}

.grid { display: grid; gap: 1.25rem; }
.grid-3 { grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); }
.grid-2 { grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); }

.stat { padding: 1.25rem 1.5rem; }
.stat-label { margin: 0; font-size: 0.875rem; font-weight: 500; color: var(--muted); }
.stat-value {
  margin: 0.25rem 0 0;
  font-family: var(--font-display);
  font-size: 2.4rem;
  font-weight: 600;
  line-height: 1;
  color: var(--green-900);
}
.stat-accent { border-top: 4px solid var(--green-700); }
.stat-accent.is-grain { border-top-color: var(--grain-400); }
.stat-accent.is-soft { border-top-color: var(--line-strong); }

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  min-height: 2.75rem;
  padding: 0.6rem 1.25rem;
  border: 1px solid transparent;
  border-radius: var(--radius-sm);
  font: inherit;
  font-weight: 600;
  text-decoration: none;
  cursor: pointer;
}
.btn-primary { background: var(--green-700); color: #fff; }
.btn-primary:hover { background: var(--green-800); color: #fff; }
.btn-block { width: 100%; }

.badge {
  display: inline-block;
  padding: 0.15rem 0.6rem;
  border-radius: 999px;
  font-size: 0.8rem;
  font-weight: 600;
  background: var(--green-100);
  color: var(--green-800);
}
.badge.is-grain { background: var(--grain-100); color: #7a4b10; }
.badge.is-neutral { background: #eeece6; color: var(--ink-soft); }

.notice {
  display: flex;
  gap: 0.75rem;
  padding: 0.85rem 1rem;
  border: 1px solid #ecd9ae;
  border-left: 4px solid var(--grain-400);
  border-radius: var(--radius-sm);
  background: var(--grain-100);
  color: #5c3b0e;
  font-size: 0.9rem;
}

/* ---------- Tables ---------- */
.table-wrap { overflow-x: auto; }
.table { width: 100%; border-collapse: collapse; font-size: 0.95rem; }
.table caption { text-align: left; padding: 0 0 0.75rem; color: var(--muted); font-size: 0.875rem; }
.table th,
.table td { padding: 0.8rem 1rem; text-align: left; border-bottom: 1px solid var(--line); }
.table thead th {
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--muted);
  background: #faf8f3;
  white-space: nowrap;
}
.table tbody tr:last-child td,
.table tbody tr:last-child th { border-bottom: 0; }
.table tbody tr:hover { background: #fbfaf6; }
.table .num { text-align: right; font-variant-numeric: tabular-nums; }
.table tbody th { font-weight: 600; color: var(--muted); }
@media (max-width: 480px) {
  .table th,
  .table td { padding: 0.7rem 0.55rem; }
  .table thead th { letter-spacing: 0.03em; }
  .card-pad { padding: 1.15rem; }
}

/* ---------- Forms ---------- */
.field { margin-bottom: 1.1rem; }
.field label { display: block; margin-bottom: 0.35rem; font-size: 0.9rem; font-weight: 600; color: var(--ink-soft); }
.field input[type="text"],
.field input[type="email"],
.field input[type="password"] {
  width: 100%;
  min-height: 2.75rem;
  padding: 0.6rem 0.8rem;
  font: inherit;
  color: var(--ink);
  background: var(--surface);
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-sm);
}
.field input:focus { outline: none; border-color: var(--green-700); box-shadow: 0 0 0 3px rgb(35 92 68 / 0.18); }
.field input[aria-invalid="true"] { border-color: #b42318; }
.field .hint { margin: 0.35rem 0 0; font-size: 0.8rem; color: var(--muted); }
.field .error { margin: 0.35rem 0 0; font-size: 0.8rem; color: #b42318; }
.field-row { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; }
@media (max-width: 480px) { .field-row { grid-template-columns: 1fr; } }
.check { display: flex; align-items: center; gap: 0.5rem; margin: 0.25rem 0 1.25rem; font-size: 0.9rem; }
.check input { width: 1.1rem; height: 1.1rem; accent-color: var(--green-700); }

/* ---------- Sign-in page ---------- */
.auth {
  min-height: 100vh;
  display: grid;
  grid-template-columns: 1.05fr 1fr;
}
.auth-brand {
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 2rem;
  padding: 2.5rem clamp(1.5rem, 5vw, 4rem);
  background: var(--green-900);
  color: #e6ede8;
  border-right: 4px solid var(--grain-400);
}
.auth-brand h1 { color: #fbf7ea; font-size: clamp(2rem, 4vw, 3.1rem); max-width: 14ch; }
.auth-brand p { max-width: 34rem; color: #c9d6ce; }
.auth-brand .produce { display: flex; flex-wrap: wrap; gap: 0.5rem; margin: 1.5rem 0 0; padding: 0; list-style: none; }
.auth-brand .produce li {
  padding: 0.3rem 0.75rem;
  border: 1px solid rgb(255 255 255 / 0.2);
  border-radius: 999px;
  font-size: 0.85rem;
  color: #f3efe2;
}
.auth-brand .explore a { color: var(--grain-400); }
.auth-panel { display: flex; align-items: center; justify-content: center; padding: 2.5rem 1.25rem; }
.auth-card { width: 100%; max-width: 28rem; padding: 2rem; }
.auth-card h2 { font-size: 1.75rem; margin-bottom: 0.35rem; }
.auth-card .sub { margin: 0 0 1.5rem; color: var(--muted); }
@media (max-width: 860px) {
  .auth { grid-template-columns: 1fr; }
  .auth-brand { border-right: 0; border-bottom: 4px solid var(--grain-400); }
  .auth-brand .produce { display: none; }
}

/* ---------- Products ---------- */
.product { overflow: hidden; display: flex; flex-direction: column; }
.product img { width: 100%; aspect-ratio: 3 / 2; object-fit: cover; background: var(--grain-100); }
.product-body { padding: 1rem 1.25rem 1.25rem; }
.product-body h2 { font-size: 1.25rem; }
.price { margin: 0.35rem 0 0; color: var(--ink-soft); }
.price strong { font-size: 1.15rem; color: var(--green-900); font-variant-numeric: tabular-nums; }

/* ---------- About ---------- */
.about-hero { display: grid; grid-template-columns: 1.3fr 1fr; gap: 2rem; align-items: center; }
.about-hero .lead { font-size: 1.1rem; color: var(--ink-soft); }
@media (max-width: 860px) { .about-hero { grid-template-columns: 1fr; } }
.fact-list { margin: 0; padding: 0; list-style: none; }
.fact-list li { display: flex; gap: 0.75rem; padding: 0.7rem 0; border-bottom: 1px solid var(--line); }
.fact-list li:last-child { border-bottom: 0; }
.fact-list li::before {
  content: "";
  flex: none;
  width: 0.5rem;
  height: 0.5rem;
  margin-top: 0.6rem;
  border-radius: 2px;
  background: var(--grain-400);
}
.chips { display: flex; flex-wrap: wrap; gap: 0.75rem; margin: 0; padding: 0; list-style: none; }
.chips li {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  padding: 0.35rem 0.9rem 0.35rem 0.35rem;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 999px;
  font-weight: 500;
}
.chips img { width: 2.25rem; height: 2.25rem; border-radius: 50%; object-fit: cover; }

/* ---------- Dashboard chart ---------- */
.chart-box { position: relative; height: 280px; }

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after { transition: none !important; animation: none !important; }
}

/* Tables that become stacked cards on narrow screens (each cell carries data-label) */
@media (max-width: 600px) {
  .table-stack thead { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
  .table-stack tr { display: block; padding: 0.75rem 0; border-bottom: 1px solid var(--line); }
  .table-stack tbody tr:last-child { border-bottom: 0; }
  .table-stack th,
  .table-stack td { display: flex; justify-content: space-between; gap: 1rem; padding: 0.3rem 0; border: 0; text-align: right; word-break: break-word; }
  .table-stack th::before,
  .table-stack td::before { content: attr(data-label); flex: none; font-weight: 600; color: var(--muted); text-align: left; }
  .table-stack tbody tr:hover { background: transparent; }
}
