/* =========================================================
   FEASTLY — base.css
   Design tokens, reset, dark mode, utilities
   ========================================================= */

/* ---------- 1. DESIGN TOKENS (Light) ---------- */
:root {
  /* Brand */
  --brand: #e85d26;
  --brand-600: #d44d19;
  --brand-700: #b83e10;
  --brand-soft: #fae6db;

  /* Warm Premium Light Mode Neutrals (Soft Linen / Ivory / Sandstone) */
  --bg: #f4efe6;
  --bg-2: #ebe3d5;
  --bg-3: #e0d6c5;
  --surface: #fbf9f4;
  --border: #dfd5c5;
  --border-strong: #cbbba4;

  /* Text */
  --text: #1c1714;
  --text-2: #574c43;
  --text-3: #877a6e;
  --text-inv: #fbf9f4;

  /* Status */
  --success: #1b9e68;
  --warning: #d98a16;
  --danger:  #dc3e42;
  --info:    #3478e6;

  /* Radii */
  --r-xs: 6px;
  --r-sm: 10px;
  --r-md: 14px;
  --r-lg: 20px;
  --r-xl: 28px;
  --r-full: 999px;

  /* Shadows (warm, layered) */
  --sh-1: 0 1px 3px rgba(28,23,20,.05), 0 1px 2px rgba(28,23,20,.04);
  --sh-2: 0 6px 16px rgba(28,23,20,.07), 0 2px 6px rgba(28,23,20,.04);
  --sh-3: 0 16px 34px rgba(28,23,20,.11), 0 4px 12px rgba(28,23,20,.06);
  --sh-brand: 0 8px 22px rgba(232,93,38,.26);

  /* Spacing scale (4px base) */
  --s-1: 4px;
  --s-2: 8px;
  --s-3: 12px;
  --s-4: 16px;
  --s-5: 20px;
  --s-6: 24px;
  --s-7: 32px;
  --s-8: 40px;
  --s-9: 56px;
  --s-10: 72px;

  /* Typography */
  --font: -apple-system, BlinkMacSystemFont, "Inter", "Segoe UI", Roboto,
          Helvetica, Arial, sans-serif;
  --fs-xs: 12px;
  --fs-sm: 13px;
  --fs-md: 15px;
  --fs-lg: 17px;
  --fs-xl: 20px;
  --fs-2xl: 24px;
  --fs-3xl: 30px;
  --fs-4xl: 40px;
  --fs-5xl: 52px;

  /* Layout */
  --container: 1200px;
  --nav-h: 64px;
  --bottom-nav-h: 68px;
  
  /* Motion */
  --ease: cubic-bezier(.22,.61,.36,1);
  --dur-1: .15s;
  --dur-2: .25s;
  --dur-3: .4s;

  /* Z-index scale */
  --z-nav: 100;
  --z-dropdown: 200;
  --z-modal: 300;
  --z-toast: 400;
}

/* ---------- 2. DARK MODE ---------- */
[data-theme="dark"] {
  --bg: #0b0b0e;
  --bg-2: #121216;
  --bg-3: #1a1a20;
  --surface: #16161b;
  --border: #26262e;
  --border-strong: #33333d;

  --text: #f5f5f7;
  --text-2: #b9b9c2;
  --text-3: #7a7a86;
  --text-inv: #0f0f12;

  --brand-soft: #2a1810;

  --sh-1: 0 1px 2px rgba(0,0,0,.4), 0 1px 3px rgba(0,0,0,.3);
  --sh-2: 0 4px 10px rgba(0,0,0,.5), 0 2px 4px rgba(0,0,0,.3);
  --sh-3: 0 12px 28px rgba(0,0,0,.6), 0 4px 10px rgba(0,0,0,.4);
}

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

html {
  -webkit-text-size-adjust: 100%;
  -webkit-tap-highlight-color: transparent;
  scroll-behavior: smooth;
}

body {
  font-family: var(--font);
  font-size: var(--fs-md);
  line-height: 1.5;
  color: var(--text);
  background: var(--bg);
  min-height: 100dvh;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  transition: background var(--dur-2) var(--ease),
              color var(--dur-2) var(--ease);
  overflow-x: hidden;
}

img, picture, svg, video { display: block; max-width: 100%; height: auto; }
button, input, select, textarea { font: inherit; color: inherit; }
button { background: none; border: 0; cursor: pointer; }
a { color: inherit; text-decoration: none; }
ul, ol { list-style: none; }

input, textarea {
  border: 0;
  outline: none;
  background: transparent;
}
input::placeholder, textarea::placeholder { color: var(--text-3); }

[hidden] { display: none !important; }

/* Focus ring (accessible + on-brand) */
:focus-visible {
  
  outline-offset: 2px;
  border-radius: var(--r-xs);
}

/* ---------- 4. TYPOGRAPHY ---------- */
h1, h2, h3, h4 { font-weight: 700; letter-spacing: -0.02em; line-height: 1.2; }
h1 { font-size: clamp(28px, 5vw, var(--fs-4xl)); }
h2 { font-size: clamp(22px, 3.5vw, var(--fs-3xl)); }
h3 { font-size: var(--fs-xl); }
h4 { font-size: var(--fs-lg); }

.section-title {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: var(--s-4);
  margin-bottom: var(--s-5);
}
.section-title h2 { font-size: var(--fs-2xl); }
.section-title a {
  font-size: var(--fs-sm);
  font-weight: 600;
  color: var(--brand);
  white-space: nowrap;
}
.section-title a:hover { color: var(--brand-700); }

/* ---------- 5. LAYOUT UTILITIES ---------- */
.container {
  width: 100%;
  max-width: var(--container);
  margin-inline: auto;
  padding-inline: var(--s-5);
  box-sizing: border-box;
}
@media (max-width: 480px) {
  .container { padding-inline: var(--s-3); }
}

.page {
  padding-top: var(--nav-h);
  padding-bottom: calc(var(--bottom-nav-h) + var(--s-8) + env(safe-area-inset-bottom));
  min-height: 100dvh;
  width: 100%;
  max-width: 100vw;
  overflow-x: hidden;
}
@media (min-width: 900px) {
  .page { padding-bottom: var(--s-8); }
}

.row     { display: flex; align-items: center; min-width: 0; }
.stack   { display: flex; flex-direction: column; min-width: 0; max-width: 100%; }
.between { display: flex; align-items: center; justify-content: space-between; gap: var(--s-3); min-width: 0; }
.center  { display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center; min-width: 0; }
.wrap    { flex-wrap: wrap; }
.gap-1 { gap: var(--s-1); }
.gap-2 { gap: var(--s-2); }
.gap-3 { gap: var(--s-3); }
.gap-4 { gap: var(--s-4); }
.gap-5 { gap: var(--s-5); }
.gap-6 { gap: var(--s-6); }

/* ---------- 6. TEXT UTILITIES ---------- */
.text-2 { color: var(--text-2); }
.text-3 { color: var(--text-3); }
.text-brand { color: var(--brand); }
.fw-500 { font-weight: 500; }
.fw-600 { font-weight: 600; }
.fw-700 { font-weight: 700; }
.fw-800 { font-weight: 800; }
.fs-xs  { font-size: var(--fs-xs); }
.fs-sm  { font-size: var(--fs-sm); }
.fs-md  { font-size: var(--fs-md); }
.fs-lg  { font-size: var(--fs-lg); }
.fs-xl  { font-size: var(--fs-xl); }
.fs-2xl { font-size: var(--fs-2xl); }

.clamp-1 {
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.clamp-2 {
  display: -webkit-box;
  line-clamp: 2;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

/* ---------- 7. DIVIDER ---------- */
.divider {
  height: 1px;
  background: var(--border);
  border: 0;
  margin: var(--s-4) 0;
}

/* ---------- 8. SCROLLBAR (desktop, subtle) ---------- */
@media (min-width: 900px) {
  ::-webkit-scrollbar { width: 10px; height: 10px; }
  ::-webkit-scrollbar-track { background: transparent; }
  ::-webkit-scrollbar-thumb {
    background: var(--border-strong);
    border-radius: var(--r-full);
    border: 2px solid var(--bg);
  }
  ::-webkit-scrollbar-thumb:hover { background: var(--text-3); }
}

/* ---------- 9. HORIZONTAL SCROLL ROWS (hide bar) ---------- */
.hscroll {
  display: flex;
  gap: var(--s-3);
  width: 100%;
  max-width: 100%;
  min-width: 0;
  overflow-x: auto;
  scroll-snap-type: x mandatory;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
  padding-bottom: var(--s-2);
}
.hscroll::-webkit-scrollbar { display: none; }
.hscroll > * { scroll-snap-align: start; flex: 0 0 auto; }

/* ---------- 10. ANIMATIONS ---------- */
@keyframes fadeIn {
  from { opacity: 0; transform: translateY(6px); }
  to   { opacity: 1; transform: translateY(0); }
}

@keyframes shimmer {
  0%   { background-position: -400px 0; }
  100% { background-position: 400px 0; }
}

/* ---------- 11. REDUCED MOTION ---------- */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: .01ms !important;
    transition-duration: .01ms !important;
    scroll-behavior: auto !important;
  }
}

/* ---------- 12. SELECTION ---------- */
::selection { background: var(--brand); color: #fff; }