/* GameTest.App — Global Styles
   Design tokens live in theme.json.
   This file handles layout, components, and game-card UI.
*/

/* ── Reset & Base ─────────────────────────────────────────────────────────── */

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

html { scroll-behavior: smooth; }

body {
  margin: 0;
  background: #12111f;
  color: var(--wp--preset--color--text-primary);
  font-family: var(--wp--preset--font-family--sans);
  -webkit-font-smoothing: antialiased;
}

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

a {
  color: var(--wp--preset--color--accent-soft);
  text-decoration: none;
  transition: color 0.15s;
}
a:hover { color: var(--wp--preset--color--text-primary); }


/* ── Site Header ──────────────────────────────────────────────────────────── */

.gt-site-header {
  position: sticky;
  top: 0;
  z-index: 100;
  background: var(--wp--preset--color--bg-primary) !important;
  border-bottom: 1px solid var(--wp--preset--color--border);
}

.gt-header-inner {
  max-width: 1100px;
  margin: 0 auto;
  padding: 0 24px;
  height: 52px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.gt-nav {
  display: flex;
  gap: 24px;
  align-items: center;
}

.gt-nav-link {
  font-size: 13px;
  color: #8a87a0;
  text-decoration: none;
  transition: color 0.15s;
}

.gt-nav-link:hover {
  color: #e8e6f0;
}

/* Logo */
.gt-logo {
  display: flex;
  align-items: center;
  gap: 10px;
  text-decoration: none;
}

.gt-logo-icon {
  width: 28px;
  height: 28px;
  background: var(--wp--preset--color--accent);
  border-radius: 6px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.gt-logo-text {
  font-size: 15px;
  font-weight: 500;
  color: #fff;
  letter-spacing: -0.01em;
  text-decoration: none;
}
.gt-logo-text em {
  color: var(--wp--preset--color--accent);
  font-style: normal;
}

/* Navigation */
.gt-nav .wp-block-navigation__container {
  gap: 24px;
}
.gt-nav .wp-block-navigation-item__content {
  font-size: var(--wp--preset--font-size--sm);
  color: var(--wp--preset--color--text-secondary);
  padding: 0;
  transition: color 0.15s;
}
.gt-nav .wp-block-navigation-item__content:hover {
  color: var(--wp--preset--color--text-primary);
}
.gt-nav .current-menu-item .wp-block-navigation-item__content {
  color: #fff;
}


/* ── Hero ─────────────────────────────────────────────────────────────────── */

.gt-hero {
  text-align: center;
  position: relative;
  overflow: hidden;
}

/* Subtle scanline texture */
.gt-hero::before {
  content: '';
  position: absolute;
  inset: 0;
  background: repeating-linear-gradient(
    0deg,
    transparent,
    transparent 2px,
    rgba(255,255,255,0.01) 2px,
    rgba(255,255,255,0.01) 4px
  );
  pointer-events: none;
}

.gt-eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: var(--wp--preset--font-size--xs);
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: #8a87b8;
  margin: 0 0 16px;
}

.gt-pixel-dot {
  display: inline-block;
  width: 6px;
  height: 6px;
  border-radius: 1px;
  background: var(--wp--preset--color--accent);
  flex-shrink: 0;
}

.gt-hero h1 em.gt-accent {
  color: var(--wp--preset--color--accent);
  font-style: normal;
}

/* Buttons */
.gt-btn {
  display: inline-block;
  font-size: var(--wp--preset--font-size--sm);
  font-family: var(--wp--preset--font-family--sans);
  font-weight: 500;
  padding: 10px 22px;
  border-radius: 6px;
  cursor: pointer;
  transition: opacity 0.15s, transform 0.1s;
  text-decoration: none;
}
.gt-btn:active { transform: scale(0.98); }

.gt-btn-primary {
  background: var(--wp--preset--color--accent);
  color: #fff;
}
.gt-btn-primary:hover {
  opacity: 0.9;
  color: #fff;
}

.gt-btn-ghost {
  background: transparent;
  color: var(--wp--preset--color--text-secondary);
  border: 1px solid var(--wp--preset--color--border);
}
.gt-btn-ghost:hover {
  color: var(--wp--preset--color--text-primary);
  border-color: var(--wp--preset--color--text-muted);
}


/* ── Games Section ────────────────────────────────────────────────────────── */

.gt-games-section {
  max-width: var(--wp--style--global--wide-size);
  margin: 0 auto;
  padding: 40px 24px;
}

.gt-section-label {
  font-size: var(--wp--preset--font-size--xs);
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: #8a87b8;
}

.gt-link-arrow {
  font-size: var(--wp--preset--font-size--sm);
  color: var(--wp--preset--color--accent);
}


/* ── Game Cards Grid ──────────────────────────────────────────────────────── */

.gt-games-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 16px;
}

@media (max-width: 900px) {
  .gt-games-grid { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 560px) {
  .gt-games-grid { grid-template-columns: 1fr; }
}

/* Loading state */
.gt-games-loading {
  grid-column: 1 / -1;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 48px 0;
}

.gt-loading-dot {
  width: 6px;
  height: 6px;
  border-radius: 1px;
  background: var(--wp--preset--color--border);
  animation: gt-pulse 1.2s ease-in-out infinite;
}
.gt-loading-dot:nth-child(2) { animation-delay: 0.2s; }
.gt-loading-dot:nth-child(3) { animation-delay: 0.4s; }

@keyframes gt-pulse {
  0%, 100% { opacity: 0.3; }
  50% { opacity: 1; }
}

/* Individual card */
.gt-game-card {
  background: #262441;
  border: 1px solid #4a4670;
  border-radius: 12px;
  overflow: hidden;
  transition: border-color 0.15s, transform 0.15s, background 0.15s;
  display: flex;
  flex-direction: column;
}
.gt-game-card:hover {
  background: #2c2a4a;
  border-color: var(--wp--preset--color--accent-soft);
  transform: translateY(-2px);
}

.gt-game-card.is-featured {
  grid-column: span 2;
}
@media (max-width: 560px) {
  .gt-game-card.is-featured { grid-column: span 1; }
}

/* Inner link covers thumbnail + body — vote controls live outside this,
   in the footer, so a tap on a vote button can never be interpreted as a
   navigation by the browser (this was the cause of mobile votes "showing
   action" via the tap highlight but never completing, since the in-flight
   fetch could get cut off by the page navigating away). */
.gt-card-link {
  display: flex;
  flex-direction: column;
  text-decoration: none;
  color: inherit;
  cursor: pointer;
}
.gt-card-link:focus-visible {
  outline: 2px solid var(--wp--preset--color--accent);
  outline-offset: 2px;
}

/* Card thumbnail */
.gt-card-thumb {
  height: 140px;
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  overflow: hidden;
}
.gt-game-card.is-featured .gt-card-thumb {
  height: 180px;
}

/* Fallback icon shown when a game has no featured image. The radial glow
   uses the same --gt-icon-color the SVG stroke uses, set inline per card in
   game-engine.js, so the glow always matches the icon rather than needing a
   separate color value kept in sync by hand. */
.gt-card-thumb-fallback {
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--gt-icon-color, #a8a5cc);
  background: radial-gradient(circle at 50% 45%, var(--gt-icon-color, #a8a5cc) 0%, transparent 70%);
  background: radial-gradient(circle at 50% 45%, color-mix(in srgb, var(--gt-icon-color, #a8a5cc) 28%, transparent) 0%, transparent 70%);
}
.gt-card-thumb-fallback svg {
  filter: drop-shadow(0 0 14px var(--gt-icon-color, #a8a5cc));
  filter: drop-shadow(0 0 14px color-mix(in srgb, var(--gt-icon-color, #a8a5cc) 55%, transparent));
}
.gt-game-card.is-featured .gt-card-thumb-fallback svg {
  width: 112px;
  height: 112px;
}

/* Status badge */
.gt-card-badge {
  position: absolute;
  top: 10px;
  right: 10px;
  font-size: 9px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  padding: 3px 8px;
  border-radius: 20px;
  font-weight: 500;
  font-family: var(--wp--preset--font-family--sans);
}

.gt-badge-new {
  background: rgba(168,152,255,0.25);
  color: #fff;
  border: 1px solid rgba(168,152,255,0.5);
}

.gt-badge-coming-soon {
  background: rgba(255,138,61,0.2);
  color: #ffb37a;
  border: 1px solid rgba(255,138,61,0.4);
}

/* Card body */
.gt-card-body {
  padding: 14px 16px 16px;
  flex: 1;
  display: flex;
  flex-direction: column;
}

.gt-card-genre {
  font-size: 10px;
  color: #b0adda;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  margin-bottom: 4px;
}

.gt-card-title {
  font-size: var(--wp--preset--font-size--base);
  font-weight: 500;
  color: var(--wp--preset--color--text-primary);
  margin: 0 0 6px;
  line-height: 1.3;
}

.gt-card-desc {
  font-size: var(--wp--preset--font-size--sm);
  color: #a8a5cc;
  line-height: 1.5;
  flex: 1;
}

/* Footer row — sits outside the <a>, holds play time + vote buttons.
   Not part of the clickable link, so taps here never compete with
   navigation. */
.gt-card-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 0 16px 16px;
  margin-top: -2px;
  border-top: 1px solid #3a3760;
  padding-top: 12px;
  flex-wrap: wrap;
}

.gt-card-meta-item {
  font-size: 11px;
  color: #9c99c4;
  display: flex;
  align-items: center;
  gap: 4px;
  white-space: nowrap;
}

/* Vote controls */
.gt-card-votes {
  position: relative;
  display: flex;
  align-items: center;
  gap: 6px;
  margin-left: auto;
}

.gt-vote-msg {
  position: absolute;
  bottom: calc(100% + 8px);
  right: 0;
  background: #13111e;
  border: 1px solid #4a4670;
  color: #ffb37a;
  font-size: 11px;
  white-space: nowrap;
  padding: 5px 10px;
  border-radius: 6px;
  opacity: 0;
  pointer-events: none;
  transform: translateY(4px);
  transition: opacity 0.15s, transform 0.15s;
  z-index: 5;
}
.gt-vote-msg.is-visible {
  opacity: 1;
  transform: translateY(0);
}

.gt-vote-btn {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 11px;
  font-family: var(--wp--preset--font-family--sans);
  color: #9c99c4;
  background: rgba(255,255,255,0.05);
  border: 1px solid #4a4670;
  border-radius: 14px;
  padding: 3px 9px;
  cursor: pointer;
  touch-action: manipulation;
  transition: background 0.15s, border-color 0.15s, color 0.15s, transform 0.1s;
  line-height: 1.4;
}
.gt-vote-btn:hover:not(:disabled) {
  background: rgba(168,152,255,0.15);
  border-color: var(--wp--preset--color--accent-soft);
  color: #fff;
}
.gt-vote-btn:active:not(:disabled) {
  transform: scale(0.95);
}
.gt-vote-btn:disabled {
  cursor: default;
  opacity: 0.7;
}
.gt-vote-btn.is-active {
  background: rgba(168,152,255,0.25);
  border-color: var(--wp--preset--color--accent-soft);
  color: #fff;
}
.gt-vote-count {
  font-weight: 500;
  min-width: 8px;
  text-align: left;
}

/* Used on the ending-screen rating widget (showEnding/loadEndingVotes in
   game-engine.js), which sits as a standalone focal element rather than a
   small card-footer accessory — same colors/states as the base button,
   just roomier. */
.gt-vote-btn.gt-vote-btn-lg {
  font-size: 14px;
  padding: 8px 16px;
  border-radius: 18px;
  gap: 6px;
}


/* ── Filter Tags ──────────────────────────────────────────────────────────── */

.gt-filter-tags {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  padding: 0 24px 24px;
  max-width: var(--wp--style--global--wide-size);
  margin: 0 auto;
}

.gt-tag {
  font-size: 11px;
  background: #252340;
  color: #9a98c0;
  border: 1px solid #38355a;
  padding: 4px 12px;
  border-radius: 20px;
  cursor: pointer;
  transition: all 0.15s;
  font-family: var(--wp--preset--font-family--sans);
}
.gt-tag:hover,
.gt-tag.is-active {
  background: rgba(108,92,231,0.15);
  color: var(--wp--preset--color--accent-soft);
  border-color: rgba(108,92,231,0.4);
}


/* ── Footer ───────────────────────────────────────────────────────────────── */

.gt-site-footer {
  border-top: 1px solid #1a1830;
}

.gt-footer-nav .wp-block-navigation__container {
  gap: 16px;
}
.gt-footer-nav .wp-block-navigation-item__content {
  font-size: var(--wp--preset--font-size--xs);
  color: #3a3752;
}


/* ── Utility ──────────────────────────────────────────────────────────────── */

.gt-error {
  color: var(--wp--preset--color--text-muted);
  font-size: var(--wp--preset--font-size--sm);
  padding: 24px;
  text-align: center;
}

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


/* ── Suggest-a-Game Modal ─────────────────────────────────────────────────── */

.gt-modal-overlay {
  position: fixed;
  inset: 0;
  z-index: 10000;
  background: rgba(8,7,16,0.7);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
}
.gt-modal-overlay[hidden] { display: none; }

.gt-modal {
  position: relative;
  width: 100%;
  max-width: 440px;
  max-height: 90vh;
  overflow-y: auto;
  background: #1c1a2e;
  border: 1px solid #4a4670;
  border-radius: 14px;
  padding: 28px;
  font-family: var(--wp--preset--font-family--sans);
}

.gt-modal-close {
  position: absolute;
  top: 14px;
  right: 14px;
  width: 28px;
  height: 28px;
  border-radius: 6px;
  border: none;
  background: transparent;
  color: #9c99c4;
  font-size: 20px;
  line-height: 1;
  cursor: pointer;
  transition: background 0.15s, color 0.15s;
}
.gt-modal-close:hover {
  background: rgba(255,255,255,0.08);
  color: #fff;
}

.gt-modal-title {
  font-size: 18px;
  font-weight: 600;
  color: var(--wp--preset--color--text-primary);
  margin: 0 0 6px;
}

.gt-modal-subtitle {
  font-size: 13px;
  color: #9c99c4;
  margin: 0 0 20px;
  line-height: 1.5;
}

.gt-form-label {
  display: block;
  font-size: 12px;
  font-weight: 500;
  color: #b0adda;
  margin-bottom: 6px;
}
.gt-form-label:not(:first-child) {
  margin-top: 16px;
}

.gt-form-optional {
  font-weight: 400;
  color: #6a6890;
}

.gt-form-input,
.gt-form-textarea {
  width: 100%;
  background: #13111e;
  border: 1px solid #4a4670;
  border-radius: 8px;
  padding: 9px 12px;
  font-size: 14px;
  font-family: var(--wp--preset--font-family--sans);
  color: var(--wp--preset--color--text-primary);
  transition: border-color 0.15s;
}
.gt-form-input:focus,
.gt-form-textarea:focus {
  outline: none;
  border-color: var(--wp--preset--color--accent-soft);
}
.gt-form-textarea {
  resize: vertical;
  min-height: 90px;
  font-family: inherit;
  line-height: 1.5;
}

.gt-modal-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-top: 20px;
}

.gt-suggest-status {
  font-size: 12px;
  color: #8fd99a;
  flex: 1;
}
.gt-suggest-status.is-error {
  color: #ff9a7a;
}

#gt-suggest-submit:disabled {
  opacity: 0.6;
  cursor: default;
}
