/* Playforge — hub styles */

:root {
  --bg: #0b0a09;
  --bg-2: #110f0d;
  --surface: #161311;
  --surface-2: #1e1a16;
  --line: rgba(255, 196, 140, 0.09);
  --line-strong: rgba(255, 196, 140, 0.18);
  --text: #f4eee7;
  --muted: #a89d91;
  --faint: #6f665d;
  --accent: #ff7a1a;
  --accent-2: #ff9a3c;
  --gold: #ffc247;
  --new: #3ef0b4;
  --radius: 18px;
  --radius-sm: 10px;
  --gutter: clamp(16px, 4vw, 40px);
  --max: 1320px;
  --ease: cubic-bezier(0.22, 1, 0.36, 1);
  --font: "Outfit", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}

*, *::before, *::after { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  background-color: var(--bg);
  background-image:
    radial-gradient(1200px 600px at 50% 115%, rgba(255, 110, 20, 0.16), transparent 70%),
    radial-gradient(900px 500px at 85% -10%, rgba(255, 194, 71, 0.06), transparent 70%);
  background-attachment: fixed;
  color: var(--text);
  font-family: var(--font);
  font-size: 16px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

img { display: block; max-width: 100%; }
button, input { font: inherit; color: inherit; }
a { color: inherit; }

:focus-visible {
  outline: 2px solid var(--gold);
  outline-offset: 3px;
}

.visually-hidden {
  position: absolute !important;
  width: 1px; height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
}

/* ---------- Background: embers + forge glow ---------- */

.embers {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: 0;
}

.forge-glow {
  position: fixed;
  left: 50%;
  bottom: -30vh;
  width: 120vw;
  height: 60vh;
  transform: translateX(-50%);
  background: radial-gradient(closest-side, rgba(255, 106, 0, 0.18), transparent);
  pointer-events: none;
  z-index: 0;
  animation: glow-breathe 7s ease-in-out infinite;
}

@keyframes glow-breathe {
  0%, 100% { opacity: 0.75; }
  50% { opacity: 1; }
}

.topbar, .page, .footer { position: relative; z-index: 1; }

/* ---------- Top bar ---------- */

.topbar {
  position: sticky;
  top: 0;
  z-index: 10;
  background: rgba(11, 10, 9, 0.78);
  -webkit-backdrop-filter: blur(14px) saturate(140%);
  backdrop-filter: blur(14px) saturate(140%);
  border-bottom: 1px solid var(--line);
}

.topbar-inner {
  max-width: var(--max);
  margin: 0 auto;
  padding: 14px var(--gutter);
  display: grid;
  grid-template-columns: auto minmax(180px, 360px) 1fr;
  align-items: center;
  gap: 14px 24px;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  text-decoration: none;
  border-radius: 12px;
}

.brand-mark { flex: none; overflow: visible; filter: drop-shadow(0 0 10px rgba(255, 122, 26, 0.35)); }

.brand-sparks line, .brand-sparks circle {
  transform-box: fill-box;
  transform-origin: center;
  animation: spark 2.4s ease-in-out infinite;
}
.brand-sparks > :nth-child(2) { animation-delay: 0.4s; }
.brand-sparks > :nth-child(3) { animation-delay: 0.9s; }
.brand-sparks > :nth-child(4) { animation-delay: 1.3s; }
.brand-sparks > :nth-child(5) { animation-delay: 1.8s; }

@keyframes spark {
  0%, 100% { opacity: 0.25; }
  50% { opacity: 1; }
}

.brand-name {
  font-size: 1.55rem;
  font-weight: 800;
  letter-spacing: -0.02em;
}
.brand-name span {
  background: linear-gradient(180deg, var(--gold), var(--accent));
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

.search {
  position: relative;
  display: flex;
  align-items: center;
  height: 44px;
  padding: 0 12px 0 14px;
  gap: 10px;
  background: var(--surface);
  border: 1px solid var(--line-strong);
  border-radius: 999px;
  color: var(--muted);
  transition: border-color 0.2s, box-shadow 0.2s;
}
.search:focus-within {
  border-color: rgba(255, 154, 60, 0.6);
  box-shadow: 0 0 0 4px rgba(255, 122, 26, 0.14);
}
.search input {
  flex: 1;
  min-width: 0;
  height: 100%;
  border: 0;
  background: none;
  outline: none;
  color: var(--text);
}
.search input::placeholder { color: var(--faint); }
.search input::-webkit-search-cancel-button { filter: grayscale(1) brightness(1.6); }
.search kbd {
  font: 600 0.75rem var(--font);
  padding: 2px 7px;
  border-radius: 6px;
  border: 1px solid var(--line-strong);
  color: var(--faint);
}

.filters {
  display: flex;
  gap: 8px;
  justify-content: flex-end;
  flex-wrap: wrap;
}

.chip {
  height: 36px;
  padding: 0 16px;
  border-radius: 999px;
  border: 1px solid var(--line-strong);
  background: transparent;
  color: var(--muted);
  font-weight: 600;
  font-size: 0.92rem;
  cursor: pointer;
  white-space: nowrap;
  transition: color 0.2s, background-color 0.2s, border-color 0.2s, box-shadow 0.2s;
}
.chip:hover { color: var(--text); border-color: rgba(255, 154, 60, 0.45); }
.chip[aria-pressed="true"] {
  color: #1a0d02;
  background: linear-gradient(180deg, var(--gold), var(--accent));
  border-color: transparent;
  box-shadow: 0 4px 18px rgba(255, 122, 26, 0.35);
}

/* ---------- Layout ---------- */

.page {
  flex: 1;
  width: 100%;
  max-width: var(--max);
  margin: 0 auto;
  padding: 28px var(--gutter) 64px;
}

/* ---------- Featured banner ---------- */

.featured {
  position: relative;
  min-height: clamp(320px, 42vw, 520px);
  border-radius: calc(var(--radius) + 6px);
  overflow: hidden;
  border: 1px solid var(--line-strong);
  background: var(--surface);
  isolation: isolate;
  box-shadow: 0 30px 80px -30px rgba(0, 0, 0, 0.8), 0 0 0 1px rgba(255, 194, 71, 0.04);
  animation: rise 0.8s var(--ease) both;
}
.featured:empty { display: none; }

.featured-cover {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: 70% 50%;
  z-index: -2;
  transform: scale(1.02);
  transition: transform 1.2s var(--ease);
}
.featured:hover .featured-cover { transform: scale(1.05); }

.featured::before {
  content: "";
  position: absolute;
  inset: 0;
  z-index: -1;
  background:
    linear-gradient(90deg, rgba(8, 7, 6, 0.96) 0%, rgba(8, 7, 6, 0.86) 36%, rgba(8, 7, 6, 0.25) 64%, transparent 82%),
    linear-gradient(0deg, rgba(8, 7, 6, 0.7), transparent 45%);
}

.featured-body {
  position: relative;
  max-width: min(540px, 56%);
  height: 100%;
  min-height: inherit;
  padding: clamp(24px, 4vw, 52px);
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  gap: 14px;
}

.eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--gold);
}
.eyebrow::before {
  content: "";
  width: 8px; height: 8px;
  border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 0 12px 2px rgba(255, 122, 26, 0.8);
}

.featured-title {
  margin: 0;
  font-size: clamp(2.4rem, 6vw, 4.4rem);
  line-height: 0.95;
  font-weight: 800;
  letter-spacing: -0.035em;
}

.featured-desc {
  margin: 0;
  color: #d6ccc1;
  font-size: clamp(1rem, 1.6vw, 1.15rem);
  max-width: 44ch;
}

.featured-actions {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 14px 18px;
  margin-top: 8px;
}

/* ---------- Buttons ---------- */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  border: 0;
  border-radius: 999px;
  font-weight: 700;
  text-decoration: none;
  cursor: pointer;
  transition: transform 0.2s var(--ease), box-shadow 0.25s, filter 0.2s;
}

.btn-play {
  height: 58px;
  padding: 0 34px 0 28px;
  font-size: 1.15rem;
  color: #1a0d02;
  background: linear-gradient(180deg, #ffd36b 0%, var(--accent-2) 55%, var(--accent) 100%);
  box-shadow: 0 10px 30px -6px rgba(255, 122, 26, 0.6), inset 0 1px 0 rgba(255, 255, 255, 0.45);
}
.btn-play:hover { transform: translateY(-2px); box-shadow: 0 16px 40px -6px rgba(255, 122, 26, 0.75), inset 0 1px 0 rgba(255, 255, 255, 0.45); filter: brightness(1.05); }
.btn-play:active { transform: translateY(0); }
.btn-play svg { width: 18px; height: 18px; }

.btn-ghost {
  height: 42px;
  padding: 0 20px;
  background: transparent;
  color: var(--text);
  border: 1px solid var(--line-strong);
}
.btn-ghost:hover { border-color: rgba(255, 154, 60, 0.5); }

/* ---------- Badges ---------- */

.badges { display: flex; flex-wrap: wrap; gap: 6px; }

.badge {
  display: inline-flex;
  align-items: center;
  height: 24px;
  padding: 0 10px;
  border-radius: 999px;
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--muted);
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--line-strong);
}
.badge-category { color: var(--text); background: rgba(255, 255, 255, 0.07); border-color: transparent; }
.badge-multiplayer { color: var(--gold); border-color: rgba(255, 194, 71, 0.4); background: rgba(255, 194, 71, 0.08); }
.badge-new {
  color: #04140e;
  background: var(--new);
  border-color: transparent;
  box-shadow: 0 0 14px rgba(62, 240, 180, 0.45);
}

/* ---------- Library / grid ---------- */

.library { margin-top: clamp(36px, 5vw, 56px); }

.library-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 18px;
}
.library-head h2 {
  margin: 0;
  font-size: 1.5rem;
  font-weight: 700;
  letter-spacing: -0.02em;
}
.library-count { margin: 0; color: var(--faint); font-size: 0.92rem; }

.grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 22px;
}
@media (min-width: 640px)  { .grid { grid-template-columns: repeat(2, 1fr); } }
@media (min-width: 1000px) { .grid { grid-template-columns: repeat(3, 1fr); } }
@media (min-width: 1360px) { .grid { grid-template-columns: repeat(4, 1fr); } }

.card {
  position: relative;
  display: flex;
  flex-direction: column;
  border-radius: var(--radius);
  background: linear-gradient(180deg, var(--surface-2), var(--surface));
  border: 1px solid var(--line);
  text-decoration: none;
  overflow: hidden;
  isolation: isolate;
  animation: rise 0.6s var(--ease) both;
  animation-delay: calc(var(--i, 0) * 60ms);
  transition: transform 0.35s var(--ease), box-shadow 0.35s var(--ease), border-color 0.35s;
}

/* forge-glow ring, shown on hover */
.card::after {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: inherit;
  padding: 1px;
  background: linear-gradient(140deg, var(--gold), var(--accent) 40%, rgba(255, 122, 26, 0.1) 70%, var(--accent));
  -webkit-mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0);
  -webkit-mask-composite: xor;
  mask: linear-gradient(#000 0 0) content-box exclude, linear-gradient(#000 0 0);
  opacity: 0;
  transition: opacity 0.35s;
  pointer-events: none;
}

.card-cover {
  position: relative;
  aspect-ratio: 16 / 9;
  overflow: hidden;
  background: #0d0c0b;
}
.card-cover img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.6s var(--ease);
}
.card-cover::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(0deg, rgba(10, 9, 8, 0.85), transparent 55%);
}

.card-play {
  position: absolute;
  right: 14px;
  bottom: 14px;
  z-index: 1;
  height: 42px;
  padding: 0 20px 0 16px;
  font-size: 0.98rem;
}
.card-play svg { width: 14px; height: 14px; }

.card-body {
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 16px 18px 20px;
}
.card-title {
  margin: 0;
  font-size: 1.25rem;
  font-weight: 700;
  letter-spacing: -0.015em;
}
.card-desc {
  margin: 0;
  color: var(--muted);
  font-size: 0.94rem;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.card:focus-visible { outline-offset: 4px; }

/* Hover effects only on devices that really hover; on touch the Play button is always shown. */
@media (hover: hover) {
  .card-play {
    opacity: 0;
    transform: translateY(14px);
    transition: opacity 0.3s var(--ease), transform 0.35s var(--ease), box-shadow 0.25s;
  }
  .card:hover, .card:focus-visible {
    transform: translateY(-6px);
    border-color: transparent;
    box-shadow:
      0 24px 50px -20px rgba(0, 0, 0, 0.9),
      0 0 0 1px rgba(255, 122, 26, 0.35),
      0 0 34px -4px rgba(255, 122, 26, 0.45);
  }
  .card:hover::after, .card:focus-visible::after { opacity: 1; }
  .card:hover .card-cover img, .card:focus-visible .card-cover img { transform: scale(1.07); }
  .card:hover .card-play, .card:focus-visible .card-play { opacity: 1; transform: translateY(0); }
}

/* "More games coming" placeholder card */
.card-soon {
  border-style: dashed;
  border-color: var(--line-strong);
  background: transparent;
  align-items: center;
  justify-content: center;
  text-align: center;
  min-height: 260px;
  padding: 28px;
  gap: 10px;
  color: var(--faint);
}
.card-soon::after { display: none; }
.card-soon svg { width: 52px; height: 52px; opacity: 0.55; }
.card-soon strong { color: var(--muted); font-weight: 600; }
.card-soon span { font-size: 0.9rem; }

.empty {
  text-align: center;
  padding: 56px 16px;
  border: 1px dashed var(--line-strong);
  border-radius: var(--radius);
  animation: rise 0.5s var(--ease) both;
}
.empty-title { margin: 0 0 4px; font-size: 1.2rem; font-weight: 700; }
.empty-text { margin: 0 0 20px; color: var(--muted); }

@keyframes rise {
  from { opacity: 0; transform: translateY(14px); }
  to { opacity: 1; transform: none; }
}

/* ---------- Footer ---------- */

.footer {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 10px;
  padding: 28px var(--gutter) 36px;
  border-top: 1px solid var(--line);
  color: var(--faint);
  font-size: 0.92rem;
}
.footer-brand { font-weight: 700; color: var(--muted); }

.noscript {
  position: relative;
  z-index: 1;
  text-align: center;
  color: var(--muted);
  padding: 24px;
}

/* ---------- Responsive ---------- */

@media (max-width: 960px) {
  .topbar-inner { grid-template-columns: auto 1fr; }
  .filters {
    grid-column: 1 / -1;
    justify-content: flex-start;
    flex-wrap: nowrap;
    overflow-x: auto;
    margin: 0 calc(var(--gutter) * -1);
    padding: 0 var(--gutter) 2px;
    scrollbar-width: none;
  }
  .filters::-webkit-scrollbar { display: none; }
}

/* Phones and small tablets: cover on top, text below, so the text never sits on the art. */
@media (max-width: 820px) {
  .featured { min-height: 0; display: flex; flex-direction: column; }
  .featured-cover { position: relative; inset: auto; height: auto; aspect-ratio: 16 / 9; z-index: 0; }
  .featured::before { display: none; }
  .featured-body { max-width: none; min-height: 0; padding: 22px 24px 26px; }
}

@media (max-width: 640px) {
  .topbar-inner { grid-template-columns: 1fr; gap: 12px; padding-top: 12px; padding-bottom: 12px; }
  .brand-name { font-size: 1.35rem; }
  .brand-mark { width: 38px; height: 38px; }
  .search kbd { display: none; }
  .featured-body { padding: 20px 20px 24px; }
  .featured .btn-play { width: 100%; }
}

/* ---------- Reduced motion ---------- */

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