/* =========================================================
   Franklin's Consultations Casino Games — styles
   Pure CSS visuals: gradients, shadows, borders, typography.
   ========================================================= */

/* ---------- Design tokens ---------- */
:root {
  /* Background palette */
  --bg-blue: #0a1a3f;
  --bg-indigo: #16204a;
  --bg-green: #1d6b43;

  /* Card palette */
  --card-bg: #050607;
  --card-border: rgba(140, 170, 185, 0.28);
  --card-border-glow: rgba(120, 220, 255, 0.35);

  /* Accents */
  --lime: #9bff3b;
  --lime-strong: #7ff01f;
  --text-light: #f4f8ff;
  --text-muted: #c7d2e0;

  /* Card sizing — fixed height, width derived from each artwork's ratio */
  --card-h: 22.5rem;        /* all cards share this height */
  --card-ratio: 2 / 3;      /* default artwork ratio (0.667) */
  --card-radius: 1.4rem;
  --card-gap: 1.25rem;

  /* Motion */
  --ease: cubic-bezier(0.22, 1, 0.36, 1);
  --t-fast: 180ms;
  --t-med: 420ms;
  --t-slow: 900ms;

  /* 3D fan rotations */
  --rot-outer: 24deg;
  --rot-inner: 8deg;
}

/* ---------- Reset / base ---------- */
*,
*::before,
*::after {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  padding: 0;
}

body {
  min-height: 100vh;
  overflow-x: hidden; /* never allow horizontal overflow */
  font-family: "Inter", system-ui, -apple-system, Segoe UI, Roboto, sans-serif;
  color: var(--text-light);
  background:
    linear-gradient(135deg, var(--bg-blue) 0%, var(--bg-indigo) 48%, var(--bg-green) 100%);
  background-attachment: fixed;
  display: flex;
  flex-direction: column;
}

/* Ambient radial lighting over the diagonal gradient */
.bg-glow {
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  background:
    radial-gradient(60rem 40rem at 50% 40%, rgba(60, 200, 150, 0.18), transparent 60%),
    radial-gradient(40rem 32rem at 12% 8%, rgba(40, 90, 200, 0.22), transparent 60%),
    radial-gradient(44rem 36rem at 90% 90%, rgba(50, 190, 110, 0.18), transparent 60%);
}

/* ---------- Accessibility helpers ---------- */
.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

/* ---------- Header ---------- */
.site-header {
  position: relative;
  z-index: 2;
  text-align: center;
  padding: 2.25rem 1.25rem 0.5rem;
}

.brand {
  margin: 0 auto;
  font-family: "Barlow Condensed", "Inter", sans-serif;
  font-weight: 800;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  font-size: clamp(1.4rem, 1rem + 2.4vw, 2.75rem);
  line-height: 1.05;
  color: var(--text-light);
  text-shadow: 0 2px 18px rgba(0, 0, 0, 0.45);
  max-width: 60rem;
}

.brand-divider {
  display: block;
  width: min(22rem, 60%);
  height: 2px;
  margin: 1rem auto 0;
  border-radius: 2px;
  background: linear-gradient(
    90deg,
    transparent,
    rgba(155, 255, 59, 0.75),
    rgba(120, 220, 255, 0.55),
    transparent
  );
}

/* ---------- Main / showcase ---------- */
.site-main {
  position: relative;
  z-index: 1;
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1.5rem 1.25rem 3rem;
}

.showcase {
  position: relative;
  width: 100%;
  max-width: 75rem;
  display: flex;
  align-items: center;
  justify-content: center;
}

/* Soft blurred glow behind the whole card group */
.glow-behind {
  position: absolute;
  z-index: 0;
  inset: 10% 6%;
  border-radius: 50%;
  background: radial-gradient(
    ellipse at center,
    rgba(90, 230, 170, 0.28),
    rgba(70, 140, 230, 0.14) 45%,
    transparent 70%
  );
  filter: blur(42px);
  pointer-events: none;
}

/* The fanned card row with 3D perspective */
.card-row {
  position: relative;
  z-index: 1;
  list-style: none;
  margin: 0;
  padding: 1rem 0;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: var(--card-gap);
  perspective: 1600px;
  perspective-origin: 50% 50%;
  width: 100%;
}

/* ---------- Game card ---------- */
.card {
  position: relative;
  flex: 0 0 auto;
  height: var(--card-h);
  aspect-ratio: var(--card-ratio); /* width derived so artwork fills exactly */
  border-radius: var(--card-radius);
  background: var(--card-bg);
  border: 1px solid var(--card-border);
  overflow: hidden;
  transform-style: preserve-3d;
  box-shadow:
    0 22px 45px rgba(0, 0, 0, 0.5),
    0 0 0 1px rgba(255, 255, 255, 0.02) inset,
    0 0 26px rgba(120, 220, 255, 0.08);

  /* Entrance start state */
  opacity: 0;
  transform: translateY(26px) scale(0.96);
  transition:
    transform var(--t-med) var(--ease),
    box-shadow var(--t-med) var(--ease),
    border-color var(--t-med) var(--ease),
    opacity var(--t-slow) var(--ease);
}

/* Per-card fan transforms (applied once visible) */
.card.is-visible {
  opacity: 1;
}

.card.is-visible.card--1 {
  transform: rotateY(var(--rot-outer)) translateX(0.4rem);
}
.card.is-visible.card--2 {
  transform: rotateY(var(--rot-inner));
}
.card.is-visible.card--3 {
  transform: rotateY(calc(var(--rot-inner) * -1));
}
.card.is-visible.card--4 {
  transform: rotateY(calc(var(--rot-outer) * -1)) translateX(-0.4rem);
}

/* Pyramid Poker artwork is a touch wider — match its native ratio */
.card--3 {
  --card-ratio: 1086 / 1448;
}

/* Hover / focus: gently lift and reduce tilt */
.card.is-visible:hover,
.card.is-visible:focus-within {
  transform: rotateY(0deg) translateY(-14px) scale(1.04);
  z-index: 5;
  border-color: var(--card-border-glow);
  box-shadow:
    0 40px 70px rgba(0, 0, 0, 0.62),
    0 0 42px rgba(120, 220, 255, 0.28);
}

/* Media / artwork */
.card__media {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover; /* fills exactly since card matches artwork ratio */
  object-position: center;
  display: block;
}

/* Subtle vignette; darkens on hover so the centered button stands out */
.card__overlay {
  position: absolute;
  inset: 0;
  background: linear-gradient(
    to bottom,
    transparent 55%,
    rgba(3, 4, 6, 0.4) 85%,
    rgba(3, 4, 6, 0.7) 100%
  );
  pointer-events: none;
  transition: background var(--t-med) var(--ease);
}

.card:hover .card__overlay,
.card:focus-within .card__overlay {
  background: rgba(3, 4, 6, 0.45);
}

/* Button content — centered over the card, revealed on hover/focus */
.card__content {
  position: absolute;
  inset: 0;
  padding: 1.1rem;
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
}

/* Lime pill "PLAY NOW" button — hidden until card hover/focus */
.card__btn {
  display: inline-block;
  width: 100%;
  max-width: 11rem;
  padding: 0.8rem 1.25rem;
  border-radius: 999px;
  background: linear-gradient(180deg, var(--lime), var(--lime-strong));
  color: #09220a;
  font-weight: 700;
  font-size: 0.82rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  text-decoration: none;
  text-align: center;
  border: none;
  cursor: pointer;
  box-shadow:
    0 8px 20px rgba(123, 240, 31, 0.35),
    0 0 0 1px rgba(255, 255, 255, 0.15) inset;

  /* Hidden state */
  opacity: 0;
  visibility: hidden;
  transform: translateY(0.75rem) scale(0.96);
  transition:
    opacity var(--t-med) var(--ease),
    transform var(--t-med) var(--ease),
    visibility var(--t-med) var(--ease),
    box-shadow var(--t-fast) var(--ease),
    filter var(--t-fast) var(--ease);
}

/* Reveal centered button on hover / keyboard focus */
.card:hover .card__btn,
.card:focus-within .card__btn {
  opacity: 1;
  visibility: visible;
  transform: translateY(0) scale(1);
}

.card:hover .card__btn:hover,
.card:focus-within .card__btn:hover {
  filter: brightness(1.06);
  transform: translateY(-2px) scale(1.02);
  box-shadow: 0 12px 26px rgba(123, 240, 31, 0.5);
}

.card__btn:active {
  transform: translateY(0) scale(1);
}

/* Visible focus states for keyboard users */
.card__btn:focus-visible {
  outline: 3px solid #fff;
  outline-offset: 3px;
}

/* Toast shown when a game link is not configured */
.toast {
  position: fixed;
  left: 50%;
  bottom: 1.5rem;
  transform: translateX(-50%) translateY(120%);
  z-index: 50;
  padding: 0.75rem 1.25rem;
  border-radius: 999px;
  background: rgba(10, 16, 26, 0.95);
  border: 1px solid var(--card-border-glow);
  color: var(--text-light);
  font-size: 0.9rem;
  box-shadow: 0 12px 30px rgba(0, 0, 0, 0.5);
  opacity: 0;
  transition: transform var(--t-med) var(--ease), opacity var(--t-med) var(--ease);
}
.toast.is-shown {
  transform: translateX(-50%) translateY(0);
  opacity: 1;
}

/* =========================================================
   Responsive behaviour
   ========================================================= */

/* Tablet: reduce widths and rotations, keep the row */
@media (max-width: 1024px) {
  :root {
    --card-h: 18rem; /* width derives from each ratio */
    --card-gap: 0.75rem;
    --rot-outer: 16deg;
    --rot-inner: 6deg;
  }
}

/* Small tablet / large phone: drop perspective, 2-column grid */
@media (max-width: 760px) {
  .card-row {
    perspective: none;
    flex-wrap: wrap;
    gap: 1rem;
    max-width: 34rem;
  }

  /* Remove 3D fan: flat cards in a 2-column grid; height follows ratio */
  .card,
  .card.is-visible.card--1,
  .card.is-visible.card--2,
  .card.is-visible.card--3,
  .card.is-visible.card--4 {
    transform: none;
    height: auto;
    width: 100%;
    max-width: 15rem;
    flex: 0 1 calc(50% - 0.5rem);
  }

  .card.is-visible:hover,
  .card.is-visible:focus-within {
    transform: translateY(-10px) scale(1.03);
  }
}

/* Very narrow screens: single column */
@media (max-width: 440px) {
  .card-row {
    max-width: 20rem;
  }
  .card,
  .card.is-visible.card--1,
  .card.is-visible.card--2,
  .card.is-visible.card--3,
  .card.is-visible.card--4 {
    flex: 0 1 100%;
    max-width: 20rem;
  }
}

/* =========================================================
   Reduced motion
   ========================================================= */
@media (prefers-reduced-motion: reduce) {
  .card {
    transition: opacity 200ms linear, box-shadow 200ms linear,
      border-color 200ms linear;
  }
  .card,
  .card.is-visible.card--1,
  .card.is-visible.card--2,
  .card.is-visible.card--3,
  .card.is-visible.card--4 {
    /* Keep the fan layout but skip movement-based easing */
    transition: opacity 200ms linear;
  }
  .card.is-visible:hover,
  .card.is-visible:focus-within {
    transform: rotateY(0deg) scale(1.02);
  }
  .card__btn {
    transition: none;
  }
}
