/* Giftify — shared design tokens & primitives (landing + app) */

:root {
  --ink: #17123b;
  --ink-soft: #3d3663;
  --body: #5a567a;
  --muted: #8b87a6;
  --primary: #4f33e8;
  --primary-600: #4226d1;
  --primary-700: #3820b5;
  --primary-soft: #ece9fc;
  --primary-soft-2: #f5f3fe;
  --lavender: #efeafb;
  --lavender-2: #e4dcfa;
  --cream: #faf6f0;
  --bg: #ffffff;
  --border: #e9e6f4;
  --border-strong: #d9d4ee;
  --success: #17a673;
  --success-soft: #e2f6ee;
  --danger: #e5484d;
  --danger-soft: #fdecec;
  --wa: #25d366;
  --wa-dark: #128c7e;
  --shadow-xs: 0 1px 2px rgba(23, 18, 59, 0.05);
  --shadow-sm: 0 2px 8px rgba(23, 18, 59, 0.07);
  --shadow-md: 0 10px 30px rgba(23, 18, 59, 0.1);
  --shadow-lg: 0 24px 60px rgba(23, 18, 59, 0.16);
  --r-sm: 10px;
  --r-md: 14px;
  --r-lg: 20px;
  --r-xl: 28px;
  --font: "Nunito", "Segoe UI", system-ui, -apple-system, "Helvetica Neue", Arial, sans-serif;
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  margin: 0;
  font-family: var(--font);
  color: var(--ink);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  line-height: 1.5;
}

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

h1, h2, h3, h4 { line-height: 1.15; margin: 0; color: var(--ink); }

p { margin: 0; }

a { color: var(--primary); text-decoration: none; }
a:hover { text-decoration: underline; }

button {
  font-family: inherit;
  cursor: pointer;
  border: 0;
  background: none;
  color: inherit;
  font-size: inherit;
}

input, select, textarea {
  font-family: inherit;
  font-size: inherit;
  color: var(--ink);
}

:focus-visible {
  outline: 3px solid rgba(79, 51, 232, 0.45);
  outline-offset: 2px;
  border-radius: 6px;
}

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

/* ---------- buttons ---------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  font-weight: 800;
  font-size: 15px;
  line-height: 1;
  padding: 14px 22px;
  border-radius: 999px;
  transition: background-color 0.15s ease, transform 0.15s ease, box-shadow 0.15s ease, border-color 0.15s ease;
  white-space: nowrap;
  user-select: none;
}
.btn:active { transform: translateY(1px); }
.btn[disabled] { opacity: 0.55; cursor: not-allowed; transform: none; }

.btn-primary {
  background: var(--primary);
  color: #fff;
  box-shadow: 0 8px 20px rgba(79, 51, 232, 0.28);
}
.btn-primary:hover { background: var(--primary-600); text-decoration: none; }

.btn-ghost {
  background: transparent;
  color: var(--ink);
  font-weight: 700;
  padding: 10px 16px;
}
.btn-ghost:hover { color: var(--primary); text-decoration: none; }

.btn-outline {
  background: #fff;
  color: var(--ink);
  border: 1.5px solid var(--border-strong);
  font-weight: 700;
}
.btn-outline:hover { border-color: var(--primary); color: var(--primary); text-decoration: none; }

.btn-lg { padding: 17px 28px; font-size: 16px; }
.btn-sm { padding: 9px 16px; font-size: 14px; }

.btn .arrow { transition: transform 0.15s ease; }
.btn:hover .arrow { transform: translateX(3px); }

/* ---------- chips ---------- */
.chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 12px;
  border-radius: 999px;
  background: var(--primary-soft);
  color: var(--primary);
  font-size: 13px;
  font-weight: 700;
  line-height: 1.2;
  white-space: nowrap;
}
.chip button.chip-x {
  display: inline-flex;
  padding: 0 1px;
  margin: 0 -2px 0 2px;
  color: inherit;
  opacity: 0.65;
  font-size: 14px;
  line-height: 1;
}
.chip button.chip-x:hover { opacity: 1; }
.chip-muted { background: #f1eff8; color: var(--ink-soft); }
.chip-success { background: var(--success-soft); color: var(--success); }
.chip-danger { background: var(--danger-soft); color: var(--danger); }

/* ---------- forms ---------- */
.field { display: flex; flex-direction: column; gap: 6px; }
.field label { font-size: 13.5px; font-weight: 800; color: var(--ink-soft); }
.input {
  width: 100%;
  padding: 13px 16px;
  border: 1.5px solid var(--border-strong);
  border-radius: var(--r-sm);
  background: #fff;
  font-size: 15px;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}
.input::placeholder { color: #a5a1bf; }
.input:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 4px rgba(79, 51, 232, 0.12);
}
.input[aria-invalid="true"] { border-color: var(--danger); }
.field-error { color: var(--danger); font-size: 13px; font-weight: 700; min-height: 1em; }

/* ---------- modal ---------- */
.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(16, 10, 46, 0.55);
  backdrop-filter: blur(3px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  z-index: 90;
  animation: fadeIn 0.18s ease;
}
.modal {
  background: #fff;
  border-radius: var(--r-lg);
  box-shadow: var(--shadow-lg);
  width: min(460px, 100%);
  max-height: min(86vh, 720px);
  overflow: auto;
  padding: 26px;
  animation: popIn 0.2s ease;
  position: relative;
}
.modal h3 { font-size: 20px; font-weight: 900; margin-bottom: 4px; }
.modal .modal-sub { color: var(--body); font-size: 14px; margin-bottom: 18px; }
.modal-close {
  position: absolute;
  top: 14px;
  right: 14px;
  width: 34px;
  height: 34px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  color: var(--muted);
  font-size: 18px;
}
.modal-close:hover { background: var(--primary-soft-2); color: var(--ink); }

@keyframes fadeIn { from { opacity: 0; } }
@keyframes popIn { from { opacity: 0; transform: scale(0.96) translateY(8px); } }

/* ---------- toast ---------- */
.toast-region {
  position: fixed;
  bottom: 22px;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  flex-direction: column;
  gap: 10px;
  z-index: 120;
  align-items: center;
  pointer-events: none;
}
.toast {
  pointer-events: auto;
  display: flex;
  align-items: center;
  gap: 10px;
  background: var(--ink);
  color: #fff;
  font-size: 14px;
  font-weight: 700;
  padding: 12px 18px;
  border-radius: 999px;
  box-shadow: var(--shadow-md);
  animation: toastIn 0.25s ease;
  max-width: min(92vw, 480px);
}
.toast.success { background: #0e5c40; }
.toast.error { background: #8e2226; }
.toast.leaving { opacity: 0; transform: translateY(8px); transition: opacity 0.25s ease, transform 0.25s ease; }

@keyframes toastIn { from { opacity: 0; transform: translateY(10px); } }

/* ---------- a11y helpers ---------- */
.visually-hidden {
  position: absolute !important;
  width: 1px; height: 1px;
  margin: -1px; padding: 0;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap; border: 0;
}
.skip-link {
  position: absolute;
  left: 16px;
  top: -48px;
  z-index: 200;
  background: var(--ink);
  color: #fff;
  padding: 10px 16px;
  border-radius: 10px;
  font-weight: 800;
  transition: top 0.15s ease;
}
.skip-link:focus { top: 12px; text-decoration: none; }

/* scrollbars for carousels */
.scroll-row {
  display: flex;
  gap: 16px;
  overflow-x: auto;
  scroll-snap-type: x mandatory;
  scrollbar-width: none;
  padding-bottom: 6px;
}
.scroll-row::-webkit-scrollbar { display: none; }
.scroll-row > * { scroll-snap-align: start; flex-shrink: 0; }
