/* ============================================================
   KebunBapakku — Design System (base.css)
   "Buah Segar, Langsung dari Kebun"
   Premium Indonesian fresh-fruit e-commerce
   ============================================================ */

/* ---------- Design tokens ---------- */
:root {
  /* Brand palette */
  --forest-900: #0f3d20;
  --forest-800: #14532d; /* Deep forest green */
  --green-700: #15803d;  /* Primary green */
  --green-500: #22c55e;  /* Fresh leaf green */
  --green-400: #4ade80;
  --green-50: #f0fdf4;

  --cream: #fffdf5;       /* Warm cream */
  --white: #ffffff;       /* Pure white */
  --charcoal: #1f2937;    /* Dark charcoal */

  /* Neutral grays */
  --gray-700: #374151;
  --gray-600: #4b5563;
  --gray-500: #6b7280;    /* Secondary text */
  --gray-400: #9ca3af;
  --gray-300: #d1d5db;
  --gray-200: #e5e7eb;
  --gray-100: #f3f4f6;
  --gray-50: #f9fafb;

  /* Accents */
  --amber: #f59e0b;       /* Promo / discount badge */
  --amber-dark: #b45309;
  --red: #dc2626;         /* Errors */
  --whatsapp: #25d366;
  --whatsapp-dark: #128c7e;

  /* Semantic */
  --bg: var(--cream);
  --surface: var(--white);
  --text: var(--charcoal);
  --text-muted: var(--gray-500);
  --border: var(--gray-200);
  --primary: var(--green-700);
  --primary-strong: var(--forest-800);

  /* Typography */
  --font-display: "Georgia", "Playfair Display", "Times New Roman", serif;
  --font-body: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue",
    Arial, "Noto Sans", sans-serif;

  /* Radii & shadows */
  --radius-sm: 8px;
  --radius: 14px;
  --radius-lg: 22px;
  --radius-pill: 999px;

  --shadow-sm: 0 1px 2px rgba(16, 24, 40, 0.05);
  --shadow: 0 4px 16px rgba(16, 24, 40, 0.08);
  --shadow-lg: 0 18px 48px rgba(16, 24, 40, 0.14);
  --shadow-green: 0 14px 34px rgba(21, 128, 61, 0.26);

  /* Layout */
  --maxw: 1200px;
  --gutter: clamp(16px, 4vw, 40px);
  --header-h: 118px;

  --transition: 180ms cubic-bezier(0.2, 0.6, 0.2, 1);
}

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

html {
  scroll-behavior: smooth;
  -webkit-text-size-adjust: 100%;
  scroll-padding-top: calc(var(--header-h) + 16px);
}

body {
  font-family: var(--font-body);
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
  min-height: 100vh;
  overflow-x: hidden;
  text-rendering: optimizeLegibility;
  -webkit-font-smoothing: antialiased;
}

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

/* Inline icon SVGs (from the icon set) have no intrinsic size — default them
   to a text-relative size so they never balloon in text contexts. Container
   rules (.product-card__media svg, .hero__art svg, etc.) override this. */
.btn > svg,
a:not(.logo):not(.cat-card):not(.product-card__media):not(.cart-item__media) > svg,
button:not(.icon-btn) > svg,
span:not(.logo__mark):not(.benefit__icon):not(.wa-cta__icon):not(.stat-card__icon):not(.thumb) > svg,
li > svg,
label > svg,
p > svg,
strong > svg {
  width: 1.25em;
  height: 1.25em;
  flex: none;
}

a {
  color: inherit;
  text-decoration: none;
}

button {
  font: inherit;
  cursor: pointer;
  border: none;
  background: none;
  color: inherit;
}

input,
select,
textarea {
  font: inherit;
  color: inherit;
}

ul {
  list-style: none;
}

/* ---------- Accessibility ---------- */
:focus-visible {
  outline: 3px solid var(--green-500);
  outline-offset: 2px;
  border-radius: 4px;
}

.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-link {
  position: absolute;
  left: -999px;
  top: 0;
  z-index: 2000;
  background: var(--forest-800);
  color: #fff;
  padding: 12px 18px;
  border-radius: 0 0 10px 0;
  font-weight: 600;
}
.skip-link:focus {
  left: 0;
}

/* ---------- Typography ---------- */
h1,
h2,
h3,
h4 {
  font-family: var(--font-display);
  line-height: 1.15;
  color: var(--forest-800);
  font-weight: 700;
  letter-spacing: -0.01em;
}

.eyebrow {
  font-family: var(--font-body);
  text-transform: uppercase;
  letter-spacing: 0.18em;
  font-size: 0.78rem;
  font-weight: 700;
  color: var(--green-700);
}

.section-title {
  font-size: clamp(1.7rem, 3.4vw, 2.6rem);
}

.section-subtitle {
  color: var(--text-muted);
  font-size: 1.05rem;
  max-width: 60ch;
}

/* ---------- Layout helpers ---------- */
.container {
  width: 100%;
  max-width: var(--maxw);
  margin-inline: auto;
  padding-inline: var(--gutter);
}

.section {
  padding-block: clamp(48px, 7vw, 96px);
}

.section-head {
  text-align: center;
  margin-inline: auto;
  margin-bottom: clamp(28px, 4vw, 48px);
  display: grid;
  gap: 10px;
  place-items: center;
}

.grid {
  display: grid;
  gap: clamp(16px, 2vw, 24px);
}

/* ---------- Buttons ---------- */
.btn {
  --btn-bg: var(--primary);
  --btn-fg: #fff;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 13px 24px;
  border-radius: var(--radius-pill);
  font-weight: 700;
  font-size: 0.98rem;
  background: var(--btn-bg);
  color: var(--btn-fg);
  transition: transform var(--transition), box-shadow var(--transition),
    background var(--transition), filter var(--transition);
  box-shadow: var(--shadow-sm);
  white-space: nowrap;
  line-height: 1.1;
}
.btn:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-green);
}
.btn:active {
  transform: translateY(0);
}

.btn--lg {
  padding: 16px 30px;
  font-size: 1.05rem;
}
.btn--block {
  width: 100%;
}

.btn--secondary {
  --btn-bg: var(--white);
  --btn-fg: var(--forest-800);
  border: 1.5px solid var(--green-500);
}
.btn--secondary:hover {
  --btn-bg: var(--green-50);
  box-shadow: var(--shadow);
}

.btn--ghost {
  --btn-bg: transparent;
  --btn-fg: var(--forest-800);
  box-shadow: none;
}
.btn--ghost:hover {
  --btn-bg: var(--green-50);
  box-shadow: none;
  transform: none;
}

.btn--whatsapp {
  --btn-bg: var(--whatsapp);
  --btn-fg: #04231a;
}
.btn--whatsapp:hover {
  --btn-bg: #1fbf5b;
  box-shadow: 0 14px 30px rgba(37, 211, 102, 0.35);
}

.btn--amber {
  --btn-bg: var(--amber);
  --btn-fg: #3a2500;
}

.btn[disabled],
.btn[aria-disabled="true"] {
  opacity: 0.5;
  cursor: not-allowed;
  pointer-events: none;
}

/* ---------- Badges ---------- */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 0.74rem;
  font-weight: 700;
  padding: 4px 10px;
  border-radius: var(--radius-pill);
  background: var(--green-50);
  color: var(--green-700);
  letter-spacing: 0.02em;
}
.badge--discount {
  background: var(--amber);
  color: #3a2500;
}
.badge--out {
  background: var(--gray-200);
  color: var(--gray-600);
}
.badge--low {
  background: #fef3c7;
  color: var(--amber-dark);
}

/* ---------- Cards ---------- */
.card {
  background: var(--surface);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  overflow: hidden;
}

/* ---------- Forms ---------- */
.field {
  display: grid;
  gap: 6px;
  margin-bottom: 16px;
}
.field label {
  font-weight: 600;
  font-size: 0.92rem;
  color: var(--gray-700);
}
.field .req {
  color: var(--red);
}
.field .hint {
  font-size: 0.82rem;
  color: var(--text-muted);
}
.input,
.select,
.textarea {
  width: 100%;
  padding: 12px 14px;
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--white);
  transition: border-color var(--transition), box-shadow var(--transition);
}
.input:focus,
.select:focus,
.textarea:focus {
  outline: none;
  border-color: var(--green-500);
  box-shadow: 0 0 0 3px rgba(34, 197, 94, 0.18);
}
.textarea {
  min-height: 96px;
  resize: vertical;
}
.field--error .input,
.field--error .select,
.field--error .textarea {
  border-color: var(--red);
}
.field__error {
  color: var(--red);
  font-size: 0.82rem;
  min-height: 1em;
  font-weight: 600;
}

/* ---------- Quantity stepper ---------- */
.qty {
  display: inline-flex;
  align-items: center;
  border: 1.5px solid var(--border);
  border-radius: var(--radius-pill);
  overflow: hidden;
  background: var(--white);
}
.qty button {
  width: 38px;
  height: 38px;
  display: grid;
  place-items: center;
  font-size: 1.2rem;
  font-weight: 700;
  color: var(--forest-800);
  transition: background var(--transition);
}
.qty button:hover:not([disabled]) {
  background: var(--green-50);
}
.qty button[disabled] {
  color: var(--gray-300);
  cursor: not-allowed;
}
.qty input {
  width: 44px;
  text-align: center;
  border: none;
  background: transparent;
  font-weight: 700;
  -moz-appearance: textfield;
  appearance: textfield;
}
.qty input::-webkit-outer-spin-button,
.qty input::-webkit-inner-spin-button {
  -webkit-appearance: none;
  margin: 0;
}

/* ---------- Toast ---------- */
.toast-stack {
  position: fixed;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 1600;
  display: grid;
  gap: 10px;
  width: min(92vw, 420px);
  pointer-events: none;
}
.toast {
  background: var(--forest-800);
  color: #fff;
  padding: 13px 18px;
  border-radius: var(--radius);
  box-shadow: var(--shadow-lg);
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 10px;
  animation: toast-in 220ms ease, toast-out 300ms ease 2.6s forwards;
}
@keyframes toast-in {
  from {
    opacity: 0;
    transform: translateY(14px);
  }
}
@keyframes toast-out {
  to {
    opacity: 0;
    transform: translateY(14px);
  }
}

/* ---------- Utilities ---------- */
.flex {
  display: flex;
}
.center {
  display: flex;
  align-items: center;
  justify-content: center;
}
.between {
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.gap-sm { gap: 8px; }
.gap { gap: 16px; }
.text-muted { color: var(--text-muted); }
.text-center { text-align: center; }
.mt { margin-top: 16px; }
.mb { margin-bottom: 16px; }
.hidden { display: none !important; }

.price {
  font-weight: 800;
  color: var(--forest-800);
  font-variant-numeric: tabular-nums;
}
.price--old {
  color: var(--gray-400);
  text-decoration: line-through;
  font-weight: 600;
  font-size: 0.9em;
}

/* Reduced motion */
@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.001ms !important;
    scroll-behavior: auto !important;
  }
}
