.flyer-storm {
    box-sizing: border-box;
}

.flyer-storm-archive {
    max-width: var(--wp--style--global--wide-size, 1200px);
    margin: 2rem auto;
    padding: 0 1rem;
}

.flyer-storm-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(min(100%, var(--fs-grid-card-width, 250px)), 1fr));
    gap: 1.5rem;
}

.flyer-storm-card {
    border: 1px solid currentColor;
    border-radius: .25rem;
    /* padding: 1rem; */
    min-width: 0;
    overflow-wrap: anywhere;
}

.flyer-storm-card h2 {
    font-size: 1.35em;
    margin: 1rem 0;
}

.flyer-storm .flyer-storm-thumbnail {
    display: block;
    max-width: 100%;
    height: auto;
}

.flyer-storm-card .flyer-storm-thumbnail.wp-post-image {
    width: 100%;
    /* height: 16rem; */
    margin-bottom: 0;
    object-fit: contain;
}

.flyer-storm-single>.flyer-storm-thumbnail {
    margin: 0 auto 1.5rem;
}

/* Only the preview is constrained here; core layout owns the main and footer widths. */
.fs-single-preview .flyer-storm-thumbnail {
    margin-inline: auto;
}

.flyer-storm a {
    text-decoration: underline;
    text-underline-offset: .15em;
}

.flyer-storm a:focus-visible {
    outline: 3px solid currentColor;
    outline-offset: 4px;
}

.flyer-storm-pagination ul {
    display: flex;
    flex-wrap: wrap;
    gap: .5rem;
    list-style: none;
    padding: 0;
}

.flyer-storm-pagination a,
.flyer-storm-pagination .current {
    display: inline-block;
    padding: .6rem .9rem;
}

.flyer-storm-screen-reader {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    overflow: hidden;
    clip-path: inset(50%);
    white-space: nowrap;
}

[data-fs-personal-downloads] {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    align-items: start;
    margin-top: 1rem;
}

[data-fs-personal-downloads] .flyer-storm-download {
    margin: auto;
}

[data-fs-personal-downloads]>p[role=status] {
    flex-basis: 100%;
    margin: 0;
    font-size: 14px;
    line-height: 1.5;
}

[data-fs-personal-downloads] .fs-download-control {
    box-sizing: border-box;
    display: inline-flex;
    justify-content: center;
    align-items: center;
    gap: 10px;
    min-height: 46px;
    padding: 11px 16px;
    border: 1px solid currentColor;
    border-radius: 6px;
    background: var(--fs-button-background, transparent);
    color: var(--fs-button-color, inherit);
    font: 600 14px/1.5 system-ui, -apple-system, sans-serif;
    text-decoration: none;
    cursor: pointer;
    white-space: normal;
    text-align: center;
}

[data-fs-personal-downloads] .fs-download-control:hover {
    text-decoration: underline;
    text-underline-offset: .2em;
    background: var(--fs-button-hover-background, var(--fs-button-background, transparent));
    color: var(--fs-button-color, inherit);
}

[data-fs-personal-downloads] .fs-download-control:focus-visible {
    outline: 3px solid var(--fs-focus-color, currentColor);
    outline-offset: 3px;
    box-shadow: none;
}

[data-fs-personal-downloads] .fs-download-control[aria-disabled=true],
[data-fs-personal-downloads] .fs-download-control:disabled {
    opacity: .65;
    cursor: wait;
}

[data-fs-personal-downloads] .fs-download-icon {
    font-size: 20px;
    line-height: 1;
}

[data-fs-personal-downloads] [hidden] {
    display: none;
}

@media(max-width:480px) {

    [data-fs-personal-downloads] .flyer-storm-download,
    [data-fs-personal-downloads] .fs-download-control {
        width: 100%;
    }
}

/* Gallery-only disclosure; detail-page download controls retain their design. */
.flyer-storm [data-fs-gallery-downloads][hidden] {
    display: none !important;
}

.fs-gallery-toggle {
    margin: 0 0 1.5rem;
    min-height: 44px;
    padding: .6rem 1rem;
    cursor: pointer;
}

.flyer-storm .fs-gallery-thumbnail-link {
    display: block;
}

.flyer-storm .fs-gallery-thumbnail-link:focus-visible,
.fs-gallery-toggle:focus-visible {
    outline: 3px solid var(--fs-focus-color, currentColor);
    outline-offset: 4px;
}

.flyer-storm .fs-gallery-placeholder {
    display: grid;
    align-content: center;
    gap: .75rem;
    min-height: 14rem;
    padding: 1rem;
    text-align: center;
    background: var(--fs-placeholder-background, transparent);
    color: inherit;
}

.flyer-storm .fs-gallery-placeholder small {
    font-weight: normal;
}

/* Bulk preparation sits outside the existing gallery/download controls. */
.fs-bundle {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 1.5rem;
    margin: 1.5rem 0;
    padding: 1rem;
    border: 1px solid var(--fs-border-color, currentColor);
    border-radius: 8px;
}

.fs-bundle[hidden],
.fs-bundle [hidden] {
    display: none !important;
}

.fs-bundle p {
    margin: 0 0 .75rem;
}

.fs-bundle-actions {
    display: flex;
    flex-wrap: wrap;
    gap: .65rem;
    align-items: center;
    margin-bottom: .75rem;
}

.fs-bundle-actions>* {
    max-width: 100%;
    white-space: normal;
    overflow-wrap: anywhere;
}

/* Change this background color to adjust the printer animation tile. */
.fs-bundle-loader {
    --fs-printer-background: #92c1e9;
    display: inline-flex;
    flex: 0 1 200px;
    margin-left: auto;
    align-self: center;
    overflow: hidden;
    box-sizing: border-box;
    width: 300px;
    max-width: 100%;
    aspect-ratio: 1;
    padding: 0px;
    border-radius: 10px;
    background-color: var(--fs-printer-background);
    align-items: center;
    justify-content: center;
}

.fs-bundle-loader[hidden] {
    display: none !important;
}

.fs-bundle-loader img {
    display: block;
    width: 100%;
    height: auto;
}

.fs-bundle-content {
    flex: 1 1 280px;
    min-width: 0;
    overflow-wrap: anywhere;
}

.fs-bundle-download {
    border: 1px solid currentColor;
    display: inline-block;
    padding: .65rem 1rem;
    background: var(--fs-button-background, transparent);
    color: var(--fs-button-color, inherit);
    border-radius: 4px;
    text-decoration: underline;
}

.fs-bundle a:focus-visible,
.fs-bundle button:focus-visible {
    outline: 3px solid var(--fs-focus-color, currentColor);
    outline-offset: 3px;
}

.fs-bundle-expiry {
    font-size: .875em;
}

.fs-bundle-report {
    margin: .5rem 0 0 1.2rem;
    overflow-wrap: anywhere;
}

/* Only visible controls participate; space-between keeps the outer controls at the edges. */
.fs-gallery-controls {
    container: fs-gallery-controls / inline-size;
    width: 100%;
}

.fs-gallery-controls [hidden] {
    display: none !important;
}

.fs-gallery-controls--top {
    margin-bottom: 1.5rem;
}

.fs-gallery-controls--bottom,
.fs-gallery-controls--manual {
    margin-top: 1.5rem;
}

.fs-gallery-controls-bar {
    display: flex;
    flex-wrap: wrap;
    width: 100%;
    gap: 1rem 1.5rem;
    align-items: center;
    justify-content: space-between;
}

.fs-gallery-controls-bar>* {
    flex: 0 1 auto;
    min-width: 0;
    max-width: 100%;
}

.fs-gallery-controls-bar:not(:has(> :not([hidden]))) {
    display: none;
}

.fs-gallery-controls:not(:has(.fs-gallery-controls-bar > :not([hidden]), .fs-bundle-details:not([hidden]))) {
    display: none;
}

.fs-gallery-controls .fs-gallery-toggle {
    margin: 0;
}

.fs-gallery-toggle,
.fs-bundle-start {
    min-height: 44px;
    max-width: 100%;
    white-space: normal;
    overflow-wrap: anywhere;
}

.fs-bundle-start:focus-visible {
    outline: 3px solid var(--fs-focus-color, currentColor);
    outline-offset: 3px;
}

.fs-gallery-toggle-control {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: .5rem;
}

.fs-gallery-toggle-control [data-fs-toggle-help] {
    font-size: .875em;
}

.fs-gallery-toggle-control [hidden] {
    display: none !important;
}

.fs-gallery-toggle:disabled {
    cursor: not-allowed;
    opacity: .7;
}

.fs-gallery-controls>.fs-bundle-details {
    margin: 1rem 0 0;
}

.fs-gallery-controls .fs-bundle-actions:not(:has(> :not([hidden]))) {
    display: none;
}

@container fs-gallery-controls (max-width:420px) {
    .fs-gallery-controls-bar {
        flex-direction: column;
        align-items: stretch;
        gap: .75rem;
    }

    .fs-gallery-controls-bar>* {
        align-self: center;
    }

    .fs-gallery-toggle-control {
        justify-content: center;
    }
}

/* Gallery presentation only: card/download nodes are retained across view changes. */
.flyer-storm[data-fs-gallery] {
    container: fs-gallery / inline-size;
    --fs-grid-card-width: 250px;
    --fs-list-thumbnail-width: 180px;
}

.flyer-storm[data-thumbnail-size="small"] {
    --fs-grid-card-width: 180px;
}

.flyer-storm[data-thumbnail-size="large"] {
    --fs-grid-card-width: 340px;
}

[data-fs-gallery][data-view="grid"][data-grid-titles="false"] .fs-gallery-title,
[data-fs-gallery][data-view="grid"] .fs-gallery-excerpt {
    display: none;
}

[data-fs-gallery] .fs-gallery-card-body {
    min-width: 0;
}

[data-fs-gallery] .fs-gallery-excerpt {
    margin: 0 0 1rem;
    overflow-wrap: anywhere;
}

[data-fs-gallery] .flyer-storm-thumbnail {
    height: auto;
    object-fit: contain;
}

[data-fs-gallery][data-view="list"] .flyer-storm-grid {
    display: flex;
    flex-direction: column;
}

[data-fs-gallery][data-view="list"] .flyer-storm-card {
    display: grid;
    grid-template-columns: minmax(0, var(--fs-list-thumbnail-width)) minmax(0, 1fr);
    align-items: start;
}

[data-fs-gallery][data-view="list"] .fs-gallery-card-body {
    padding: 1rem;
}

[data-fs-gallery][data-view="list"] .fs-gallery-title {
    display: block;
    margin: 0 0 .75rem;
}

[data-fs-gallery][data-view="list"] .fs-gallery-thumbnail-link {
    margin: 0;
}

[data-fs-gallery][data-view="list"] .fs-gallery-placeholder {
    min-height: 0;
    aspect-ratio: 8.5/11;
}

@container fs-gallery (max-width:480px) {
    [data-fs-gallery][data-view="list"] .flyer-storm-card {
        grid-template-columns: minmax(0, 1fr);
    }

    [data-fs-gallery][data-view="list"] .fs-gallery-thumbnail-link {
        width: min(100%, var(--fs-list-thumbnail-width));
        margin: 1rem auto 0;
    }
}

.flyer-storm-view-switch {
    display: flex;
    flex-wrap: wrap;
    gap: .3rem;
    align-items: center;
    justify-content: center;
    max-width: 100%;
}

.flyer-storm-view-switch .fs-view-button {
    min-height: 44px;
    padding: .45rem .3rem;
    border: 0;
    border-radius: 4px;
    background: transparent;
    color: var(--fs-control-color, inherit);
    font: inherit;
    cursor: pointer;
}

.flyer-storm-view-switch .fs-view-button[aria-pressed="true"] {
    font-weight: 700;
    text-decoration: underline;
    text-underline-offset: .25em;
}

.flyer-storm-view-switch .fs-view-toggle {
    display: inline-flex;
    flex: 0 0 56px;
    align-items: center;
    justify-content: center;
    min-height: 44px;
    padding: 0;
    border: 0;
    border-radius: 4px;
    background: transparent;
    color: var(--fs-control-color, inherit);
    cursor: pointer;
}

.flyer-storm-view-switch .fs-view-track {
    position: relative;
    display: block;
    width: 44px;
    height: 26px;
    border: 2px solid currentColor;
    border-radius: 20px;
    background: var(--fs-switch-track-background, transparent);
    box-sizing: border-box;
}

.flyer-storm-view-switch .fs-view-track::after {
    content: "";
    position: absolute;
    top: 2px;
    left: 2px;
    width: 18px;
    height: 18px;
    border-radius: 50%;
    background: currentColor;
    transform: translateX(0);
    transition: transform 140ms ease;
}

.flyer-storm-view-switch .fs-view-toggle[aria-checked="true"] .fs-view-track::after {
    transform: translateX(18px);
}

.flyer-storm-view-switch button:focus-visible {
    outline: 3px solid var(--fs-focus-color, currentColor);
    outline-offset: 3px;
}

.flyer-storm-view-switch button:disabled {
    opacity: .7;
    cursor: not-allowed;
}

.flyer-storm-view-switch [data-fs-view-help] {
    flex-basis: 100%;
    font-size: .875em;
    text-align: center;
    max-width: 20rem;
}

.flyer-storm-view-switch [hidden] {
    display: none !important;
}

@media(prefers-reduced-motion:reduce) {
    .flyer-storm-view-switch .fs-view-track::after {
        transition: none;
    }
}

.fs-gallery-search {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: .6rem;
    margin-block: 1rem;
}

.fs-gallery-search input {
    max-width: 100%;
}

.fs-gallery-search input,
.fs-gallery-search button {
    box-sizing: border-box;
    min-height: 44px;
    font: inherit;
    padding: .6rem 1rem;
}

.fs-gallery-search button {
    cursor: pointer;
    border: 1px solid currentColor;
    border-radius: .25rem;
    background: var(--fs-button-background, transparent);
    color: var(--fs-button-color, inherit);
}

.fs-gallery-search button:hover {
    background: var(--fs-button-hover-background, var(--fs-button-background, transparent));
}

.fs-gallery-search :focus-visible {
    outline: 3px solid var(--fs-focus-color, currentColor);
    outline-offset: 3px;
}

.fs-gallery-search :disabled {
    cursor: not-allowed;
    opacity: .7;
}

.fs-gallery-search [role="status"] {
    flex-basis: 100%;
}

.fs-gallery-search [hidden] {
    display: none !important;
}

/* Shared download preference stays with the group, never each gallery card. */
.fs-download-format {
    margin-block: 1em;
}

.fs-download-format p {
    font-size: .9em;
    margin-block: .5em;
    max-width: 65ch;
}

.fs-download-format[hidden] {
    display: none;
}

.fs-gallery-controls-bar .fs-download-format--compact {
    margin: 0;
}

.flyer-storm-format-switch {
    flex-wrap: nowrap;
}