/* Teaser: en dörr på glänt mitt i natten, med festljus som läcker ut.
   Ren CSS – sajtens CSP tillåter inga skript. */
@font-face {
  font-family: "Fredoka";
  font-style: normal;
  font-weight: 400 700;
  font-display: swap;
  src: url("/fonts/fredoka-latin.woff2") format("woff2");
}

:root {
  --night: #120626;
  --night-2: #1E0B3E;
  --wood: #2B1553;
  --wood-edge: #3D1F70;
  --glow: #FFE2A8;
  --pink: #FF3EA5;
  --cyan: #22D3EE;
  --yellow: #FFD23F;
  --text: #F3EEFF;
  --muted: #B4A6D6;
}

* { box-sizing: border-box; margin: 0; padding: 0; }
html { color-scheme: dark; overflow-x: clip; }
body {
  min-height: 100vh;
  font-family: "Fredoka", ui-rounded, system-ui, sans-serif;
  color: var(--text);
  background:
    radial-gradient(ellipse 70% 45% at 50% 38%, rgba(255, 62, 165, .13), transparent 70%),
    radial-gradient(ellipse 120% 80% at 50% 120%, var(--night-2), var(--night) 60%);
  line-height: 1.5;
  display: flex; flex-direction: column; align-items: center;
  overflow-x: clip;
}
a { color: inherit; }
img { display: block; max-width: 100%; height: auto; }

.top { width: min(1080px, 100% - 2.5rem); display: flex; justify-content: space-between; align-items: center; padding: 1.4rem 0; }
.top img { height: 34px; width: auto; opacity: .92; }
.lang { color: var(--muted); text-decoration: none; font-size: .95rem; padding: .35rem .85rem; border-radius: 999px; border: 1px solid rgba(255, 255, 255, .14); }
.lang:hover { color: var(--text); border-color: rgba(255, 255, 255, .35); }

main { width: min(640px, 100% - 2.5rem); display: flex; flex-direction: column; align-items: center; text-align: center; padding-bottom: 4rem; }

/* ---------- Lobbykoden ovanför dörren: bokstäverna snurrar och stannar aldrig ---------- */
.code {
  display: flex; gap: .4rem; margin-top: clamp(.5rem, 3vh, 2rem); margin-bottom: 1.1rem;
  padding: .5rem .6rem; border-radius: 14px; background: rgba(0, 0, 0, .35);
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, .08), 0 0 30px rgba(34, 211, 238, .12);
}
.slot {
  width: 1.9rem; height: 2.4rem; overflow: hidden; border-radius: 8px;
  background: rgba(255, 255, 255, .06); font-weight: 700; font-size: 1.5rem; line-height: 2.4rem;
  color: var(--cyan); text-shadow: 0 0 12px rgba(34, 211, 238, .7);
}
.slot span { display: flex; flex-direction: column; animation: spin 6s steps(8) infinite; }
.slot i { display: block; height: 2.4rem; font-style: normal; text-align: center; }
.slot:nth-child(2) span { animation-duration: 4.4s; animation-delay: -1.2s; color: var(--pink); text-shadow: 0 0 12px rgba(255, 62, 165, .7); }
.slot:nth-child(3) span { animation-duration: 7.2s; animation-delay: -3s; color: var(--yellow); text-shadow: 0 0 12px rgba(255, 210, 63, .6); }
.slot:nth-child(4) span { animation-duration: 5.2s; animation-delay: -2.1s; }
@keyframes spin { to { transform: translateY(-19.2rem); } }

/* ---------- Dörren ---------- */
.door-scene { position: relative; width: clamp(130px, min(56vw, 22svh), 230px); margin-bottom: clamp(1.4rem, 4svh, 2.6rem); }
.door {
  position: relative; aspect-ratio: 5 / 8; border-radius: 999px 999px 8px 8px;
  padding: 9px; background: var(--wood-edge);
  box-shadow: 0 0 0 1px rgba(255, 255, 255, .06), 0 30px 80px rgba(0, 0, 0, .55);
  perspective: 700px;
}
.room {
  position: absolute; inset: 9px; border-radius: inherit; overflow: hidden;
  background: radial-gradient(ellipse at 50% 70%, var(--glow), #FF9BCF 45%, #7B2FF7 100%);
}
/* Festljus som skiftar därinne */
.room::before, .room::after {
  content: ""; position: absolute; width: 140%; height: 70%; left: -20%; border-radius: 50%;
  filter: blur(24px); mix-blend-mode: screen; opacity: .8;
}
.room::before { top: 0; background: var(--cyan); animation: lights 5s ease-in-out infinite alternate; }
.room::after { bottom: -10%; background: var(--pink); animation: lights 6.5s ease-in-out -2s infinite alternate-reverse; }
@keyframes lights { from { transform: translateX(-30%) scale(.9); } to { transform: translateX(30%) scale(1.1); } }
/* Skuggor av gäster som glider förbi bakom springan */
.guest {
  position: absolute; bottom: -8%; width: 34%; aspect-ratio: 1 / 2.2; border-radius: 50% 50% 40% 40% / 30% 30% 20% 20%;
  background: rgba(30, 8, 60, .75); filter: blur(5px); z-index: 1;
  animation: pass 9s ease-in-out infinite;
}
.guest::before { content: ""; position: absolute; left: 22%; top: -30%; width: 56%; aspect-ratio: 1; border-radius: 50%; background: inherit; }
.guest:nth-child(2) { width: 28%; animation-duration: 12s; animation-delay: -5s; }
.guest:nth-child(3) { width: 38%; animation-duration: 15s; animation-delay: -9s; animation-direction: reverse; }
@keyframes pass { 0% { left: -60%; } 45%, 55% { left: 30%; transform: translateY(-4%); } 100% { left: 130%; } }

/* Dörrbladen: öppnas på glänt när sidan laddas */
.leaf {
  position: absolute; top: 9px; bottom: 9px; width: calc(50% - 9px); z-index: 2;
  background: linear-gradient(180deg, var(--wood) 0%, #24104A 100%);
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, .05);
  backface-visibility: hidden;
}
.leaf.l { background: linear-gradient(90deg, #2E1759 0%, var(--wood) 60%, #170833 100%); }
.leaf.r { background: linear-gradient(270deg, #2E1759 0%, var(--wood) 60%, #170833 100%); }
.leaf::after { /* handtag */
  content: ""; position: absolute; top: 55%; width: 7px; height: 26px; border-radius: 4px; background: var(--yellow);
  box-shadow: 0 0 10px rgba(255, 210, 63, .6);
}
.leaf.l { left: 9px; border-radius: 999px 0 0 8px / 999px 0 0 8px; transform-origin: left center; animation: open-l 2.6s cubic-bezier(.6, 0, .2, 1) .4s both; }
.leaf.r { right: 9px; border-radius: 0 999px 8px 0 / 0 999px 8px 0; transform-origin: right center; animation: open-r 2.6s cubic-bezier(.6, 0, .2, 1) .4s both; }
.leaf.l::after { right: 10px; }
.leaf.r::after { left: 10px; }
@keyframes open-l { from { transform: rotateY(0); } to { transform: rotateY(calc(var(--open, 24deg) * -1)); } }
@keyframes open-r { from { transform: rotateY(0); } to { transform: rotateY(var(--open, 24deg)); } }

/* Ljuset som faller ut på golvet */
.spill {
  position: absolute; left: 50%; top: 100%; width: min(260%, 100vw); height: 150px; transform: translateX(-50%);
  background: radial-gradient(ellipse 50% 100% at 50% 0%, rgba(255, 190, 220, .55), rgba(255, 62, 165, .18) 45%, transparent 75%);
  clip-path: polygon(41% 0, 59% 0, 100% 100%, 0 100%);
  animation: spill 2.6s cubic-bezier(.6, 0, .2, 1) .4s both;
  pointer-events: none; z-index: -1;
}
@keyframes spill { from { opacity: 0; clip-path: polygon(50% 0, 50% 0, 50% 100%, 50% 100%); } }

/* ---------- Text och formulär ---------- */
h1 {
  font-size: clamp(2.1rem, 6.4vw, 3.4rem); font-weight: 700; line-height: 1.08; letter-spacing: -.02em;
  text-wrap: balance; animation: appear 1s ease-out 1.8s both;
}
.lead { margin-top: 1rem; color: var(--muted); font-size: clamp(1.05rem, 2.4vw, 1.2rem); max-width: 34em; text-wrap: pretty; animation: appear 1s ease-out 2s both; }
@keyframes appear { from { opacity: 0; transform: translateY(10px); } }

.join { width: 100%; margin-top: 2rem; animation: appear 1s ease-out 2.2s both; }
.field {
  display: flex; gap: .5rem; padding: .45rem; border-radius: 999px;
  background: rgba(255, 255, 255, .07); box-shadow: inset 0 0 0 1px rgba(255, 255, 255, .14), 0 0 60px rgba(255, 62, 165, .18);
  transition: box-shadow .2s;
}
.field:focus-within { box-shadow: inset 0 0 0 2px var(--cyan), 0 0 70px rgba(34, 211, 238, .25); }
.field input {
  flex: 1; min-width: 0; border: 0; background: transparent; color: var(--text);
  font: inherit; font-size: 1.1rem; padding: .7rem 1.1rem; outline: none;
}
.field input::placeholder { color: rgba(243, 238, 255, .45); }
.field button {
  flex: none; border: 0; cursor: pointer; font: inherit; font-weight: 600; font-size: 1.08rem;
  padding: .8rem 1.5rem; border-radius: 999px; color: #fff; background: var(--pink);
  box-shadow: 0 5px 0 #C21877; transform: translateY(-2px); transition: transform .1s, box-shadow .1s;
}
.field button:hover { background: #ff55b0; }
.field button:active { transform: translateY(2px); box-shadow: 0 1px 0 #C21877; }
.field button:focus-visible { outline: 3px solid var(--yellow); outline-offset: 3px; }
.privacy { margin-top: .9rem; font-size: .92rem; color: var(--muted); }
.privacy a { color: var(--text); text-decoration-color: var(--pink); text-underline-offset: 3px; }
.privacy a:focus-visible { outline: 2px solid var(--yellow); outline-offset: 2px; border-radius: 3px; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.trap { position: absolute; left: -9999px; width: 1px; height: 1px; overflow: hidden; }

@media (max-width: 520px) {
  .field { flex-direction: column; gap: .7rem; padding: 0; background: none; box-shadow: none; }
  .field:focus-within { box-shadow: none; }
  .field input {
    padding: .95rem 1.2rem; border-radius: 999px; text-align: center;
    background: rgba(255, 255, 255, .08); box-shadow: inset 0 0 0 1px rgba(255, 255, 255, .16);
  }
  .field input:focus { box-shadow: inset 0 0 0 2px var(--cyan); }
  .field button { width: 100%; padding: .95rem 1.5rem; }
  .code { margin-bottom: .8rem; }
  .slot { width: 1.6rem; height: 2rem; line-height: 2rem; font-size: 1.25rem; }
  .slot i { height: 2rem; }
  .slot span { animation-name: spin-sm; }
  .inside { margin-top: 2.5rem; }
  .top { padding: 1rem 0; }
}
@keyframes spin-sm { to { transform: translateY(-16rem); } }

/* Låga skärmar (mobil på tvären, små laptops): mindre dörr, tätare */
@media (max-height: 560px) {
  .door-scene { width: clamp(90px, 20svh, 140px); margin-bottom: 1.2rem; }
  .code { margin-top: 0; margin-bottom: .6rem; transform: scale(.85); }
  h1 { font-size: clamp(1.8rem, 5vw, 2.4rem); }
}

/* ---------- Siluetter av spellägena ---------- */
.inside { margin-top: 3.5rem; animation: appear 1s ease-out 2.5s both; }
.inside p { color: var(--muted); font-size: 1rem; }
.shadows { display: flex; flex-wrap: wrap; justify-content: center; gap: .9rem; margin-top: 1.1rem; }
.shadows img {
  width: clamp(44px, 11vw, 56px); height: auto; border-radius: 28%;
  filter: blur(5px) grayscale(1) brightness(.45); opacity: .8;
  transition: filter .35s, opacity .35s, transform .35s;
  animation: peek 16s ease-in-out infinite;
}
.shadows img:nth-child(2) { animation-delay: 2s; }
.shadows img:nth-child(3) { animation-delay: 4s; }
.shadows img:nth-child(4) { animation-delay: 6s; }
.shadows img:nth-child(5) { animation-delay: 8s; }
.shadows img:nth-child(6) { animation-delay: 10s; }
.shadows img:nth-child(7) { animation-delay: 12s; }
.shadows img:nth-child(8) { animation-delay: 14s; }
@keyframes peek {
  0%, 10%, 100% { filter: blur(5px) grayscale(1) brightness(.45); transform: none; }
  4%, 6% { filter: blur(0) grayscale(0) brightness(1); transform: translateY(-4px) rotate(-4deg); }
}
.shadows img:hover { animation-play-state: paused; filter: none; opacity: 1; transform: translateY(-4px) rotate(-4deg); }

/* ---------- Tack-sidan: dörren öppnas mer ---------- */
.leaf { --open: 34deg; }
.joined .leaf { --open: 68deg; }
.joined .spill { width: min(340%, 100vw); height: 190px; }

footer { margin-top: auto; padding: 2rem 0 2.5rem; color: rgba(180, 166, 214, .7); font-size: .9rem; }
.back { display: inline-block; margin-top: 2rem; color: var(--text); font-weight: 600; text-decoration-color: var(--pink); text-underline-offset: 4px; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01s !important; animation-iteration-count: 1 !important; animation-delay: 0s !important; transition: none !important; }
  .guest, .room::before, .room::after { animation: none !important; }
  .slot span { animation: none !important; }
}
