:root {
    color-scheme: dark;
    --gate-background: #0b142b;
    --gate-surface: #142343;
    --gate-input: #0e1b36;
    --gate-border: #344873;
    --gate-ink: #f3f6fd;
    --gate-muted: #b5c4df;
    --gate-accent: #bacff7;
    --gate-accent-dark: #101d39;
    --gate-radius: 14px;
}

*, *::before, *::after { box-sizing: border-box; }
body {
    min-height: 100svh;
    margin: 0;
    color: var(--gate-ink);
    background: radial-gradient(ellipse at 15% 12%, #1b3060, transparent 65%), var(--gate-background);
    font: 400 1rem/1.75 "Noto Sans Arabic", system-ui, sans-serif;
}
:is(input, button, select) { font: inherit; }
a { color: var(--gate-accent); }
:focus-visible { outline: 2px solid var(--gate-accent); outline-offset: 3px; }

.gate-container { width: min(100% - 2.5rem, 1220px); margin-inline: auto; }
.gate-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: .9rem;
    min-height: 88px;
    border-bottom: 1px solid var(--gate-border);
}
.gate-brand { display: inline-flex; align-items: center; gap: .75rem; min-width: 0; color: var(--gate-ink); font-weight: 700; text-decoration: none; }
.gate-brand img { width: auto; height: 62px; max-width: 122px; flex: none; object-fit: contain; }
.gate-brand span { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.gate-site-link { flex: none; color: var(--gate-muted); font-size: .86rem; text-decoration: none; }
.gate-site-link:hover { color: var(--gate-ink); }
.gate-site-link i { margin-inline-start: .25rem; }

.gate-main {
    display: grid;
    grid-template-columns: minmax(0, .9fr) minmax(0, 1.1fr);
    align-items: center;
    gap: clamp(1.2rem, 4vw, 3.75rem);
    min-height: calc(100svh - 88px);
    padding-block: clamp(1.5rem, 4vw, 3.5rem);
}
.gate-card {
    min-width: 0;
    width: 100%;
    padding: clamp(1.15rem, 3.25vw, 2.3rem);
    border: 1px solid var(--gate-border);
    border-radius: 24px;
    background: var(--gate-surface);
    box-shadow: 0 20px 65px #060e2073;
}
.gate-card h1 { margin: 0; font-size: clamp(1.55rem, 3vw, 2.25rem); font-weight: 700; line-height: 1.45; }
.gate-intro { margin: .55rem 0 1.35rem; color: var(--gate-muted); font-size: .94rem; }
.gate-intro bdi { color: var(--gate-ink); font: 600 .91rem Inter, system-ui, sans-serif; white-space: nowrap; }

.gate-tabs, .gate-choice { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: .4rem; }
.gate-tabs {
    margin-bottom: 1.35rem;
    border: 1px solid var(--gate-border);
    border-radius: var(--gate-radius);
    background: var(--gate-input);
    padding: .32rem;
}
.gate-tabs a {
    padding: .5rem;
    border-radius: 10px;
    color: var(--gate-muted);
    text-align: center;
    text-decoration: none;
    font-size: .88rem;
    font-weight: 600;
}
.gate-tabs a[aria-current] { background: #263d6d; color: var(--gate-ink); }
.gate-tabs a:hover { color: var(--gate-ink); }

.gate-choice { gap: .55rem; }
nav.gate-choice { margin-bottom: 1.1rem; }
.gate-choice :is(a, label) {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: .4rem;
    min-height: 46px;
    border: 1px solid var(--gate-border);
    border-radius: var(--gate-radius);
    padding: .4rem .5rem;
    background: var(--gate-input);
    color: var(--gate-muted);
    text-align: center;
    text-decoration: none;
    font-size: .82rem;
    font-weight: 600;
    cursor: pointer;
}
.gate-choice input { position: absolute; width: 1px; height: 1px; opacity: 0; }
.gate-choice :is(a[aria-current], label:has(input:checked)) { background: #263d6d; border-color: #8ca9db; color: var(--gate-ink); }
.gate-choice :is(a, label):hover { border-color: #8ca9db; color: var(--gate-ink); }
.gate-choice label:focus-within { outline: 2px solid var(--gate-accent); outline-offset: 3px; }
.gate-choice i { color: var(--gate-accent); flex: none; }

.gate-form { display: grid; gap: .9rem; }
.gate-field { display: grid; gap: .32rem; min-width: 0; }
.gate-field[hidden] { display: none; }
.gate-fieldset { min-width: 0; border: 0; padding: 0; margin: 0; }
.gate-field > label, .gate-fieldset legend { color: var(--gate-ink); font-size: .86rem; font-weight: 600; }
.gate-fieldset legend { padding: 0; margin-bottom: .32rem; }
.gate-input {
    width: 100%;
    min-height: 51px;
    padding: .54rem .85rem;
    border: 1px solid var(--gate-border);
    border-radius: var(--gate-radius);
    background: var(--gate-input);
    color: var(--gate-ink);
    font-size: 1rem;
}
.gate-input::placeholder { color: #9eafcf; }
.gate-input:focus { outline-offset: 1px; border-color: #9eb7e7; }
.gate-input[aria-invalid="true"] { border-color: #ff9b9b; }
.gate-input[type="tel"] { font-family: Inter, system-ui, sans-serif; text-align: left; }
.gate-error { color: #ffc4c4; font-size: .83rem; }
.gate-message {
    display: flex;
    align-items: start;
    gap: .55rem;
    padding: .65rem .8rem;
    margin-bottom: .9rem;
    border: 1px solid #5b7ab0;
    border-radius: var(--gate-radius);
    background: #233962;
    color: #e4ecff;
    font-size: .84rem;
}
.gate-message-error { border-color: #a96978; background: #3b2338; color: #ffd1d6; }

.gate-button {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: .65rem;
    width: 100%;
    min-height: 52px;
    padding: .5rem .8rem;
    border: 1px solid var(--gate-accent);
    border-radius: var(--gate-radius);
    background: var(--gate-accent);
    color: var(--gate-accent-dark);
    font-size: .9rem;
    font-weight: 700;
    cursor: pointer;
}
.gate-button:hover { background: #d5e3ff; }
.gate-button:disabled { cursor: wait; }
.gate-form[aria-busy="true"] .gate-button i { display: none; }
.gate-form[aria-busy="true"] .gate-button::after {
    content: "";
    width: 1rem;
    height: 1rem;
    border: 2px solid #405e9a;
    border-inline-end-color: transparent;
    border-radius: 50%;
    animation: gate-spin .7s linear infinite;
}
@keyframes gate-spin { to { transform: rotate(360deg); } }

.gate-consent { display: flex; align-items: start; gap: .6rem; color: var(--gate-muted); font-size: .84rem; }
.gate-consent input { width: 1rem; height: 1rem; margin: .25rem 0 0; flex: none; accent-color: var(--gate-accent); }
.gate-link {
    background: none;
    border: 0;
    padding: 0;
    color: var(--gate-accent);
    text-decoration: underline;
    text-underline-offset: .19em;
    font-size: inherit;
    cursor: pointer;
}
.gate-link:hover { color: var(--gate-ink); }
.gate-otp-actions { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: .5rem 1rem; margin-top: 1rem; font-size: .85rem; }
.gate-otp { position: relative; }
.gate-otp-input { height: 64px; font: 700 1.6rem Inter, system-ui, sans-serif; text-align: center; letter-spacing: .3em; }
.gate-otp-digits { display: none; }
.gate-otp.is-enhanced .gate-otp-input { position: relative; z-index: 1; background: transparent; border: 0; color: transparent; caret-color: transparent; }
.gate-otp.is-enhanced .gate-otp-digits {
    display: grid;
    grid-template-columns: repeat(var(--gate-otp-length), minmax(0, 1fr));
    gap: .55rem;
    position: absolute;
    inset: 0;
    pointer-events: none;
}
.gate-otp-digits span {
    display: grid;
    place-items: center;
    border: 1px solid var(--gate-border);
    border-radius: var(--gate-radius);
    background: var(--gate-input);
    color: var(--gate-ink);
    font: 700 1.55rem Inter, system-ui, sans-serif;
}
.gate-otp:focus-within .gate-otp-digits .is-current { border-color: var(--gate-accent); background: #21365f; }
.gate-otp:has(input[aria-invalid="true"]) .gate-otp-digits span { border-color: #ff9b9b; }
.gate-sr-only { position: absolute; width: 1px; height: 1px; padding: 0; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }

.gate-visual {
    position: relative;
    align-self: stretch;
    display: flex;
    align-items: end;
    overflow: hidden;
    isolation: isolate;
    min-width: 0;
    min-height: 530px;
    margin: 0;
    border: 1px solid var(--gate-border);
    border-radius: 24px;
    background: var(--gate-surface);
}
.gate-visual img, .gate-visual::after { position: absolute; inset: 0; width: 100%; height: 100%; }
.gate-visual img { object-fit: cover; object-position: center; z-index: -2; }
.gate-visual::after { content: ""; z-index: -1; background: linear-gradient(0deg, #0b142bf7, #0b142b37 47%, transparent 74%); }
.gate-visual figcaption { padding: clamp(1.1rem, 4vw, 2.25rem); }
.gate-visual strong { display: block; margin-bottom: .3rem; font-size: clamp(1.25rem, 3vw, 2.1rem); line-height: 1.5; }
.gate-visual span { color: #d9e5fa; font-size: .91rem; }

.gate-legal {
    width: min(640px, 100% - 1.5rem);
    max-height: min(78svh, 700px);
    padding: 0;
    overflow: hidden;
    border: 1px solid var(--gate-border);
    border-radius: 20px;
    background: var(--gate-surface);
    color: var(--gate-ink);
}
.gate-legal[open] { display: grid; grid-template-rows: auto minmax(0, 1fr) auto; }
.gate-legal::backdrop { background: #050b1bd1; }
.gate-legal-head { display: flex; align-items: center; justify-content: space-between; gap: .65rem; padding: .9rem 1.1rem; border-bottom: 1px solid var(--gate-border); }
.gate-legal-head h2 { margin: 0; font-size: 1.1rem; }
.gate-legal-head button { width: 40px; height: 40px; }
.gate-legal-body { overflow: auto; padding: .65rem 1.1rem; overflow-wrap: anywhere; }
.gate-legal-foot { padding: .85rem 1.1rem 1.1rem; }

@media (max-width: 850px) {
    .gate-container { width: min(100% - 1.5rem, 600px); }
    .gate-header { min-height: 72px; }
    .gate-brand img { height: 52px; max-width: 104px; }
    .gate-main { min-height: 0; grid-template-columns: minmax(0, 1fr); gap: 1rem; }
    .gate-visual { min-height: 0; aspect-ratio: 16 / 10; }
}

@media (prefers-reduced-motion: reduce) {
    .gate-form[aria-busy="true"] .gate-button::after { animation: none; }
}
