/*
 * Modernist dark theme — tokens taken from the "Каталог приложений" design.
 * Bootstrap stays responsible for layout, grid and components; this file only
 * retunes Bootstrap's variables and adds the few component classes the design
 * needs. Retune the tokens here, not inside the templates.
 */

:root,
[data-bs-theme="dark"] {
    --app-bg: #0e0e11;
    --app-surface: #16161c;
    --app-surface-2: #1a1a21;
    --app-surface-3: #22222b;
    --app-border: #26262e;
    --app-border-strong: #3a3a44;
    --app-text: #f4f4f2;
    --app-muted: #a5a5b2;
    --app-dim: #8b8b99;
    --app-accent: #cdff4a;
    --app-accent-hover: #e4ff9a;
    --app-on-accent: #0e0e11;

    --bs-body-bg: var(--app-bg);
    --bs-body-color: var(--app-text);
    --bs-secondary-color: var(--app-muted);
    --bs-border-color: var(--app-border);
    --bs-link-color: var(--app-accent);
    --bs-link-color-rgb: 205, 255, 74;
    --bs-link-hover-color: var(--app-accent-hover);
    --bs-link-hover-color-rgb: 228, 255, 154;
    --bs-border-radius: 0;
    --bs-border-radius-sm: 0;
    --bs-border-radius-lg: 0;
    --bs-font-sans-serif: "Archivo", system-ui, -apple-system, "Segoe UI", sans-serif;
    --bs-emphasis-color: var(--app-text);
}

body {
    background: var(--app-bg);
    color: var(--app-text);
    font-family: var(--bs-font-sans-serif);
    -webkit-font-smoothing: antialiased;
}

.page {
    max-width: 1120px;
}

/* — headings — */
.heading {
    font-weight: 800;
    letter-spacing: -0.03em;
    line-height: 0.96;
}

.heading-hero {
    font-size: clamp(36px, 5.6vw, 62px);
}

.heading-app {
    font-size: clamp(32px, 4.6vw, 52px);
    line-height: 1;
    letter-spacing: -0.025em;
}

.section-label {
    font-weight: 800;
    font-size: 12px;
    letter-spacing: 0.14em;
    text-transform: uppercase;
    color: var(--app-dim);
}

.lead-muted {
    color: var(--app-muted);
    line-height: 1.55;
    text-wrap: pretty;
}

/* — masthead — */
.masthead {
    border-bottom: 1px solid #2a2a31;
    background: #131318;
}

.masthead-brand {
    font-weight: 800;
    font-size: 18px;
    letter-spacing: 0.16em;
    text-transform: uppercase;
    color: var(--app-text);
    text-decoration: none;
}

.masthead-brand:hover {
    color: var(--app-text);
}

.masthead-tick {
    width: 2px;
    height: 16px;
    background: var(--app-accent);
}

.masthead-link {
    color: var(--app-accent);
    font-size: 13px;
    font-weight: 600;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    text-decoration: none;
    border-bottom: 2px solid var(--app-border-strong);
}

.masthead-link:hover {
    color: var(--app-accent-hover);
    border-bottom-color: var(--app-accent);
}

/* — catalog rows — */
.app-row {
    display: grid;
    grid-template-columns: 128px minmax(0, 1fr) auto;
    gap: 32px;
    align-items: center;
    padding: 26px 28px;
    margin-bottom: 14px;
    background: var(--app-surface);
    border: 1px solid var(--app-border);
    color: inherit;
    text-decoration: none;
    transition: background 130ms linear, border-color 130ms linear;
    animation: app-rise 460ms cubic-bezier(.16, .84, .28, 1) both;
}

.app-row:hover,
.app-row:focus-visible {
    background: #1c1c24;
    border-color: var(--app-accent);
    color: inherit;
}

.app-row:active .app-icon {
    transform: translateY(2px);
}

.app-row-title {
    font-weight: 800;
    font-size: 30px;
    letter-spacing: -0.02em;
    line-height: 1.04;
}

.app-row-text {
    font-size: 16px;
    line-height: 1.5;
    color: var(--app-muted);
    max-width: 56ch;
    text-wrap: pretty;
}

.app-row-cta {
    font-weight: 800;
    font-size: 24px;
    color: var(--app-accent);
}

.app-icon {
    width: 128px;
    height: 128px;
    background: var(--app-surface-3);
    object-fit: cover;
    transition: transform 120ms ease;
}

.app-icon-framed {
    background: var(--app-surface-2);
    border: 1px solid var(--app-border);
}

@keyframes app-rise {
    from { opacity: 0; transform: translateY(14px); }
    to { opacity: 1; transform: none; }
}

@media (prefers-reduced-motion: reduce) {
    .app-row { animation: none; }
}

/* — chips — */
.chip {
    font-size: 11px;
    font-weight: 600;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: var(--app-on-accent);
    background: var(--app-accent);
    padding: 3px 8px;
}

.chip-meta {
    font-size: 12px;
    color: var(--app-dim);
    letter-spacing: 0.04em;
}

/* — app page — */
.listing-language {
    display: flex;
    align-items: center;
    gap: 18px;
    margin: 6px 0 32px;
}

.listing-language select {
    min-height: 44px;
    padding: 9px 38px 9px 14px;
    color: var(--app-text);
    background-color: var(--app-surface);
    border: 1px solid var(--app-border-strong);
    border-radius: 0;
    font: inherit;
    font-size: 14px;
    font-weight: 600;
}

.listing-language select:hover,
.listing-language select:focus {
    border-color: var(--app-accent);
    outline: 0;
}

.feature-graphic {
    display: block;
    width: 100%;
    height: auto;
    aspect-ratio: 1024 / 500;
    object-fit: cover;
    background: var(--app-surface-2);
    border: 1px solid var(--app-border);
}

.category-trail {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 7px;
    color: var(--app-dim);
    font-size: 11px;
    font-weight: 600;
    letter-spacing: 0.1em;
    text-transform: uppercase;
}

.category-badge {
    padding: 3px 8px;
    color: var(--app-text);
    background: var(--app-surface-3);
    border: 1px solid var(--app-border-strong);
}

.back-link {
    font-size: 13px;
    font-weight: 600;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    color: var(--app-dim);
    text-decoration: none;
}

.back-link:hover {
    color: var(--app-accent);
}

.app-head {
    display: grid;
    grid-template-columns: 128px minmax(0, 1fr) auto;
    gap: 24px;
    align-items: center;
    padding: 24px 0;
    border-bottom: 1px solid var(--app-border);
}

.app-tagline {
    max-width: 52ch;
    font-size: 17px;
    line-height: 1.45;
    color: var(--app-muted);
    text-wrap: pretty;
}

.app-description {
    max-width: 68ch;
    font-size: 17px;
    line-height: 1.6;
    text-wrap: pretty;
}

.listing-content[dir="rtl"] .app-description {
    margin-inline-start: 0;
    margin-inline-end: auto;
}

.btn-play {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    background: var(--app-accent);
    color: var(--app-on-accent);
    padding: 15px 22px;
    min-height: 44px;
    font-size: 14px;
    font-weight: 600;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    text-decoration: none;
    border: 2px solid var(--app-accent);
}

.btn-play:hover,
.btn-play:focus-visible {
    background: var(--app-accent-hover);
    border-color: var(--app-accent-hover);
    color: var(--app-on-accent);
}

/* — screenshots — */
.shot-nav {
    flex: none;
    width: 48px;
    height: 48px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--app-surface);
    border: 1px solid var(--app-border-strong);
    color: var(--app-text);
    font-size: 20px;
    font-weight: 800;
    cursor: pointer;
}

.shot-nav:hover {
    background: var(--app-accent);
    border-color: var(--app-accent);
    color: var(--app-on-accent);
}

.shot-scroller {
    flex: 1 1 auto;
    min-width: 0;
    display: flex;
    gap: 12px;
    overflow-x: auto;
    padding-bottom: 12px;
    scroll-snap-type: x mandatory;
    scroll-behavior: smooth;
    scrollbar-width: thin;
    scrollbar-color: var(--app-accent) var(--app-surface-2);
}

.shot-scroller::-webkit-scrollbar { height: 8px; }
.shot-scroller::-webkit-scrollbar-track { background: var(--app-surface-2); }
.shot-scroller::-webkit-scrollbar-thumb { background: var(--app-border-strong); }
.shot-scroller::-webkit-scrollbar-thumb:hover { background: var(--app-accent); }

.shot {
    flex: none;
    height: 340px;
    width: auto;
    background: var(--app-surface-2);
    border: 1px solid var(--app-border);
    scroll-snap-align: start;
    cursor: zoom-in;
    object-fit: contain;
    padding: 0;
}

.note {
    font-size: 12px;
    color: var(--app-dim);
}

/* — lightbox — */
.lightbox .modal-content {
    background: transparent;
    border: 0;
}

.lightbox .modal-body {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 0;
}

.lightbox img {
    max-width: 100%;
    max-height: 82dvh;
    object-fit: contain;
    background: #111116;
    border: 1px solid var(--app-border);
}

.lightbox-label {
    font-size: 12px;
    font-weight: 600;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: var(--app-dim);
}

/* — focus — */
a:focus-visible,
button:focus-visible,
[tabindex]:focus-visible {
    outline: 2px solid var(--app-accent);
    outline-offset: 2px;
}

/* — responsive — */
@media (max-width: 820px) {
    .app-row {
        grid-template-columns: 88px minmax(0, 1fr);
        gap: 18px;
        padding: 18px;
    }

    .app-row .app-icon {
        width: 88px;
        height: 88px;
    }

    .app-row-cta {
        display: none;
    }

    .app-head {
        grid-template-columns: minmax(0, 1fr);
    }

    .listing-language { align-items: flex-start; flex-direction: column; gap: 8px; }
}

@media (max-width: 620px) {
    .shot { height: 200px; }
    .shot-nav { width: 44px; height: 44px; }
}
