/* självhostade typsnitt (SIL Open Font License, se fonts/OFL-*.txt) */
@font-face{font-family:'Press Start 2P';font-style:normal;font-weight:400;font-display:swap;src:url(fonts/press-start-2p-latin-ext.woff2) format('woff2');unicode-range:U+0100-02BA,U+02BD-02C5,U+02C7-02CC,U+02CE-02D7,U+02DD-02FF,U+0304,U+0308,U+0329,U+1D00-1DBF,U+1E00-1E9F,U+1EF2-1EFF,U+2020,U+20A0-20AB,U+20AD-20C0,U+2113,U+2C60-2C7F,U+A720-A7FF}
@font-face{font-family:'Press Start 2P';font-style:normal;font-weight:400;font-display:swap;src:url(fonts/press-start-2p-latin.woff2) format('woff2');unicode-range:U+0000-00FF,U+0131,U+0152-0153,U+02BB-02BC,U+02C6,U+02DA,U+02DC,U+0304,U+0308,U+0329,U+2000-206F,U+20AC,U+2122,U+2191,U+2193,U+2212,U+2215,U+FEFF,U+FFFD}
@font-face{font-family:'Rubik';font-style:normal;font-weight:400 600;font-display:swap;src:url(fonts/rubik-latin-ext.woff2) format('woff2');unicode-range:U+0100-02BA,U+02BD-02C5,U+02C7-02CC,U+02CE-02D7,U+02DD-02FF,U+0304,U+0308,U+0329,U+1D00-1DBF,U+1E00-1E9F,U+1EF2-1EFF,U+2020,U+20A0-20AB,U+20AD-20C0,U+2113,U+2C60-2C7F,U+A720-A7FF}
@font-face{font-family:'Rubik';font-style:normal;font-weight:400 600;font-display:swap;src:url(fonts/rubik-latin.woff2) format('woff2');unicode-range:U+0000-00FF,U+0131,U+0152-0153,U+02BB-02BC,U+02C6,U+02DA,U+02DC,U+0304,U+0308,U+0329,U+2000-206F,U+20AC,U+2122,U+2191,U+2193,U+2212,U+2215,U+FEFF,U+FFFD}

:root {
  --bg: #07060c;
  --fg: #f4f0e8;
  --muted: #a9a3b8;
  --line: rgba(255, 255, 255, .12);
  --hot-1: #ffd25a;
  --hot-2: #ff5a36;
  --cold-1: #e6fbff;
  --cold-2: #4cc3ff;
  --pixel: 'Press Start 2P', ui-monospace, monospace;
  --text: Rubik, system-ui, -apple-system, 'Segoe UI', sans-serif;
  color-scheme: dark;
}

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

html { background: var(--bg); }

body {
  margin: 0;
  min-height: 100vh;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  color: var(--fg);
  font-family: var(--text);
  line-height: 1.5;
  background:
    radial-gradient(60vmax 50vmax at -10% -10%, rgba(255, 90, 54, .22), transparent 60%),
    radial-gradient(60vmax 50vmax at 110% 110%, rgba(76, 195, 255, .2), transparent 60%),
    var(--bg);
  background-attachment: fixed;
  overflow-x: hidden;
  padding: env(safe-area-inset-top) env(safe-area-inset-right) env(safe-area-inset-bottom) env(safe-area-inset-left);
}

/* scanlines */
body::after {
  content: '';
  position: fixed;
  inset: 0;
  pointer-events: none;
  background: repeating-linear-gradient(to bottom, rgba(255, 255, 255, .025) 0 1px, transparent 1px 3px);
  z-index: 50;
}

#sky {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: 0;
}

.hero, main, .foot { position: relative; z-index: 1; }

/* --- rubrik --- */
.hero {
  text-align: center;
  padding: clamp(16px, 4vh, 48px) 16px 0;
}

.kicker {
  margin: 0 0 18px;
  font-family: var(--pixel);
  font-size: 10px;
  letter-spacing: .3em;
  text-transform: uppercase;
  color: var(--muted);
}

@media (max-height: 760px) { .kicker { display: none; } }

/* loggan krymper på låga skärmar så att karusellen alltid får plats utan att sidan scrollar */
.logo {
  --logo-h: clamp(110px, calc(100dvh - 640px), 346px);
  margin: 0 auto;
  width: min(100%, calc(var(--logo-h) * 1.79));
  container-type: inline-size;
}

/* bildens mörka bakgrund tonas ut i kanterna så loggan flyter i sidan */
.logo img {
  display: block;
  width: 100%;
  height: auto;
  margin: -3.4cqi 0 -4.5cqi;
  --fade: linear-gradient(to right, transparent 8%, #000 18%, #000 84%, transparent 94%),
          linear-gradient(to bottom, transparent 0%, #000 10%, #000 88%, transparent 100%);
  -webkit-mask-image: var(--fade);
  -webkit-mask-composite: source-in;
  mask-image: var(--fade);
  mask-composite: intersect;
  animation: rise .8s cubic-bezier(.2, .8, .2, 1) both, float 6s ease-in-out .8s infinite;
}

@keyframes float { 50% { transform: translateY(-6px); } }
@keyframes pulse { 50% { opacity: .55; transform: scale(.92); } }

.lead {
  margin: 12px 0 0;
  color: var(--muted);
  font-size: 15px;
}

kbd {
  display: inline-block;
  min-width: 1.8em;
  padding: 1px 6px;
  margin: 0 2px;
  border: 1px solid var(--line);
  border-bottom-width: 2px;
  border-radius: 6px;
  font: 600 12px/1.6 var(--text);
  text-align: center;
  color: var(--fg);
  background: rgba(255, 255, 255, .06);
}

/* --- spelkarusell --- */
main {
  flex: 1;
  display: flex;
  flex-direction: column;
  justify-content: center;
  width: 100%;
  padding-bottom: 4px;
}

.carousel {
  --card-w: min(400px, 78vw);
  position: relative;
}

.games {
  position: relative;
  list-style: none;
  margin: 0;
  display: flex;
  gap: clamp(12px, 2.5vw, 28px);
  /* sidopadding gör att första och sista kortet också kan hamna i mitten */
  padding: 18px calc(50% - var(--card-w) / 2);
  overflow-x: auto;
  overscroll-behavior-x: contain;
  scroll-snap-type: x mandatory;
  scrollbar-width: none;
  -webkit-mask-image: linear-gradient(to right, transparent, #000 12%, #000 88%, transparent);
  mask-image: linear-gradient(to right, transparent, #000 12%, #000 88%, transparent);
}

.games::-webkit-scrollbar { display: none; }

.card {
  --accent: #fff;
  flex: 0 0 var(--card-w);
  scroll-snap-align: center;
  perspective: 900px;
  scale: .88;
  transition: scale .35s cubic-bezier(.2, .8, .2, 1);
  animation: rise .7s cubic-bezier(.2, .8, .2, 1) both;
  animation-delay: calc(var(--i, 0) * 90ms + 150ms);
}

.card.active { scale: 1; }
.card:not(.active) .card-link { filter: brightness(.5) saturate(.6); cursor: pointer; }
.card:not(.active) a.card-link:hover { filter: brightness(.75) saturate(.8); }

.arrow {
  position: absolute;
  z-index: 2;
  top: 50%;
  translate: 0 -50%;
  display: grid;
  place-items: center;
  width: 44px;
  height: 44px;
  padding: 0;
  border: 1px solid var(--line);
  border-radius: 12px;
  color: var(--fg);
  background: rgba(20, 18, 30, .75);
  cursor: pointer;
  transition: background .2s, border-color .2s, opacity .2s;
}

.arrow::before {
  content: '';
  border-style: solid;
  border-width: 7px 0 7px 11px;
  border-color: transparent transparent transparent currentColor;
}

.arrow.prev { left: max(8px, calc(50% - var(--card-w) / 2 - 72px)); }
.arrow.prev::before { rotate: 180deg; }
.arrow.next { right: max(8px, calc(50% - var(--card-w) / 2 - 72px)); }
.arrow:hover:not(:disabled) { border-color: var(--fg); background: rgba(40, 36, 58, .9); }
.arrow:disabled { opacity: .25; cursor: default; }

@media (hover: none) { .arrow { display: none; } }

.dots {
  display: flex;
  justify-content: center;
  gap: 8px;
}

.dots button {
  width: 10px;
  height: 10px;
  padding: 0;
  border: 0;
  border-radius: 5px;
  background: var(--line);
  cursor: pointer;
  transition: width .3s, background .3s;
}

.dots button[aria-current='true'] { width: 26px; background: var(--fg); }
.dots[hidden] { display: none; }

/* få kort: en vanlig centrerad rad i stället för karusell (klassen sätts av layout() i menu.js) */
.carousel.static .games {
  justify-content: center;
  padding-inline: 16px;
  overflow: visible;
  -webkit-mask-image: none;
  mask-image: none;
}

.carousel.static .card { flex: 0 1 var(--card-w); min-width: 0; scale: 1; }
.carousel.static .card:not(.active) .card-link { filter: none; }
.carousel.static .arrow { display: none; }

@keyframes rise { from { opacity: 0; transform: translateY(28px); } }

.card-link {
  --rx: 0deg;
  --ry: 0deg;
  position: relative;
  display: flex;
  flex-direction: column;
  height: 100%;
  border-radius: 18px;
  overflow: hidden;
  color: inherit;
  text-decoration: none;
  background: linear-gradient(180deg, rgba(255, 255, 255, .06), rgba(255, 255, 255, .02));
  border: 1px solid var(--line);
  box-shadow: 0 18px 40px -20px rgba(0, 0, 0, .8);
  transform: rotateX(var(--rx)) rotateY(var(--ry));
  transition: transform .25s ease-out, border-color .2s, box-shadow .25s, filter .35s;
  outline: none;
}

/* glans som följer pekaren */
.card-link::after {
  content: '';
  position: absolute;
  inset: 0;
  pointer-events: none;
  background: radial-gradient(400px circle at var(--gx, 50%) var(--gy, 0%), color-mix(in srgb, var(--accent) 22%, transparent), transparent 55%);
  opacity: 0;
  transition: opacity .25s;
}

a.card-link:hover, a.card-link:focus-visible {
  border-color: var(--accent);
  box-shadow:
    0 0 0 1px var(--accent),
    0 0 36px -4px color-mix(in srgb, var(--accent) 60%, transparent),
    0 26px 50px -22px rgba(0, 0, 0, .9);
}

a.card-link:hover::after, a.card-link:focus-visible::after { opacity: 1; }

.shot {
  position: relative;
  aspect-ratio: 2 / 1;
  overflow: hidden;
  background: color-mix(in srgb, var(--accent) 18%, #111);
}

.shot img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
  transform: scale(1.02);
  transition: transform .6s cubic-bezier(.2, .8, .2, 1), filter .4s;
  filter: saturate(.85) brightness(.9);
}

a.card-link:hover .shot img, a.card-link:focus-visible .shot img {
  transform: scale(1.08);
  filter: saturate(1.1) brightness(1);
}

.shot::after {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(to top, rgba(10, 9, 16, .85), transparent 55%);
}

.badge {
  position: absolute;
  z-index: 1;
  top: 12px;
  left: 12px;
  padding: 6px 8px;
  font-family: var(--pixel);
  font-size: 9px;
  letter-spacing: .1em;
  color: #0b0a10;
  background: var(--accent);
  border-radius: 6px;
  box-shadow: 3px 3px 0 rgba(0, 0, 0, .5);
}

.body {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 18px 20px 64px;
}

.title {
  margin: -34px 0 2px;
  position: relative;
  font-family: var(--pixel);
  font-weight: 400;
  font-size: clamp(16px, 2vw, 20px);
  line-height: 1.3;
  color: #fff;
  text-shadow: 3px 3px 0 color-mix(in srgb, var(--accent) 55%, #000);
}

.tagline {
  margin: 0;
  font-weight: 600;
  color: var(--accent);
}

.desc {
  margin: 0;
  font-size: 14px;
  color: var(--muted);
}

.chips {
  list-style: none;
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin: 6px 0 0;
  padding: 0;
}

.chips li {
  padding: 3px 9px;
  font-size: 12px;
  border-radius: 999px;
  border: 1px solid var(--line);
  color: var(--fg);
  background: rgba(255, 255, 255, .04);
}

.play {
  position: absolute;
  right: 18px;
  bottom: 18px;
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 10px 14px 10px 16px;
  font-family: var(--pixel);
  font-size: 11px;
  letter-spacing: .08em;
  text-transform: uppercase;
  color: #0b0a10;
  background: var(--accent);
  border-radius: 10px;
  box-shadow: 4px 4px 0 rgba(0, 0, 0, .55);
  transition: transform .2s, box-shadow .2s;
}

.play::after {
  content: '';
  width: 0;
  height: 0;
  border-style: solid;
  border-width: 5px 0 5px 8px;
  border-color: transparent transparent transparent currentColor;
}

a.card-link:hover .play, a.card-link:focus-visible .play {
  animation: nudge .9s ease-in-out infinite;
}

a.card-link:active .play {
  transform: translate(3px, 3px);
  box-shadow: 1px 1px 0 rgba(0, 0, 0, .55);
}

@keyframes nudge { 50% { transform: translateX(4px); } }

/* kort som inte är klara än */
.card.soon .card-link { opacity: .6; }
.card.soon .shot img { filter: grayscale(1) brightness(.6); }

/* spel utan touchstöd på en mobil */
.kit-note {
  margin: 4px 0 0;
  font-size: 13px;
  color: var(--hot-1);
}

.kit-note::before { content: '⚠ '; }

.warn {
  --accent: #fff;
  width: min(360px, calc(100% - 32px));
  padding: 22px 22px 18px;
  color: var(--fg);
  font-family: var(--text);
  background: #14121d;
  border: 1px solid color-mix(in srgb, var(--accent) 55%, transparent);
  border-radius: 16px;
  box-shadow: 0 0 40px -8px color-mix(in srgb, var(--accent) 45%, transparent), 0 24px 60px -20px #000;
}

.warn::backdrop { background: rgba(7, 6, 12, .7); backdrop-filter: blur(3px); }
.warn[open] { animation: rise .3s cubic-bezier(.2, .8, .2, 1); }

.warn-title { margin: 0 0 8px; font-size: 17px; font-weight: 600; line-height: 1.35; }
.warn-text { margin: 0 0 18px; font-size: 14px; color: var(--muted); }

.warn-actions { display: flex; gap: 10px; justify-content: flex-end; }

.warn-actions button {
  padding: 10px 16px;
  font: 600 14px var(--text);
  border-radius: 10px;
  cursor: pointer;
}

.warn-back { color: var(--fg); background: transparent; border: 1px solid var(--line); }
.warn-play { color: #0b0a10; background: var(--accent); border: 1px solid var(--accent); }
.warn-actions button:focus-visible { outline: 2px solid var(--fg); outline-offset: 2px; }

.card.teaser .card-link {
  align-items: center;
  justify-content: center;
  gap: 14px;
  min-height: 260px;
  border: 2px dashed var(--line);
  background: transparent;
  box-shadow: none;
}

.teaser-icon {
  display: grid;
  place-items: center;
  width: 54px;
  height: 54px;
  font-family: var(--pixel);
  font-size: 22px;
  border-radius: 14px;
  background: linear-gradient(135deg, var(--hot-2), var(--cold-2));
  color: #0b0a10;
  animation: pulse 2.4s ease-in-out infinite;
}

.teaser-text {
  margin: 0;
  font-family: var(--pixel);
  font-size: 10px;
  letter-spacing: .12em;
  text-transform: uppercase;
  color: var(--muted);
}

/* --- sidfot --- */
.foot {
  padding: 4px 16px 16px;
  text-align: center;
  font-size: 13px;
  color: var(--muted);
}

.foot p { margin: 6px 0; }

@media (hover: none) { .hint { display: none; } }

.noscript { position: relative; z-index: 1; text-align: center; }

/* --- övergång när ett spel startar --- */
body::before {
  content: '';
  position: fixed;
  inset: 0;
  z-index: 100;
  pointer-events: none;
  background: var(--launch, #fff);
  clip-path: circle(0% at 50% 50%);
  transition: clip-path .42s cubic-bezier(.7, 0, .3, 1);
}

body.launching::before { clip-path: circle(150% at 50% 50%); }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation: none !important;
    transition: none !important;
  }
  .card-link { transform: none; }
}
