/* =====================================================================================
   Tweaked SEO Audit — product-area UI corrections.

   Loaded ONLY by the pages under /tools/seo-audit/. Every selector is scoped under
   `main` so nothing here can reach the shared header, navigation or footer, and
   nothing in public/lib/ is modified.
   ===================================================================================== */


/* -------------------------------------------------------------------------------------
   1. ORDERED-LIST MARKERS

   The global reset in lib/css/style.css zeroes margin and padding on `ol` and `ul`.
   Bulma's `.content ul {list-style: disc outside; margin-inline-start: 2em}` is then
   overridden later by `.content ul {list-style: none; margin-inline-start: 0}`, and the
   `.points` lists supply their own 40px inline-start margin, so unordered lists keep
   room for their bullets.

   There is no equivalent `.content ol` rule. Ordered lists therefore end up with zero
   inline-start indent while their markers still render `list-style-position: outside` —
   so the numbers are painted in the container's padding gutter, roughly 14px LEFT of the
   readable text column, on every product page that uses one.

   Restoring an inline-start padding puts the marker back inside the list's own content
   box. `outside` positioning is kept deliberately: it is what makes wrapped lines align
   with the text rather than tucking under the number, which was already correct.
   ------------------------------------------------------------------------------------- */
main .content ol {
    padding-inline-start: 2.25em;
}

/* Nested ordered lists indent again, but less, so deep nesting cannot walk off the
   right edge on a narrow screen. */
main .content ol ol {
    padding-inline-start: 1.75em;
}

/* Unordered lists are deliberately NOT touched: measurement showed their bullets already
   sit inside the content column via the 40px inline-start margin on `.points`. */


/* -------------------------------------------------------------------------------------
   2. SCREENSHOT ACTIVATION

   Each screenshot is wrapped in a real <button>, so it is focusable, operable with Enter
   and Space, and announced as a control — no click-only div, no added ARIA. The button
   is visually transparent: it must not change the look of the figure, only make it
   activatable and signal that it can be enlarged.

   The horizontal scroller on wide screenshots lives on the <picture> INSIDE this button,
   so touch panning still works exactly as before.
   ------------------------------------------------------------------------------------- */
main .shot-open {
    display: block;
    width: 100%;
    margin: 0;
    padding: 0;
    border: 0;
    background: none;
    font: inherit;
    color: inherit;
    text-align: inherit;
    cursor: zoom-in;
    position: relative;
}

/* The affordance: a small expand glyph in the corner of the shot. Restrained on purpose —
   it must not cover UI detail in the screenshot underneath. */
main .shot-open::after {
    content: "\2922";           /* ⤢ north-east / south-west arrow */
    position: absolute;
    inset-block-start: 10px;
    inset-inline-end: 10px;
    z-index: 2;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 34px;
    height: 34px;
    border-radius: 8px;
    background: rgba(20, 32, 54, 0.72);
    color: #fff;
    font-size: 17px;
    line-height: 1;
    opacity: 0;
    transform: scale(0.9);
    transition: opacity 0.15s ease, transform 0.15s ease;
    pointer-events: none;
}

/* Touch devices get no hover, so the affordance is shown permanently but faint. */
@media (hover: none) {
    main .shot-open::after {
        opacity: 0.78;
        transform: none;
    }
}

@media (hover: hover) {
    main .shot-open:hover::after,
    main .shot-open:focus-visible::after {
        opacity: 1;
        transform: none;
    }
    main .shot-open:hover img {
        border-color: #3f7bf0;
    }
}

/* Focus must be at least as obvious as hover. */
main .shot-open:focus-visible {
    outline: 3px solid #3f7bf0;
    outline-offset: 3px;
    border-radius: var(--radius-large, 8px);
}
main .shot-open:focus-visible::after {
    opacity: 1;
    transform: none;
}

/* A screenshot the viewer cannot open (JS unavailable) should not pretend to be a
   control. The enhancement adds .shot-ready; without it the button is inert-looking. */
main .shot-open:not(.shot-ready) {
    cursor: default;
}
main .shot-open:not(.shot-ready)::after {
    display: none;
}


/* -------------------------------------------------------------------------------------
   3. THE VIEWER

   One native <dialog> reused by every screenshot. `showModal()` provides the modal
   semantics, the top layer, Escape-to-close and focus containment; the ::backdrop
   pseudo-element provides the dim. The dialog itself is a transparent full-viewport
   surface and the visible panel is the inner wrapper, which is what makes a click on
   the backdrop distinguishable from a click on the image.

   Nothing here assumes a particular image size or aspect ratio.
   ------------------------------------------------------------------------------------- */
dialog.shotview {
    width: 100%;
    max-width: 100%;
    height: 100%;
    max-height: 100%;
    margin: 0;
    padding: 0;
    border: 0;
    background: transparent;
    overflow: hidden;
}

dialog.shotview::backdrop {
    background: rgba(8, 14, 26, 0.86);
}

.shotview-inner {
    /* Centres the panel and gives the close control somewhere predictable to sit. */
    box-sizing: border-box;
    width: 100%;
    height: 100%;
    padding: 56px 16px 16px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 12px;
}

.shotview-figure {
    margin: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 12px;
    /* The figure may not exceed the space the inner wrapper gives it. */
    max-width: 100%;
    max-height: 100%;
    min-height: 0;
}

/* The image box scrolls in BOTH directions when the picture is larger than the space,
   so a very large screenshot stays inspectable instead of being shrunk to nothing. */
.shotview-imgwrap {
    max-width: 100%;
    max-height: 100%;
    min-height: 0;
    overflow: auto;
    border-radius: 10px;
    background: #0e1a2e;
    -webkit-overflow-scrolling: touch;
}

/* Intrinsic ratio is preserved by `height:auto`; the two max-* rules fit the image to
   the viewport without cropping, distorting, or upscaling a small image. */
.shotview-imgwrap img {
    display: block;
    width: auto;
    height: auto;
    max-width: 100%;
    max-height: calc(100vh - 150px);
    object-fit: contain;
    border-radius: 10px;
}

.shotview-cap {
    max-width: 70ch;
    margin: 0;
    color: #e8eefb;
    font-size: 0.95rem;
    line-height: 1.5;
    text-align: center;
    flex: 0 0 auto;
}

.shotview-close {
    position: absolute;
    inset-block-start: 12px;
    inset-inline-end: 12px;
    z-index: 3;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 44px;
    height: 44px;
    padding: 0;
    border: 1px solid rgba(255, 255, 255, 0.28);
    border-radius: 10px;
    background: rgba(20, 32, 54, 0.9);
    color: #fff;
    font-size: 22px;
    line-height: 1;
    cursor: pointer;
}

.shotview-close:hover {
    background: rgba(38, 58, 94, 0.95);
}

.shotview-close:focus-visible {
    outline: 3px solid #8fb4ff;
    outline-offset: 2px;
}

/* Small screens: the caption costs more than it gives, and the image needs the room. */
@media screen and (max-width: 560px) {
    .shotview-inner {
        padding: 64px 8px 8px;
    }
    .shotview-imgwrap img {
        max-height: calc(100vh - 120px);
    }
    .shotview-cap {
        font-size: 0.88rem;
    }
}

@media (prefers-reduced-motion: reduce) {
    main .shot-open::after {
        transition: none;
    }
}
