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

/* ---------- Design tokens ---------- */
:root {
  /* Brand palette — leafy green on off-white and soft cream */
  --forest-900: #1d3a28;
  --forest-800: #24472f;  /* Deep leaf — headings */
  --green-700: #2f6b3f;   /* Primary leafy green */
  --green-600: #3b7d4c;
  --green-500: #5a9a68;   /* Focus / accents */
  --green-400: #8fc29b;
  --green-100: #e3eee0;
  --green-50: #f1f6ee;

  --cream: #faf8f2;       /* Off-white page background */
  --cream-200: #f3efe4;   /* Soft cream panels */
  --sand: #e8e2d3;
  --white: #ffffff;
  --charcoal: #1e2721;

  /* Neutral grays (slightly warm) */
  --gray-700: #3a433d;
  --gray-600: #4d5750;
  --gray-500: #677169;    /* Secondary text */
  --gray-400: #98a199;
  --gray-300: #cfd4cc;
  --gray-200: #e6e8e1;
  --gray-100: #f1f2ed;
  --gray-50: #f8f8f4;

  /* Accents */
  --amber: #d9a441;
  --amber-dark: #8a5a12;
  --red: #b42318;
  --whatsapp: #25d366;
  --whatsapp-dark: #128c7e;

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

  /* Typography */
  --font-body: ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue",
    Arial, "Noto Sans", sans-serif;
  --font-display: var(--font-body);

  /* Radii & shadows */
  --radius-sm: 10px;
  --radius: 14px;
  --radius-lg: 20px;
  --radius-pill: 999px;

  --shadow-sm: 0 1px 2px rgba(29, 58, 40, 0.05);
  --shadow: 0 2px 10px rgba(29, 58, 40, 0.06);
  --shadow-lg: 0 10px 30px rgba(29, 58, 40, 0.1);
  --shadow-green: 0 6px 18px rgba(47, 107, 63, 0.18);

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

  --transition: 160ms 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(.product-card__media):not(.cart-item__media):not(.icon-btn) > svg,
button:not(.icon-btn) > svg,
span:not(.logo__mark):not(.stat-card__icon):not(.thumb):not([class*="__icon"]):not([class*="__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: 2.5px solid var(--green-700);
  outline-offset: 2px;
  border-radius: 6px;
}

.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.2;
  color: var(--forest-800);
  font-weight: 700;
  letter-spacing: -0.02em;
}

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

.section-title {
  font-size: clamp(1.3rem, 2.2vw, 1.65rem);
}

.section-subtitle {
  color: var(--text-muted);
  font-size: 0.98rem;
  max-width: 60ch;
  margin-top: 4px;
}

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

.section {
  padding-block: clamp(40px, 6vw, 72px);
}
.section--tight {
  padding-block: clamp(24px, 3.5vw, 40px);
}
.section--flush {
  padding-block: 8px clamp(40px, 6vw, 72px);
}

.section-head {
  text-align: center;
  margin-inline: auto;
  margin-bottom: clamp(20px, 3vw, 32px);
  display: grid;
  gap: 8px;
  place-items: center;
}
.section-head--row {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 16px;
  text-align: left;
  margin-bottom: 20px;
}
.link-more {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-weight: 600;
  font-size: 0.92rem;
  color: var(--green-700);
  white-space: nowrap;
}
.link-more:hover {
  text-decoration: underline;
  text-underline-offset: 3px;
}
.link-more svg {
  width: 16px;
  height: 16px;
}
.link-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: var(--green-700);
  font-weight: 600;
  font-size: 0.92rem;
  padding: 4px 0;
}
.link-btn:hover {
  text-decoration: underline;
  text-underline-offset: 3px;
}

.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: 8px;
  padding: 11px 20px;
  border-radius: var(--radius-pill);
  font-weight: 600;
  font-size: 0.95rem;
  border: 1.5px solid transparent;
  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 {
  --btn-bg: var(--forest-800);
  box-shadow: var(--shadow-green);
}
.btn:active {
  transform: translateY(0);
}

.btn--lg {
  padding: 13px 24px;
  font-size: 1rem;
}
.btn--sm {
  padding: 8px 14px;
  font-size: 0.86rem;
  gap: 6px;
}
.btn--dark {
  --btn-bg: var(--charcoal);
  --btn-fg: #fff;
}
.btn--dark:hover {
  --btn-bg: #000;
  box-shadow: var(--shadow-lg);
}
.btn--block {
  width: 100%;
}

.btn--secondary {
  --btn-bg: var(--white);
  --btn-fg: var(--forest-800);
  border-color: var(--gray-300);
}
.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 6px 18px rgba(37, 211, 102, 0.3);
}

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

.btn[disabled],
.btn[aria-disabled="true"] {
  opacity: 0.6;
  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,
.fine-print .req {
  color: var(--red);
}
.field .opt {
  color: var(--text-muted);
  font-weight: 400;
  font-size: 0.85em;
}
.field .hint {
  font-size: 0.82rem;
  color: var(--text-muted);
}
.input,
.select,
.textarea {
  width: 100%;
  padding: 11px 14px;
  border: 1.5px solid var(--gray-300);
  border-radius: var(--radius-sm);
  background: var(--white);
  min-height: 46px;
  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;
}
.select--sm {
  width: auto;
  min-height: 40px;
  padding: 8px 34px 8px 12px;
  font-size: 0.9rem;
}
.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; }

/* Admin dashboard only — prices are never rendered on public pages. */
.price {
  font-weight: 700;
  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;
}

.spin {
  animation: spin 0.8s linear infinite;
}
@keyframes spin {
  to { transform: rotate(360deg); }
}

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