/* Picture viewers on the Introduction page (docs/site.js), the download
   callout and buttons, and the full-screen view for every picture. Colours
   come from mdBook's theme variables, so the five themes (light, rust, coal,
   navy, ayu) all work. */
:root {
    --v7-radius: 14px;
    --v7-pad: 8px;
    --v7-line: color-mix(in srgb, var(--fg) 12%, transparent);
    --v7-well: color-mix(in srgb, var(--fg) 4%, var(--bg));
    --v7-segments: color-mix(in srgb, var(--fg) 7%, transparent);
    --v7-active: var(--bg);
    --v7-active-ring: color-mix(in srgb, var(--fg) 10%, transparent);
    --v7-muted: color-mix(in srgb, var(--fg) 65%, var(--bg));
    --v7-btn-bg: var(--links);
    --v7-btn-fg: #fff;
    --v7-btn-hover: color-mix(in srgb, var(--v7-btn-bg) 86%, #000);
    --v7-ease-out: cubic-bezier(0.23, 1, 0.32, 1);
}
/* Dark themes: no shadows; the active segment is lighter than its track. */
html:is(.coal, .navy, .ayu) {
    --v7-active: color-mix(in srgb, var(--fg) 14%, var(--bg));
    --v7-active-ring: transparent;
    --v7-btn-hover: color-mix(in srgb, var(--v7-btn-bg) 86%, #fff);
}
/* Ayu's link colour is bright cyan; darken it slightly so white button text
   keeps clear contrast. */
html.ayu {
    --v7-btn-bg: #0077a8;
}

/* Download callout and buttons on the Introduction and Download pages. */
.v7-download {
    margin: 1.5rem 0 1.75rem;
    padding: 16px 18px;
    border-radius: var(--v7-radius);
    background: var(--v7-well);
    box-shadow: inset 0 0 0 1px var(--v7-line);
}
.v7-actions {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 10px;
}
.content a.v7-btn,
.content a.v7-btn:link,
.content a.v7-btn:visited {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 10px 16px;
    border-radius: 9px;
    font-weight: 600;
    line-height: 1.3;
    text-decoration: none;
    transition: background-color 150ms ease, box-shadow 150ms ease,
        transform 160ms var(--v7-ease-out);
}
.content a.v7-btn:hover {
    text-decoration: none;
}
.content a.v7-btn:active {
    transform: scale(0.98);
}
.content a.v7-btn:focus-visible {
    outline: 2px solid var(--links);
    outline-offset: 2px;
}
.content a.v7-btn-primary,
.content a.v7-btn-primary:link,
.content a.v7-btn-primary:visited {
    background: var(--v7-btn-bg);
    color: var(--v7-btn-fg);
}
@media (hover: hover) and (pointer: fine) {
    .content a.v7-btn-primary:hover {
        background: var(--v7-btn-hover);
        color: var(--v7-btn-fg);
    }
}
.content a.v7-btn-secondary,
.content a.v7-btn-secondary:link,
.content a.v7-btn-secondary:visited {
    background: var(--v7-active);
    color: var(--fg);
    box-shadow: inset 0 0 0 1px var(--v7-line);
}
@media (hover: hover) and (pointer: fine) {
    .content a.v7-btn-secondary:hover {
        background: color-mix(in srgb, var(--fg) 8%, var(--bg));
        color: var(--fg);
    }
}
.v7-icon {
    flex: 0 0 auto;
    display: block;
}
.content .v7-download-meta {
    margin: 10px 0 0;
    color: var(--v7-muted);
    font-size: 0.9em;
    line-height: 1.45;
}

/* The viewer: a soft well holding the controls and one large picture. It
   reaches past the text column into the page margins when they have room,
   up to 160px a side, so the pictures are as large as the page allows. */
.content {
    container-type: inline-size;
}
.v7-viewer {
    --v7-reach: clamp(0px, (100cqw - 100%) / 2 - 16px, 160px);
    margin: 1.25rem calc(var(--v7-reach) * -1) 2.5rem;
    padding: var(--v7-pad);
    border-radius: var(--v7-radius);
    background: var(--v7-well);
    box-shadow: inset 0 0 0 1px var(--v7-line);
}
.v7-controls {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px;
    padding: 4px 4px 12px;
}
/* Kept in the layout while hidden, so switching to Windows 7 moves nothing. */
.v7-controls .v7-subtabs.v7-away {
    visibility: hidden;
}

/* Segmented controls: a muted track, the chosen segment raised on it. */
.v7-tabs {
    display: flex;
    gap: 2px;
    max-width: 100%;
    padding: 3px;
    border-radius: 10px;
    background: var(--v7-segments);
    overflow-x: auto;
    scrollbar-width: none;
}
.v7-tabs::-webkit-scrollbar {
    display: none;
}
.v7-viewer button {
    flex: 0 0 auto;
    padding: 6px 12px;
    border: 0;
    border-radius: 7px;
    background: transparent;
    color: var(--v7-muted);
    font: inherit;
    font-size: 0.875em;
    line-height: 1.4;
    white-space: nowrap;
    cursor: pointer;
    transition: transform 160ms var(--v7-ease-out);
}
.v7-viewer button[aria-selected="true"] {
    background: var(--v7-active);
    color: var(--fg);
    box-shadow: 0 0 0 1px var(--v7-active-ring), 0 1px 2px rgb(0 0 0 / 0.08);
}
html:is(.coal, .navy, .ayu) .v7-viewer button[aria-selected="true"] {
    box-shadow: none;
}
@media (hover: hover) and (pointer: fine) {
    .v7-viewer button:hover {
        color: var(--fg);
    }
}
.v7-viewer button:active {
    transform: scale(0.97);
}
.v7-viewer button:focus-visible {
    outline: 2px solid var(--links);
    outline-offset: 2px;
}

/* Tab bar switch on the left, the picture beside it. */
.v7-viewer-body {
    display: flex;
    gap: 8px;
    align-items: stretch;
}
.v7-side {
    flex-direction: column;
    flex: 0 0 auto;
    align-self: flex-start;
}
.v7-stage {
    flex: 1 1 auto;
    min-width: 0;
    margin: 0;
}
.v7-frame {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: clamp(12px, 4%, 32px);
    border-radius: calc(var(--v7-radius) - var(--v7-pad));
    background: var(--bg);
    box-shadow: inset 0 0 0 1px var(--v7-line);
}
.v7-frame img {
    display: block;
    max-width: 100%;
    height: auto;
    transition: opacity 180ms ease, filter 180ms ease;
}
.v7-frame img.v7-swapping {
    opacity: 0.4;
    filter: blur(2px);
}
/* Where a click leads: shown on hover with a mouse only. */
.v7-hint {
    position: absolute;
    top: 8px;
    right: 8px;
    padding: 3px 8px;
    border-radius: 6px;
    background: rgb(0 0 0 / 0.6);
    color: #fff;
    font-size: 0.75em;
    opacity: 0;
    pointer-events: none;
    transition: opacity 150ms ease;
}
@media (hover: hover) and (pointer: fine) {
    .v7-frame:hover .v7-hint {
        opacity: 1;
    }
}
.v7-stage figcaption {
    max-width: 70ch;
    padding: 10px 4px 2px;
    color: var(--v7-muted);
    font-size: 0.9em;
    text-wrap: pretty;
}

/* Phones: everything stacks; the switch becomes a row above the picture. */
@media (max-width: 640px) {
    .v7-viewer-body {
        flex-direction: column;
    }
    .v7-side {
        flex-direction: row;
    }
    .v7-viewer button {
        font-size: 1em;
    }
}

/* Pictures in the pages: a faint edge so window shots sit on any theme. */
main img {
    outline: 1px solid var(--v7-line);
    outline-offset: -1px;
}
.v7-frame img {
    outline-color: transparent;
}
img.v7-zoomable {
    cursor: zoom-in;
}

/* Full-screen view: fades and grows in, leaves faster than it came. */
.v7-zoom {
    position: fixed;
    inset: 0;
    z-index: 1000;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 12px;
    padding: 3vmin;
    background: rgb(0 0 0 / 0.88);
    cursor: zoom-out;
    opacity: 0;
    visibility: hidden;
    transition: opacity 150ms ease, visibility 0s linear 150ms;
}
.v7-zoom.v7-open {
    opacity: 1;
    visibility: visible;
    transition: opacity 220ms var(--v7-ease-out);
}
.v7-zoom img {
    min-height: 0;
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
    outline: 0;
    transform: scale(0.96);
    transition: transform 150ms ease;
}
.v7-zoom.v7-open img {
    transform: scale(1);
    transition: transform 260ms var(--v7-ease-out);
}
.v7-zoom p {
    flex: 0 0 auto;
    max-width: 70ch;
    margin: 0;
    color: rgb(255 255 255 / 0.8);
    font-size: 0.9em;
    text-align: center;
    text-wrap: pretty;
}
.v7-zoom p:empty {
    display: none;
}
.v7-zoom code {
    background: rgb(255 255 255 / 0.1);
    color: inherit;
}
body.v7-zoomed {
    overflow: hidden;
}

@media (prefers-reduced-motion: reduce) {
    .content a.v7-btn:active,
    .v7-viewer button:active,
    .v7-zoom img,
    .v7-zoom.v7-open img {
        transform: none;
    }
    .v7-frame img.v7-swapping {
        filter: none;
    }
}
