/* RWK Systems — home page */
:root {
  --bg: #300D50;
  --bg-2: #2B0C47;
  --bg-3: #1f0834;
  --surface: #ffffff;
  --surface-soft: #f7f4fb;
  --ink: #0c0183;
  --ink-soft: #4a3f7a;
  --text-on-dark: #ffffff;
  --text-muted: #c9b9e0;
  --accent: #EC5046;
  --accent-2: #E702BF;
  --teal: #2DE4C1;
  --gradient: linear-gradient(90deg, var(--accent) 0%, var(--accent-2) 100%);
  --gradient-rev: linear-gradient(90deg, var(--accent-2) 0%, var(--accent) 100%);
  --shadow-soft: 0 12px 30px rgba(0, 0, 0, 0.25);
  --shadow-lift: 0 24px 60px rgba(0, 0, 0, 0.45);
  --radius: 22px;
  --radius-sm: 14px;
  --header-font: "Poppins", system-ui, -apple-system, sans-serif;
  --body-font: "Rubik", system-ui, -apple-system, sans-serif;
  --container: 1180px;
  --gutter: clamp(16px, 3vw, 28px);
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--text-on-dark);
  font-family: var(--body-font);
  font-size: 16px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  scroll-behavior: smooth;
}

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

a { color: inherit; text-decoration: none; }

.app {
  position: relative;
  min-height: 100dvh;
  padding: clamp(40px, 6vw, 80px) var(--gutter) 0;
  overflow-x: clip;
}

/* Soft animated background */
.bg-glow {
  position: fixed;
  inset: -20vmax;
  z-index: -1;
  background:
    radial-gradient(40vmax 40vmax at 15% 10%, rgba(231, 2, 191, 0.18), transparent 60%),
    radial-gradient(45vmax 45vmax at 85% 90%, rgba(45, 228, 193, 0.12), transparent 65%),
    radial-gradient(35vmax 35vmax at 80% 20%, rgba(236, 80, 70, 0.14), transparent 60%);
  filter: blur(20px);
  animation: drift 28s ease-in-out infinite alternate;
}

@keyframes drift {
  0%   { transform: translate3d(-2%, -1%, 0) scale(1); }
  100% { transform: translate3d(3%, 2%, 0) scale(1.05); }
}

/* Site header — right-justified logo */
.site-header {
  max-width: var(--container);
  margin: 0 auto clamp(28px, 4vw, 48px);
  display: flex;
  justify-content: flex-end;
  align-items: center;
}

.brand {
  display: inline-flex;
  align-items: center;
  text-decoration: none;
  transition: opacity 0.2s ease;
  border-radius: 6px;
}

.brand:hover { opacity: 0.82; }
.brand:focus-visible {
  outline: none;
  box-shadow: 0 0 0 3px rgba(231, 2, 191, 0.45);
}

.brand__logo {
  display: block;
  height: clamp(34px, 4.4vw, 46px);
  width: auto;
}

.grid-root {
  max-width: var(--container);
  margin: 0 auto;
}

.loading {
  text-align: center;
  color: var(--text-muted);
  padding: 60px 0;
}

/* Sections */
.section {
  margin-bottom: clamp(40px, 6vw, 72px);
}

.section__heading {
  font-family: var(--header-font);
  font-size: clamp(20px, 2.4vw, 28px);
  font-weight: 600;
  letter-spacing: 0.02em;
  margin: 0 0 24px;
  display: flex;
  align-items: center;
  gap: 14px;
}

.section__heading::after {
  content: "";
  flex: 1;
  height: 1px;
  background: linear-gradient(90deg, rgba(231, 2, 191, 0.5), transparent);
}

/* Card grid */
.cards {
  display: grid;
  gap: clamp(16px, 2.2vw, 24px);
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
}

@media (min-width: 1100px) {
  .cards { grid-template-columns: repeat(4, 1fr); }
}

/* Card */
.card {
  position: relative;
  background: var(--surface);
  color: var(--ink);
  border-radius: var(--radius);
  padding: 36px 24px 28px;
  text-align: center;
  cursor: pointer;
  border: 0;
  font: inherit;
  width: 100%;
  box-shadow: var(--shadow-soft);
  /* Entry state — drops in from above when .is-visible is added */
  opacity: 0;
  transform: translateY(-44px);
  transition:
    opacity 0.55s ease-out,
    transform 0.75s cubic-bezier(0.2, 0.85, 0.3, 1.05),
    translate 0.35s cubic-bezier(0.2, 0.7, 0.2, 1),
    box-shadow 0.4s cubic-bezier(0.2, 0.7, 0.2, 1);
  transition-delay: var(--delay, 0ms), var(--delay, 0ms), 0s, 0s;
  overflow: hidden;
  isolation: isolate;
}

.card.is-visible {
  opacity: 1;
  transform: translateY(0);
}

/* Hover lift uses `translate` so it doesn't fight with the entry transform */
.card:hover,
.card:focus-visible {
  translate: 0 -6px;
  box-shadow: var(--shadow-lift);
  outline: none;
}

.card:focus-visible {
  box-shadow: var(--shadow-lift), 0 0 0 3px rgba(231, 2, 191, 0.55);
}

@media (prefers-reduced-motion: reduce) {
  .card,
  .bg-glow {
    animation: none !important;
    transition: none !important;
    opacity: 1 !important;
    transform: none !important;
  }
}

.card__media {
  height: 130px;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 18px;
  border-radius: var(--radius-sm);
  padding: 12px;
  /* Themed media tile — only paints when card has --media-bg set */
  background: var(--media-bg, transparent);
  transition: background 0.3s ease;
}

.card__media img {
  max-height: 100%;
  max-width: 80%;
  object-fit: contain;
  transition: transform 0.5s cubic-bezier(0.2, 0.7, 0.2, 1);
}

.card:hover .card__media img,
.card:focus-visible .card__media img {
  transform: scale(1.06);
}

.card__title {
  font-family: var(--header-font);
  font-size: 18px;
  font-weight: 700;
  margin: 0;
  color: var(--ink);
}

/* Platform pill — anchored to the card frame, not the content flow,
   so placement stays consistent regardless of image dimensions. */
.card__platform {
  position: absolute;
  top: 14px;
  right: 14px;
  font-family: var(--header-font);
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--ink);
  background: rgba(12, 1, 131, 0.08);
  padding: 4px 10px;
  border-radius: 999px;
  z-index: 1;
}

/* Footer */
.site-footer {
  max-width: var(--container);
  margin: 60px auto 0;
  padding: 36px 0 30px;
  text-align: center;
  font-size: 13px;
  color: var(--text-muted);
  border-top: 1px solid rgba(255, 255, 255, 0.06);
}

/* Modal */
.modal {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: var(--gutter);
}

.modal[hidden] { display: none; }

.modal__backdrop {
  position: absolute;
  inset: 0;
  background: rgba(11, 4, 27, 0.72);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  animation: fade-in 0.25s ease forwards;
}

.modal__panel {
  position: relative;
  background: var(--surface);
  color: var(--ink);
  border-radius: var(--radius);
  width: min(560px, 100%);
  max-height: calc(100dvh - 2 * var(--gutter));
  display: flex;
  flex-direction: column;
  overflow: hidden;
  box-shadow: 0 30px 80px rgba(0, 0, 0, 0.55);
  animation: pop-in 0.4s cubic-bezier(0.2, 0.7, 0.2, 1) forwards;
}

@keyframes fade-in { from { opacity: 0; } to { opacity: 1; } }
@keyframes pop-in {
  from { opacity: 0; transform: translateY(20px) scale(0.96); }
  to   { opacity: 1; transform: translateY(0) scale(1); }
}

.modal__close {
  position: absolute;
  top: 12px;
  right: 12px;
  width: 36px;
  height: 36px;
  border-radius: 999px;
  border: 0;
  /* Solid white pill so it stays visible over any media-tile background,
     including the dark themed one (Time Travel etc.) */
  background: #ffffff;
  color: var(--ink);
  font-size: 22px;
  line-height: 1;
  cursor: pointer;
  z-index: 2;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.18);
  transition: background 0.2s ease, transform 0.2s ease, box-shadow 0.2s ease;
}

.modal__close:hover {
  transform: scale(1.08);
  box-shadow: 0 6px 16px rgba(0, 0, 0, 0.25);
}

.modal__media {
  background: linear-gradient(135deg, #f7f4fb 0%, #ece6f5 100%);
  height: clamp(160px, 28vh, 220px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  transition: background 0.3s ease;
}

.modal__media img {
  max-height: 100%;
  max-width: 70%;
  object-fit: contain;
}

.modal__body {
  padding: 24px clamp(20px, 4vw, 32px) clamp(24px, 4vw, 32px);
  overflow-y: auto;
}

.modal__platform {
  display: inline-block;
  font-family: var(--header-font);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--ink);
  background: rgba(12, 1, 131, 0.08);
  padding: 4px 10px;
  border-radius: 999px;
  margin: 0 0 12px;
}

/* Make sure [hidden] wins over the explicit display above */
.modal__platform[hidden] { display: none; }

.modal__title {
  font-family: var(--header-font);
  font-size: clamp(22px, 4vw, 28px);
  font-weight: 700;
  margin: 0 0 12px;
  color: var(--ink);
}

.modal__description {
  font-size: 16px;
  line-height: 1.6;
  color: var(--ink-soft);
  margin: 0 0 22px;
}

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  font-family: var(--header-font);
  font-size: 15px;
  font-weight: 600;
  letter-spacing: 0.03em;
  text-transform: uppercase;
  padding: 14px 28px;
  border-radius: 999px;
  border: 0;
  cursor: pointer;
  transition: transform 0.25s ease, box-shadow 0.25s ease, background 0.4s ease;
  color: var(--text-on-dark);
  background: var(--gradient);
  box-shadow: 0 10px 24px rgba(231, 2, 191, 0.35);
}

.btn:hover, .btn:focus-visible {
  background: var(--gradient-rev);
  transform: translateY(-2px);
  box-shadow: 0 14px 30px rgba(231, 2, 191, 0.45);
  outline: none;
}

.btn--primary::after {
  content: "→";
  font-weight: 700;
}

/* Body lock when modal is open */
body.modal-open { overflow: hidden; }

/* Mobile-specific tweaks — keep modal as a floating card, not full-screen */
@media (max-width: 600px) {
  .card { padding: 28px 18px 24px; }
  .card__media { height: 110px; margin-bottom: 14px; }
  .card__title { font-size: 16px; }
}
