/* ---- the portal's tool cards and guides (Pages/Portal.razor) -------------------------------------------------------------
   A card leads with a picture of its tool (wwwroot/portal/shots, taken by tools/portal-shots) and wears the tool's look
   (looks/looks.css): its colour, and its spot illustration tucked into the picture's corner. Under the description, a few
   chips say what it does; along the foot, its pages and the Info button.

   Info opens the guide, a <dialog> that is dark in both themes like a banner: a window on the left that plays the tool's
   screenshots (js/portal-guide.js zooms each to the part its step is about and rings it), the steps down the right, and the
   controls along the foot. */

/* ---- cards ---- */

/* A tool with a look wears the look's colour all over its card (the kit's band, icon and hover read --tile-hue, which the page
   sets inline from the section, hence the !important); one without keeps its section's. */
.portal__tool:not(.look) { --look-hue: var(--tile-hue); }
.portal__tool.look { --tile-hue: var(--look-hue) !important; }

.portal .portal__tool--shot { padding-top: 0; overflow: hidden; }
.portal .portal__tool--shot::before { z-index: 2; }

.portal__shot {
    position: relative;
    margin: 0 -1rem 0.25rem;
    aspect-ratio: 16 / 10;
    overflow: hidden;
    background:
        radial-gradient(80% 90% at 80% 10%, hsl(var(--look-hue) 70% 40% / 0.5), transparent 70%),
        hsl(var(--look-hue) 35% 10%);
    border-bottom: 1px solid var(--rl-border);
}

.portal__shot > img:first-child {
    display: block;
    width: 100%;
    height: 100%;
    object-fit: cover;
    object-position: left top;
    transition: transform 0.6s var(--rl-ease-out, ease-out);
}

/* The foot of the picture melts into the card, so the title reads as the picture's caption. */
.portal__shot::after {
    content: "";
    position: absolute;
    inset: auto 0 0;
    height: 38%;
    background: linear-gradient(180deg, transparent, color-mix(in srgb, var(--rl-surface) 92%, transparent));
    pointer-events: none;
}

.portal__spot {
    position: absolute;
    right: 0.7rem;
    bottom: 0.55rem;
    z-index: 1;
    width: 3.4rem;
    height: 3.4rem;
    filter: drop-shadow(0 6px 14px rgb(0 0 0 / 0.45));
    transition: transform 0.4s var(--rl-ease-out, ease-out);
}

.ui-tile.portal__tool:hover .portal__shot > img:first-child { transform: scale(1.045); }
.ui-tile.portal__tool:hover .portal__spot { transform: translateY(-3px) rotate(-4deg) scale(1.06); }

.portal .portal__tool--shot .ui-tile__desc { -webkit-line-clamp: 4; line-clamp: 4; }

.portal__tool .ui-tile__icon { background: linear-gradient(140deg, hsl(var(--look-hue) 72% 56%), hsl(calc(var(--look-hue) + 40) 70% 44%)); }

.portal__highlights {
    display: flex;
    flex-wrap: wrap;
    gap: 0.3rem;
    margin: 0;
    padding: 0;
    list-style: none;
}

.portal__highlights li {
    padding: 0.12rem 0.55rem;
    border: 1px solid hsl(var(--look-hue) 70% 55% / 0.28);
    border-radius: 999px;
    background: hsl(var(--look-hue) 70% 55% / 0.1);
    color: color-mix(in srgb, hsl(var(--look-hue) 70% 50%) 55%, var(--rl-text));
    font-size: 0.72rem;
    font-weight: 550;
    line-height: 1.5;
    white-space: nowrap;
}

.portal .portal__tool .ui-tile__foot { flex-wrap: nowrap; align-items: flex-end; }
.portal .portal__tool .portal__links { flex: 1 1 auto; min-width: 0; }

.portal__info {
    flex: none;
    display: inline-flex;
    align-items: center;
    gap: 0.3rem;
    margin-left: auto;
    padding: 0.28rem 0.7rem 0.28rem 0.5rem;
    border: 1px solid hsl(var(--look-hue) 70% 55% / 0.45);
    border-radius: 999px;
    background: hsl(var(--look-hue) 70% 55% / 0.12);
    color: color-mix(in srgb, hsl(var(--look-hue) 75% 50%) 60%, var(--rl-text));
    font: inherit;
    font-size: 0.78rem;
    font-weight: 650;
    cursor: pointer;
    transition: background-color var(--rl-dur) var(--rl-ease), transform var(--rl-dur) var(--rl-ease), box-shadow var(--rl-dur) var(--rl-ease);
}

.portal__info svg { width: 1rem; height: 1rem; }
.portal__info:hover { background: hsl(var(--look-hue) 70% 55% / 0.22); box-shadow: 0 4px 14px -6px hsl(var(--look-hue) 80% 50% / 0.7); transform: translateY(-1px); }
.portal__info:focus-visible { outline: 2px solid var(--rl-accent); outline-offset: 2px; }

/* ---- the guide ---- */

.pguide {
    --g-c: hsl(var(--look-hue, var(--tile-hue)) 78% 62%);
    --g-c2: hsl(calc(var(--look-hue, var(--tile-hue)) + 38) 75% 56%);
    --g-ink: hsl(var(--look-hue, var(--tile-hue)) 85% 80%);
    --g-h: min(48rem, calc(100dvh - 2rem));
    width: min(78rem, calc(100vw - 2rem));
    max-width: none;
    height: var(--g-h);
    max-height: none;
    padding: 0;
    border: 1px solid hsl(var(--look-hue, 225) 60% 60% / 0.35);
    border-radius: 22px;
    color: #eef0f6;
    background:
        radial-gradient(70% 60% at 90% 0%, hsl(var(--look-hue, 225) 80% 45% / 0.35), transparent 70%),
        radial-gradient(60% 60% at 0% 100%, hsl(calc(var(--look-hue, 225) + 38) 80% 40% / 0.28), transparent 70%),
        linear-gradient(160deg, hsl(var(--look-hue, 225) 40% 11%), hsl(calc(var(--look-hue, 225) + 30) 45% 6%));
    box-shadow: 0 40px 120px rgb(0 0 0 / 0.6), 0 0 0 1px rgb(255 255 255 / 0.04) inset;
    overflow: hidden;
}

.pguide[open] { animation: pguide-in 0.42s var(--rl-ease-out, cubic-bezier(.16, 1, .3, 1)) both; }
.pguide::backdrop { background: rgb(6 8 14 / 0.62); backdrop-filter: blur(6px); -webkit-backdrop-filter: blur(6px); animation: pguide-fade 0.3s ease both; }

@keyframes pguide-in { from { opacity: 0; transform: translateY(16px) scale(0.965); } }
@keyframes pguide-fade { from { opacity: 0; } }

.pguide__shell { display: grid; grid-template-rows: auto minmax(0, 1fr) auto; height: 100%; }

.pguide__head { position: relative; isolation: isolate; display: flex; align-items: center; gap: 0.9rem; min-height: 5.6rem; padding: 1rem 1.2rem 0.75rem; }

/* The tool's banner art, on the right of the head behind the close button, fading out towards the title. */
.pguide__heroArt {
    position: absolute;
    top: 0;
    right: 3.6rem;
    z-index: -1;
    height: 100%;
    width: auto;
    max-width: 62%;
    object-fit: cover;
    object-position: right center;
    pointer-events: none;
    -webkit-mask-image: linear-gradient(90deg, transparent 0%, #000 45%);
    mask-image: linear-gradient(90deg, transparent 0%, #000 45%);
    opacity: 0.9;
    animation: look-motif-in 0.7s var(--rl-ease-out, ease-out) both;
}

.pguide__close { position: relative; z-index: 1; backdrop-filter: blur(6px); -webkit-backdrop-filter: blur(6px); }

.pguide__badge {
    flex: none;
    width: 3.4rem;
    height: 3.4rem;
    filter: drop-shadow(0 8px 18px rgb(0 0 0 / 0.45));
    animation: pguide-bob 5s ease-in-out infinite alternate;
}

@keyframes pguide-bob { to { transform: translateY(-4px) rotate(-3deg); } }

.pguide__titles { flex: 1 1 auto; min-width: 0; }
.pguide__eyebrow { margin: 0; color: var(--g-ink); font-size: 0.68rem; font-weight: 750; letter-spacing: 0.14em; text-transform: uppercase; }
.pguide__title { margin: 0.05rem 0 0; color: #fff; font-size: clamp(1.25rem, 2.4vw, 1.6rem); font-weight: 760; letter-spacing: -0.015em; }
.pguide__tagline { margin: 0.1rem 0 0; color: rgb(255 255 255 / 0.74); font-size: 0.9rem; }

.pguide__close {
    flex: none;
    display: grid;
    place-items: center;
    width: 2.4rem;
    height: 2.4rem;
    padding: 0;
    border: 1px solid rgb(255 255 255 / 0.14);
    border-radius: 50%;
    background: rgb(255 255 255 / 0.06);
    color: #fff;
    cursor: pointer;
    transition: background-color 0.16s, transform 0.16s;
}

.pguide__close svg { width: 1.15rem; height: 1.15rem; }
.pguide__close:hover { background: rgb(255 255 255 / 0.14); transform: rotate(90deg); }
.pguide__close:focus-visible, .pguide__step:focus-visible, .pguide__foot .btn:focus-visible { outline: 2px solid var(--g-ink); outline-offset: 2px; }

.pguide__body {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(15rem, 20rem);
    gap: 1rem;
    min-height: 0;
    padding: 0 1.2rem;
}

/* ---- the window the screenshots play in ---- */

.pguide__screen {
    position: relative;
    align-self: center;
    justify-self: center;
    width: min(100%, calc((var(--g-h) - 10.5rem) * 1.533));
    display: flex;
    flex-direction: column;
    border: 1px solid rgb(255 255 255 / 0.12);
    border-radius: 14px;
    overflow: hidden;
    background: #0b0d12;
    box-shadow: 0 24px 60px -18px rgb(0 0 0 / 0.75), 0 0 0 6px hsl(var(--look-hue, 225) 70% 55% / 0.08);
}

.pguide__chrome { display: flex; align-items: center; gap: 0.7rem; height: 1.9rem; padding: 0 0.7rem; background: rgb(255 255 255 / 0.05); border-bottom: 1px solid rgb(255 255 255 / 0.07); }
.pguide__dots { display: flex; gap: 0.35rem; }
.pguide__dots i { width: 0.6rem; height: 0.6rem; border-radius: 50%; background: rgb(255 255 255 / 0.18); }
.pguide__dots i:first-child { background: #ff6b6b; }
.pguide__dots i:nth-child(2) { background: #f7c548; }
.pguide__dots i:nth-child(3) { background: #5bd08c; }

.pguide__url {
    flex: 1 1 auto;
    min-width: 0;
    max-width: 26rem;
    margin: 0 auto;
    padding: 0.1rem 0.8rem;
    border-radius: 999px;
    background: rgb(0 0 0 / 0.35);
    color: rgb(255 255 255 / 0.62);
    font-size: 0.72rem;
    text-align: center;
    white-space: pre;
    overflow: hidden;
    text-overflow: ellipsis;
}

.pguide__viewport { position: relative; aspect-ratio: 1472 / 960; overflow: hidden; }

.pguide__slide {
    position: absolute;
    inset: 0;
    opacity: 0;
    visibility: hidden;
    transform: translateX(5%) scale(0.985);
    transition: opacity 0.5s ease, transform 0.65s var(--rl-ease-out, cubic-bezier(.16, 1, .3, 1)), visibility 0s linear 0.65s;
}

.pguide__slide.is-back:not(.is-active) { transform: translateX(-5%) scale(0.985); }
.pguide__slide.is-active { opacity: 1; visibility: visible; transform: none; transition: opacity 0.5s ease, transform 0.65s var(--rl-ease-out, cubic-bezier(.16, 1, .3, 1)), visibility 0s; }
.pguide__slide.is-active.is-back { animation: pguide-from-left 0.65s var(--rl-ease-out, cubic-bezier(.16, 1, .3, 1)) both; }

@keyframes pguide-from-left { from { opacity: 0; transform: translateX(-5%) scale(0.985); } }

.pguide__zoom {
    position: absolute;
    inset: 0;
    transform-origin: 0 0;
    transition: transform 1.25s cubic-bezier(0.22, 0.7, 0.12, 1);
    will-change: transform;
}

.pguide__zoom img { display: block; width: 100%; height: 100%; object-fit: cover; object-position: left top; }

.pguide__slide.is-zoomed .pguide__zoom { transform: translate(var(--zx, 0), var(--zy, 0)) scale(var(--zs, 1)); }

/* A step with no region drifts slowly over the whole page instead. */
.pguide__slide.is-active:not([data-focus]) .pguide__zoom { animation: pguide-drift 9s ease-out both; }
@keyframes pguide-drift { from { transform: scale(1.06) translate(-1.5%, -1%); } }

/* The ring around the step's region, and the room around it dimmed, so the eye goes there. It sits in the zoomed layer, so its
   line is drawn thinner by the zoom to stay the same on screen. */
.pguide__ring {
    position: absolute;
    border: calc(2.5px / var(--ring-s, 1)) solid var(--g-c);
    border-radius: calc(10px / var(--ring-s, 1));
    box-shadow: 0 0 0 200vmax rgb(4 6 12 / 0.5), 0 0 calc(22px / var(--ring-s, 1)) hsl(var(--look-hue, 225) 90% 65% / 0.7);
    opacity: 0;
    transition: opacity 0.5s ease 0.55s;
    pointer-events: none;
}

.pguide__slide.is-zoomed .pguide__ring { opacity: 1; animation: pguide-pulse 1.8s ease-in-out 1.2s infinite alternate; }

@keyframes pguide-pulse {
    to { box-shadow: 0 0 0 200vmax rgb(4 6 12 / 0.5), 0 0 calc(40px / var(--ring-s, 1)) hsl(var(--look-hue, 225) 95% 70% / 0.95); }
}

/* ---- the cover and the last page ---- */

.pguide__slide--cover, .pguide__slide--tips {
    display: flex;
    align-items: center;
    gap: clamp(1rem, 4%, 2.5rem);
    padding: clamp(1rem, 5%, 3rem);
    background:
        radial-gradient(60% 80% at 25% 40%, hsl(var(--look-hue, 225) 80% 50% / 0.32), transparent 70%),
        radial-gradient(rgb(255 255 255 / 0.08) 1px, transparent 1.4px) 0 0 / 22px 22px,
        linear-gradient(150deg, hsl(var(--look-hue, 225) 45% 13%), hsl(calc(var(--look-hue, 225) + 30) 50% 7%));
}

.pguide__coverArt {
    flex: none;
    width: 38%;
    max-width: 17rem;
    aspect-ratio: 1;
    filter: drop-shadow(0 20px 40px rgb(0 0 0 / 0.55));
}

.pguide__slide--cover.is-active .pguide__coverArt { animation: pguide-pop 0.9s var(--rl-ease-out, cubic-bezier(.16, 1, .3, 1)) both, pguide-bob 5s ease-in-out 0.9s infinite alternate; }
@keyframes pguide-pop { from { opacity: 0; transform: scale(0.7) rotate(-8deg); } }

.pguide__coverText { min-width: 0; }
.pguide__coverLede { margin: 0 0 1rem; color: rgb(255 255 255 / 0.9); font-size: clamp(0.9rem, 1.6vw, 1.12rem); line-height: 1.55; }

.pguide__chips { display: flex; flex-wrap: wrap; gap: 0.45rem; margin: 0; padding: 0; list-style: none; }
.pguide__chips li {
    padding: 0.3rem 0.8rem;
    border: 1px solid hsl(var(--look-hue, 225) 80% 70% / 0.45);
    border-radius: 999px;
    background: hsl(var(--look-hue, 225) 70% 55% / 0.18);
    color: #fff;
    font-size: 0.82rem;
    font-weight: 600;
}

.pguide__slide.is-active .pguide__chips li,
.pguide__slide.is-active .pguide__tips li { animation: pguide-rise 0.5s var(--rl-ease-out, cubic-bezier(.16, 1, .3, 1)) both; }
.pguide__slide.is-active li:nth-child(1) { animation-delay: 0.25s; }
.pguide__slide.is-active li:nth-child(2) { animation-delay: 0.35s; }
.pguide__slide.is-active li:nth-child(3) { animation-delay: 0.45s; }
.pguide__slide.is-active li:nth-child(4) { animation-delay: 0.55s; }
.pguide__slide.is-active li:nth-child(5) { animation-delay: 0.65s; }
.pguide__slide.is-active li:nth-child(6) { animation-delay: 0.75s; }

@keyframes pguide-rise { from { opacity: 0; transform: translateY(10px); } }

.pguide__slide--tips { flex-direction: column; align-items: flex-start; justify-content: center; gap: 0.6rem; overflow: auto; }
.pguide__slide--tips h3 { margin: 0; color: #fff; font-size: 1.2rem; }
.pguide__tips { display: flex; flex-direction: column; gap: 0.5rem; margin: 0; padding: 0; list-style: none; max-width: 46rem; }
.pguide__tips li {
    position: relative;
    padding: 0.55rem 0.8rem 0.55rem 2.2rem;
    border: 1px solid rgb(255 255 255 / 0.1);
    border-radius: 12px;
    background: rgb(255 255 255 / 0.05);
    color: rgb(255 255 255 / 0.9);
    font-size: 0.88rem;
    line-height: 1.45;
}

.pguide__tips li::before {
    content: "";
    position: absolute;
    left: 0.8rem;
    top: 0.8rem;
    width: 0.7rem;
    height: 0.7rem;
    border-radius: 50%;
    background: linear-gradient(140deg, var(--g-c), var(--g-c2));
    box-shadow: 0 0 10px hsl(var(--look-hue, 225) 90% 60% / 0.7);
}

.pguide__pagesLabel { margin: 0.4rem 0 0; color: var(--g-ink); font-size: 0.7rem; font-weight: 750; letter-spacing: 0.12em; text-transform: uppercase; }
.pguide__pages { display: flex; flex-wrap: wrap; gap: 0.35rem; margin: 0; padding: 0; list-style: none; }
.pguide__pages a {
    display: inline-block;
    padding: 0.25rem 0.7rem;
    border-radius: 999px;
    background: rgb(255 255 255 / 0.1);
    color: #fff;
    font-size: 0.8rem;
    text-decoration: none;
}
.pguide__pages a:hover { background: hsl(var(--look-hue, 225) 70% 55% / 0.4); }

.pguide__progress { height: 3px; background: rgb(255 255 255 / 0.08); }
.pguide__progress span { display: block; height: 100%; transform: scaleX(0); transform-origin: left; background: linear-gradient(90deg, var(--g-c), var(--g-c2)); }

/* ---- the steps down the right ---- */

.pguide__steps {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
    min-height: 0;
    margin: 0;
    padding: 0.2rem 0.2rem 0.5rem 0;
    overflow: auto;
    list-style: none;
    scrollbar-width: thin;
}

.pguide__steps > li { border-radius: 12px; transition: background-color 0.3s ease; }
.pguide__steps > li.is-current { background: rgb(255 255 255 / 0.07); box-shadow: inset 3px 0 0 var(--g-c); }

.pguide__step {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    width: 100%;
    padding: 0.5rem 0.6rem;
    border: 0;
    border-radius: 12px;
    background: none;
    color: rgb(255 255 255 / 0.72);
    font: inherit;
    font-size: 0.88rem;
    font-weight: 600;
    text-align: left;
    cursor: pointer;
}

.pguide__step:hover { color: #fff; }
.is-current > .pguide__step { color: #fff; }

.pguide__num {
    flex: none;
    display: grid;
    place-items: center;
    width: 1.6rem;
    height: 1.6rem;
    border: 1px solid rgb(255 255 255 / 0.22);
    border-radius: 50%;
    font-size: 0.74rem;
    font-weight: 750;
    transition: background-color 0.3s ease, border-color 0.3s ease, transform 0.3s ease;
}

.is-done > .pguide__step .pguide__num { border-color: hsl(var(--look-hue, 225) 70% 60% / 0.6); color: var(--g-ink); }
.is-current > .pguide__step .pguide__num { border-color: transparent; background: linear-gradient(140deg, var(--g-c), var(--g-c2)); color: #fff; transform: scale(1.08); box-shadow: 0 0 14px hsl(var(--look-hue, 225) 90% 60% / 0.6); }

.pguide__text {
    display: grid;
    margin: 0;
    padding: 0 0.75rem 0 2.8rem;
    max-height: 0;
    overflow: hidden;
    color: rgb(255 255 255 / 0.8);
    font-size: 0.84rem;
    line-height: 1.5;
    opacity: 0;
    transition: max-height 0.45s ease, opacity 0.35s ease, padding 0.35s ease;
}

.is-current > .pguide__text { max-height: 14rem; padding-bottom: 0.7rem; opacity: 1; }

/* ---- the foot ---- */

.pguide__foot { display: flex; align-items: center; gap: 0.45rem; padding: 0.8rem 1.2rem 1rem; }

.pguide__foot .pguide__nav, .pguide__foot .pguide__play {
    display: grid;
    place-items: center;
    width: 2.5rem;
    height: 2.5rem;
    min-height: 0;
    padding: 0;
    border: 1px solid rgb(255 255 255 / 0.16);
    border-radius: 50%;
    background: rgb(255 255 255 / 0.07);
    color: #fff;
}

.pguide__foot .pguide__nav:hover:not(:disabled), .pguide__foot .pguide__play:hover { background: rgb(255 255 255 / 0.16); }
.pguide__foot .pguide__nav:disabled { opacity: 0.35; cursor: default; }
.pguide__foot svg { width: 1.15rem; height: 1.15rem; }
.pguide__nav--prev svg { transform: rotate(180deg); }
.pguide__play { position: relative; }
.pguide .pguide__icoPlay { display: none; }
.pguide:not(.is-playing) .pguide__icoPlay { display: block; }
.pguide:not(.is-playing) .pguide__icoPause { display: none; }

.pguide__count { margin-left: 0.35rem; color: rgb(255 255 255 / 0.6); font-size: 0.8rem; font-variant-numeric: tabular-nums; }

.pguide__foot .pguide__open {
    margin-left: auto;
    border-color: transparent;
    background: linear-gradient(135deg, var(--g-c), var(--g-c2));
    color: #fff;
    font-weight: 650;
    text-shadow: 0 1px 2px rgb(0 0 0 / 0.3);
    box-shadow: 0 8px 22px -8px hsl(var(--look-hue, 225) 85% 55% / 0.8);
}

.pguide__foot .pguide__open:hover { filter: brightness(1.08); }

/* ---- narrow screens: the steps go under the window, only the current one showing ---- */

@media (max-width: 60rem) {
    .pguide { --g-h: calc(100dvh - 1rem); width: calc(100vw - 1rem); border-radius: 16px; }
    .pguide__body { grid-template-columns: minmax(0, 1fr); grid-template-rows: auto minmax(0, 1fr); padding: 0 0.8rem; }
    .pguide__screen { width: 100%; align-self: start; }
    .pguide__steps > li:not(.is-current) { display: none; }
    .pguide__steps > li.is-current { box-shadow: none; }
    .pguide__head { min-height: 0; padding: 0.8rem 0.9rem 0.6rem; }
    .pguide__heroArt { display: none; }
    .pguide__badge { width: 2.6rem; height: 2.6rem; }
    .pguide__foot { padding: 0.6rem 0.8rem 0.8rem; }
    .pguide__count { display: none; }
    .pguide__coverArt { width: 30%; }
    .pguide__coverLede { font-size: 0.82rem; margin-bottom: 0.5rem; display: -webkit-box; -webkit-line-clamp: 4; -webkit-box-orient: vertical; overflow: hidden; }
    .pguide__chips li { font-size: 0.7rem; padding: 0.15rem 0.55rem; }
}

@media (prefers-reduced-motion: reduce) {
    .pguide[open], .pguide::backdrop, .pguide__badge, .pguide__heroArt, .pguide__slide, .pguide__zoom, .pguide__ring,
    .pguide__slide.is-active .pguide__zoom, .pguide__slide.is-active li, .pguide__coverArt, .portal__shot > img:first-child, .portal__spot {
        animation: none !important;
        transition: none !important;
    }
}
