/* ==========================================================================
   aridesk — the sign-in pages (login, register, forgot/reset password,
   complete-profile, auto-login), in the public site's design language.
   Loaded AFTER css/home.css, which carries the tokens (light + dark), the
   base, the logo, the theme toggle, the buttons, the form fields and the
   motion. Shared behaviours: js/auth.js. See DESIGN.md.

   One card on the dotted ground with soft glows; beside it, on wide screens,
   a navy panel with curved corners and glass rows (the login and register
   pages). The card is the one thing on the screen: one primary action.
   ========================================================================== */

body.auth { min-height: 100dvh; display: flex; flex-direction: column; }
.auth [hidden] { display: none !important; }

/* --------------------------------------------------------------------------
   Slim header: the logo, a way back to the site, the theme toggle
   -------------------------------------------------------------------------- */
.auth-header { padding: 16px 0; }
.auth-header__inner { display: flex; align-items: center; justify-content: space-between; gap: 16px; }
.auth-header__actions { display: flex; align-items: center; gap: 8px; }
.auth-header__back {
    display: inline-flex; align-items: center; gap: 6px;
    min-height: 44px; padding: 0 16px 0 14px; border-radius: 999px;
    background: var(--surface); color: var(--ink);
    font-size: 0.9375rem; font-weight: 500; white-space: nowrap;
    transition: background-color var(--dur-fast), color var(--dur-fast);
}
.auth-header__back:hover { background: var(--accent-soft); color: var(--accent-text); }
.auth-header__back svg { width: 16px; height: 16px; }

/* --------------------------------------------------------------------------
   The ground: the hero's dots and glows, the card floating on it
   -------------------------------------------------------------------------- */
.auth-main {
    flex: 1;
    padding: clamp(8px, 3vw, 40px) 0 clamp(40px, 6vw, 72px);
    background:
        radial-gradient(42% 55% at 14% 18%, var(--blue-wash) 0%, transparent 70%),     /* taste-skill-ignore: owner's design language */
        radial-gradient(40% 50% at 86% 24%, var(--accent-wash) 0%, transparent 70%),   /* taste-skill-ignore: owner's design language */
        radial-gradient(var(--dots) 1.2px, transparent 1.2px) 0 0 / 26px 26px,         /* taste-skill-ignore: dotted grid, owner's design language */
        var(--bg);
}
.auth-layout {
    display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
    gap: 28px; align-items: stretch;
    width: min(100%, 1040px); margin-inline: auto;
}
.auth-layout--single { grid-template-columns: minmax(0, 1fr); width: min(100%, 520px); }
.auth-layout--wide { width: min(100%, 640px); }

.auth-card {
    min-width: 0;
    background: var(--card); color: var(--ink);
    border-radius: var(--radius-lg);
    padding: clamp(26px, 4vw, 44px);
    box-shadow: var(--shadow-card); /* taste-skill-ignore: owner's design language */
}
/* The login page hides the card until it knows the visitor is not already signed in */
.auth-card--checking { visibility: hidden; }
.js .auth-card:not(.auth-card--checking) { animation: hv2-fade-up 700ms var(--ease-out) both; }
.js .auth-aside { animation: hv2-fade-up 700ms var(--ease-out) 120ms both; }

.auth-card__head { margin-bottom: 24px; }
.auth-card__title {
    font-size: clamp(1.75rem, 1.4rem + 1.2vw, 2.25rem);
    font-weight: 700; line-height: 1.15; letter-spacing: -0.01em;
    text-wrap: balance;
}
.auth-card__title::before { content: ''; display: block; width: 40px; height: 5px; border-radius: 3px; background: var(--accent); margin-bottom: 14px; }
.auth-card__text { margin-top: 10px; color: var(--muted); font-size: var(--step-body); }
.auth-card--center { text-align: center; }
.auth-card--center .auth-card__title::before { margin-inline: auto; }

/* --------------------------------------------------------------------------
   Form pieces on top of home.css's .form-group / .form-label / .form-input
   -------------------------------------------------------------------------- */
.auth-form { display: grid; gap: 16px; }
.auth-form fieldset { border: 0; padding: 0; margin: 0; min-width: 0; }
.auth-form legend { padding: 0; }
.auth .btn svg { width: 18px; height: 18px; flex-shrink: 0; }
.auth .btn.loading { pointer-events: none; opacity: 0.8; }
.auth .btn.loading::before {
    content: ''; width: 16px; height: 16px; border-radius: 999px; flex-shrink: 0;
    border: 2px solid currentColor; border-top-color: transparent;
    animation: auth-spin 0.8s linear infinite;
}
.form-meta { display: flex; align-items: center; justify-content: space-between; gap: 12px; font-size: var(--step-small); }
.auth-link { color: var(--accent-text); font-weight: 600; text-decoration: underline; text-underline-offset: 3px; }
.auth-link:hover { color: var(--accent); }
.auth-fineprint { font-size: 0.8125rem; line-height: 1.55; color: var(--muted); text-align: center; }
.auth-fineprint a, .auth-hint a, .consent-line a { color: var(--accent-text); text-decoration: underline; text-underline-offset: 3px; }
.form-help { font-size: 0.8125rem; color: var(--muted); }
.form-input:read-only { color: var(--muted); }

/* a text button (resend, change the number) */
.auth-textbtn { color: var(--accent-text); font-weight: 600; font-size: var(--step-small); padding: 6px 2px; }
.auth-textbtn:hover { color: var(--accent); }
.auth-textbtn:disabled { color: var(--muted); cursor: default; }
.auth-actions-row { display: flex; flex-wrap: wrap; justify-content: center; gap: 4px 20px; }

/* the eye on a password field */
.password-wrap { position: relative; }
.password-wrap .form-input { padding-inline-end: 54px; }
.password-toggle {
    position: absolute; top: 50%; inset-inline-end: 8px; transform: translateY(-50%);
    width: 40px; height: 40px; border-radius: 10px; display: grid; place-items: center;
    color: var(--muted); transition: color var(--dur-fast), background-color var(--dur-fast);
}
.password-toggle:hover { color: var(--ink); background: var(--surface-2); }
.password-toggle svg { width: 20px; height: 20px; }
.password-toggle .eye-closed { display: none; }
.password-toggle.is-visible .eye-open { display: none; }
.password-toggle.is-visible .eye-closed { display: block; }

/* consent line, on the card ground */
.auth .consent-line { color: var(--ink); }
.auth .consent-line input { width: 18px; height: 18px; margin-top: 2px; }

/* the Turnstile widget keeps its room so the form does not jump */
.auth .turnstile-slot { min-height: var(--turnstile-h); }
.auth .cf-turnstile { max-width: 100%; }

/* --------------------------------------------------------------------------
   Alerts: the scripts write textContent and toggle .show
   -------------------------------------------------------------------------- */
.alert {
    display: none; align-items: flex-start; gap: 10px;
    padding: 12px 14px; margin-bottom: 18px; border-radius: 12px;
    font-size: var(--step-small); font-weight: 500; line-height: 1.5; color: var(--ink);
}
.alert.show { display: flex; }
.alert::before {
    content: '!'; flex-shrink: 0; width: 20px; height: 20px; margin-top: 1px; border-radius: 999px;
    display: grid; place-items: center; font-size: 13px; font-weight: 700; color: #ffffff; background: var(--accent);
}
.alert--error { background: var(--accent-soft); border: 1.5px solid rgba(232, 74, 95, 0.35); }
.alert--success { background: var(--ok-soft); border: 1.5px solid rgba(22, 163, 74, 0.35); }
.alert--success::before { content: '\2713'; background: var(--ok); }
.auth-form .alert { margin-bottom: 0; }

/* --------------------------------------------------------------------------
   Email / phone switch: an ink pill on a soft track
   -------------------------------------------------------------------------- */
.auth-tabs { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 4px; padding: 4px; border-radius: 14px; background: var(--surface-2); margin-bottom: 22px; }
.auth-tab {
    display: inline-flex; align-items: center; justify-content: center; gap: 8px;
    min-height: 44px; border-radius: 10px;
    font-weight: 600; color: var(--muted);
    transition: background-color var(--dur-fast), color var(--dur-fast), box-shadow var(--dur-fast);
}
.auth-tab svg { width: 18px; height: 18px; }
.auth-tab:hover { color: var(--ink); }
.auth-tab.active { background: var(--ink); color: var(--bg); box-shadow: var(--shadow-chip); } /* taste-skill-ignore: owner's design language */

/* --------------------------------------------------------------------------
   Phone sign-in: the number with its country code, the hint, the four digits
   -------------------------------------------------------------------------- */
.phone-step { display: none; }
.phone-step.active { display: grid; gap: 16px; }
.phone-row { display: grid; grid-template-columns: auto minmax(0, 1fr); gap: 10px; }
.phone-row .form-input { direction: ltr; text-align: start; font-variant-numeric: tabular-nums; }
.country-select { position: absolute; width: 1px; height: 1px; opacity: 0; pointer-events: none; } /* taste-skill-ignore: visually hidden, not a rule */
.country-dropdown { position: relative; }
.country-dropdown__toggle {
    display: inline-flex; align-items: center; gap: 8px;
    min-height: 56px; padding: 0 12px 0 14px; border-radius: 12px;
    background: var(--field); border: 2px solid var(--field-border); color: var(--ink);
    font-weight: 600; font-variant-numeric: tabular-nums; direction: ltr;
    transition: border-color var(--dur-fast);
}
.country-dropdown__toggle:hover, .country-dropdown.open .country-dropdown__toggle { border-color: var(--accent); }
.country-dropdown__toggle img { width: 24px; height: 18px; border-radius: 3px; object-fit: cover; }
.country-dropdown__toggle svg { width: 16px; height: 16px; color: var(--muted); transition: transform var(--dur-fast); }
.country-dropdown.open .country-dropdown__toggle svg { transform: rotate(180deg); }
.country-dropdown__list {
    display: none; position: absolute; top: calc(100% + 6px); inset-inline-start: 0; z-index: 20;
    min-width: 170px; max-height: 280px; overflow-y: auto;
    padding: 6px; border-radius: 14px;
    background: var(--card); box-shadow: var(--shadow-card); border: 1px solid var(--line); /* taste-skill-ignore: open menu */
}
.country-dropdown.open .country-dropdown__list { display: block; }
.country-dropdown__item {
    display: flex; align-items: center; gap: 10px;
    padding: 10px 12px; border-radius: 10px; cursor: pointer;
    font-weight: 500; direction: ltr; font-variant-numeric: tabular-nums;
    transition: background-color var(--dur-fast);
}
.country-dropdown__item img { width: 24px; height: 18px; border-radius: 3px; object-fit: cover; }
.country-dropdown__item:hover, .country-dropdown__item:focus-visible { background: var(--surface-2); }
.country-dropdown__item[aria-selected="true"] { background: var(--accent-soft); color: var(--accent-text); }

.auth-hint {
    display: flex; align-items: flex-start; gap: 12px;
    padding: 14px 16px; border-radius: 14px;
    background: var(--surface-2); color: var(--muted);
    font-size: var(--step-small); line-height: 1.55;
}
.auth-hint strong { color: var(--ink); }
.auth-hint__icon { flex-shrink: 0; width: 38px; height: 38px; border-radius: 11px; display: grid; place-items: center; background: var(--accent-soft); color: var(--accent-text); }
.auth-hint__icon svg { width: 18px; height: 18px; }

.code-inputs { display: flex; justify-content: center; gap: 10px; direction: ltr; }
.code-input {
    width: 58px; height: 66px; padding: 0; text-align: center;
    font-size: 1.625rem; font-weight: 700; font-variant-numeric: tabular-nums;
    border-radius: 14px; background: var(--field); border: 2px solid var(--field-border); color: var(--ink);
    transition: border-color var(--dur-fast), transform var(--dur-fast) var(--ease-out);
}
.code-input:focus { outline: none; border-color: var(--accent); }
.code-input.filled { border-color: var(--ink); }

/* --------------------------------------------------------------------------
   Divider, states, spinner
   -------------------------------------------------------------------------- */
.auth-divider { display: flex; align-items: center; gap: 14px; margin: 26px 0 16px; color: var(--muted); font-size: var(--step-small); white-space: nowrap; }
.auth-divider::before, .auth-divider::after { content: ''; flex: 1; height: 1px; background: var(--line); } /* taste-skill-ignore: the form divider ("או"), a line by design */

.auth-state { text-align: center; padding: 16px 0 8px; display: grid; gap: 10px; justify-items: center; }
.auth-state p { color: var(--muted); max-width: 36ch; }
.auth-state .btn { margin-top: 10px; }
.auth-spinner {
    width: 48px; height: 48px; border-radius: 999px; margin-bottom: 8px;
    border: 4px solid var(--accent-soft); border-top-color: var(--accent);
    animation: auth-spin 0.9s linear infinite;
}
.auth-state__icon { display: grid; place-items: center; color: var(--accent); margin-bottom: 4px; }
.auth-state__icon svg { width: 40px; height: 40px; stroke-width: 1.75; }
@keyframes auth-spin { to { transform: rotate(360deg); } }

/* --------------------------------------------------------------------------
   The navy panel beside the card (login, register): curved corners, the
   band's colour lights, glass rows
   -------------------------------------------------------------------------- */
.auth-aside {
    min-width: 0; position: relative; isolation: isolate; overflow: hidden;
    display: flex; flex-direction: column; gap: 22px;
    padding: clamp(26px, 4vw, 44px);
    border-radius: var(--radius-xl);
    background: var(--band); color: var(--band-ink);
}
.auth-aside__label { font-size: 0.8125rem; font-weight: 700; color: var(--band-muted); }
.auth-aside__title { font-size: clamp(1.5rem, 1.2rem + 1.2vw, 2rem); font-weight: 700; line-height: 1.15; letter-spacing: -0.01em; color: var(--band-ink); text-wrap: balance; }
.auth-aside__title::before { content: ''; display: block; width: 40px; height: 5px; border-radius: 3px; background: var(--accent); margin-bottom: 14px; }
.auth-aside__text { color: var(--band-muted); margin-top: -8px; }
.auth-aside__list { display: grid; gap: 10px; }
.auth-aside__item { display: flex; align-items: flex-start; gap: 14px; padding: 16px 18px; border-radius: 18px; }
.auth-aside__icon { flex-shrink: 0; width: 44px; height: 44px; border-radius: 13px; display: grid; place-items: center; color: #ffffff; background: var(--accent); box-shadow: var(--shadow-glow); } /* taste-skill-ignore: owner's design language */
.auth-aside__icon svg { width: 22px; height: 22px; }
.auth-aside__num { flex-shrink: 0; width: 44px; height: 44px; border-radius: 999px; display: grid; place-items: center; font-weight: 700; font-size: 1.125rem; background: rgba(255, 255, 255, 0.14); color: var(--band-ink); }
.auth-aside__item:first-child .auth-aside__num { background: var(--accent); color: #ffffff; box-shadow: var(--shadow-glow); } /* taste-skill-ignore: owner's design language */
.auth-aside__item h3 { font-size: 1.0625rem; font-weight: 700; line-height: 1.3; color: var(--band-ink); }
.auth-aside__item p { margin-top: 3px; font-size: var(--step-small); color: var(--band-muted); line-height: 1.5; }
.auth-aside__trust { margin-top: auto; align-self: flex-start; display: inline-flex; align-items: center; gap: 8px; padding: 10px 16px 10px 14px; border-radius: 999px; background: var(--glass-strong); font-size: var(--step-small); font-weight: 500; }
.auth-aside__trust svg { width: 18px; height: 18px; color: var(--ok); flex-shrink: 0; }

/* --------------------------------------------------------------------------
   Footer: one quiet line
   -------------------------------------------------------------------------- */
.auth-footer { padding: 20px 0 28px; font-size: var(--step-small); color: var(--muted); }
.auth-footer__inner { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px 24px; }
.auth-footer__links { display: flex; flex-wrap: wrap; gap: 6px 18px; }
.auth-footer__links a { color: var(--muted); transition: color var(--dur-fast); }
.auth-footer__links a:hover { color: var(--accent-text); }

/* --------------------------------------------------------------------------
   Motion off, responsive
   -------------------------------------------------------------------------- */
@media (prefers-reduced-motion: reduce) {
    .js .auth-card:not(.auth-card--checking), .js .auth-aside { animation: none; }
    .auth .btn.loading::before, .auth-spinner { animation-duration: 1.5s; }
}
@media (max-width: 960px) {
    .auth-layout { grid-template-columns: minmax(0, 1fr); width: min(100%, 560px); }
    .auth-aside { gap: 18px; }
}
@media (max-width: 768px) {
    .auth-aside .glass { -webkit-backdrop-filter: none; backdrop-filter: none; background: rgba(255, 255, 255, 0.08); } /* taste-skill-ignore: removes the blur on phones */
}
@media (max-width: 480px) {
    :root { --gutter: 14px; }
    .auth-header { padding: 12px 0; }
    .auth-card { padding: 26px 18px; border-radius: 20px; }
    .auth-aside { padding: 24px 18px; border-radius: 20px; }
    .auth-header__back span { display: none; }
    .auth-header__back { padding: 0 12px; }
    .code-input { width: 52px; height: 60px; font-size: 1.5rem; }
    .auth-footer__inner { justify-content: center; text-align: center; }
}

/* --------------------------------------------------------------------------
   404: the same card, a big figure in the brand colour, two ways out
   -------------------------------------------------------------------------- */
.auth-layout--404 { width: min(100%, 640px); }
.auth-404__code { font-size: clamp(5rem, 4rem + 8vw, 9rem); font-weight: 700; line-height: 0.95; letter-spacing: -0.04em; color: var(--accent-text); font-variant-numeric: tabular-nums; }
.auth-404__eyebrow { display: inline-block; margin-bottom: 18px; padding: 6px 14px; border-radius: 999px; background: var(--accent-soft); color: var(--accent-text); font-size: 0.8125rem; font-weight: 700; }
.auth-404 .auth-card__title { margin-top: 14px; }
.auth-404 .auth-card__title::before { display: none; }
.auth-404 .auth-card__text { max-width: 46ch; margin-inline: auto; }
.auth-404__actions { display: flex; flex-wrap: wrap; justify-content: center; gap: 12px; margin-top: 28px; }
@media (max-width: 480px) { .auth-404__actions .btn { width: 100%; } }
