/* Interactive tutorial (/tutorial): screenshot stage, spotlight, hotspot, speech bubble with arrow. */
.tutorial-main {
    max-width: 1240px;
    margin: 0 auto;
    padding: 1.5rem 1rem 3rem;
}

.tutorial-topbar {
    display: flex;
    flex-wrap: wrap;
    align-items: flex-end;
    justify-content: space-between;
    gap: 0.75rem 1.5rem;
    margin-bottom: 0.75rem;
}
.tutorial-title {
    margin: 0.15rem 0 0;
    font-family: var(--font-ui);
    font-size: clamp(1.4rem, 2.4vw, 2rem);
    color: rgb(10, 61, 145);
    line-height: 1.15;
}
.tutorial-topbar-actions {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.5rem;
}
.tutorial-count {
    font-family: var(--font-ui);
    font-weight: 600;
    color: rgba(10, 61, 145, 0.75);
    margin-right: 0.25rem;
    font-variant-numeric: tabular-nums;
}

.tutorial-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 2.4rem;
    padding: 0 1.1rem;
    border-radius: 999px;
    border: 1.5px solid rgba(10, 61, 145, 0.25);
    background: #fff;
    color: rgb(10, 61, 145);
    font: 600 0.95rem var(--font-ui);
    text-decoration: none;
    cursor: pointer;
    transition: background-color 0.15s ease, transform 0.1s ease;
}
.tutorial-btn:hover { background: #eef4ff; }
.tutorial-btn:active { transform: scale(0.97); }
.tutorial-btn:disabled { opacity: 0.4; cursor: default; }
.tutorial-btn--primary {
    background: #0b5cb7;
    border-color: #0b5cb7;
    color: #fff;
}
.tutorial-btn--primary:hover { background: #094c99; }
.tutorial-btn:focus-visible { outline: 3px solid #f5b400; outline-offset: 2px; }

.tutorial-progress {
    height: 6px;
    border-radius: 999px;
    background: rgba(10, 61, 145, 0.12);
    overflow: hidden;
    margin-bottom: 1rem;
}
.tutorial-progress span {
    display: block;
    height: 100%;
    width: 0;
    background: #0b5cb7;
    transition: width 0.3s ease;
}

/* The stage holds the screenshot frame and the bubble. Inside the frame, overlays are positioned in % of the image. */
.tutorial-stage {
    position: relative;
    user-select: none;
    /* fit the window height as well as its width, so no scrolling is needed mid-step */
    /* the site zooms the root on scaled Windows displays; vh is not zoomed, so divide it back (as the front page does) */
    max-width: max(320px, calc((100dvh / var(--display-compensation-factor, 1) - 15.5rem) * 16 / 9));
    margin: 0 auto;
}
.tutorial-frame {
    position: relative;
    aspect-ratio: 16 / 9;
    border-radius: 16px;
    overflow: hidden;
    background: #dfe9f8;
    box-shadow: 0 12px 40px rgba(10, 30, 60, 0.18);
}
.tutorial-frame > img {
    display: block;
    width: 100%;
    height: 100%;
}
.tutorial-stage--dim .tutorial-frame::after {
    content: "";
    position: absolute;
    inset: 0;
    background: rgba(10, 30, 60, 0.45);
    pointer-events: none;
}

/* Spotlight: everything outside the box is darkened by its huge shadow. */
.tutorial-spot {
    position: absolute;
    border-radius: 12px;
    box-shadow: 0 0 0 9999px rgba(10, 30, 60, 0.55);
    outline: 3px solid #f5b400;
    pointer-events: none;
    transition: left 0.3s ease, top 0.3s ease, width 0.3s ease, height 0.3s ease;
}
.tutorial-spot--pulse::after {
    content: "";
    position: absolute;
    inset: -3px;
    border-radius: inherit;
    border: 3px solid #f5b400;
    animation: tutorial-pulse 1.4s ease-out infinite;
}
@keyframes tutorial-pulse {
    from { transform: scale(1); opacity: 0.9; }
    to { transform: scale(1.12); opacity: 0; }
}
.tutorial-hotspot {
    position: absolute;
    z-index: 2;
    margin: 0;
    padding: 0;
    border: 0;
    border-radius: 12px;
    background: transparent;
    cursor: pointer;
}
.tutorial-hotspot:hover { background: rgba(245, 180, 0, 0.12); }
.tutorial-hotspot:focus-visible { outline: 3px solid #fff; outline-offset: 3px; }
.tutorial-type {
    position: absolute;
    z-index: 2;
    box-sizing: border-box;
    border: 0;
    border-radius: 12px;
    background: rgba(255, 255, 255, 0.96);
    color: rgb(10, 61, 145);
    font: 700 clamp(1.2rem, 3.2vw, 2.6rem) var(--font-ui);
    letter-spacing: 0.4em;
    text-align: center;
    text-transform: uppercase;
}
.tutorial-type:focus { outline: 3px solid #0b5cb7; }

/* Speech bubble */
.tutorial-bubble {
    position: absolute;
    z-index: 3;
    width: min(380px, calc(100% - 24px));
    box-sizing: border-box;
    padding: 1rem 1.15rem 1.05rem;
    border-radius: 14px;
    background: #fff;
    color: #12305c;
    box-shadow: 0 14px 40px rgba(10, 30, 60, 0.35);
    font-family: var(--font-ui);
    transition: left 0.3s ease, top 0.3s ease;
}
.tutorial-page .tutorial-bubble,
.tutorial-page .tutorial-bubble * { text-align: left; }
.tutorial-bubble-title {
    margin: 0 0 0.35rem;
    font-size: 1.12rem;
    color: rgb(10, 61, 145);
}
.tutorial-bubble-text {
    margin: 0;
    font-size: 0.98rem;
    line-height: 1.45;
}
.tutorial-bubble-hint {
    margin: 0.55rem 0 0;
    font-size: 0.88rem;
    font-weight: 600;
    color: #8a5a00;
}
.tutorial-bubble-hint:empty { display: none; }
.tutorial-bubble-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    margin-top: 0.8rem;
}
.tutorial-bubble-actions:empty { display: none; }

.tutorial-bubble-arrow {
    position: absolute;
    width: 18px;
    height: 18px;
    background: #fff;
    transform: rotate(45deg);
    display: none;
}
.tutorial-bubble[data-side="below"] .tutorial-bubble-arrow { display: block; top: -8px; margin-left: -9px; }
.tutorial-bubble[data-side="above"] .tutorial-bubble-arrow { display: block; bottom: -8px; margin-left: -9px; }
.tutorial-bubble[data-side="right"] .tutorial-bubble-arrow { display: block; left: -8px; margin-top: -9px; }
.tutorial-bubble[data-side="left"] .tutorial-bubble-arrow { display: block; right: -8px; left: auto !important; margin-top: -9px; }

.tutorial-bubble--nudge { animation: tutorial-nudge 0.45s ease; }
@keyframes tutorial-nudge {
    0%, 100% { translate: 0; }
    20% { translate: -8px; }
    40% { translate: 8px; }
    60% { translate: -5px; }
    80% { translate: 5px; }
}

/* Small screens: the bubble drops below the screenshot instead of floating over it. */
.tutorial-bubble--docked {
    position: relative;
    width: 100%;
    margin-top: 0.75rem;
    left: auto !important;
    top: auto !important;
}

@media (prefers-reduced-motion: reduce) {
    .tutorial-spot, .tutorial-bubble, .tutorial-progress span { transition: none; }
    .tutorial-spot--pulse::after, .tutorial-bubble--nudge { animation: none; }
}
