/*
Theme Name: LightPlay
Theme URI: https://example.com/lightplay
Author: Custom Build
Description: A clean, minimalistic, light-themed game site theme with a masonry homepage grid, centered post content, toggleable thumbnails, and playful color accents.
Version: 1.4.0
License: GNU General Public License v2 or later
Text Domain: lightplay
*/

:root {
  --lp-bg: #ffffff;
  --lp-surface: #ffffff;
  --lp-ink: #1a1a2e;
  --lp-muted: #6b7280;
  --lp-line: #ececf2;
  --lp-accent: #6c5ce7;
  --lp-accent-2: #00cec9;
  --lp-accent-3: #ff7675;
  --lp-accent-4: #fdcb6e;
  --lp-radius: 16px;
  --lp-shadow: 0 4px 20px rgba(28, 20, 60, 0.06);
  --lp-shadow-hover: 0 10px 34px rgba(108, 92, 231, 0.16);
  --lp-max: 1180px;
  --lp-font: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  margin: 0;
  font-family: var(--lp-font);
  color: var(--lp-ink);
  background: var(--lp-bg);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

a { color: var(--lp-accent); text-decoration: none; transition: color .18s ease; }
a:hover { color: var(--lp-accent-3); }

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

.lp-container {
  width: 100%;
  max-width: var(--lp-max);
  margin: 0 auto;
  padding: 0 20px;
}

/* ---------- Header ---------- */
.lp-header {
  position: sticky;
  top: 0;
  z-index: 100;
  background: rgba(255, 255, 255, 0.82);
  backdrop-filter: saturate(180%) blur(12px);
  border-bottom: 1px solid var(--lp-line);
}
.lp-header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 68px;
  gap: 20px;
}
.lp-logo {
  font-weight: 800;
  font-size: 22px;
  letter-spacing: -0.02em;
  color: var(--lp-ink);
  display: inline-flex;
  align-items: center;
  gap: 8px;
}
.lp-logo .lp-dot {
  width: 12px; height: 12px; border-radius: 50%;
  background: linear-gradient(135deg, var(--lp-accent), var(--lp-accent-2));
  box-shadow: 0 0 0 4px rgba(108,92,231,.12);
  animation: lp-pulse 2.6s ease-in-out infinite;
}
@keyframes lp-pulse {
  0%,100% { transform: scale(1); }
  50% { transform: scale(1.25); }
}
.lp-nav { display: flex; align-items: center; gap: 6px; }
.lp-nav ul { list-style: none; display: flex; gap: 4px; margin: 0; padding: 0; }
.lp-nav a {
  color: var(--lp-ink);
  font-weight: 600;
  font-size: 15px;
  padding: 8px 14px;
  border-radius: 999px;
  transition: background .18s ease, color .18s ease;
}
.lp-nav a:hover { background: rgba(108,92,231,.08); color: var(--lp-accent); }
.lp-nav .current-menu-item > a { background: rgba(108,92,231,.1); color: var(--lp-accent); }

.lp-search {
  position: relative;
}
.lp-search input {
  border: 1px solid var(--lp-line);
  background: #fafaff;
  border-radius: 999px;
  padding: 8px 16px 8px 38px;
  font-size: 14px;
  width: 180px;
  transition: width .2s ease, box-shadow .2s ease;
  outline: none;
  font-family: var(--lp-font);
}
.lp-search input:focus { width: 230px; box-shadow: 0 0 0 4px rgba(108,92,231,.12); border-color: var(--lp-accent); }
.lp-search svg { position: absolute; left: 13px; top: 50%; transform: translateY(-50%); color: var(--lp-muted); }

.lp-burger {
  display: none;
  background: none; border: none; cursor: pointer;
  width: 42px; height: 42px; border-radius: 12px;
  align-items: center; justify-content: center;
}
.lp-burger span { display: block; width: 20px; height: 2px; background: var(--lp-ink); position: relative; transition: .2s; }
.lp-burger span::before, .lp-burger span::after { content: ""; position: absolute; left: 0; width: 20px; height: 2px; background: var(--lp-ink); transition: .2s; }
.lp-burger span::before { top: -6px; }
.lp-burger span::after { top: 6px; }
.lp-burger.is-open span { background: transparent; }
.lp-burger.is-open span::before { top: 0; transform: rotate(45deg); }
.lp-burger.is-open span::after { top: 0; transform: rotate(-45deg); }

/* ---------- Hero (home) ---------- */
.lp-hero {
  text-align: center;
  padding: 54px 0 34px;
}
.lp-hero h1 {
  font-size: clamp(30px, 5vw, 48px);
  font-weight: 800;
  letter-spacing: -0.03em;
  margin: 0 0 12px;
  line-height: 1.1;
}
.lp-hero h1 .lp-grad {
  background: linear-gradient(120deg, var(--lp-accent), var(--lp-accent-2), var(--lp-accent-3));
  background-size: 200% auto;
  -webkit-background-clip: text; background-clip: text;
  -webkit-text-fill-color: transparent;
  animation: lp-shift 6s linear infinite;
}
@keyframes lp-shift { to { background-position: 200% center; } }
.lp-hero p { color: var(--lp-muted); font-size: 18px; margin: 0 auto; max-width: 560px; }

/* category chips */
.lp-chips { display: flex; flex-wrap: wrap; gap: 10px; justify-content: center; margin: 26px 0 8px; }
.lp-chip {
  border: 1px solid var(--lp-line);
  background: #fff;
  color: var(--lp-ink);
  padding: 8px 16px;
  border-radius: 999px;
  font-weight: 600;
  font-size: 14px;
  cursor: pointer;
  transition: all .18s ease;
}
.lp-chip:nth-child(4n+1):hover, .lp-chip:nth-child(4n+1).is-active { background: var(--lp-accent); color: #fff; border-color: var(--lp-accent); }
.lp-chip:nth-child(4n+2):hover, .lp-chip:nth-child(4n+2).is-active { background: var(--lp-accent-2); color: #fff; border-color: var(--lp-accent-2); }
.lp-chip:nth-child(4n+3):hover, .lp-chip:nth-child(4n+3).is-active { background: var(--lp-accent-3); color: #fff; border-color: var(--lp-accent-3); }
.lp-chip:nth-child(4n):hover, .lp-chip:nth-child(4n).is-active { background: var(--lp-accent-4); color: var(--lp-ink); border-color: var(--lp-accent-4); }

/* ---------- Uniform grid ---------- */
.lp-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 18px;
  padding: 28px 0 60px;
}
.lp-card {
  background: var(--lp-surface);
  border: 1px solid var(--lp-line);
  border-radius: var(--lp-radius);
  overflow: hidden;
  box-shadow: var(--lp-shadow);
  transition: transform .2s ease, box-shadow .2s ease;
  opacity: 0;
  transform: translateY(14px);
  display: flex;
  flex-direction: column;
}
.lp-card.is-in { opacity: 1; transform: translateY(0); }
.lp-card:hover { transform: translateY(-4px); box-shadow: var(--lp-shadow-hover); }
/* Fixed-ratio thumbnail: every card is the same width and height */
.lp-card-thumb {
  position: relative;
  overflow: hidden;
  background: #f4f4fb;
  aspect-ratio: 4 / 3;
  display: block;
}
.lp-card-thumb img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover; /* crop to fill so all thumbnails match exactly */
  transition: transform .4s ease;
}
.lp-card:hover .lp-card-thumb img { transform: scale(1.06); }
.lp-card-thumb .lp-play {
  position: absolute; inset: 0;
  display: flex; align-items: center; justify-content: center;
  opacity: 0; transition: opacity .2s ease;
  background: rgba(26,26,46,.28);
}
.lp-card:hover .lp-play { opacity: 1; }
.lp-play span {
  width: 52px; height: 52px; border-radius: 50%;
  background: #fff; color: var(--lp-accent);
  display: flex; align-items: center; justify-content: center;
  box-shadow: 0 6px 20px rgba(0,0,0,.18);
  transform: scale(.85); transition: transform .2s ease;
}
.lp-card:hover .lp-play span { transform: scale(1); }
.lp-card-body { padding: 14px 16px 16px; flex: 1 1 auto; }
.lp-card-cat {
  display: inline-block; font-size: 11px; font-weight: 700;
  text-transform: uppercase; letter-spacing: .06em;
  color: var(--lp-accent); margin-bottom: 6px;
}
.lp-card-title { font-size: 16px; font-weight: 700; margin: 0; line-height: 1.3; }
.lp-card-title a { color: var(--lp-ink); }
.lp-card-title a:hover { color: var(--lp-accent); }

/* ---------- Single post ---------- */
.lp-single { max-width: 820px; margin: 0 auto; padding: 40px 20px 70px; text-align: center; }
.lp-single .lp-cat { color: var(--lp-accent); font-weight: 700; text-transform: uppercase; letter-spacing: .06em; font-size: 12px; }
.lp-single h1.lp-title { font-size: clamp(26px, 4vw, 40px); font-weight: 800; letter-spacing: -0.02em; margin: 10px 0 8px; }
.lp-meta { color: var(--lp-muted); font-size: 14px; margin-bottom: 22px; }

.lp-thumb-wrap { margin: 0 auto 22px; max-width: 640px; }
.lp-thumb-wrap img { border-radius: var(--lp-radius); box-shadow: var(--lp-shadow); margin: 0 auto; }

/* game embed area (native + iframe) */
.lp-game {
  --lp-game-w: 800px;
  --lp-game-ratio: 75%;
  margin: 0 auto 26px;
  width: min(100%, var(--lp-game-w));
}
.lp-game-frame {
  position: relative;
  width: 100%;
  padding-top: var(--lp-game-ratio); /* preserves the game's aspect ratio */
  border-radius: var(--lp-radius);
  overflow: hidden;
  background: #f4f4fb;
  box-shadow: var(--lp-shadow);
  border: 1px solid var(--lp-line);
}
.lp-game-frame iframe,
.lp-game-frame embed,
.lp-game-frame video,
.lp-game-frame canvas {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  border: 0;
  display: block;
}
/* Fullscreen button for native games */
.lp-game-fs {
  position: absolute; right: 10px; bottom: 10px; z-index: 3;
  width: 38px; height: 38px; border-radius: 10px;
  border: none; cursor: pointer;
  background: rgba(26,26,46,.6); color: #fff;
  display: flex; align-items: center; justify-content: center;
  opacity: 0; transition: opacity .18s ease, background .18s ease;
}
.lp-game:hover .lp-game-fs { opacity: 1; }
.lp-game-fs:hover { background: var(--lp-accent); }

.lp-content { text-align: center; font-size: 17px; color: #2a2a3a; }
.lp-content p { margin: 0 auto 16px; max-width: 680px; }
.lp-content h2, .lp-content h3 { text-align: center; }
.lp-content a { text-decoration: underline; text-underline-offset: 3px; }

/* ---------- Archive header ---------- */
.lp-page-head { text-align: center; padding: 46px 0 10px; }
.lp-page-head h1 { font-size: clamp(26px,4vw,40px); font-weight: 800; letter-spacing: -0.02em; margin: 0 0 6px; }
.lp-page-head p { color: var(--lp-muted); margin: 0; }

/* ---------- Pagination ---------- */
.lp-pagination { display: flex; justify-content: center; gap: 8px; padding: 10px 0 60px; }
.lp-pagination .page-numbers {
  min-width: 40px; height: 40px; padding: 0 12px;
  display: inline-flex; align-items: center; justify-content: center;
  border: 1px solid var(--lp-line); border-radius: 12px;
  font-weight: 600; color: var(--lp-ink); background: #fff;
  transition: all .18s ease;
}
.lp-pagination .page-numbers:hover { border-color: var(--lp-accent); color: var(--lp-accent); }
.lp-pagination .page-numbers.current { background: var(--lp-accent); color: #fff; border-color: var(--lp-accent); }

/* ---------- Page content ---------- */
.lp-page { max-width: 800px; margin: 0 auto; padding: 40px 20px 70px; }
.lp-page h1.lp-title { font-size: clamp(26px,4vw,40px); font-weight: 800; text-align: center; margin-bottom: 20px; }

/* ---------- Footer ---------- */
.lp-footer {
  border-top: 1px solid var(--lp-line);
  background: linear-gradient(180deg, #fff, #fafaff);
  padding: 40px 0 30px;
  margin-top: 20px;
}
.lp-footer-inner { display: flex; flex-wrap: wrap; gap: 24px; justify-content: space-between; align-items: center; }
.lp-footer .lp-logo { font-size: 18px; }
.lp-footer-links { display: flex; flex-wrap: wrap; gap: 18px; }
.lp-footer-links a { color: var(--lp-muted); font-weight: 500; font-size: 14px; }
.lp-footer-links a:hover { color: var(--lp-accent); }
.lp-footer-bottom { text-align: center; color: var(--lp-muted); font-size: 13px; margin-top: 24px; }

/* ---------- Back to top ---------- */
.lp-top {
  position: fixed; right: 22px; bottom: 22px; z-index: 90;
  width: 46px; height: 46px; border-radius: 50%;
  background: var(--lp-accent); color: #fff; border: none; cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  box-shadow: 0 8px 22px rgba(108,92,231,.35);
  opacity: 0; pointer-events: none; transform: translateY(10px);
  transition: opacity .2s ease, transform .2s ease, background .2s ease;
}
.lp-top.is-visible { opacity: 1; pointer-events: auto; transform: translateY(0); }
.lp-top:hover { background: var(--lp-accent-3); }

/* ---------- Responsive ---------- */
@media (max-width: 860px) {
  .lp-search { display: none; }
  .lp-burger { display: flex; }
  .lp-nav {
    position: absolute; top: 68px; left: 0; right: 0;
    background: #fff; border-bottom: 1px solid var(--lp-line);
    flex-direction: column; padding: 12px 20px;
    transform: translateY(-140%); transition: transform .25s ease;
    box-shadow: var(--lp-shadow);
  }
  .lp-nav.is-open { transform: translateY(0); }
  .lp-nav ul { flex-direction: column; width: 100%; gap: 2px; }
  .lp-nav a { display: block; }
}
@media (max-width: 560px) {
  .lp-grid { columns: 2 150px; column-gap: 12px; }
  .lp-card { margin-bottom: 12px; }
}

/* ---------- Games template: index sidebar + grid ---------- */
.lp-games-layout {
  display: grid;
  grid-template-columns: 240px 1fr;
  gap: 24px;
  align-items: start;
  padding-top: 28px;
}
.lp-games-main { min-width: 0; }
.lp-games-main .lp-grid { padding-top: 0; }

/* Sidebar */
.lp-index {
  position: sticky;
  top: 88px; /* clears the sticky header */
}
.lp-index-inner {
  background: var(--lp-surface);
  border: 1px solid var(--lp-line);
  border-radius: var(--lp-radius);
  box-shadow: var(--lp-shadow);
  padding: 14px;
  max-height: calc(100vh - 120px);
  display: flex;
  flex-direction: column;
}
.lp-index-head {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 10px;
}
.lp-index-title { font-weight: 800; font-size: 15px; letter-spacing: -0.01em; }
.lp-index-count {
  font-size: 12px; font-weight: 700; color: var(--lp-accent);
  background: rgba(108,92,231,.1); border-radius: 999px; padding: 2px 9px;
}
.lp-index-filter {
  width: 100%; border: 1px solid var(--lp-line); background: #fafaff;
  border-radius: 10px; padding: 8px 12px; font-size: 14px; font-family: var(--lp-font);
  outline: none; margin-bottom: 10px; transition: box-shadow .18s ease, border-color .18s ease;
}
.lp-index-filter:focus { border-color: var(--lp-accent); box-shadow: 0 0 0 3px rgba(108,92,231,.12); }
.lp-index-list {
  list-style: none; margin: 0; padding: 0 4px 0 0;
  overflow-y: auto; overscroll-behavior: contain;
}
.lp-index-item { margin: 0; }
.lp-index-item a {
  display: block; color: var(--lp-ink); font-weight: 600; font-size: 14px;
  padding: 7px 10px; border-radius: 8px; line-height: 1.3;
  transition: background .14s ease, color .14s ease;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.lp-index-item a:hover { background: rgba(108,92,231,.08); color: var(--lp-accent); }
.lp-index-item.is-filtered { display: none; }
.lp-index-empty { color: var(--lp-muted); font-size: 14px; padding: 6px 10px; margin: 0; }

/* Scrollbar polish */
.lp-index-list::-webkit-scrollbar { width: 8px; }
.lp-index-list::-webkit-scrollbar-thumb { background: var(--lp-line); border-radius: 8px; }
.lp-index-list::-webkit-scrollbar-thumb:hover { background: #d8d8e6; }

@media (max-width: 860px) {
  .lp-games-layout { grid-template-columns: 1fr; gap: 16px; }
  .lp-index { position: static; }
  .lp-index-inner { max-height: none; }
  .lp-index-list { max-height: 260px; }
}
