@property --border-angle {
  syntax: "<angle>";
  inherits: false;
  initial-value: 0deg;
}

:root {
  color-scheme: light;
  background: #eeecf7;
  font-family: Arial, sans-serif;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  background:
    radial-gradient(ellipse at 0% 70%, rgb(137 120 247 / 30%), transparent 60%),
    radial-gradient(ellipse at 100% 80%, rgb(110 86 225 / 25%), transparent 60%),
    linear-gradient(180deg, #f0eff3 0%, #eeecf7 40%, #d7d0f4 75%, #eeecf7 100%);
  background-attachment: fixed;
}

main {
  display: grid;
  min-height: 100vh;
  min-height: 100svh;
  place-items: center;
}

.portal {
  position: relative;
  isolation: isolate;
  display: block;
  width: min(100%, 1080px, calc(100vh * 0.8));
  width: min(100%, 1080px, calc(100svh * 0.8));
  color: #271078;
  cursor: pointer;
  -webkit-tap-highlight-color: rgb(107 66 255 / 20%);
}

.portal::before {
  content: "";
  position: absolute;
  inset: 0;
  z-index: 1;
  padding: 3px;
  pointer-events: none;
  background: conic-gradient(
    from var(--border-angle),
    #b5a4f7 0deg,
    #b5a4f7 55deg,
    #7044ff 100deg,
    #2110b4 135deg,
    #a18aff 155deg,
    #f2edff 172deg,
    #7044ff 190deg,
    #b5a4f7 225deg,
    #b5a4f7 290deg,
    #4b2bd4 325deg,
    #b5a4f7 360deg
  );
  -webkit-mask: linear-gradient(#fff 0 0) content-box, linear-gradient(#fff 0 0);
  -webkit-mask-composite: xor;
  mask: linear-gradient(#fff 0 0) content-box, linear-gradient(#fff 0 0);
  mask-composite: exclude;
  animation: border-travel 17s linear infinite, border-glow 6.7s ease-in-out infinite;
}

/* Each leg has its own pace: slow drift, quick sweep, then a brief rest. */
@keyframes border-travel {
  0% { --border-angle: 0deg; animation-timing-function: ease-in; }
  18% { --border-angle: 45deg; animation-timing-function: ease-out; }
  25% { --border-angle: 210deg; animation-timing-function: ease-in-out; }
  42% { --border-angle: 250deg; animation-timing-function: ease-in; }
  49% { --border-angle: 265deg; animation-timing-function: ease-out; }
  59% { --border-angle: 480deg; animation-timing-function: ease-in-out; }
  80% { --border-angle: 535deg; animation-timing-function: ease-in; }
  86% { --border-angle: 550deg; animation-timing-function: ease-out; }
  94% { --border-angle: 690deg; animation-timing-function: ease-out; }
  100% { --border-angle: 720deg; }
}

@keyframes border-glow {
  0%, 100% { opacity: 0.75; filter: brightness(1); }
  23% { opacity: 1; filter: brightness(1.2); }
  61% { opacity: 0.65; filter: brightness(0.95); }
  78% { opacity: 1; filter: brightness(1.15); }
}

.portal:focus-visible {
  outline: 4px solid #6942ff;
  outline-offset: -4px;
}

picture,
img {
  display: block;
  width: 100%;
}

img {
  height: auto;
}

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
  border: 0;
}

@media (max-width: 767px) {
  .portal {
    width: 100%;
    max-width: 320px;
  }
}

@media (prefers-reduced-motion: reduce) {
  .portal::before {
    animation: none;
  }
}
