/* =====================================================================
   Happy Puzzle Quest — game page layout (bus-pass/, bharat-trails/)
   Structure and sizes only. Every game page defines its own COLORS
   in a :root block inside the page, so each page wears its game's theme.
   ===================================================================== */
@font-face {
  font-family: "Inter";
  font-style: normal;
  font-weight: 100 900;
  font-display: swap;
  src: url("../fonts/inter-latin.woff2") format("woff2");
}
@font-face {
  font-family: "Outfit";
  font-style: normal;
  font-weight: 100 900;
  font-display: swap;
  src: url("../fonts/outfit-latin.woff2") format("woff2");
}

/* =====================================================================
   DESIGN TOKENS — font sizes and layout (colors live in each page)
   ===================================================================== */
:root {
  /* ---------- Font families ---------- */
  --font-heading: "Outfit", system-ui, -apple-system, "Segoe UI", sans-serif;
  --font-body:    "Inter", system-ui, -apple-system, "Segoe UI", sans-serif;

  /* ---------- Font sizes ---------- */
  --fs-xs:       0.75rem;                                 /* 12px — captions         */
  --fs-sm:       0.875rem;                                /* 14px — small text, nav  */
  --fs-base:     1rem;                                    /* 16px — body text        */
  --fs-developer: 1.125rem;                               /* 18px — developer name   */
  --fs-section:  1.375rem;                                /* 22px — section titles   */
  --fs-title:    clamp(1.5rem, 0.9rem + 3vw, 3.5rem);     /* 24–56px — game title    */

  /* ---------- Sizes ---------- */
  --icon-size:        clamp(72px, 40px + 14vw, 240px);    /* game icon: 72px phone → 240px desktop */
  --shot-height:      clamp(240px, 180px + 14vw, 360px);  /* screenshot height       */
  --button-height:    44px;
  --button-min-width: 220px;

  /* ---------- Layout ---------- */
  --container-width: 1100px;
  --gutter:          clamp(1rem, 0.5rem + 2vw, 2rem);
  --radius-sm:       8px;
  --radius-icon:     22%;
  --topbar-height:   60px;
  --transition:      200ms ease;

  /* ---------- Fullscreen screenshot viewer (same on every game page) ---------- */
  --lightbox-bg:        rgba(0, 0, 0, 0.94);
  --lightbox-fg:        #ffffff;
  --lightbox-btn-bg:    rgba(255, 255, 255, 0.12);
  --lightbox-btn-hover: rgba(255, 255, 255, 0.24);
  --lightbox-nav-space: clamp(1rem, 6vw, 5rem);   /* room for the side arrows */
}
@media (max-width: 640px) { :root { --lightbox-nav-space: 0.75rem; } }

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

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

body {
  margin: 0;
  background: var(--g-bg);
  color: var(--g-text);
  font-family: var(--font-body);
  font-size: var(--fs-base);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}

h1, h2, h3 { margin: 0; font-family: var(--font-heading); font-weight: 600; line-height: 1.15; }
p { margin: 0; }
img { display: block; max-width: 100%; }
a { color: inherit; }
ul { margin: 0; padding: 0; list-style: none; }

:focus-visible {
  outline: 2px solid var(--g-accent);
  outline-offset: 3px;
  border-radius: var(--radius-sm);
}

.skip-link {
  position: absolute; left: var(--gutter); top: -100px; z-index: 100;
  padding: 0.5rem 1rem;
  background: var(--g-button-bg); color: var(--g-button-text);
  border-radius: var(--radius-sm);
}
.skip-link:focus { top: 0.75rem; }

.container {
  width: 100%;
  max-width: var(--container-width);
  margin-inline: auto;
  padding-inline: var(--gutter);
}

/* =====================================================================
   TOP BAR — studio brand, so the page is clearly not a store page
   ===================================================================== */
.topbar {
  height: var(--topbar-height);
  background: var(--g-topbar-bg);
  border-bottom: 1px solid var(--g-border);
}
.topbar__inner {
  display: flex; align-items: center; justify-content: space-between; gap: 1rem;
  height: 100%;
}
.brand {
  display: inline-flex; align-items: center; gap: 0.6rem;
  font-family: var(--font-heading);
  font-size: var(--fs-base);
  font-weight: 600;
  text-decoration: none;
}
.brand__mark { width: 28px; height: 28px; flex-shrink: 0; }
.topbar__link {
  color: var(--g-text-muted);
  font-size: var(--fs-sm);
  font-weight: 500;
  text-decoration: none;
  white-space: nowrap;
}
.topbar__link:hover { color: var(--g-text); }

/* =====================================================================
   APP HEADER — title, developer, button (left) · icon (right)
   ===================================================================== */
.app-header {
  display: grid;
  grid-template-columns: 1fr auto;
  grid-template-areas:
    "info icon"
    "actions icon";
  align-items: start;
  column-gap: 2rem;
  padding-top: clamp(1.5rem, 1rem + 3vw, 3.5rem);
}
.app-header__info { grid-area: info; }
.app-header__icon { grid-area: icon; }
.app-header__actions { grid-area: actions; margin-top: 2rem; }

.app-title {
  font-size: var(--fs-title);
  font-weight: 500;
  letter-spacing: -0.02em;
  line-height: 1.12;
}
.app-developer {
  display: inline-block;
  margin-top: 0.75rem;
  color: var(--g-accent);
  font-size: var(--fs-developer);
  font-weight: 500;
  text-decoration: none;
}
.app-developer:hover { text-decoration: underline; }

.app-icon {
  width: var(--icon-size);
  height: var(--icon-size);
  border-radius: var(--radius-icon);
  box-shadow: 0 1px 2px var(--g-shadow), 0 8px 24px -6px var(--g-shadow);
}

.store-button {
  display: inline-flex; align-items: center; justify-content: center; gap: 0.5rem;
  min-width: var(--button-min-width);
  min-height: var(--button-height);
  padding: 0 1.5rem;
  border-radius: var(--radius-sm);
  background: var(--g-button-bg);
  color: var(--g-button-text);
  font-size: var(--fs-sm);
  font-weight: 600;
  text-decoration: none;
  transition: filter var(--transition);
}
.store-button svg { width: 18px; height: 18px; flex-shrink: 0; }
.store-button:hover { filter: brightness(1.07); }
.store-button[aria-disabled="true"] { opacity: 0.55; cursor: not-allowed; filter: none; }
.store-note {
  margin-top: 0.5rem;
  color: var(--g-text-muted);
  font-size: var(--fs-xs);
}

/* Phone: small icon left of the title, full-width button */
@media (max-width: 640px) {
  .app-header {
    grid-template-columns: auto 1fr;
    grid-template-areas:
      "icon info"
      "actions actions";
    column-gap: 1rem;
    align-items: center;
  }
  .app-developer { margin-top: 0.25rem; font-size: var(--fs-sm); }
  .app-header__actions { margin-top: 1.5rem; }
  .store-button { width: 100%; }
}

/* =====================================================================
   SCREENSHOTS — horizontal strip
   ===================================================================== */
.screenshots {
  display: flex; gap: 0.75rem;
  margin-top: clamp(1.5rem, 1rem + 2vw, 3rem);
  padding-bottom: 0.75rem;
  overflow-x: auto;
  scroll-snap-type: x mandatory;
  scrollbar-width: thin;
  scrollbar-color: var(--g-border) transparent;
}
.screenshots__item {
  flex-shrink: 0;
  padding: 0;
  border: 0;
  border-radius: var(--radius-sm);
  background: none;
  cursor: zoom-in;
  scroll-snap-align: start;
}
.screenshots img {
  height: var(--shot-height);
  width: auto;
  border-radius: var(--radius-sm);
  border: 1px solid var(--g-border);
  background: var(--g-shot-bg);
  transition: filter var(--transition);
}
.screenshots__item:hover img { filter: brightness(1.05); }

/* =====================================================================
   LIGHTBOX — fullscreen screenshot viewer (built by the page script)
   ===================================================================== */
.lightbox {
  width: 100vw; height: 100vh; height: 100dvh;
  max-width: none; max-height: none;
  margin: 0; padding: 0; border: 0;
  background: var(--lightbox-bg);
  color: var(--lightbox-fg);
}
.lightbox[open] { display: flex; align-items: center; justify-content: center; }
.lightbox::backdrop { background: transparent; }
html.lightbox-open { overflow: hidden; }

.lightbox__image {
  max-width: calc(100vw - 2 * var(--lightbox-nav-space));
  max-height: calc(100dvh - 7rem);
  object-fit: contain;
  border-radius: var(--radius-sm);
  user-select: none;
  touch-action: pan-y;
}

.lightbox__btn {
  position: absolute;
  display: grid; place-items: center;
  width: 48px; height: 48px;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: var(--lightbox-btn-bg);
  color: inherit;
  cursor: pointer;
  transition: background var(--transition);
}
.lightbox__btn:hover { background: var(--lightbox-btn-hover); }
.lightbox__btn:focus-visible { outline: 2px solid var(--lightbox-fg); outline-offset: 2px; }
.lightbox__btn svg { width: 24px; height: 24px; }
.lightbox__close { top: 1rem; right: 1rem; }
.lightbox__prev  { left: 1rem;  top: 50%; transform: translateY(-50%); }
.lightbox__next  { right: 1rem; top: 50%; transform: translateY(-50%); }

.lightbox__counter {
  position: absolute; bottom: 1.25rem; left: 50%;
  transform: translateX(-50%);
  font-size: var(--fs-sm);
  opacity: 0.8;
}

/* Phone: arrows move to the bottom, next to the counter */
@media (max-width: 640px) {
  .lightbox__prev, .lightbox__next { top: auto; bottom: 0.5rem; transform: none; }
}

/* =====================================================================
   SECTIONS — about, app support
   ===================================================================== */
.section { margin-top: clamp(2rem, 1.5rem + 2vw, 3rem); max-width: 760px; }
.section__title { font-size: var(--fs-section); font-weight: 500; }
.section__text { margin-top: 1rem; color: var(--g-text-muted); }
.section__text + .section__text { margin-top: 0.75rem; }

.tags { display: flex; flex-wrap: wrap; gap: 0.5rem; margin-top: 1.25rem; }
.tags li {
  padding: 0.25rem 0.85rem;
  border: 1px solid var(--g-border);
  border-radius: 999px;
  color: var(--g-text-muted);
  font-size: var(--fs-sm);
}

.support { margin-top: 1rem; display: grid; gap: 0.25rem; }
.support__row {
  display: flex; align-items: center; gap: 1rem;
  padding: 0.75rem 0;
  border-bottom: 1px solid var(--g-border);
}
.support__row:last-child { border-bottom: 0; }
.support__row svg { width: 22px; height: 22px; flex-shrink: 0; color: var(--g-text-muted); }
.support__label { display: block; font-size: var(--fs-sm); font-weight: 600; }
.support__value { display: block; color: var(--g-text-muted); font-size: var(--fs-sm); }
.support__value a { color: var(--g-accent); text-decoration: none; }
.support__value a:hover { text-decoration: underline; }

/* =====================================================================
   FOOTER
   ===================================================================== */
.footer {
  margin-top: clamp(3rem, 2rem + 4vw, 5rem);
  padding-block: 1.5rem;
  border-top: 1px solid var(--g-border);
  color: var(--g-text-muted);
  font-size: var(--fs-sm);
}
.footer__inner {
  display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 0.75rem 1.5rem;
}
.footer__links { display: flex; flex-wrap: wrap; gap: 0.5rem 1.25rem; }
.footer__links a { text-decoration: none; }
.footer__links a:hover { color: var(--g-text); }
