/* ==========================================================================
   Polyfun Games — site styles
   Colors are pulled from the logo: two-tone red on a near-black canvas.
   ========================================================================== */

:root {
  --bg: #100f14;
  --bg-2: #15131a;
  --surface: #1b1921;
  --surface-2: #23202b;
  --line: rgba(255, 255, 255, 0.08);
  --line-strong: rgba(255, 255, 255, 0.16);
  --text: #f4f2f6;
  --muted: #a7a3b0;
  --faint: #6f6b78;
  --red: #ed332e;        /* logo light face */
  --red-dark: #bf2025;   /* logo dark face */
  --red-glow: rgba(237, 51, 46, 0.35);

  --font-display: "Montserrat", system-ui, sans-serif;
  --font-body: "Inter", system-ui, -apple-system, "Segoe UI", sans-serif;

  --radius: 18px;
  --radius-sm: 12px;
  --wrap: 1180px;
  --gutter: clamp(16px, 4vw, 32px);
  --ease: cubic-bezier(0.2, 0.8, 0.2, 1);

  color-scheme: dark;
}

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

html { scroll-behavior: smooth; scroll-padding-top: 84px; }

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

img { display: block; max-width: 100%; }
a { color: inherit; }
::selection { background: var(--red); color: #fff; }

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

.icon { width: 1em; height: 1em; fill: currentColor; flex: none; }

.skip-link {
  position: absolute; left: 16px; top: -60px; z-index: 100;
  padding: 10px 16px; border-radius: 8px;
  background: var(--red); color: #fff; font-weight: 600; text-decoration: none;
}
.skip-link:focus { top: 16px; }

:focus-visible { outline: 2px solid var(--red); outline-offset: 3px; border-radius: 6px; }

/* ---------- Header ---------- */

.site-header {
  position: sticky; top: 0; z-index: 50;
  background: rgba(16, 15, 20, 0.72);
  backdrop-filter: saturate(140%) blur(14px);
  -webkit-backdrop-filter: saturate(140%) blur(14px);
  border-bottom: 1px solid var(--line);
}
.site-header .wrap {
  display: flex; align-items: center; justify-content: space-between;
  height: 68px; gap: 24px;
}

.brand {
  display: inline-flex; align-items: center; gap: 10px;
  text-decoration: none;
  font-family: var(--font-display); font-weight: 800; font-size: 18px;
  letter-spacing: 0.02em;
}
.brand img { width: 30px; height: auto; }
.brand span b { color: var(--red); font-weight: 800; }

.nav { display: flex; align-items: center; gap: 6px; }
.nav a {
  padding: 8px 14px; border-radius: 999px;
  color: var(--muted); text-decoration: none; font-weight: 500; font-size: 15px;
  transition: color 0.2s, background 0.2s;
}
.nav a:hover { color: var(--text); background: var(--surface-2); }

@media (max-width: 760px) {
  .nav .nav-link { display: none; }
}

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

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 10px;
  min-height: 48px; padding: 0 22px;
  border-radius: 999px; border: 1px solid transparent;
  font-family: var(--font-body); font-weight: 600; font-size: 15px;
  text-decoration: none; cursor: pointer; white-space: nowrap;
  transition: transform 0.25s var(--ease), background 0.2s, border-color 0.2s, box-shadow 0.25s;
}
.btn .icon { font-size: 18px; }
.btn:hover { transform: translateY(-2px); }

.btn-primary {
  background: linear-gradient(135deg, var(--red) 0%, var(--red) 50%, var(--red-dark) 50%, var(--red-dark) 100%);
  background-size: 220% 100%; background-position: 0 0;
  color: #fff;
  box-shadow: 0 8px 28px -10px var(--red-glow);
}
.btn-primary:hover { background-position: 100% 0; box-shadow: 0 14px 34px -10px var(--red-glow); }

.btn-ghost { border-color: var(--line-strong); color: var(--text); background: rgba(255, 255, 255, 0.02); }
.btn-ghost:hover { border-color: var(--text); background: rgba(255, 255, 255, 0.06); }

.btn-sm { min-height: 40px; padding: 0 16px; font-size: 14px; }

/* ---------- Section scaffolding ---------- */

.section { padding: clamp(72px, 10vw, 128px) 0; position: relative; }
.section + .section,
.hero + .section { padding-top: 0; }

.section-head {
  display: flex; align-items: flex-end; justify-content: space-between; gap: 24px;
  margin-bottom: clamp(32px, 5vw, 48px); flex-wrap: wrap;
}
.eyebrow {
  display: inline-flex; align-items: center; gap: 10px;
  margin: 0 0 14px;
  color: var(--red); font-weight: 600; font-size: 13px;
  letter-spacing: 0.16em; text-transform: uppercase;
}
/* tiny isometric cube, echoing the logo */
.eyebrow::before {
  content: ""; width: 12px; height: 14px;
  background: linear-gradient(90deg, var(--red) 50%, var(--red-dark) 50%);
  clip-path: polygon(50% 0, 100% 25%, 100% 75%, 50% 100%, 0 75%, 0 25%);
}
h1, h2, h3 { font-family: var(--font-display); line-height: 1.08; margin: 0; letter-spacing: -0.02em; }
h2 { font-size: clamp(32px, 5vw, 52px); font-weight: 800; }
.section-head p { margin: 12px 0 0; color: var(--muted); max-width: 520px; }

/* ---------- Hero ---------- */

.hero {
  position: relative;
  padding: clamp(56px, 9vw, 112px) 0 clamp(72px, 10vw, 128px);
  overflow: hidden;
}
/* isometric cube lattice, faded towards the edges */
.hero::before {
  content: ""; position: absolute; inset: 0; z-index: -2;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='56' height='97' viewBox='0 0 56 97'%3E%3Cg fill='none' stroke='%23ffffff' stroke-opacity='.06'%3E%3Cpath d='M28 0 56 16.2v32.3L28 64.7 0 48.5V16.2zM28 32.3 56 16.2M28 32.3 0 16.2M28 32.3v32.4M0 48.5v32.3l28 16.2 28-16.2V48.5'/%3E%3C/g%3E%3C/svg%3E");
  mask-image: radial-gradient(ellipse 70% 70% at 60% 40%, #000 20%, transparent 75%);
  -webkit-mask-image: radial-gradient(ellipse 70% 70% at 60% 40%, #000 20%, transparent 75%);
}
.hero::after {
  content: ""; position: absolute; z-index: -1;
  width: 720px; height: 720px; right: -160px; top: -120px;
  background: radial-gradient(circle, rgba(237, 51, 46, 0.22), transparent 62%);
  pointer-events: none;
}

.hero .wrap {
  display: grid; grid-template-columns: 1.05fr 0.95fr; align-items: center;
  gap: clamp(40px, 6vw, 72px);
}

.hero h1 {
  font-size: clamp(44px, 7.4vw, 92px);
  font-weight: 900;
  letter-spacing: -0.035em;
  line-height: 0.98;
}
.hero h1 .accent {
  background: linear-gradient(100deg, var(--red) 0%, #ff6a4d 50%, var(--red-dark) 100%);
  -webkit-background-clip: text; background-clip: text; color: transparent;
}
.hero-lede {
  margin: 24px 0 32px; max-width: 520px;
  color: var(--muted); font-size: clamp(17px, 1.6vw, 19px);
}
.hero-actions { display: flex; flex-wrap: wrap; gap: 12px; }

.hero-platforms {
  display: flex; align-items: center; flex-wrap: wrap; gap: 8px 20px;
  margin-top: 40px; padding-top: 24px; border-top: 1px solid var(--line);
  color: var(--faint); font-size: 14px;
}
.hero-platforms a {
  display: inline-flex; align-items: center; gap: 8px;
  color: var(--muted); text-decoration: none; font-weight: 500;
  transition: color 0.2s;
}
.hero-platforms a:hover { color: var(--text); }
.hero-platforms .icon { font-size: 18px; }

/* fanned stack of phone screenshots */
.hero-art { position: relative; height: clamp(420px, 46vw, 560px); }
.hero-art .mark {
  position: absolute; left: 50%; top: 50%; width: 58%;
  transform: translate(-50%, -50%);
  opacity: 0.16; filter: blur(1px);
}
.phone {
  position: absolute; top: 50%; left: 50%;
  width: clamp(150px, 17vw, 210px); aspect-ratio: 9 / 16;
  border-radius: 26px; padding: 7px;
  background: linear-gradient(160deg, #3a3642, #1b1921);
  box-shadow: 0 30px 60px -20px rgba(0, 0, 0, 0.8), inset 0 0 0 1px rgba(255, 255, 255, 0.08);
  transition: transform 0.6s var(--ease);
}
.phone img { width: 100%; height: 100%; object-fit: cover; border-radius: 20px; }
.phone-1 { transform: translate(-125%, -46%) rotate(-12deg); }
.phone-2 { transform: translate(-50%, -54%); z-index: 2; }
.phone-3 { transform: translate(25%, -46%) rotate(12deg); }
.hero-art:hover .phone-1 { transform: translate(-135%, -48%) rotate(-15deg); }
.hero-art:hover .phone-2 { transform: translate(-50%, -58%); }
.hero-art:hover .phone-3 { transform: translate(35%, -48%) rotate(15deg); }

@media (max-width: 900px) {
  .hero .wrap { grid-template-columns: 1fr; }
  .hero { padding-bottom: 48px; }
  .hero-art { height: 400px; margin-top: 8px; }
  .phone { width: 150px; }
}
@media (max-width: 420px) {
  .hero-art { height: 330px; }
  .phone { width: 122px; border-radius: 20px; padding: 5px; }
  .phone img { border-radius: 16px; }
}

/* ---------- VR feature ---------- */

.feature {
  display: grid; grid-template-columns: minmax(0, 1.3fr) minmax(0, 1fr);
  background: var(--surface);
  border: 1px solid var(--line); border-radius: calc(var(--radius) + 6px);
  overflow: hidden;
}
.feature-media { position: relative; background: #000; min-width: 0; }
.feature-media::before { content: ""; display: block; padding-top: 56.25%; } /* 16:9 minimum */
.feature-media iframe { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; }

/* click-to-load YouTube (no YouTube scripts until the visitor presses play) */
.yt {
  position: absolute; inset: 0; display: grid; place-items: center;
  background: #000 center / cover no-repeat;
  cursor: pointer; border: 0; padding: 0; width: 100%; color: #fff;
}
.yt::before {
  content: ""; position: absolute; inset: 0;
  background: linear-gradient(180deg, rgba(0, 0, 0, 0.05), rgba(0, 0, 0, 0.55));
  transition: opacity 0.3s;
}
.yt-play {
  position: relative; display: grid; place-items: center;
  width: 84px; height: 84px; border-radius: 50%;
  background: var(--red); box-shadow: 0 10px 40px -6px var(--red-glow);
  transition: transform 0.3s var(--ease);
}
.yt-play .icon { font-size: 40px; margin-left: 5px; }
.yt:hover .yt-play { transform: scale(1.08); }
.yt-label {
  position: absolute; left: 20px; bottom: 16px;
  font-size: 14px; font-weight: 500; opacity: 0.9;
}

.feature-body {
  padding: clamp(28px, 4vw, 48px);
  display: flex; flex-direction: column; justify-content: center; gap: 18px;
}
.tag {
  align-self: flex-start;
  display: inline-flex; align-items: center; gap: 6px;
  padding: 5px 12px; border-radius: 999px;
  background: rgba(237, 51, 46, 0.12); color: #ff7b6e;
  font-size: 12px; font-weight: 600; letter-spacing: 0.08em; text-transform: uppercase;
}
.feature-body h3 { font-size: clamp(28px, 3.4vw, 40px); font-weight: 800; }
.feature-body p { margin: 0; color: var(--muted); }
.feature-actions { display: grid; grid-template-columns: repeat(auto-fit, minmax(210px, 1fr)); gap: 10px; margin-top: 6px; }
.feature-actions .link-card { padding: 14px 16px; }

@media (max-width: 900px) {
  .feature { grid-template-columns: 1fr; }
}

/* ---------- Mobile games grid ---------- */

.games {
  display: grid; grid-template-columns: repeat(5, 1fr);
  gap: clamp(16px, 2vw, 24px);
  list-style: none; margin: 0; padding: 0;
}
.game { position: relative; }
.game-shot {
  aspect-ratio: 9 / 16; border-radius: var(--radius);
  padding: 6px; background: var(--surface-2);
  border: 1px solid var(--line);
  overflow: hidden;
  transition: transform 0.45s var(--ease), box-shadow 0.45s var(--ease), border-color 0.3s;
}
.game-shot img {
  width: 100%; height: 100%; object-fit: cover;
  border-radius: calc(var(--radius) - 6px);
  transition: transform 0.6s var(--ease);
}
.game:hover .game-shot {
  transform: translateY(-8px) rotate(-1.2deg);
  border-color: rgba(237, 51, 46, 0.5);
  box-shadow: 0 30px 50px -24px var(--red-glow);
}
.game:hover .game-shot img { transform: scale(1.04); }
.game h3 { margin: 16px 2px 10px; font-size: 17px; font-weight: 700; letter-spacing: -0.01em; }
.stores { display: flex; flex-direction: column; align-items: flex-start; gap: 6px; }
.stores a {
  display: inline-flex; align-items: center; gap: 6px;
  height: 30px; padding: 0 11px; border-radius: 999px;
  background: var(--surface-2); border: 1px solid var(--line);
  color: var(--muted); font-size: 12.5px; font-weight: 500; text-decoration: none; white-space: nowrap;
  transition: color 0.2s, border-color 0.2s, background 0.2s;
}
.stores a:hover { color: var(--text); border-color: var(--line-strong); background: var(--surface); }
.stores .icon { font-size: 13px; }

/* 10 games: 5 or 2 columns keep the rows even */
@media (max-width: 820px) {
  .games { grid-template-columns: repeat(2, 1fr); }
  .game h3 { font-size: 16px; }
}

/* ---------- Find us ---------- */

.links {
  display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px;
  list-style: none; margin: 0; padding: 0;
}
.link-card {
  --brand: var(--red);
  position: relative; display: flex; align-items: center; gap: 16px;
  padding: 20px; height: 100%;
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
  text-decoration: none; overflow: hidden;
  transition: border-color 0.25s, transform 0.3s var(--ease), background 0.25s;
}
.link-card:hover { transform: translateY(-3px); border-color: var(--line-strong); background: var(--surface-2); }
.link-card .badge {
  display: grid; place-items: center; flex: none;
  width: 48px; height: 48px; border-radius: 14px;
  background: color-mix(in srgb, var(--brand) 16%, transparent);
  color: var(--brand); font-size: 22px;
  transition: background 0.25s, color 0.25s;
}
.link-card:hover .badge { background: var(--brand); color: #fff; }
.link-card strong { display: block; font-weight: 600; }
.link-card small { display: block; color: var(--faint); font-size: 13px; line-height: 1.4; }
.link-card .go {
  margin-left: auto; color: var(--faint); font-size: 14px;
  transition: transform 0.25s var(--ease), color 0.25s;
}
.link-card:hover .go { color: var(--text); transform: translate(2px, -2px); }

.link-card.steam     { --brand: #66c0f4; }
.link-card.meta      { --brand: #0081fb; }
.link-card.play      { --brand: #34a853; }
.link-card.itch      { --brand: #fa5c5c; }
.link-card.discord   { --brand: #5865f2; }
.link-card.youtube   { --brand: #ff0033; }
.link-card.x         { --brand: #e7e7e7; }
.link-card.x:hover .badge { color: #000; }
.link-card.instagram { --brand: #e1306c; }
.link-card.linkedin  { --brand: #0a66c2; }

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

/* ---------- Contact ---------- */

.contact {
  position: relative; overflow: hidden;
  display: flex; align-items: center; justify-content: space-between; gap: 32px; flex-wrap: wrap;
  padding: clamp(32px, 5vw, 56px);
  border-radius: calc(var(--radius) + 6px);
  background:
    radial-gradient(120% 140% at 100% 0%, rgba(237, 51, 46, 0.28), transparent 55%),
    var(--surface);
  border: 1px solid var(--line);
}
.contact h2 { font-size: clamp(30px, 4.4vw, 46px); }
.contact p { margin: 12px 0 0; color: var(--muted); }
.contact-mail {
  display: inline-flex; align-items: center; gap: 12px;
  font-family: var(--font-display); font-weight: 700;
  font-size: clamp(18px, 2.4vw, 26px);
  text-decoration: none; word-break: break-all;
  border-bottom: 2px solid var(--red); padding-bottom: 4px;
  transition: color 0.2s;
}
.contact-mail:hover { color: #ff7b6e; }
.contact-mail .icon { color: var(--red); }

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

.site-footer {
  border-top: 1px solid var(--line);
  background: var(--bg-2);
  color: var(--faint); font-size: 14px;
}
.site-footer .wrap {
  display: flex; align-items: center; justify-content: space-between; gap: 20px 32px; flex-wrap: wrap;
  padding-top: 32px; padding-bottom: 32px;
}
.footer-meta { display: flex; flex-direction: column; gap: 4px; }
.footer-meta .brand { color: var(--text); }
.footer-meta .addr { display: inline-flex; align-items: center; gap: 8px; }
.footer-links { display: flex; flex-wrap: wrap; gap: 6px 22px; }
.footer-links a { color: var(--muted); text-decoration: none; }
.footer-links a:hover { color: var(--text); }
.socials { display: flex; gap: 6px; }
.socials a {
  display: grid; place-items: center; width: 38px; height: 38px; border-radius: 10px;
  color: var(--muted); font-size: 17px; transition: color 0.2s, background 0.2s;
}
.socials a:hover { color: var(--text); background: var(--surface-2); }

/* ---------- Legal / long-form pages ---------- */

.legal-hero {
  padding: clamp(48px, 8vw, 88px) 0 clamp(28px, 4vw, 40px);
  border-bottom: 1px solid var(--line);
  background: radial-gradient(80% 140% at 85% 0%, rgba(237, 51, 46, 0.16), transparent 60%);
}
.legal-hero h1 { font-size: clamp(36px, 6vw, 60px); font-weight: 900; }
.legal-hero p { margin: 14px 0 0; color: var(--muted); }

.prose {
  max-width: 760px;
  padding: clamp(32px, 5vw, 56px) 0 clamp(72px, 10vw, 112px);
  color: #d6d3dc;
  font-size: 16.5px; line-height: 1.75;
}
.prose h2 {
  font-size: clamp(24px, 3vw, 30px); font-weight: 800;
  margin: 2.4em 0 0.6em; color: var(--text);
}
.prose h3 { font-size: 20px; font-weight: 700; margin: 2em 0 0.5em; color: var(--text); }
.prose h4 { font-size: 16px; font-weight: 700; margin: 1.6em 0 0.4em; color: var(--text); letter-spacing: 0.01em; }
.prose > :first-child { margin-top: 0; }
.prose p { margin: 0 0 1em; }
.prose ul { margin: 0 0 1.2em; padding-left: 1.3em; }
.prose li { margin: 0.35em 0; }
.prose li::marker { color: var(--red); }
.prose li p { margin: 0; }
.prose a { color: #ff7b6e; text-underline-offset: 3px; }
.prose a:hover { color: var(--text); }
.prose strong { color: var(--text); }

/* ---------- Reveal on scroll ---------- */

.reveal { opacity: 0; transform: translateY(24px); transition: opacity 0.8s var(--ease), transform 0.8s var(--ease); }
.reveal.is-in { opacity: 1; transform: none; }
.no-js .reveal { opacity: 1; transform: none; }

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { transition: none !important; animation: none !important; }
  .reveal { opacity: 1; transform: none; }
}
