/*
 * WinThat shared front-end styles.
 * Brand tokens, card component, skeletons, badges, save button, toast.
 * Loaded on every public page.
 */

:root {
  /* Palette (aligns with app + mockup direction) */
  --wt-bg:         #F7F7FB;
  --wt-surface:    #FFFFFF;
  --wt-text:       #0B1739;              /* navy */
  --wt-text-soft:  #4A5378;
  --wt-muted:      #6B7280;
  --wt-line:       rgba(11, 23, 57, 0.09);
  --wt-line-strong:rgba(11, 23, 57, 0.16);

  --wt-brand:       #4A3AFF;             /* royal blue */
  --wt-brand-dark:  #2E22C4;
  --wt-brand-soft:  #EEEBFF;

  --wt-accent-purple:#7C3AED;            /* purple secondary */
  --wt-verify:      #14B8A6;             /* teal — verified accent */
  --wt-verify-soft: #CCFBF1;
  --wt-closing:     #F97316;             /* orange — ending-soon */
  --wt-closing-soft:#FFEDD5;
  --wt-warn:        #F59E0B;
  --wt-error:       #EF4444;
  --wt-success:     #059669;

  --wt-radius:      14px;
  --wt-radius-lg:   20px;
  --wt-shadow-sm:   0 1px 2px rgba(11, 23, 57, 0.04), 0 1px 3px rgba(11, 23, 57, 0.05);
  --wt-shadow-md:   0 4px 12px rgba(11, 23, 57, 0.06), 0 10px 24px rgba(74, 58, 255, 0.06);
}

/* ── Card ─────────────────────────────────────────────────────────────── */
.wt-card {
  display: flex; flex-direction: column;
  background: var(--wt-surface);
  border: 1px solid var(--wt-line);
  border-radius: var(--wt-radius-lg);
  overflow: hidden;
  transition: transform .12s ease, border-color .12s ease, box-shadow .12s ease;
  position: relative;
}
.wt-card:hover, .wt-card:focus-within {
  transform: translateY(-2px);
  border-color: var(--wt-line-strong);
  box-shadow: var(--wt-shadow-md);
}
.wt-card--exclusive { border-color: rgba(74, 58, 255, 0.28); }

.wt-card-cover {
  position: relative;
  display: block;
  aspect-ratio: 16 / 10;      /* reserve dimensions to prevent layout shift */
  background: #EFEEFB;
  color: inherit; text-decoration: none;
  overflow: hidden;
}
.wt-card-image {
  position: absolute; inset: 0;
  width: 100%; height: 100%;
  object-fit: cover;
  background-color: #EFEEFB;
}
.wt-card-image--errored {
  background: linear-gradient(135deg, #EFEEFB, #E5DBFB);
  display: flex; align-items: center; justify-content: center;
}
.wt-card-image--errored::before {
  content: '🎁'; font-size: 2.4rem;
}
.wt-card-image--placeholder {
  display: flex; align-items: center; justify-content: center;
  font-size: 2.4rem; color: var(--wt-brand);
  background: linear-gradient(135deg, #EFEEFB, #E5DBFB);
}

/* Verified/exclusive/featured pills (top-left of image) */
.wt-card-pills {
  position: absolute; top: 12px; left: 12px;
  display: flex; flex-wrap: wrap; gap: 6px; max-width: calc(100% - 60px);
  pointer-events: none;
  z-index: 2;
}
.wt-pill {
  display: inline-flex; align-items: center; gap: 4px;
  padding: 4px 10px; border-radius: 999px;
  font-size: 11px; font-weight: 700; letter-spacing: 0.02em;
  background: #FFFFFF; color: var(--wt-text);
  box-shadow: 0 1px 2px rgba(11, 23, 57, 0.08);
}
.wt-pill-verified { color: var(--wt-verify); background: #FFFFFF; }
.wt-pill-verified svg { color: var(--wt-verify); }
.wt-pill-exclusive { background: var(--wt-brand); color: #fff; }
.wt-pill-featured  { background: var(--wt-accent-purple); color: #fff; }

/* Bookmark icon (top-right of image) */
.wt-card-bookmark {
  position: absolute; top: 10px; right: 10px;
  width: 34px; height: 34px; border-radius: 10px;
  background: #FFFFFF;
  border: 1px solid var(--wt-line);
  display: flex; align-items: center; justify-content: center;
  cursor: pointer; padding: 0;
  transition: border-color .15s, background .15s;
  z-index: 3;
}
.wt-card-bookmark:hover { border-color: var(--wt-brand); }
.wt-card-bookmark.is-saved { background: var(--wt-brand-soft); border-color: var(--wt-brand); }
.wt-card-bookmark:focus-visible {
  outline: 2px solid var(--wt-brand);
  outline-offset: 2px;
}

/* Card body */
.wt-card-body {
  padding: 14px 16px 14px;
  display: flex; flex-direction: column; gap: 6px;
  flex: 1;
}
.wt-card-title {
  margin: 0; font-size: 15px; font-weight: 800; line-height: 1.3;
  color: var(--wt-text);
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical;
  overflow: hidden;
}
.wt-card-title a { color: inherit; text-decoration: none; }
.wt-card-title a:hover, .wt-card-title a:focus-visible { text-decoration: underline; }

.wt-card-sponsor {
  color: var(--wt-text-soft); font-size: 13px;
}
.wt-card-sponsor strong { color: var(--wt-text); font-weight: 700; }

.wt-card-elig {
  display: inline-flex; align-items: center; gap: 6px;
  color: var(--wt-text-soft); font-size: 12.5px;
}
.wt-card-elig svg { color: var(--wt-text-soft); flex: 0 0 14px; }

.wt-card-closes {
  color: var(--wt-closing); font-size: 12.5px; font-weight: 700;
  margin-top: 2px;
}

/* Bottom action buttons */
.wt-card-actions {
  display: flex; gap: 8px; margin-top: 10px;
}
.wt-btn-save, .wt-btn-entered {
  flex: 1;
  display: inline-flex; align-items: center; justify-content: center;
  gap: 6px;
  padding: 8px 10px; border-radius: 10px;
  font-size: 12.5px; font-weight: 700;
  border: 1px solid var(--wt-line);
  background: #FFFFFF; color: var(--wt-text-soft);
  cursor: pointer;
  transition: all .12s ease;
}
.wt-btn-save:hover, .wt-btn-entered:hover {
  border-color: var(--wt-brand); color: var(--wt-brand);
}
.wt-btn-save.is-active {
  background: var(--wt-brand-soft); color: var(--wt-brand);
  border-color: var(--wt-brand);
}
.wt-btn-entered.is-active {
  background: var(--wt-brand); color: #fff;
  border-color: var(--wt-brand);
}
.wt-btn-entered.is-active svg { color: #fff; }
.wt-btn-save:focus-visible, .wt-btn-entered:focus-visible {
  outline: 2px solid var(--wt-brand);
  outline-offset: 2px;
}

/* ── Save button ──────────────────────────────────────────────────────── */
.wt-save-btn {
  flex: 0 0 32px;
  width: 32px; height: 32px; border-radius: 999px;
  border: 1px solid var(--wt-line);
  background: var(--wt-surface); color: var(--wt-text-soft);
  font-size: 18px; line-height: 1;
  cursor: pointer;
  transition: color .15s, background .15s, border-color .15s, transform .1s;
  display: inline-flex; align-items: center; justify-content: center;
}
.wt-save-btn:hover { color: var(--wt-brand); border-color: var(--wt-brand); }
.wt-save-btn:focus-visible {
  outline: 2px solid var(--wt-brand);
  outline-offset: 2px;
}
.wt-save-btn:active { transform: scale(0.94); }
.wt-save-btn.is-saved {
  background: var(--wt-brand-soft); color: var(--wt-brand);
  border-color: var(--wt-brand);
}

/* ── Skeleton ─────────────────────────────────────────────────────────── */
.wt-skel-card {
  border-radius: var(--wt-radius-lg);
  border: 1px solid var(--wt-line);
  background: var(--wt-surface);
  overflow: hidden;
}
.wt-skel-image {
  aspect-ratio: 16 / 10;
  background: linear-gradient(90deg, #EFEEFB 0%, #E5E1F5 40%, #EFEEFB 80%);
  background-size: 200% 100%;
  animation: wt-shimmer 1.4s infinite linear;
}
.wt-skel-body {
  padding: 14px 16px 18px;
  display: flex; flex-direction: column; gap: 10px;
}
.wt-skel-line {
  height: 12px; border-radius: 6px;
  background: linear-gradient(90deg, #EDEDF3 0%, #DFDFEA 40%, #EDEDF3 80%);
  background-size: 200% 100%;
  animation: wt-shimmer 1.4s infinite linear;
}
.wt-skel-title { height: 16px; width: 80%; }
.wt-skel-mid   { width: 60%; }
.wt-skel-short { width: 45%; }
@keyframes wt-shimmer {
  from { background-position: 200% 0; }
  to   { background-position: -200% 0; }
}
@media (prefers-reduced-motion: reduce) {
  .wt-skel-image, .wt-skel-line { animation: none; }
}

/* ── Empty / error states ─────────────────────────────────────────────── */
.wt-empty {
  text-align: center;
  padding: 60px 20px;
  color: var(--wt-muted);
  border: 1px dashed var(--wt-line-strong);
  border-radius: var(--wt-radius-lg);
  background: var(--wt-surface);
}
.wt-empty h3 { color: var(--wt-text); margin-bottom: 6px; }
.wt-empty p  { margin: 0 0 14px; font-size: 14px; }
.wt-empty .wt-btn { margin-top: 6px; }

/* ── Buttons ──────────────────────────────────────────────────────────── */
.wt-btn {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 10px 18px; border-radius: 12px;
  font-size: 14px; font-weight: 700; font-family: inherit;
  cursor: pointer; border: 1px solid transparent;
  transition: background .15s, border-color .15s, color .15s;
  text-decoration: none;
}
.wt-btn-primary  { background: var(--wt-brand); color: #fff; }
.wt-btn-primary:hover { background: var(--wt-brand-dark); }
.wt-btn-ghost    { background: transparent; color: var(--wt-brand); border-color: var(--wt-line); }
.wt-btn-ghost:hover { border-color: var(--wt-brand); }

/* ── Focus visibility across brand components ─────────────────────────── */
.wt-card a:focus-visible,
.wt-btn:focus-visible,
.wt-save-btn:focus-visible {
  outline: 2px solid var(--wt-brand);
  outline-offset: 2px;
}

/* ── Announcement bar (above sticky nav) ───────────────────────────────── */
.wt-announce-bar {
  position: relative;
  z-index: 90;
  background: linear-gradient(90deg, #EEEBFF 0%, #CCFBF1 100%);
  color: var(--wt-text);
  border-bottom: 1px solid rgba(11, 23, 57, 0.06);
  font-size: 0.86rem;
  padding: 8px 0;
}
.wt-announce-bar[hidden] { display: none; }
.wt-announce-inner {
  display: flex; align-items: center; gap: 12px;
  padding-left: 24px; padding-right: 44px;
  flex-wrap: wrap;
}
.wt-announce-pill {
  display: inline-flex; align-items: center;
  padding: 2px 8px; border-radius: 999px;
  background: var(--wt-brand); color: #fff;
  font-size: 0.68rem; font-weight: 800; letter-spacing: 0.06em;
}
.wt-announce-text { flex: 1 1 auto; color: var(--wt-text); font-weight: 500; }
.wt-announce-cta {
  color: var(--wt-brand); font-weight: 800; text-decoration: none;
  white-space: nowrap;
}
.wt-announce-cta:hover { text-decoration: underline; }
.wt-announce-dismiss {
  position: absolute; right: 12px; top: 50%; transform: translateY(-50%);
  background: transparent; border: none; color: var(--wt-text-soft);
  font-size: 1.2rem; padding: 4px 8px; cursor: pointer;
  border-radius: 6px;
}
.wt-announce-dismiss:hover { background: rgba(11, 23, 57, 0.06); color: var(--wt-text); }
@media (max-width: 720px) {
  .wt-announce-bar { font-size: 0.78rem; padding: 6px 0; }
  .wt-announce-inner { gap: 8px; padding-right: 40px; }
  .wt-announce-text { flex: 1 1 100%; order: 3; margin-top: 2px; }
  .wt-announce-cta  { order: 2; }
}

/* "New" pill for nav */
.wt-new-pill {
  display: inline-block;
  margin-left: 4px;
  padding: 1px 6px; border-radius: 999px;
  background: #CCFBF1; color: #0F766E;
  font-size: 0.62rem; font-weight: 800; letter-spacing: 0.04em;
  vertical-align: 1px;
}

/* ── Logo mark (used in header) ───────────────────────────────────────── */
.wt-logo {
  display: inline-flex; align-items: center; gap: 8px;
  font-family: 'Plus Jakarta Sans', 'Inter', sans-serif;
  font-weight: 800; font-size: 1.3rem;
  color: var(--wt-brand);
  letter-spacing: -0.02em;
  text-decoration: none;
}
.wt-logo img, .wt-logo svg { height: 28px; width: auto; }

/* ── Toast (small announce) ───────────────────────────────────────────── */
.wt-toast {
  position: fixed; bottom: 30px; left: 50%;
  transform: translateX(-50%) translateY(80px);
  background: var(--wt-text); color: #fff;
  padding: 10px 18px; border-radius: 999px;
  font-size: 14px; font-weight: 700;
  opacity: 0; transition: opacity .2s ease, transform .25s ease;
  pointer-events: none;
  z-index: 2000;
}
.wt-toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }
