/* ============================================================
   tokens.css
   Spacing, radii, shadow, motion, layout — non-color/type.
   ============================================================ */

:root {
  /* ---- Spacing (8px base) ---- */
  --space-0:  0;
  --space-1:  4px;
  --space-2:  8px;
  --space-3:  12px;
  --space-4:  16px;
  --space-5:  24px;
  --space-6:  32px;
  --space-7:  40px;
  --space-8:  48px;
  --space-9:  64px;
  --space-10: 80px;
  --space-11: 96px;
  --space-12: 128px;
  --space-13: 160px;
  --space-14: 192px;

  /* ---- Radii ---- */
  --radius-sm:   6px;   /* inputs, small chips */
  --radius-md:   12px;  /* cards, buttons */
  --radius-lg:   20px;  /* hero photos, modals */
  --radius-xl:   28px;  /* big editorial frames */
  --radius-pill: 999px;

  /* ---- Border widths ---- */
  --border-thin:   1px;
  --border-medium: 1.5px;
  --border-thick:  2px;

  /* ---- Shadows (warm-tinted) ---- */
  --shadow-1: 0 1px 2px rgba(31,27,22,0.06), 0 1px 1px rgba(31,27,22,0.04);
  --shadow-2: 0 4px 12px rgba(31,27,22,0.08), 0 2px 4px rgba(31,27,22,0.04);
  --shadow-3: 0 12px 32px rgba(31,27,22,0.12), 0 4px 8px rgba(31,27,22,0.06);
  --shadow-4: 0 24px 64px rgba(31,27,22,0.16), 0 8px 16px rgba(31,27,22,0.08);

  /* ---- Motion ---- */
  --ease:           cubic-bezier(0.2, 0.7, 0.2, 1);
  --ease-out:       cubic-bezier(0.16, 1, 0.3, 1);
  --duration-micro:  120ms;
  --duration-fast:   180ms;
  --duration-base:   240ms;
  --duration-slow:   360ms;

  /* ---- Layout ---- */
  --container:        1200px;
  --container-text:   720px;
  --container-wide:   1320px;
  --gutter:           24px;
  --header-h:         72px;

  /* ---- Z-index ---- */
  --z-sticky:  20;
  --z-header:  40;
  --z-overlay: 80;
  --z-modal:   90;
  --z-toast:   100;
}

@media (max-width: 720px) {
  :root {
    --gutter: 16px;
    --header-h: 60px;
  }
}

/* ---- Reset-ish ---- */
*, *::before, *::after { box-sizing: border-box; }
img, svg, video { display: block; max-width: 100%; height: auto; }
button { font: inherit; color: inherit; cursor: pointer; }

/* ---- Container utilities ---- */
.container {
  width: 100%;
  max-width: var(--container);
  margin-inline: auto;
  padding-inline: var(--gutter);
}
.container-wide { max-width: var(--container-wide); }
.container-text { max-width: var(--container-text); }

/* ---- Section spacing ---- */
.section       { padding-block: var(--space-11); }
.section-tight { padding-block: var(--space-8); }
.section-loose { padding-block: var(--space-12); }
.section-tint  { background: var(--paper-tint); }
.section-deep  { background: var(--paper-deep); }

@media (max-width: 720px) {
  .section       { padding-block: var(--space-8); }
  .section-tight { padding-block: var(--space-6); }
  .section-loose { padding-block: var(--space-9); }
}

/* ---- Stacks & rows (gap-based, never margin-based) ---- */
.stack { display: flex; flex-direction: column; gap: var(--space-4); }
.stack-2 { gap: var(--space-2); }
.stack-3 { gap: var(--space-3); }
.stack-5 { gap: var(--space-5); }
.stack-6 { gap: var(--space-6); }
.stack-8 { gap: var(--space-8); }

.row { display: flex; flex-direction: row; gap: var(--space-4); align-items: center; }
.row-3 { gap: var(--space-3); }
.row-5 { gap: var(--space-5); }
.row-6 { gap: var(--space-6); }
.row-wrap { flex-wrap: wrap; }

.grid {
  display: grid;
  grid-template-columns: repeat(12, 1fr);
  gap: var(--space-5);
}
@media (max-width: 960px) { .grid { grid-template-columns: repeat(6, 1fr); } }
@media (max-width: 600px) { .grid { grid-template-columns: repeat(4, 1fr); } }

/* ============================================================
   COMPONENT PRIMITIVES (used by UI kits)
   ============================================================ */

/* ---- Button ---- */
.btn {
  --btn-bg: var(--accent);
  --btn-fg: var(--accent-ink);
  --btn-bg-hover: var(--accent-strong);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-2);
  padding: 14px 22px;
  border-radius: var(--radius-md);
  border: none;
  background: var(--btn-bg);
  color: var(--btn-fg);
  font-family: var(--font-body);
  font-size: 1rem;
  font-weight: 600;
  letter-spacing: 0.005em;
  line-height: 1;
  text-decoration: none;
  box-shadow: var(--shadow-1);
  transition:
    transform var(--duration-fast) var(--ease),
    box-shadow var(--duration-fast) var(--ease),
    background var(--duration-fast) var(--ease),
    color var(--duration-fast) var(--ease);
}
.btn:hover { background: var(--btn-bg-hover); transform: translateY(-2px); box-shadow: var(--shadow-2); }
.btn:active { transform: translateY(0); box-shadow: var(--shadow-1); transition-duration: var(--duration-micro); }

.btn-secondary {
  --btn-bg: var(--paper);
  --btn-fg: var(--ink);
  --btn-bg-hover: var(--paper-tint);
  box-shadow: inset 0 0 0 1px var(--ink-24);
}
.btn-secondary:hover { box-shadow: inset 0 0 0 1px var(--ink-40), var(--shadow-1); }

.btn-ghost {
  --btn-bg: transparent;
  --btn-fg: var(--ink);
  --btn-bg-hover: var(--ink-06);
  box-shadow: none;
}
.btn-ghost:hover { box-shadow: none; }

.btn-lg { padding: 18px 28px; font-size: 1.0625rem; }
.btn-sm { padding: 10px 16px; font-size: 0.9375rem; }

/* ---- Card ---- */
.card {
  background: var(--paper);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-1);
  padding: var(--space-5);
  transition:
    transform var(--duration-fast) var(--ease),
    box-shadow var(--duration-fast) var(--ease);
}
.card:hover { transform: translateY(-2px); box-shadow: var(--shadow-2); }
.card-flat { box-shadow: none; border: 1px solid var(--ink-12); }
.card-flat:hover { box-shadow: var(--shadow-1); border-color: var(--ink-24); }

/* ---- Input ---- */
.input, .textarea, .select {
  width: 100%;
  padding: 12px 14px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--ink-24);
  background: var(--paper);
  color: var(--ink);
  font: inherit;
  transition: border-color var(--duration-fast) var(--ease), box-shadow var(--duration-fast) var(--ease);
}
.input:focus, .textarea:focus, .select:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
}
.textarea { min-height: 110px; resize: vertical; }
.label {
  display: block;
  font-size: 0.875rem;
  font-weight: 600;
  margin-bottom: var(--space-2);
  color: var(--ink);
}
.help { font-size: 0.8125rem; color: var(--ink-56); margin-top: 6px; }

/* ---- Badge / pill ---- */
.badge {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  padding: 4px 10px;
  border-radius: var(--radius-pill);
  background: var(--ink-06);
  color: var(--ink);
  font-size: 0.8125rem;
  font-weight: 500;
  line-height: 1.4;
}
.badge-accent { background: var(--accent-soft); color: var(--accent-strong); }
.badge-success { background: var(--success-soft); color: var(--success); }
.badge-warning { background: var(--warning-soft); color: var(--warning); }
.badge-danger  { background: var(--danger-soft);  color: var(--danger); }

/* ---- Divider ---- */
.hr {
  height: 1px;
  background: var(--ink-12);
  border: 0;
  margin: 0;
}

/* ---- Eyebrow rule ---- */
.eyebrow-rule {
  display: inline-flex;
  align-items: center;
  gap: var(--space-3);
  font-family: var(--font-body);
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--accent);
}
.eyebrow-rule::before {
  content: '';
  width: 28px;
  height: 1px;
  background: var(--accent);
}

/* ---- Star rating ---- */
.stars {
  display: inline-flex;
  align-items: center;
  gap: 2px;
  color: var(--star);
  font-size: 1rem;
  letter-spacing: 0.05em;
}

/* ---- Image protection gradient ---- */
.protect-gradient {
  position: absolute;
  inset: 0;
  background: linear-gradient(180deg, rgba(31,27,22,0) 0%, rgba(31,27,22,0.55) 100%);
  pointer-events: none;
}

/* ---- Sticky-header backdrop ---- */
.header-backdrop {
  background: color-mix(in srgb, var(--paper) 80%, transparent);
  backdrop-filter: blur(8px) saturate(180%);
  -webkit-backdrop-filter: blur(8px) saturate(180%);
  border-bottom: 1px solid var(--ink-12);
}

/* ---- Scroll-fade utility ---- */
.fade-in {
  opacity: 0;
  transform: translateY(8px);
  transition: opacity var(--duration-base) var(--ease), transform var(--duration-base) var(--ease);
}
.fade-in.is-visible { opacity: 1; transform: translateY(0); }
