html {
    height: 100%;
}

body {
    min-height: 100%;
    margin: 0;
    display: grid;
    place-items: center;
    background-color: #000;
    overflow: hidden;
}

/* The simulation runs at a fraction of the screen resolution; the browser
   scales it up, which gives the soft glow for free. */
#stream {
    position: fixed;
    inset: 0;
    width: 100%;
    height: 100%;
    opacity: 0;
    transition: opacity 1.5s ease-out;
    touch-action: none;
}

#stream.running {
    opacity: 1;
}

/* The link is the eye of the whirl: a small light in the colours of the stream.
   --heat (0..1) is set from main.js and warms it up while it is on the move. */
#linkedin {
    --heat: 0;
    --glow: color-mix(in srgb, #78a5ff, #ff8c28 calc(var(--heat) * 100%));
    position: relative;
    display: grid;
    place-items: center;
    width: 56px;
    height: 56px;
    border-radius: 50%;
    text-decoration: none;
    -webkit-tap-highlight-color: transparent;
}

/* A dark pool behind it, so it stays readable with light passing underneath. */
#linkedin::before {
    content: "";
    position: absolute;
    inset: -34px;
    border-radius: 50%;
    background: radial-gradient(closest-side, rgb(0 0 0 / 0.8) 35%, transparent);
}

/* A thin orbit around the light. */
#linkedin::after {
    content: "";
    position: absolute;
    inset: 6px;
    border-radius: 50%;
    border: 1px solid color-mix(in srgb, var(--glow) 55%, transparent);
    transition: inset 0.25s ease-out, border-color 0.25s ease-out;
}

#linkedin .core {
    position: relative;
    width: 12px;
    height: 12px;
    border-radius: 50%;
    background: #fff;
    box-shadow:
        0 0 6px 2px #fff,
        0 0 18px 7px var(--glow),
        0 0 46px 16px color-mix(in srgb, var(--glow) 45%, transparent);
    transition: scale 0.25s ease-out;
    animation: twinkle 2.3s ease-in-out infinite;
}

/* Two rays through the star. Their lengths breathe at different paces from each
   other and from the twinkle, so the pattern never visibly repeats. */
#linkedin .core::before,
#linkedin .core::after {
    content: "";
    position: absolute;
    left: 50%;
    top: 50%;
    width: 64px;
    height: 1px;
    translate: -50% -50%;
    background: linear-gradient(90deg, transparent, var(--glow) 30%, #fff 50%, var(--glow) 70%, transparent);
    animation: ray 1.9s ease-in-out infinite;
}

#linkedin .core::after {
    rotate: 90deg;
    animation-duration: 3.1s;
    animation-delay: -1.2s;
}

@keyframes twinkle {
    0%, 100% { filter: brightness(1); }
    14% { filter: brightness(1.7); }
    27% { filter: brightness(0.75); }
    45% { filter: brightness(1.4); }
    61% { filter: brightness(0.85); }
    79% { filter: brightness(1.9); }
    90% { filter: brightness(0.95); }
}

@keyframes ray {
    0%, 100% { scale: 0.3 1; opacity: 0.25; }
    35% { scale: 1 1; opacity: 0.95; }
    52% { scale: 0.55 1; opacity: 0.45; }
    74% { scale: 1.2 1; opacity: 1; }
}

/* Escape stops the stream (see main.js) and the twinkling with it. */
.paused #linkedin .core,
.paused #linkedin .core::before,
.paused #linkedin .core::after {
    animation-play-state: paused;
}

#linkedin .label {
    position: absolute;
    top: 100%;
    margin-top: 12px;
    font: 0.6875rem/1 ui-monospace, "SF Mono", Menlo, Consolas, monospace;
    letter-spacing: 0.28em;
    text-indent: 0.28em;
    color: rgb(70 255 120 / 0.75); /* terminal green */
    text-shadow: 0 0 8px rgb(70 255 120 / 0.45);
    transition: color 0.25s ease-out, text-shadow 0.25s ease-out;
}

#linkedin:hover::after,
#linkedin:focus-visible::after {
    inset: 0;
    border-color: var(--glow);
}

#linkedin:hover .core,
#linkedin:focus-visible .core {
    scale: 1.35;
}

#linkedin:hover .label,
#linkedin:focus-visible .label {
    color: rgb(140 255 170);
    text-shadow: 0 0 12px rgb(70 255 120 / 0.9);
}

#linkedin:focus-visible {
    outline: 2px solid #fff;
    outline-offset: 10px;
}

@media (prefers-reduced-motion: reduce) {
    #stream,
    #linkedin::after,
    #linkedin .core,
    #linkedin .label {
        transition: none;
    }
}
