/* The template gallery at the start of "Stwórz animację" (Shared/Animations/AnimationWizardSections/
   TemplateGallery.razor; mockup 004 A). It sits in the wizard's .aw-page and uses its cards, pills and
   band from wwwroot/animation-editor/styles/preview.css, with the panel's colours (theme.css, --vn-*).
   A plain stylesheet linked in Pages/_Layout.cshtml rather than a scoped .razor.css: a scoped
   stylesheet of a new component reaches the styles bundle only on a full rebuild. preview.css loads
   after this file, so a rule here that overrides one of its own is the more specific. Every class starts
   with "aw-gallery", "aw-tile", "aw-thumb", "aw-shot", "aw-badge", "aw-ori" or "aw-band-note"; the
   band's actions are touched only under .aw-gallery-page. */

/* ─── Band ───────────────────────────────────────────────────────────────────── */
.aw-page .aw-band-note {
    font-size: 13px;
    color: rgba(255, 255, 255, .8);
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.aw-page .aw-band-note b { color: #fff; font-weight: 700; }

/* A long template name in the note truncates instead of widening the band on a narrow window. */
.aw-page.aw-gallery-page .aw-band-actions { min-width: 0; max-width: 100%; }
.aw-page.aw-gallery-page .aw-band-actions .aw-pill-white { flex-shrink: 0; }

/* ─── Card and toolbar ───────────────────────────────────────────────────────── */
.aw-page .aw-gallery-body { padding: 16px; }

.aw-page .aw-card.aw-gallery { padding: 18px 20px 20px; }

.aw-page .aw-gallery-toolbar { display: flex; flex-wrap: wrap; align-items: center; gap: 12px; }

.aw-page .aw-gallery-title { font-size: 17px; font-weight: 800; letter-spacing: -.01em; margin-right: auto; }

.aw-page .aw-gallery-search {
    flex: 0 1 360px;
    min-width: 0;
    height: 42px;
    margin: 0;
    padding: 0 18px;
    border-radius: 999px;
    background: var(--vn-field);
    display: flex;
    align-items: center;
    gap: 10px;
}

.aw-page .aw-gallery-search:focus-within { background: #fff; box-shadow: 0 0 0 2px var(--vn-ring); }
.aw-page .aw-gallery-search svg { color: var(--vn-purple); flex-shrink: 0; }

/* theme.css fills every input in <main> and sets its height; inside the pill the input is bare. */
.aw-page .aw-gallery-search input {
    flex: 1;
    min-width: 0;
    height: 100% !important;
    padding: 0 !important;
    border: 0 !important;
    outline: 0 !important;
    box-shadow: none !important;
    background: transparent !important;
    color: var(--vn-text);
}

.aw-page .aw-gallery-seg {
    height: 42px;
    display: inline-flex;
    background: var(--vn-field);
    border-radius: 999px;
    padding: 3px;
    gap: 2px;
}

.aw-page .aw-gallery-seg > button:focus-visible { outline: 2px solid var(--vn-focus); outline-offset: 2px; }

.aw-page .aw-gallery-seg > button {
    border: 0;
    background: transparent;
    border-radius: 999px;
    padding: 0 14px;
    display: inline-flex;
    align-items: center;
    gap: 7px;
    font-size: 13px;
    font-weight: 600;
    color: var(--vn-head);
    cursor: pointer;
    white-space: nowrap;
}

.aw-page .aw-gallery-seg > button[aria-pressed="true"] { background: #fff; color: var(--vn-indigo); font-weight: 700; box-shadow: 0 1px 4px rgba(67, 47, 141, .18); }

.aw-page .aw-gallery-count { font-size: 12px; color: var(--vn-label); margin-top: 14px; }
.aw-page .aw-gallery-count b { color: var(--vn-text); font-weight: 700; }

.aw-page .aw-gallery-empty { padding: 40px 0; text-align: center; color: var(--vn-label); font-size: 13px; }

.aw-page .aw-gallery-none {
    padding: 48px 0 40px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 14px;
    text-align: center;
    color: var(--vn-head);
    font-size: 14px;
}

.aw-page .aw-gallery-none a { text-decoration: none; }

.aw-page .aw-gallery-more { display: flex; justify-content: center; margin-top: 18px; }

/* ─── Tiles ──────────────────────────────────────────────────────────────────── */
/* min(270px, 100%): on a window narrower than one tile the column shrinks instead of overflowing. */
.aw-page .aw-gallery-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(min(270px, 100%), 1fr));
    gap: 16px;
    margin-top: 14px;
}

.aw-page .aw-gallery-grid[aria-busy="true"] { opacity: .6; }

.aw-page .aw-tile {
    position: relative;
    display: block;
    min-width: 0;
    border: 0;
    background: #fff;
    border-radius: 14px;
    padding: 8px 8px 12px;
    text-align: left;
    font: inherit;
    color: var(--vn-text);
    box-shadow: 0 0 0 1px #ECE7F4;
    cursor: pointer;
}

.aw-page .aw-tile:hover { box-shadow: 0 0 0 1px #D9CDEB, 0 8px 20px rgba(67, 47, 141, .10); }
.aw-page .aw-tile.is-on { box-shadow: 0 0 0 2px var(--vn-ring), 0 10px 26px rgba(67, 47, 141, .18); }
.aw-page .aw-tile:focus-visible { outline: 2px solid var(--vn-focus); outline-offset: 3px; }

.aw-page .aw-tile-name {
    display: block;
    font-size: 14px;
    font-weight: 700;
    margin: 11px 4px 0;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.aw-page .aw-tile.is-on .aw-tile-name { color: var(--vn-indigo); }

/* The ID, network and author under the name: secondary, one line, cut with an ellipsis. */
.aw-page .aw-tile-details {
    display: block;
    font-size: 12px;
    color: var(--vn-label);
    margin: 3px 4px 0;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    font-variant-numeric: tabular-nums;
}

.aw-page .aw-tile-check {
    position: absolute;
    right: 8px;
    top: 8px;
    width: 26px;
    height: 26px;
    border-radius: 999px;
    background: var(--vn-purple);
    color: #fff;
    display: grid;
    place-items: center;
    box-shadow: 0 0 0 2px #fff;
    z-index: 3;
}

/* ─── Thumbnail frame ────────────────────────────────────────────────────────── */
/* Always 16:9 with a dotted ground; a horizontal shot fills it, a vertical one stands in its middle. */
.aw-page .aw-thumb {
    position: relative;
    display: block;
    aspect-ratio: 16 / 9;
    border-radius: 10px;
    overflow: hidden;
    background-color: #E5E2EB;
    background-image: radial-gradient(#D2CCDC 1px, transparent 1.3px);
    background-size: 12px 12px;
}

.aw-page .aw-shot { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; display: block; }

/* A price tag in the template editor's tag picker (PriceTagPickerModal.razor) has its own
   proportions: the whole tag shows, centred on the dotted ground. */
.aw-page .aw-shot.is-contain { object-fit: contain; }

.aw-page .aw-shot.is-vertical {
    inset: 7% auto 7% 50%;
    width: auto;
    height: 86%;
    aspect-ratio: 9 / 16;
    transform: translateX(-50%);
    border-radius: 3px;
    box-shadow: 0 4px 12px rgba(33, 28, 51, .28);
}

/* A template saved before thumbnails were drawn: its orientation and name on the dotted ground. */
.aw-page .aw-thumb-none {
    position: absolute;
    inset: 0 0 28px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 10px;
    padding: 0 16px;
    color: var(--vn-head);
}

.aw-page .aw-thumb-none-name {
    max-width: 100%;
    font-size: 13px;
    font-weight: 600;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.aw-page .aw-badge {
    position: absolute;
    bottom: 8px;
    font-size: 11px;
    font-weight: 600;
    color: #fff;
    background: rgba(24, 16, 36, .66);
    padding: 3px 8px;
    border-radius: 999px;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    white-space: nowrap;
    z-index: 2;
}

.aw-page .aw-badge.is-left { left: 8px; }
.aw-page .aw-badge.is-right { right: 8px; font-variant-numeric: tabular-nums; }

/* ─── Orientation glyph ──────────────────────────────────────────────────────── */
.aw-page .aw-ori { display: inline-block; border: 1.6px solid currentColor; border-radius: 2px; flex-shrink: 0; }
.aw-page .aw-ori.is-h { width: 13px; height: 9px; }
.aw-page .aw-ori.is-v { width: 9px; height: 13px; }
.aw-page .aw-badge .aw-ori { border-width: 1.4px; }
.aw-page .aw-badge .aw-ori.is-h { width: 11px; height: 8px; }
.aw-page .aw-badge .aw-ori.is-v { width: 8px; height: 11px; }
.aw-page .aw-ori.is-large { border-width: 2px; border-radius: 4px; }
.aw-page .aw-ori.is-large.is-h { width: 40px; height: 26px; }
.aw-page .aw-ori.is-large.is-v { width: 26px; height: 40px; }

/* ─── Narrow windows ─────────────────────────────────────────────────────────── */
@media (max-width: 700px) {
    .aw-page .aw-gallery-body { padding: 12px; }
    .aw-page .aw-card.aw-gallery { padding: 14px; }
    .aw-page .aw-gallery-search { flex: 1 1 100%; }
    .aw-page .aw-gallery-seg { max-width: 100%; overflow-x: auto; }
}
