/* ==========================================================================
   HP Gift Redemption — shared design system
   Brand: HP blue #0096D6 and white, navy ink, cool greys. Typeface: HP's
   Forma DJR when available (see fonts note below), else Inter (self-hosted).
   ========================================================================== */

@font-face {
  font-family: 'InterVariable';
  font-style: normal;
  font-display: swap;
  font-weight: 100 900;
  src: url('/vendor/inter/inter-latin-wght-normal.woff2') format('woff2-variations');
}
/* To use HP's brand typeface (Forma DJR), drop the woff2 files into public/fonts/ and uncomment:
@font-face { font-family: 'Forma DJR'; font-weight: 400; font-display: swap; src: url('/fonts/FormaDJRMicro-Regular.woff2') format('woff2'); }
@font-face { font-family: 'Forma DJR'; font-weight: 500; font-display: swap; src: url('/fonts/FormaDJRMicro-Medium.woff2') format('woff2'); }
@font-face { font-family: 'Forma DJR'; font-weight: 700; font-display: swap; src: url('/fonts/FormaDJRMicro-Bold.woff2') format('woff2'); }
*/

:root {
  /* HP blue. --brand is the logo blue; buttons use --brand-600 so white text
     stays readable (WCAG AA). Change these five to match an official guide. */
  --brand: #0096d6;
  --brand-600: #0078b8;
  --brand-700: #00639a;
  --brand-50: #eaf6fc;
  --brand-100: #c9e8f8;
  --navy: #0a2240;

  --ink: #121a24;
  --ink-2: #374352;
  --muted: #637184;
  --faint: #97a3b2;
  --line: #e2e8ef;
  --line-2: #eef2f6;
  --bg: #f4f7fa;
  --surface: #ffffff;

  --red: #e5484d;
  --red-ink: #b42a2f;
  --red-50: #fff1f1;
  --red-100: #ffdcdc;
  --amber: #f5a524;
  --amber-ink: #8a5300;
  --amber-50: #fff7e6;

  --radius: 16px;
  --radius-sm: 10px;
  --radius-xs: 7px;
  --shadow-1: 0 1px 2px rgba(16, 24, 32, 0.06), 0 1px 1px rgba(16, 24, 32, 0.03);
  --shadow-2: 0 10px 30px -10px rgba(16, 24, 32, 0.16), 0 2px 6px rgba(16, 24, 32, 0.05);
  --shadow-3: 0 24px 60px -18px rgba(16, 24, 32, 0.32);
  --ease: cubic-bezier(0.2, 0.7, 0.2, 1);
  --ease-spring: cubic-bezier(0.34, 1.4, 0.64, 1);
  --font: 'Forma DJR', 'HP Simplified', 'InterVariable', 'Inter', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
  --mono: ui-monospace, 'SF Mono', 'Cascadia Mono', Consolas, monospace;
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }
body {
  margin: 0;
  font-family: var(--font);
  font-size: 15px;
  line-height: 1.5;
  color: var(--ink);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  font-feature-settings: 'cv11', 'ss01';
}
[hidden] { display: none !important; }
h1, h2, h3, p { margin: 0; }
button, input, select { font: inherit; color: inherit; }
a { color: var(--brand-700); }
svg { display: block; }
.num { font-variant-numeric: tabular-nums; }

/* ---- Brand mark: official HP logo (public/img/hp-logo.svg, white variant on dark UIs) */
.brand { display: inline-flex; align-items: center; gap: 12px; text-decoration: none; color: inherit; }
.brand-mark {
  --size: 36px;
  display: inline-block;
  width: var(--size);
  height: var(--size);
  background: url('/img/hp-logo.svg') center / contain no-repeat;
  flex: none;
}
.brand-mark.is-white { background-image: url('/img/hp-logo-white.svg'); }
.brand-word { font-weight: 600; font-size: 15px; letter-spacing: 0.01em; white-space: nowrap; }

/* ---- Buttons ------------------------------------------------------------ */
.btn {
  --btn-bg: var(--surface);
  --btn-fg: var(--ink);
  --btn-bd: var(--line);
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 40px;
  padding: 0 16px;
  border: 1px solid var(--btn-bd);
  border-radius: 999px;
  background: var(--btn-bg);
  color: var(--btn-fg);
  font-weight: 600;
  font-size: 14px;
  line-height: 1;
  text-decoration: none;
  white-space: nowrap;
  cursor: pointer;
  user-select: none;
  -webkit-tap-highlight-color: transparent;
  transition: background-color 0.18s var(--ease), border-color 0.18s var(--ease), color 0.18s var(--ease),
    transform 0.12s var(--ease), box-shadow 0.18s var(--ease), opacity 0.18s;
}
.btn:hover { --btn-bd: #cfd6db; }
.btn:active { transform: scale(0.97); }
.btn:focus-visible { outline: none; box-shadow: 0 0 0 3px var(--brand-100); }
.btn[disabled] { opacity: 0.5; pointer-events: none; }
.btn-primary { --btn-bg: var(--brand-600); --btn-fg: #fff; --btn-bd: var(--brand-600); }
.btn-primary:hover { --btn-bg: var(--brand-700); --btn-bd: var(--brand-700); }
.btn-dark { --btn-bg: var(--ink); --btn-fg: #fff; --btn-bd: var(--ink); }
.btn-dark:hover { --btn-bg: #000; --btn-bd: #000; }
.btn-danger { --btn-bg: var(--red); --btn-fg: #fff; --btn-bd: var(--red); }
.btn-danger:hover { --btn-bg: var(--red-ink); --btn-bd: var(--red-ink); }
.btn-ghost { --btn-bg: transparent; --btn-bd: transparent; }
.btn-ghost:hover { --btn-bg: var(--line-2); --btn-bd: transparent; }
.btn-sm { min-height: 30px; padding: 0 12px; font-size: 13px; }
.btn-lg { min-height: 54px; padding: 0 26px; font-size: 16px; }
.btn-block { width: 100%; }
.btn .spinner { width: 18px; height: 18px; border-width: 2px; border-color: rgba(255, 255, 255, 0.35); border-top-color: #fff; }
.btn.is-loading > :not(.spinner) { opacity: 0; }
.btn.is-loading .spinner { position: absolute; }

/* ---- Form fields -------------------------------------------------------- */
.field { display: block; margin-bottom: 16px; }
.field-label { display: block; font-size: 13px; font-weight: 600; color: var(--ink-2); margin-bottom: 6px; }
.input {
  width: 100%;
  height: 52px;
  padding: 0 16px;
  border: 1.5px solid var(--line);
  border-radius: 12px;
  background: var(--surface);
  font-size: 16px; /* >=16px: no iOS zoom on focus */
  transition: border-color 0.18s var(--ease), box-shadow 0.18s var(--ease);
  -webkit-appearance: none;
  appearance: none;
}
.input::placeholder { color: var(--faint); }
.input:hover { border-color: #cfd6db; }
.input:focus { outline: none; border-color: var(--brand); box-shadow: 0 0 0 4px var(--brand-50); }
.input.is-invalid { border-color: var(--red); box-shadow: 0 0 0 4px var(--red-50); }
.input-sm { height: 36px; border-radius: 9px; font-size: 14px; padding: 0 12px; border-width: 1px; }
.field-error { display: block; min-height: 0; font-size: 13px; color: var(--red-ink); margin-top: 6px; }
.field-error:empty { display: none; }

/* ---- Pills / badges ----------------------------------------------------- */
.pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 24px;
  padding: 0 10px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 600;
  white-space: nowrap;
  background: var(--line-2);
  color: var(--ink-2);
}
.pill::before { content: ''; width: 6px; height: 6px; border-radius: 50%; background: currentColor; opacity: 0.85; }
.pill.no-dot::before { display: none; }
.pill-ok { background: var(--brand-50); color: var(--brand-700); }
.pill-red { background: var(--red-50); color: var(--red-ink); }
.pill-amber { background: var(--amber-50); color: var(--amber-ink); }
.pill-solid { background: var(--brand-600); color: #fff; }

/* ---- Card --------------------------------------------------------------- */
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow-1); }

/* ---- Spinner ------------------------------------------------------------ */
.spinner {
  width: 28px;
  height: 28px;
  border: 3px solid var(--line);
  border-top-color: var(--brand);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ---- Motion primitives -------------------------------------------------- */
@keyframes fade-up { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: none; } }
@keyframes fade-in { from { opacity: 0; } to { opacity: 1; } }
@keyframes pop-in { 0% { opacity: 0; transform: scale(0.85); } 100% { opacity: 1; transform: none; } }
@keyframes draw { to { stroke-dashoffset: 0; } }
.anim-in > * { animation: fade-up 0.5s var(--ease) both; }
.anim-in > *:nth-child(2) { animation-delay: 0.05s; }
.anim-in > *:nth-child(3) { animation-delay: 0.1s; }
.anim-in > *:nth-child(4) { animation-delay: 0.15s; }
.anim-in > *:nth-child(5) { animation-delay: 0.2s; }
.anim-in > *:nth-child(n + 6) { animation-delay: 0.25s; }

/* ---- Toasts ------------------------------------------------------------- */
.toasts {
  position: fixed;
  z-index: 100;
  left: 50%;
  bottom: max(20px, env(safe-area-inset-bottom));
  transform: translateX(-50%);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  pointer-events: none;
  width: min(92vw, 440px);
}
.toast {
  pointer-events: auto;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 16px;
  border-radius: 12px;
  background: var(--ink);
  color: #fff;
  font-size: 14px;
  font-weight: 500;
  box-shadow: var(--shadow-3);
  animation: fade-up 0.28s var(--ease) both;
}
.toast.is-error { background: var(--red-ink); }
.toast.is-ok::before { content: ''; width: 8px; height: 8px; border-radius: 50%; background: var(--brand); flex: none; }
.toast.is-leaving { animation: fade-in 0.2s reverse both; }

/* ---- Modal dialog ------------------------------------------------------- */
.modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 90;
  display: grid;
  place-items: center;
  padding: 20px;
  background: rgba(20, 24, 28, 0.42);
  backdrop-filter: blur(3px);
  -webkit-backdrop-filter: blur(3px);
  animation: fade-in 0.18s var(--ease) both;
}
.modal {
  width: min(100%, 420px);
  padding: 24px;
  border-radius: 18px;
  background: var(--surface);
  box-shadow: var(--shadow-3);
  animation: pop-in 0.24s var(--ease-spring) both;
}
.modal h3 { font-size: 18px; font-weight: 700; letter-spacing: -0.01em; }
.modal p { margin-top: 8px; color: var(--ink-2); }
.modal .input { margin-top: 14px; height: 44px; font-size: 15px; }
.modal-actions { display: flex; justify-content: flex-end; gap: 10px; margin-top: 22px; }

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