/* ==========================================================================
   Apepite — App Store–inspired public storefront overrides
   Built on top of Bootstrap 5.3 CDN + data-bs-theme (light / dark)
   ========================================================================== */

:root {
    color-scheme: light;
    /* system-ui / ui-sans-serif: avoid named local fonts (e.g. "SF Pro Display") — Firefox blocks
       those under strict tracking protection ("visibility level 2 requires 3"). */
    --ap-font: system-ui, ui-sans-serif, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Helvetica, Arial, sans-serif;
    --ap-dark: #1d1d1f;
    --ap-muted: #6e6e73;
    --ap-blue: #0071e3;
    --ap-blue-hover: #0077ed;
    --ap-bg: #fbfbfd;
    --ap-card-bg: #ffffff;
    --ap-card-radius: 1.25rem;
    --ap-hero-bg: linear-gradient(180deg, #000000 0%, #1d1d1f 100%);
    --ap-body-text: #333333;
    --ap-border-subtle: rgba(0, 0, 0, 0.06);
    --ap-header-bg: rgba(255, 255, 255, 0.72);
    --ap-header-border: rgba(0, 0, 0, 0.08);
    --ap-footer-bg: #f5f5f7;
    --ap-footer-border: rgba(0, 0, 0, 0.06);
    --ap-code-bg: #f5f5f7;
    --ap-table-border: #e5e5e7;
    --ap-nav-pill-bg: #1d1d1f;
    --ap-nav-pill-fg: #ffffff;
    --ap-card-shadow: 0 2px 12px rgba(0, 0, 0, 0.04);
    --ap-card-shadow-hover: 0 8px 24px rgba(0, 0, 0, 0.08);
    --ap-nav-link-hover-bg: rgba(0, 0, 0, 0.04);
    --ap-nav-active-bg: rgba(0, 113, 227, 0.08);
}

html[data-bs-theme="dark"] {
    color-scheme: dark;
    --ap-dark: #f5f5f7;
    --ap-muted: #a1a1a6;
    --ap-blue: #0a84ff;
    --ap-blue-hover: #409cff;
    --ap-bg: #000000;
    --ap-card-bg: #1c1c1e;
    --ap-card-radius: 1.25rem;
    --ap-hero-bg: linear-gradient(180deg, #000000 0%, #1c1c1e 100%);
    --ap-body-text: #d1d1d6;
    --ap-border-subtle: rgba(255, 255, 255, 0.12);
    --ap-header-bg: rgba(28, 28, 30, 0.72);
    --ap-header-border: rgba(255, 255, 255, 0.08);
    --ap-footer-bg: #1c1c1e;
    --ap-footer-border: rgba(255, 255, 255, 0.08);
    --ap-code-bg: #2c2c2e;
    --ap-table-border: #3a3a3c;
    --ap-nav-pill-bg: #f5f5f7;
    --ap-nav-pill-fg: #1c1c1e;
    --ap-card-shadow: 0 2px 12px rgba(0, 0, 0, 0.35);
    --ap-card-shadow-hover: 0 8px 28px rgba(0, 0, 0, 0.45);
    --ap-nav-link-hover-bg: rgba(255, 255, 255, 0.06);
    --ap-nav-active-bg: rgba(10, 132, 255, 0.22);
}

/* Base */
body {
    font-family: var(--ap-font);
    color: var(--ap-dark);
    background: var(--ap-bg);
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

/* ---------- Header / Navbar ---------- */
.site-header {
    background: var(--ap-header-bg);
    backdrop-filter: saturate(180%) blur(20px);
    -webkit-backdrop-filter: saturate(180%) blur(20px);
    border-bottom: 1px solid var(--ap-header-border);
    position: sticky;
    top: 0;
    z-index: 1030;
}

html[data-bs-theme="dark"] .navbar-toggler-icon {
    filter: invert(1);
}

.site-header .navbar {
    padding-top: 0.75rem;
    padding-bottom: 0.75rem;
}

.site-header .navbar-brand {
    font-size: 1.35rem;
    letter-spacing: -0.02em;
    color: var(--ap-dark);
}

.site-header .nav-link {
    font-size: 0.875rem;
    color: var(--ap-muted);
    transition: color 0.2s;
}

.site-header .nav-link:hover,
.site-header .nav-link.active {
    color: var(--ap-dark);
}

.locale-switcher {
    gap: 0.125rem;
}

.locale-switcher .nav-link {
    font-size: 0.75rem;
    padding: 0.25rem 0.5rem;
    border-radius: 0.375rem;
}

.locale-switcher .nav-link.active {
    background: var(--ap-nav-pill-bg);
    color: var(--ap-nav-pill-fg);
}

/* ---------- Hero ---------- */
.hero-section {
    background: var(--ap-hero-bg);
    color: #fff;
    padding: 6rem 1rem 5rem;
}

.hero-eyebrow {
    font-size: 0.875rem;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: rgba(255, 255, 255, 0.7);
    margin-bottom: 0.75rem;
}

.hero-title {
    font-size: clamp(2rem, 5vw, 3.5rem);
    font-weight: 700;
    letter-spacing: -0.025em;
    line-height: 1.1;
    max-width: 44rem;
    margin: 0 auto 1.25rem;
}

.hero-tagline {
    font-size: 1.125rem;
    color: rgba(255, 255, 255, 0.8);
    max-width: 36rem;
    margin: 0 auto 2rem;
    line-height: 1.5;
}

.hero-cta {
    background: var(--ap-blue);
    border-color: var(--ap-blue);
    border-radius: 1.75rem;
    padding: 0.75rem 2rem;
    font-size: 1rem;
    font-weight: 500;
    transition: background 0.2s;
}

.hero-cta:hover {
    background: var(--ap-blue-hover);
    border-color: var(--ap-blue-hover);
}

/* ---------- Directory Section ---------- */
.directory-section {
    padding: 4rem 0 5rem;
}

.section-heading {
    font-size: 1.75rem;
    font-weight: 700;
    letter-spacing: -0.02em;
    margin-bottom: 2rem;
    color: var(--ap-dark);
}

/* ---------- App Cards ---------- */
.app-card {
    background: var(--ap-card-bg);
    border-radius: var(--ap-card-radius);
    padding: 2rem 1.25rem;
    text-align: center;
    box-shadow: var(--ap-card-shadow);
    border: 1px solid var(--ap-border-subtle);
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.app-card:hover {
    transform: translateY(-4px);
    box-shadow: var(--ap-card-shadow-hover);
}

.app-card-icon {
    width: 72px;
    height: 72px;
    margin: 0 auto 1rem;
    border-radius: 1rem;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.75rem;
    font-weight: 700;
    color: #fff;
    flex-shrink: 0;
}

.app-card-icon:not(.app-card-icon--has-image) {
    background: linear-gradient(135deg, var(--ap-blue) 0%, #34c759 100%);
}

.app-card-icon--has-image {
    padding: 0;
    overflow: hidden;
    background: var(--ap-card-bg);
    border: 1px solid var(--ap-border-subtle);
}

.app-card-icon__img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.app-card-icon--lg {
    width: 96px;
    height: 96px;
    font-size: 2.25rem;
    border-radius: 1.25rem;
}

.app-card-name {
    font-size: 1rem;
    font-weight: 600;
    color: var(--ap-dark);
    margin: 0;
}

/* ---------- App Page Layout ---------- */
.app-page-container {
    padding-top: 3rem;
    padding-bottom: 4rem;
}

.app-sidebar {
    margin-bottom: 2rem;
}

.app-identity {
    text-align: center;
}

.app-sidebar-name {
    font-size: 1.25rem;
    font-weight: 700;
    margin-top: 0.75rem;
    margin-bottom: 0;
    color: var(--ap-dark);
}

.app-pages-nav .nav-link {
    font-size: 0.9rem;
    color: var(--ap-muted);
    padding: 0.4rem 0.75rem;
    border-radius: 0.5rem;
    transition: background 0.15s, color 0.15s;
}

.app-pages-nav .nav-link:hover {
    background: var(--ap-nav-link-hover-bg);
    color: var(--ap-dark);
}

.app-pages-nav .nav-link.active {
    background: var(--ap-nav-active-bg);
    color: var(--ap-blue);
}

/* ---------- Page Content ---------- */
.app-page-content h1 {
    font-size: 2rem;
    font-weight: 700;
    letter-spacing: -0.02em;
    color: var(--ap-dark);
}

.page-body {
    line-height: 1.7;
    font-size: 1rem;
    color: var(--ap-body-text);
}

.page-body h2,
.page-body h3 {
    margin-top: 1.5em;
    margin-bottom: 0.5em;
    font-weight: 600;
    letter-spacing: -0.01em;
    color: var(--ap-dark);
}

.page-body pre {
    background: var(--ap-code-bg);
    border-radius: 0.75rem;
    padding: 1.25rem;
    font-size: 0.875rem;
    overflow-x: auto;
}

.page-body code {
    font-size: 0.9em;
    background: var(--ap-code-bg);
    padding: 0.15em 0.4em;
    border-radius: 0.25rem;
}

.page-body pre code {
    background: transparent;
    padding: 0;
}

.page-body img {
    max-width: 100%;
    height: auto;
    border-radius: 0.75rem;
}

.page-body table {
    width: 100%;
    border-collapse: collapse;
    margin: 1.5rem 0;
    font-size: 0.9rem;
}

.page-body th,
.page-body td {
    border: 1px solid var(--ap-table-border);
    padding: 0.5rem 0.75rem;
    text-align: left;
}

.page-body blockquote {
    margin: 1.5rem 0;
    padding-left: 1.25rem;
    border-left: 3px solid var(--ap-blue);
    color: var(--ap-muted);
}

/* ---------- Breadcrumb ---------- */
.breadcrumb {
    font-size: 0.8125rem;
    --bs-breadcrumb-divider: '›';
}

html[data-bs-theme="dark"] .breadcrumb-item a {
    color: var(--ap-blue);
}

html[data-bs-theme="dark"] .breadcrumb-item.active {
    color: var(--ap-muted);
}

/* ---------- Footer ---------- */
.site-footer {
    background: var(--ap-footer-bg);
    border-top: 1px solid var(--ap-footer-border);
    padding: 3rem 1rem;
    margin-top: 2rem;
}

.footer-tagline {
    font-size: 0.9375rem;
    color: var(--ap-muted);
    margin-bottom: 0.5rem;
}

.footer-copyright {
    font-size: 0.8125rem;
}

/* ---------- Responsive polish ---------- */
@media (max-width: 991.98px) {
    .app-sidebar {
        text-align: center;
    }

    .app-pages-nav .nav {
        flex-direction: row !important;
        flex-wrap: wrap;
        justify-content: center;
        gap: 0.25rem;
    }
}

@media (max-width: 575.98px) {
    .hero-section {
        padding: 4rem 1rem 3.5rem;
    }

    .directory-section {
        padding: 2.5rem 0 3rem;
    }
}

/* ==========================================================================
   Auth — login, register, password reset (English-only flows)
   ========================================================================== */

.auth-page {
    position: relative;
    min-height: 100dvh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 2rem 1.25rem;
    overflow: hidden;
}

.auth-page__backdrop {
    position: absolute;
    inset: 0;
    background:
        radial-gradient(120% 80% at 50% -20%, rgba(0, 113, 227, 0.14), transparent 55%),
        var(--ap-bg);
    pointer-events: none;
}

html[data-bs-theme="dark"] .auth-page__backdrop {
    background:
        radial-gradient(120% 80% at 50% -20%, rgba(10, 132, 255, 0.2), transparent 55%),
        var(--ap-bg);
}

.auth-page__inner {
    position: relative;
    width: 100%;
    max-width: 26rem;
    z-index: 1;
}

.auth-card {
    background: var(--ap-card-bg);
    border: 1px solid var(--ap-border-subtle);
    border-radius: var(--ap-card-radius);
    box-shadow: var(--ap-card-shadow);
    padding: 2rem 1.75rem 1.75rem;
}

.auth-card--narrow {
    max-width: 100%;
}

.auth-card__header {
    text-align: center;
    margin-bottom: 1.75rem;
}

.auth-card__brand {
    display: inline-block;
    font-size: 0.8125rem;
    font-weight: 600;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: var(--ap-muted);
    text-decoration: none;
    margin-bottom: 1rem;
    transition: color 0.2s ease;
}

.auth-card__brand:hover {
    color: var(--ap-blue);
}

.auth-card__title {
    font-size: 1.625rem;
    font-weight: 600;
    letter-spacing: -0.03em;
    color: var(--ap-dark);
    margin: 0 0 0.5rem;
    line-height: 1.2;
}

.auth-card__lead {
    font-size: 0.9375rem;
    color: var(--ap-muted);
    margin: 0;
    line-height: 1.45;
}

.auth-card__body {
    font-size: 0.9375rem;
    color: var(--ap-body-text);
    line-height: 1.55;
}

.auth-card__body.prose p:last-child {
    margin-bottom: 0;
}

.auth-card__alert {
    border-radius: 0.75rem;
    font-size: 0.875rem;
}

.auth-form .form-label {
    font-size: 0.8125rem;
    font-weight: 500;
    color: var(--ap-dark);
    margin-bottom: 0.375rem;
}

.auth-form .form-control,
.auth-form .form-select {
    border-radius: 0.625rem;
    border-color: var(--ap-border-subtle);
    background-color: var(--ap-card-bg);
    color: var(--ap-dark);
}

.auth-form .form-control:focus,
.auth-form .form-select:focus {
    border-color: var(--ap-blue);
    box-shadow: 0 0 0 0.2rem color-mix(in srgb, var(--ap-blue) 22%, transparent);
}

.auth-form .form-check-input:checked {
    background-color: var(--ap-blue);
    border-color: var(--ap-blue);
}

.auth-form__hint {
    line-height: 1.45;
}

.auth-card__submit {
    border-radius: 0.75rem;
    font-weight: 600;
    padding-block: 0.75rem;
    background: var(--ap-blue);
    border-color: var(--ap-blue);
    transition: background-color 0.2s ease, border-color 0.2s ease, transform 0.15s ease;
}

.auth-card__submit:hover {
    background: var(--ap-blue-hover);
    border-color: var(--ap-blue-hover);
}

.auth-card__submit:active {
    transform: scale(0.99);
}

.auth-card__footer {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: center;
    gap: 0.5rem 0.75rem;
    margin-top: 1.5rem;
    padding-top: 1.25rem;
    border-top: 1px solid var(--ap-border-subtle);
    font-size: 0.875rem;
}

.auth-card__footer--single {
    justify-content: center;
    text-align: center;
    color: var(--ap-muted);
}

.auth-card__footer--single a {
    font-weight: 500;
}

.auth-card__footer--stack {
    flex-direction: column;
    align-items: stretch;
    gap: 0.625rem;
}

.auth-card__footer a {
    color: var(--ap-blue);
    text-decoration: none;
}

.auth-card__footer a:hover {
    text-decoration: underline;
}

.auth-card__footer .btn-outline-secondary {
    border-radius: 0.75rem;
    font-weight: 500;
}

.auth-card__footer .btn-primary {
    border-radius: 0.75rem;
    font-weight: 600;
}

.auth-card__footer-sep {
    display: inline-block;
    width: 4px;
    height: 4px;
    border-radius: 50%;
    background: var(--ap-muted);
    opacity: 0.45;
    vertical-align: middle;
}
/* ==== Page content ==== */
.app-preview {
    width: 100%;
    overflow: auto;
}
.app-preview img {
    max-width: 75vw;
    max-height: 75vh;
}
@media (min-width: 992px) {
    .app-preview img {
        max-width: 320px;
    }
    .app-preview table {
        width: 100% !important;
    }
}
.app-preview table, .app-preview tr, .app-preview td {
    border: none;
}
