/* ============================================================
   Dourak — Entry screen (entry.css)
   Standalone, token-driven cascade for the gateway page.
   Uses ONLY design tokens (variables.css) + a small set of
   component-scoped Entry tokens (the PWA brand navy #0F2A5C).
   RTL-first, mobile-first, CSP-compliant (no inline styles).
   ============================================================ */

*,
*::before,
*::after {
    box-sizing: border-box;
}

[hidden] {
    display: none !important;
}

:root {
    /* ---- Safe-area insets (notched / home-indicator devices) ---- */
    --safe-top: env(safe-area-inset-top, 0px);
    --safe-right: env(safe-area-inset-right, 0px);
    --safe-bottom: env(safe-area-inset-bottom, 0px);
    --safe-left: env(safe-area-inset-left, 0px);

    /* ---- Component-scoped Entry tokens ----
       The PWA brand navy (#0F2A5C, the manifest theme-color) anchors this
       screen. Scoped here so the global token set stays untouched. */
    --entry-primary: #0F2A5C;
    --entry-primary-hover: #0c2347;
    --entry-primary-soft: #edf2fb;
    --entry-gradient: linear-gradient(135deg, #0F2A5C 0%, #2f80ed 100%);
    --entry-shadow-hero: 0 20px 50px rgba(15, 42, 92, 0.22);
}

.entry-body {
    margin: 0;
    min-height: 100dvh;
    display: flex;
    flex-direction: column;
    background: var(--color-bg);
    color: var(--color-text);
    font-family: var(--font-family);
    -webkit-tap-highlight-color: transparent;
}

button,
input,
select,
textarea {
    font-family: inherit;
}

a {
    color: inherit;
    text-decoration: none;
}

:focus-visible {
    outline: none;
    box-shadow: var(--focus-ring);
}

/* ---- Accessibility: skip link + screen-reader-only ---- */
.c-sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

.c-skip-link {
    position: fixed;
    top: var(--safe-top);
    inset-inline-start: var(--space-3);
    z-index: calc(var(--z-drawer) + 20);
    padding: var(--space-2) var(--space-3);
    border-radius: var(--radius-pill);
    background: var(--entry-primary);
    color: var(--color-text-inverse);
    font-size: var(--fs-sm);
    font-weight: var(--fw-semibold);
    transform: translateY(-200%);
    transition: transform var(--transition-fast);
}

.c-skip-link:focus-visible {
    transform: none;
}

/* ---- Layout ---- */
.entry-main {
    flex: 1;
    display: flex;
    padding: var(--space-5) var(--gutter) calc(var(--space-6) + var(--safe-bottom));
}

.entry-shell {
    width: 100%;
    max-width: 440px;
    margin: auto;
}

/* ---- Brand hero ---- */
.e-hero {
    position: relative;
    z-index: 0;
    background: var(--entry-gradient);
    border-radius: 24px;
    box-shadow: var(--entry-shadow-hero);
    padding: var(--space-6) var(--space-5);
    text-align: center;
    color: var(--color-text-inverse);
}

.e-mark {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 76px;
    height: 76px;
    border-radius: 22px;
    font-size: 2.1rem;
    background: rgba(255, 255, 255, 0.14);
    border: 1px solid rgba(255, 255, 255, 0.28);
    box-shadow: 0 10px 24px rgba(0, 0, 0, 0.18);
    -webkit-backdrop-filter: blur(6px);
    backdrop-filter: blur(6px);
}

.e-brand {
    margin: var(--space-4) 0 var(--space-2);
    font-size: var(--fs-3xl);
    font-weight: var(--fw-extrabold);
    letter-spacing: -0.01em;
    line-height: 1.25;
}

.e-tagline {
    margin: 0 auto;
    max-width: 300px;
    font-size: var(--fs-md);
    font-weight: var(--fw-medium);
    line-height: 1.7;
    color: rgba(255, 255, 255, 0.9);
}

/* ---- Entry card (overlaps the hero) ---- */
.e-card {
    position: relative;
    z-index: 1;
    margin-top: calc(-1 * var(--space-5));
    background: var(--color-card);
    border: 1px solid var(--color-border);
    border-radius: 24px;
    box-shadow: var(--shadow-card);
    padding: var(--space-6);
}

.e-welcome {
    margin: 0 0 var(--space-5);
    font-size: var(--fs-xl);
    font-weight: var(--fw-extrabold);
    text-align: center;
    color: var(--color-text);
}

.e-actions {
    display: flex;
    flex-direction: column;
    gap: var(--space-4);
}

/* ---- Buttons (design-system §8, token-driven) ---- */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: var(--space-2);
    height: var(--btn-height);
    padding: 0 var(--space-5);
    border-radius: var(--radius-md);
    border: none;
    font-size: var(--fs-base);
    font-weight: var(--fw-semibold);
    line-height: 1;
    cursor: pointer;
    text-align: center;
    transition: transform var(--transition-fast), box-shadow var(--transition-fast), border-color var(--transition-fast), background-color var(--transition-fast);
}

.btn i {
    font-size: 1.15em;
}

.btn:active {
    transform: scale(0.98);
}

.btn:disabled {
    opacity: 0.55;
    cursor: not-allowed;
    pointer-events: none;
}

.btn-block {
    width: 100%;
}

.btn-lg {
    height: 64px;
    border-radius: var(--radius-lg);
    font-size: var(--fs-md);
}

.btn-primary {
    background: var(--entry-primary);
    color: var(--color-text-inverse);
    box-shadow: var(--shadow-primary);
}

.btn-primary:hover:not(:disabled) {
    background: var(--entry-primary-hover);
    box-shadow: var(--shadow-md);
    transform: translateY(-2px);
}

.btn-secondary {
    background: var(--entry-primary-soft);
    color: var(--entry-primary);
    border: 1px solid var(--color-border-strong);
}

.btn-secondary:hover:not(:disabled) {
    background: var(--entry-primary);
    color: var(--color-text-inverse);
    box-shadow: var(--shadow-md);
    transform: translateY(-2px);
}

.btn-outline {
    background: transparent;
    color: var(--entry-primary);
    border: 1px solid var(--color-border-strong);
}

.btn-outline:hover:not(:disabled) {
    border-color: var(--entry-primary);
    background: var(--entry-primary-soft);
    transform: translateY(-2px);
}

.btn-ghost {
    background: transparent;
    color: var(--color-text-secondary);
}

.btn-ghost:hover:not(:disabled) {
    background: var(--color-bg);
    color: var(--color-text);
}

/* ---- Footer note ---- */
.e-footer {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: var(--space-2);
    margin: var(--space-5) 0 0;
    padding-top: var(--space-4);
    border-top: 1px solid var(--color-border);
    font-size: var(--fs-xs);
    line-height: 1.7;
    color: var(--color-text-muted);
    text-align: center;
}

.e-footer i {
    font-size: 1.1rem;
}

/* ---- Placeholder (قريبًا) view ---- */
.e-soon {
    position: relative;
    z-index: 1;
    margin-top: calc(-1 * var(--space-5));
    padding: var(--space-7) var(--space-6);
    background: var(--color-card);
    border: 1px solid var(--color-border);
    border-radius: 24px;
    box-shadow: var(--shadow-card);
    text-align: center;
}

.e-soon-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 64px;
    height: 64px;
    border-radius: 22px;
    background: var(--entry-primary-soft);
    color: var(--entry-primary);
    font-size: 2rem;
}

.e-soon-title {
    margin: var(--space-4) 0 var(--space-2);
    font-size: var(--fs-xl);
    font-weight: var(--fw-extrabold);
    color: var(--color-text);
}

.e-soon-lead {
    margin: 0 auto;
    max-width: 320px;
    font-size: var(--fs-base);
    line-height: 1.7;
    color: var(--color-text-secondary);
}

.e-chip {
    display: inline-flex;
    align-items: center;
    margin: var(--space-5) auto;
    padding: var(--space-2) var(--space-4);
    border-radius: var(--radius-pill);
    background: var(--color-primary-light);
    color: var(--entry-primary);
    font-size: var(--fs-sm);
    font-weight: var(--fw-medium);
    font-family: ui-monospace, "Cascadia Code", "Segoe UI Mono", monospace;
}

/* ---- Reduced motion ---- */
@media (prefers-reduced-motion: reduce) {
    .btn,
    .c-skip-link {
        transition: none;
        transform: none;
    }
}

/* ---- Tablet (≥768px): wider rhythm, still centered ---- */
@media (min-width: 768px) {
    .entry-shell {
        max-width: 440px;
    }

    .e-hero {
        padding: var(--space-7) var(--space-6);
    }

    .e-card,
    .e-soon {
        padding: var(--space-7);
    }
}