/* ==========================================================================
   EFFEKTER — allt som rör sig. Gäller bara när <body> har klassen .fx
   (Admin → Inställningar → Effekter) och besökaren inte bett om mindre
   rörelse i sitt operativsystem.
   ========================================================================== */

/* ---- Element som glider in vid scroll ------------------------------- */
.fx [data-reveal] {
  opacity: 0;
  transform: translateY(36px) scale(.985);
  transition: opacity var(--dur-slow) var(--ease-out), transform var(--dur-slow) var(--ease-out);
  transition-delay: calc(var(--i, 0) * 90ms);
}
.fx [data-reveal].is-in { opacity: 1; transform: none; }

/* ---- Hero: rubrikraderna sveper upp, planlinjerna ritas med krita ----- */
.fx .hero__line > span { transform: translateY(108%) rotate(2deg); animation: line-up 1.15s var(--ease-out) forwards; animation-delay: calc(var(--i) * 140ms + 200ms); }
@keyframes line-up { to { transform: none; } }

.fx .hero__pitch path, .fx .hero__pitch ellipse {
  stroke-dasharray: 1;
  stroke-dashoffset: 1;
  animation: draw 2.4s var(--ease-in-out) forwards;
}
.fx .hero__pitch path:nth-child(2) { animation-delay: .5s; }
.fx .hero__pitch ellipse { animation-delay: .9s; animation-duration: 2.8s; }
.fx .hero__pitch path:nth-child(4) { animation-delay: 1.3s; }
.fx .hero__spot { opacity: 0; animation: fade-in .6s ease 2.6s forwards; }
@keyframes draw { to { stroke-dashoffset: 0; } }
@keyframes fade-in { to { opacity: 1; } }

/* Strålkastarna sveper sakta, som på en arena innan avspark */
.fx .hero__beams i { animation: beam 9s var(--ease-in-out) infinite alternate; }
.fx .hero__beams i:last-child { animation-delay: -4.5s; }
@keyframes beam {
  from { transform: rotate(-30deg); opacity: .5; }
  to   { transform: rotate(-14deg); opacity: 1; }
}
.fx .hero__beams i:last-child { animation-name: beam-r; }
@keyframes beam-r {
  from { transform: rotate(30deg); opacity: .5; }
  to   { transform: rotate(14deg); opacity: 1; }
}

/* Ken Burns på toppbilden */
.fx .hero__img { animation: kenburns 22s ease-out both; }
@keyframes kenburns { from { transform: scale(1.14); } to { transform: scale(1); } }

/* ---- Guldglans som sveper över knappen -------------------------------- */
.btn--shine::after {
  content: "";
  position: absolute; inset: 0;
  z-index: -1;
  background: linear-gradient(105deg, transparent 35%, rgb(255 255 255 / .65) 50%, transparent 65%);
  transform: translateX(-120%);
  pointer-events: none;
}
.fx .btn--shine::after { animation: shine 3.6s var(--ease-in-out) 1.5s infinite; }
.btn--shine:hover::after { animation-duration: 1.1s; }
@keyframes shine { 0% { transform: translateX(-120%); } 40%, 100% { transform: translateX(120%); } }

/* ---- Kort som lyser där muspekaren är -------------------------------- */
.glow-card { position: relative; }
.fx .glow-card::after {
  content: "";
  position: absolute; inset: 0;
  border-radius: inherit;
  pointer-events: none;
  z-index: 1;
  opacity: 0;
  transition: opacity var(--dur);
  background: radial-gradient(440px circle at var(--mx, 50%) var(--my, 50%), color-mix(in srgb, var(--accent) 13%, transparent), transparent 45%);
}
.fx .glow-card::before {   /* glödande guldkant */
  content: "";
  position: absolute; inset: 0;
  border-radius: inherit;
  padding: 1.5px;
  pointer-events: none;
  z-index: 4;
  opacity: 0;
  transition: opacity var(--dur);
  background: radial-gradient(280px circle at var(--mx, 50%) var(--my, 50%), var(--accent), transparent 60%);
  -webkit-mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0);
  -webkit-mask-composite: xor;
          mask-composite: exclude;
}
.fx .glow-card:hover::after, .fx .glow-card:hover::before { opacity: 1; }

/* ---- Affischer som lutar mot muspekaren (3D) --------------------------- */
.tilt-card, .fx .tilt-card[data-reveal].is-in { transform: perspective(1100px) rotateX(var(--rx, 0deg)) rotateY(var(--ry, 0deg)) translateY(var(--lift, 0)); }
.fx .tilt-card { transition: transform .6s var(--ease-out), box-shadow var(--dur), opacity var(--dur-slow) var(--ease-out); }
.fx .tilt-card.is-tilting { transition: transform .12s linear, box-shadow var(--dur); }
.event-card__shine {
  position: absolute; inset: 0; z-index: 1; pointer-events: none;
  background: linear-gradient(115deg, transparent 30%, rgb(255 236 170 / .28) 46%, rgb(255 255 255 / .05) 54%, transparent 70%);
  background-size: 250% 100%;
  background-position: var(--shine, 120%) 0;
  opacity: 0;
  transition: opacity var(--dur);
  mix-blend-mode: screen;
}
.fx .tilt-card:hover .event-card__shine, .fx .tilt-card.is-tilting .event-card__shine { opacity: 1; }
/* Eventkorten: när de glider in vid scroll används transform redan — tilt tar över först efter */
.fx .event-card[data-reveal]:not(.is-in) { transform: translateY(40px) rotateX(8deg); }

/* ---- Stjärnan ----------------------------------------------------------- */
.fx .empty-state__star, .fx .cta-band__star, .fx .poster__star { animation: spin-slow 16s linear infinite; }
.fx .signup__star { animation: spin-slow 40s linear infinite; }
.fx .logo-star { animation: star-in 1.4s var(--ease-out) both; }
@keyframes star-in { from { transform: rotate(-180deg) scale(.4); opacity: 0; } }

/* ---- Matchklockan: 00:00 → 90:00 när man scrollar ---------------------- */
.match-clock {
  position: fixed;
  left: max(1rem, env(safe-area-inset-left));
  bottom: max(1rem, env(safe-area-inset-bottom));
  z-index: 40;
  display: flex; align-items: center; gap: .55rem;
  padding: .4rem .45rem .4rem .8rem;
  border-radius: 999px;
  background: color-mix(in srgb, #070708 82%, transparent);
  color: #fff;
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  box-shadow: inset 0 0 0 1px rgb(255 255 255 / .16), 0 10px 30px -10px rgb(0 0 0 / .6);
  font-variant-numeric: tabular-nums;
  opacity: 0;
  transform: translateY(20px);
  transition: opacity var(--dur), transform var(--dur) var(--ease-out), box-shadow var(--dur);
  pointer-events: none;
}
.match-clock.is-visible { opacity: 1; transform: none; }
.match-clock.is-visible.is-hidden { opacity: 0; transform: translateY(20px); }
.match-clock.is-full { box-shadow: inset 0 0 0 1px var(--accent), var(--glow); }
.match-clock__live { width: 8px; height: 8px; border-radius: 50%; background: var(--danger); animation: live 1.4s ease-in-out infinite; color: var(--danger); }
.match-clock.is-full .match-clock__live, .match-clock.is-half .match-clock__live { background: var(--accent); color: var(--accent); }
.match-clock__time { font-family: var(--font-display); font-weight: 900; font-stretch: 112%; font-size: 1.05rem; line-height: 1; min-width: 4.4ch; text-align: right; letter-spacing: .02em; }
.match-clock__ring { position: relative; display: grid; place-items: center; width: 34px; height: 34px; }
.match-clock__ring svg { position: absolute; inset: 0; transform: rotate(-90deg); fill: none; stroke-width: 3; }
.match-clock__ring circle { stroke: rgb(255 255 255 / .14); }
.match-clock__ring .match-clock__arc { stroke: var(--accent); stroke-dasharray: 100; stroke-dashoffset: calc(100 - var(--progress, 0) * 100); stroke-linecap: round; }
.match-clock__ball { width: 18px; height: 18px; transform: rotate(calc(var(--progress, 0) * 1440deg)); }

/* ---- Siffror: räknas upp (JS), lite studs när de landar -------------- */
.fx .stat.is-in .stat__value { animation: settle .9s var(--ease-out) both; animation-delay: calc(var(--i, 0) * 90ms + .2s); }
@keyframes settle { 0% { letter-spacing: .1em; filter: blur(5px); } 100% { letter-spacing: 0; filter: none; } }

/* ---- Hörnflaggan på bilderna ritas in -------------------------------- */
.fx .split__corner path { stroke-dasharray: 1; stroke-dashoffset: 1; transition: stroke-dashoffset 1.2s var(--ease-out) .5s; }
.fx .split__media.is-in .split__corner path { stroke-dashoffset: 0; }

/* ---- Utan effekter --------------------------------------------------- */
.no-fx .marquee__track, .no-fx .marquee__star { animation: none; }
.no-fx .hero__pitch path, .no-fx .hero__pitch ellipse { stroke-dasharray: none; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .001ms !important; animation-iteration-count: 1 !important; transition-duration: .001ms !important; scroll-behavior: auto !important; }
  .fx [data-reveal] { opacity: 1; transform: none; }
  .fx .hero__line > span { transform: none; }
  .fx .hero__pitch path, .fx .hero__pitch ellipse { stroke-dashoffset: 0; }
  .marquee__track { animation: none; }
  .match-clock { display: none; }
  .tilt-card { transform: none !important; }
}

/* Toppbildens text animeras direkt när sidan laddas — den ska inte vänta på scroll */
.fx .hero [data-reveal] { transition: none; animation: rise .9s var(--ease-out) both; animation-delay: calc(var(--i, 0) * 130ms + 400ms); }
@keyframes rise { from { opacity: 0; transform: translateY(24px); } to { opacity: 1; transform: none; } }
