/* ===== Strona główna: Gry Olka i Marysi =====
   Styl "pudełka z klockami": kremowe tło w izometryczne klocki, grube kontury w kolorze --ink,
   twarde cienie, jaskrawe kolory zabawek. Fonty lokalne (podzbiory z tools/fonts.py). */

@font-face {
  font-family: 'Bungee';
  src: url('fonts/bungee.woff') format('woff');
  font-display: swap;
}
@font-face {
  font-family: 'Baloo 2';
  src: url('fonts/baloo2.woff') format('woff');
  font-weight: 400 800;
  font-display: swap;
}

:root {
  color-scheme: light;
  --ink: #1b1530;
  --ink-soft: #4a4262;
  --paper: #fff4dc;
  --yellow: #ffd23f;
  --red: #ff4b3e;
  --pink: #ff5fa8;
  --blue: #2d8cff;
  --green: #2fc25b;
  --violet: #b69cff;
  --display: 'Bungee', 'Arial Black', Impact, sans-serif;
  --body: 'Baloo 2', 'Trebuchet MS', 'Segoe UI', sans-serif;
  --wrap: 1180px;
}

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

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

body {
  margin: 0;
  min-height: 100vh;
  overflow-x: hidden;
  font-family: var(--body);
  font-size: 19px;
  font-weight: 500;
  line-height: 1.5;
  color: var(--ink);
  background-color: #fff1d2;
  /* izometryczne klocki (trzy odcienie kremu = trzy ściany klocka) */
  background-image:
    radial-gradient(ellipse 90% 60% at 50% -10%, rgba(255, 210, 63, .55), transparent 70%),
    linear-gradient(30deg, #fbe4b6 12%, transparent 12.5%, transparent 87%, #fbe4b6 87.5%, #fbe4b6),
    linear-gradient(150deg, #fbe4b6 12%, transparent 12.5%, transparent 87%, #fbe4b6 87.5%, #fbe4b6),
    linear-gradient(30deg, #fbe4b6 12%, transparent 12.5%, transparent 87%, #fbe4b6 87.5%, #fbe4b6),
    linear-gradient(150deg, #fbe4b6 12%, transparent 12.5%, transparent 87%, #fbe4b6 87.5%, #fbe4b6),
    linear-gradient(60deg, #fff8e8 25%, transparent 25.5%, transparent 75%, #fff8e8 75%, #fff8e8),
    linear-gradient(60deg, #fff8e8 25%, transparent 25.5%, transparent 75%, #fff8e8 75%, #fff8e8);
  background-size: 100% 900px, 56px 98px, 56px 98px, 56px 98px, 56px 98px, 56px 98px, 56px 98px;
  background-position: 0 0, 0 0, 0 0, 28px 49px, 28px 49px, 0 0, 28px 49px;
  background-repeat: no-repeat, repeat, repeat, repeat, repeat, repeat, repeat;
}

::selection { background: var(--yellow); color: var(--ink); }

.sr-only {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}

a:focus-visible {
  outline: 4px solid var(--ink);
  outline-offset: 5px;
  border-radius: 14px;
}

/* ---------- nagłówek: litery na klockach ---------- */

.hero {
  position: relative;
  max-width: var(--wrap);
  margin: 0 auto;
  padding: clamp(40px, 7vw, 88px) 20px clamp(40px, 6vw, 72px);
  text-align: center;
  perspective: 900px;
}

.blocks {
  margin: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: clamp(12px, 1.8vw, 20px);
  font-family: var(--display);
  font-weight: 400;
  line-height: 1;
}
.line {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  column-gap: clamp(14px, 2.4vw, 30px);
  row-gap: clamp(12px, 1.8vw, 20px);
}
.word { display: inline-flex; gap: clamp(4px, .7vw, 9px); }

.tile {
  --t: clamp(34px, 6.2vw, 68px);
  width: var(--t);
  height: var(--t);
  display: grid;
  place-items: center;
  padding-top: calc(var(--t) * .06);
  font-size: calc(var(--t) * .56);
  color: var(--ink);
  background: var(--c);
  border: clamp(3px, .35vw, 4px) solid var(--ink);
  border-radius: calc(var(--t) * .2);
  box-shadow:
    inset calc(var(--t) * .07) calc(var(--t) * .07) 0 rgba(255, 255, 255, .45),
    inset 0 calc(var(--t) * -.1) 0 rgba(0, 0, 0, .13),
    0 calc(var(--t) * .09) 0 var(--ink);
  transform: rotate(var(--r, 0deg));
  transition: translate .2s cubic-bezier(.3, 1.6, .5, 1), scale .2s;
  animation: drop .75s cubic-bezier(.3, 1.55, .5, 1) both;
  animation-delay: calc(var(--i) * 55ms + 120ms);
}
.line--big .tile { --t: clamp(64px, 12vw, 120px); }
.tile:hover { translate: 0 -10px; scale: 1.06; }

.t-y { --c: #ffd23f; }
.t-p { --c: #ff8cc6; }
.t-b { --c: #6fb3ff; }
.t-g { --c: #5fd889; }
.t-o { --c: #ffa94d; }
.t-c { --c: #5ee3f5; }
.t-r { --c: #ff7a6e; }
.t-v { --c: #b69cff; }

@keyframes drop {
  from { opacity: 0; transform: translateY(-90px) rotate(calc(var(--r, 0deg) * -4)); }
  60% { opacity: 1; }
  to { opacity: 1; transform: translateY(0) rotate(var(--r, 0deg)); }
}

.lead {
  max-width: 30ch;
  margin: clamp(26px, 3.5vw, 38px) auto 0;
  font-size: clamp(20px, 2.3vw, 25px);
  font-weight: 700;
  line-height: 1.35;
  text-wrap: balance;
  animation: fade-up .6s .9s ease-out both;
}

.quick {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 12px;
  margin-top: 24px;
  animation: fade-up .6s 1.05s ease-out both;
}
.quick a {
  font-family: var(--display);
  font-size: 15px;
  line-height: 1;
  color: var(--ink);
  text-decoration: none;
  background: var(--q);
  border: 3px solid var(--ink);
  border-radius: 999px;
  padding: 10px 16px 8px;
  box-shadow: 0 4px 0 var(--ink);
  transition: translate .15s, box-shadow .15s;
}
.quick a:hover { translate: 0 -2px; box-shadow: 0 6px 0 var(--ink); }
.quick a:active { translate: 0 3px; box-shadow: 0 1px 0 var(--ink); }
.q-klockowy { --q: #6fb3ff; }
.q-turbo { --q: var(--yellow); }
.q-obby { --q: #ff8cc6; }

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

/* obracające się klocki 3D w tle nagłówka */
.cube {
  --s: 64px;
  position: absolute;
  width: var(--s);
  height: var(--s);
  transform-style: preserve-3d;
  animation: spin 26s linear infinite;
  pointer-events: none;
}
.cube i {
  position: absolute;
  inset: 0;
  border: 4px solid var(--ink);
  border-radius: 7px;
  background: var(--f);
  box-shadow: inset 5px 5px 0 rgba(255, 255, 255, .35);
}
.cube i:nth-child(1) { --f: var(--c1); transform: translateZ(calc(var(--s) / 2)); }
.cube i:nth-child(2) { --f: var(--c2); transform: rotateY(90deg) translateZ(calc(var(--s) / 2)); }
.cube i:nth-child(3) { --f: var(--c1); transform: rotateY(180deg) translateZ(calc(var(--s) / 2)); }
.cube i:nth-child(4) { --f: var(--c2); transform: rotateY(-90deg) translateZ(calc(var(--s) / 2)); }
.cube i:nth-child(5) { --f: var(--c3); transform: rotateX(90deg) translateZ(calc(var(--s) / 2)); }
.cube i:nth-child(6) { --f: var(--c3); transform: rotateX(-90deg) translateZ(calc(var(--s) / 2)); }
.cube--a { --s: 70px; --c1: #ff8cc6; --c2: #ff5fa8; --c3: #ffd0e6; left: 6%; top: 17%; }
.cube--b { --s: 52px; --c1: #6fb3ff; --c2: #2d8cff; --c3: #c8e2ff; right: 7%; top: 30%; animation-duration: 21s; animation-direction: reverse; }
.cube--c { --s: 38px; --c1: #5fd889; --c2: #2fc25b; --c3: #c9f3d6; right: 15%; top: 72%; animation-duration: 17s; }

@keyframes spin {
  from { transform: rotateX(-22deg) rotateY(0deg); }
  to { transform: rotateX(-22deg) rotateY(360deg); }
}

/* ---------- gry ---------- */

/* kontener na całą szerokość okna: przycina obrócone ozdoby kolaży dopiero na krawędzi ekranu,
   żeby nie poszerzały strony (bez tego przewija się w bok na szerokościach ok. 600-760 px) */
.games {
  padding-top: clamp(24px, 4vw, 48px);
  display: grid;
  gap: clamp(72px, 10vw, 130px);
  overflow-x: clip;
}

.game {
  --accent: var(--blue);
  --tint: #d3e7ff;
  --tag: var(--green);
  width: 100%;
  max-width: var(--wrap);
  margin: 0 auto;
  padding: 0 20px;
  display: grid;
  grid-template-columns: minmax(0, 1.12fr) minmax(0, .88fr);
  align-items: center;
  gap: clamp(36px, 5vw, 72px);
  scroll-margin-top: 28px;
}
.game--turbo { --accent: var(--yellow); --tint: #fff0b8; --tag: #ff7a6e; }
.game--obby { --accent: var(--pink); --tint: #ffd9ec; --tag: var(--violet); }
.game:nth-child(even) .game__media { order: 2; }

/* kolaż zrzutów: duży kadr + dwa naklejone mniejsze */
.game__media {
  position: relative;
  isolation: isolate;
  padding-bottom: 17%;
}
.game__media::before {
  content: '';
  position: absolute;
  inset: 11% -5% 1% 8%;
  z-index: -1;
  background: var(--accent);
  border: 4px solid var(--ink);
  border-radius: 30px;
  rotate: 2.5deg;
}
.game:nth-child(even) .game__media::before { inset: 11% 8% 1% -5%; rotate: -2.5deg; }

.shot {
  display: block;
  overflow: hidden;
  background: var(--ink);
  border: 4px solid var(--ink);
  border-radius: 18px;
  box-shadow: 10px 10px 0 var(--ink);
  transition: rotate .4s cubic-bezier(.3, 1.4, .5, 1), translate .4s cubic-bezier(.3, 1.4, .5, 1), box-shadow .4s;
}
.shot img { display: block; width: 100%; height: auto; }
.shot--main { rotate: -1.6deg; }
.shot--a, .shot--b {
  position: absolute;
  bottom: 0;
  width: 45%;
  border-radius: 14px;
  box-shadow: 6px 6px 0 var(--ink);
}
.shot--a { left: -2%; rotate: 3.5deg; }
.shot--b { right: -2.5%; rotate: -3.5deg; }

.game:hover .shot--main { rotate: 0deg; translate: 0 -6px; box-shadow: 14px 16px 0 var(--ink); }
.game:hover .shot--a { rotate: -2deg; translate: -10px 8px; }
.game:hover .shot--b { rotate: 3deg; translate: 10px 8px; }

.game__who {
  display: inline-block;
  margin: 0 0 16px;
  padding: 7px 13px 5px;
  font-family: var(--display);
  font-size: 15px;
  line-height: 1.1;
  background: var(--tag);
  border: 3px solid var(--ink);
  border-radius: 10px;
  box-shadow: 0 4px 0 var(--ink);
  rotate: -3deg;
}

.game__title {
  margin: 0;
  font-family: var(--display);
  font-weight: 400;
  font-size: clamp(40px, 5.2vw, 64px);
  line-height: 1.04;
  color: var(--accent);
  /* kontur i "wytłoczenie" jak w logach gier */
  text-shadow:
    3px 0 0 var(--ink), -3px 0 0 var(--ink), 0 3px 0 var(--ink), 0 -3px 0 var(--ink),
    2px 2px 0 var(--ink), -2px 2px 0 var(--ink), 2px -2px 0 var(--ink), -2px -2px 0 var(--ink),
    0 8px 0 var(--ink);
}

.game__desc {
  max-width: 46ch;
  margin: 20px 0 0;
  font-size: clamp(18px, 1.55vw, 20px);
  text-wrap: pretty;
}

.chips {
  list-style: none;
  display: flex;
  flex-wrap: wrap;
  gap: 9px;
  margin: 20px 0 0;
  padding: 0;
}
.chips li {
  padding: 7px 13px 5px;
  font-size: 16px;
  font-weight: 700;
  line-height: 1.2;
  white-space: nowrap;
  background: #fff;
  border: 3px solid var(--ink);
  border-radius: 999px;
  box-shadow: 0 3px 0 var(--ink);
}
.chips li:nth-child(odd) { background: var(--tint); }

.game__keys {
  margin: 18px 0 0;
  font-size: 16px;
  font-weight: 600;
  line-height: 1.9;
  color: var(--ink-soft);
}
kbd {
  display: inline-block;
  min-width: 26px;
  margin: 0 2px;
  padding: 3px 6px 1px;
  font-family: var(--display);
  font-size: 12px;
  line-height: 1.4;
  text-align: center;
  color: var(--ink);
  background: #fff;
  border: 2px solid var(--ink);
  border-radius: 7px;
  box-shadow: 0 3px 0 var(--ink);
}

.play {
  display: inline-flex;
  align-items: center;
  gap: 14px;
  margin-top: 26px;
  padding: 15px 26px 12px 32px;
  font-family: var(--display);
  font-size: clamp(26px, 2.6vw, 32px);
  line-height: 1;
  color: var(--ink);
  text-decoration: none;
  background: var(--accent);
  border: 4px solid var(--ink);
  border-radius: 18px;
  box-shadow: inset 0 -6px 0 rgba(0, 0, 0, .12), 0 8px 0 var(--ink);
  transition: translate .12s, box-shadow .12s;
}
.play svg { width: .95em; height: .95em; margin-top: -3px; fill: currentColor; transition: translate .2s; }
.play:hover { translate: 0 -3px; box-shadow: inset 0 -6px 0 rgba(0, 0, 0, .12), 0 11px 0 var(--ink); }
.play:hover svg { translate: 4px 0; }
.play:active { translate: 0 6px; box-shadow: inset 0 -3px 0 rgba(0, 0, 0, .12), 0 2px 0 var(--ink); }

/* wjazd sekcji przy przewijaniu (tam, gdzie przeglądarka to obsługuje) */
@supports (animation-timeline: view()) {
  .game {
    animation: rise linear both;
    animation-timeline: view();
    animation-range: entry 0% entry 45%;
  }
  @keyframes rise {
    from { opacity: 0; translate: 0 70px; }
    to { opacity: 1; translate: 0 0; }
  }
}

/* ---------- stopka ---------- */

.info {
  max-width: var(--wrap);
  margin: clamp(90px, 12vw, 150px) auto 0;
  padding: 0 20px 56px;
}
.info h2 {
  margin: 0 0 26px;
  font-family: var(--display);
  font-weight: 400;
  font-size: clamp(26px, 3vw, 34px);
  text-align: center;
}
.facts {
  list-style: none;
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 22px;
  margin: 0;
  padding: 0;
}
.facts li {
  padding: 20px 22px 22px;
  background: #fff;
  border: 4px solid var(--ink);
  border-radius: 22px;
  box-shadow: 8px 8px 0 var(--ink);
}
.facts li:nth-child(1) { rotate: -1deg; }
.facts li:nth-child(2) { rotate: .8deg; }
.facts li:nth-child(3) { rotate: -.6deg; }
.facts svg {
  width: 52px;
  height: 52px;
  stroke: var(--ink);
  stroke-width: 3;
  color: var(--ink);
}
.facts h3 {
  margin: 10px 0 6px;
  font-family: var(--display);
  font-weight: 400;
  font-size: 19px;
}
.facts p { margin: 0; font-size: 17px; line-height: 1.45; text-wrap: pretty; }

.bye {
  margin: 56px 0 0;
  font-family: var(--display);
  font-size: clamp(24px, 3vw, 30px);
  text-align: center;
  color: var(--pink);
  text-shadow:
    2px 0 0 var(--ink), -2px 0 0 var(--ink), 0 2px 0 var(--ink), 0 -2px 0 var(--ink),
    2px 2px 0 var(--ink), -2px 2px 0 var(--ink), 2px -2px 0 var(--ink), -2px -2px 0 var(--ink),
    0 5px 0 var(--ink);
}

/* ---------- mniejsze ekrany ---------- */

@media (max-width: 999px) {
  .game { grid-template-columns: minmax(0, 1fr); gap: 34px; }
  .game:nth-child(even) .game__media { order: 0; }
  .game__media { max-width: 720px; width: 100%; margin: 0 auto; }
  .game__info { max-width: 720px; width: 100%; margin: 0 auto; }
  .cube--a { left: 3%; top: 8%; --s: 54px; }
  .cube--b { right: 3%; top: 14%; --s: 42px; }
  .cube--c { display: none; }
}

@media (max-width: 760px) {
  body { font-size: 18px; }
  .facts { grid-template-columns: minmax(0, 1fr); }
  .facts li { rotate: 0deg !important; }
  .game__media::before { inset: 10% -2.5% 1% 6%; }
  .game:nth-child(even) .game__media::before { inset: 10% 6% 1% -2.5%; }
  .shot { box-shadow: 7px 7px 0 var(--ink); }
  .shot--a, .shot--b { box-shadow: 4px 4px 0 var(--ink); border-width: 3px; }
}

@media (max-width: 560px) {
  .cube { display: none; }
  .game__media { padding-bottom: 19%; }
  .play { width: 100%; justify-content: center; }
}

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