/*
 * Sign-in, forgot-password and reset-password pages.
 * Desktop: split screen. The left half is the website's home hero (photo, navy overlay,
 * crystal accent); the right half is the CMS surface. Under 1024px the photo fills the
 * screen and the form sits on a frosted navy card, with the headline below it.
 * Loaded after tokens.css, which supplies Gilroy and the --c-* CMS tokens.
 */

body.auth {
    /* website palette */
    --navy: #0a1628;
    --steel: #1e5082;
    --crystal: #4a9fd4;
    /* CMS palette */
    --action: var(--c-action);
    --action-hover: var(--c-action-hover);
    --ink: var(--c-ink);
    --muted: var(--c-muted);
    --faint: var(--c-faint);
    --surface: var(--c-surface);
    --subtle: var(--c-subtle);
    --line: var(--c-line);
    --line-strong: var(--c-line-strong);
    --danger: var(--c-danger);
    --danger-soft: var(--c-danger-soft);
    --danger-line: var(--c-danger-line);
    --ok: var(--tone-ok-fg);
    --ok-soft: var(--tone-ok-bg);
    --ok-line: #BFE5D6;
    --on-dark: #FFFFFF;
    --on-dark-muted: rgba(255, 255, 255, .74);
    --on-dark-faint: rgba(255, 255, 255, .52);
    /* phone glass card */
    --glass: rgba(13, 30, 53, .62);
    --glass-line: rgba(255, 255, 255, .14);
    --glass-field: rgba(255, 255, 255, .08);
    --glass-field-line: rgba(255, 255, 255, .2);
    --ok-on-dark: #6EDBB0;
    --ease: cubic-bezier(.2, .7, .2, 1);

    margin: 0;
    min-height: 100vh;
    background: var(--navy);
    color: var(--ink);
    font-family: var(--font);
    -webkit-font-smoothing: antialiased;
}
body.auth *, body.auth *::before, body.auth *::after { box-sizing: border-box; }
body.auth [hidden] { display: none !important; }
:where(body.auth) a { color: inherit; }

.shell { display: grid; grid-template-columns: minmax(0, 1.3fr) minmax(440px, 1fr); min-height: 100vh; }

/* ---------- hero (website side) ---------- */
.hero { position: relative; overflow: hidden; isolation: isolate; color: var(--on-dark); display: flex; flex-direction: column; justify-content: space-between; gap: 48px; padding: 40px 56px 36px; }
.hero-photo { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; z-index: -3; animation: auth-settle 2.4s var(--ease) both; }
.hero::before { content: ""; position: absolute; inset: 0; z-index: -2;
    background:
        linear-gradient(to right, rgba(10, 22, 40, .84) 0%, rgba(10, 22, 40, .5) 55%, rgba(10, 22, 40, .28) 100%),
        linear-gradient(to top, rgba(10, 22, 40, .92) 0%, rgba(10, 22, 40, 0) 48%); }
.hero-glow { position: absolute; z-index: -1; width: 620px; height: 620px; border-radius: 50%; top: 12%; right: -18%; background: radial-gradient(circle, rgba(74, 159, 212, .22) 0%, transparent 70%); animation: auth-pulse 6s ease-in-out infinite; pointer-events: none; }

.brand { display: flex; align-items: center; gap: 12px; text-decoration: none; }
.brand img { width: 40px; height: 40px; }
.brand-name { font-size: 12px; font-weight: 700; letter-spacing: .22em; text-transform: uppercase; line-height: 1.3; }
.brand-name small { display: block; font-size: 10px; font-weight: 400; letter-spacing: .2em; color: var(--on-dark-faint); }

.thesis { max-width: 760px; }
.eyebrow { display: flex; align-items: center; gap: 12px; margin: 0 0 24px; font-size: 11px; font-weight: 700; letter-spacing: .25em; text-transform: uppercase; color: var(--on-dark-muted); }
.eyebrow::before { content: ""; width: 48px; height: 1px; background: rgba(255, 255, 255, .35); }
.hero h1 { margin: 0 0 22px; font-size: clamp(40px, 4.1vw, 64px); line-height: 1.04; font-weight: 700; letter-spacing: -.01em; text-wrap: balance; }
.hero h1 > span { display: block; }
.hero h1 .accent { color: var(--crystal); }
.lede { margin: 0; max-width: 44ch; font-size: 17px; line-height: 1.6; color: var(--on-dark-muted); text-shadow: 0 1px 14px rgba(10, 22, 40, .85); }

.legal { display: flex; flex-wrap: wrap; gap: 6px 18px; font-size: 12px; color: var(--on-dark-faint); }
.legal a { text-decoration: none; border-bottom: 1px solid rgba(255, 255, 255, .25); }
.legal a:hover { color: var(--on-dark); border-color: var(--crystal); }

/* ---------- panel (CMS side) ---------- */
.panel { position: relative; display: flex; flex-direction: column; background: var(--surface); padding: 32px clamp(24px, 5vw, 72px) 28px; }
.band { position: absolute; top: 0; left: 0; right: 0; height: 4px; background: var(--band); }
.seam { position: absolute; top: 0; bottom: 0; left: 0; width: 1px; background: linear-gradient(to bottom, transparent 0%, rgba(74, 159, 212, .6) 50%, transparent 100%); pointer-events: none; }
.panel-top { display: flex; justify-content: flex-end; }
.site-link { display: inline-flex; align-items: center; gap: 6px; font-size: 13px; color: var(--muted); text-decoration: none; padding: 6px 2px; }
.site-link:hover { color: var(--action); }
.site-link svg { width: 14px; height: 14px; }

.form-wrap { width: 100%; max-width: 380px; margin: auto; padding-block: 32px; }
.kicker { display: inline-flex; align-items: center; gap: 8px; margin: 0 0 14px; font-size: 11px; font-weight: 700; letter-spacing: .2em; text-transform: uppercase; color: var(--action); }
.kicker::before { content: ""; width: 18px; height: 4px; border-radius: 2px; background: var(--band); }
.form-wrap h2 { margin: 0 0 8px; font-size: 32px; line-height: 1.15; font-weight: 700; color: var(--ink); }
.sub { margin: 0 0 28px; font-size: 15px; line-height: 1.55; color: var(--muted); }

.alert { display: flex; gap: 10px; align-items: flex-start; margin: 0 0 20px; padding: 12px 14px; border: 1px solid var(--danger-line); border-radius: 10px; background: var(--danger-soft); color: var(--danger); font-size: 14px; line-height: 1.45; }
.alert svg { flex: none; width: 18px; height: 18px; margin-top: 1px; }
.alert strong { font-weight: 700; }
.alert.ok { border-color: var(--ok-line); background: var(--ok-soft); color: var(--ok); }

.auth-form { display: grid; gap: 18px; }
.field { display: grid; gap: 8px; }
.field label { font-size: 13px; font-weight: 700; color: var(--ink); }
.control { position: relative; }
.control > svg { position: absolute; left: 14px; top: 50%; width: 18px; height: 18px; transform: translateY(-50%); color: var(--faint); pointer-events: none; transition: color .2s; }
.control input { width: 100%; height: 50px; margin: 0; padding: 0 14px 0 44px; border: 1px solid var(--line-strong); border-radius: 10px; background: var(--subtle); color: var(--ink); font: 400 15px/1 var(--font); transition: border-color .2s, box-shadow .2s, background-color .2s; }
.control input::placeholder { color: var(--faint); }
.control input:hover { border-color: #B5C2D0; }
.control input:focus { outline: none; border-color: var(--action); background: var(--surface); box-shadow: 0 0 0 4px rgba(31, 116, 214, .14); }
.control input[readonly] { background: var(--line); border-color: var(--line); color: var(--muted); cursor: default; box-shadow: none; }
.control input.is-invalid { border-color: var(--danger); background: var(--surface); box-shadow: 0 0 0 4px rgba(194, 69, 95, .12); }
.control:focus-within > svg { color: var(--action); }
.control.has-toggle input { padding-right: 52px; }
.pw-toggle { position: absolute; right: 6px; top: 50%; transform: translateY(-50%); display: grid; place-items: center; width: 40px; height: 40px; border: 0; border-radius: 8px; background: transparent; color: var(--faint); cursor: pointer; }
.pw-toggle:hover { color: var(--ink); background: var(--line); }
.pw-toggle:focus-visible { outline: 2px solid var(--action); outline-offset: 1px; }
.pw-toggle svg { width: 18px; height: 18px; }
.error-text { font-size: 13px; color: var(--danger); }

.row { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; font-size: 14px; }
.check { display: inline-flex; align-items: center; gap: 9px; color: var(--ink); cursor: pointer; }
.check input { width: 17px; height: 17px; margin: 0; accent-color: var(--action); }
.forgot { color: var(--action); text-decoration: none; font-weight: 700; }
.forgot:hover { text-decoration: underline; }

.btn { position: relative; overflow: hidden; display: inline-flex; align-items: center; justify-content: center; gap: 10px; width: 100%; height: 52px; margin-top: 4px; border: 0; border-radius: 10px; background: var(--action); color: #fff; font: 700 15px/1 var(--font); letter-spacing: .02em; text-decoration: none; cursor: pointer; box-shadow: 0 8px 20px -10px rgba(31, 116, 214, .7); transition: background-color .2s, transform .15s, box-shadow .2s; }
.btn:hover { background: var(--action-hover); box-shadow: 0 10px 24px -10px rgba(26, 99, 184, .8); }
.btn:active { transform: scale(.99); }
.btn:focus-visible { outline: 3px solid rgba(31, 116, 214, .35); outline-offset: 2px; }
.btn svg { width: 16px; height: 16px; transition: transform .25s var(--ease); }
.btn:hover svg { transform: translateX(3px); }
.btn::after { content: ""; position: absolute; inset: 0; background: linear-gradient(110deg, transparent 35%, rgba(255, 255, 255, .26) 50%, transparent 65%); transform: translateX(-100%); transition: transform .9s var(--ease); pointer-events: none; }
.btn:hover::after { transform: translateX(100%); }
.btn .spinner { display: none; width: 18px; height: 18px; border: 2px solid rgba(255, 255, 255, .35); border-top-color: #fff; border-radius: 50%; animation: auth-spin .7s linear infinite; }
.btn.is-loading { pointer-events: none; }
.btn.is-loading .spinner { display: block; }
.btn.is-loading svg { display: none; }
.btn.secondary { background: var(--surface); color: var(--action); border: 1px solid var(--line-strong); box-shadow: none; }
.btn.secondary:hover { background: var(--subtle); border-color: var(--action); }
.btn.secondary::after { display: none; }

.back { display: inline-flex; align-items: center; justify-self: center; gap: 6px; padding: 6px 4px; font-size: 14px; font-weight: 700; color: var(--muted); text-decoration: none; }
.back:hover { color: var(--action); }
.back svg { width: 16px; height: 16px; }

.rules { display: grid; gap: 6px; margin: -4px 0 0; padding: 0; list-style: none; font-size: 13px; color: var(--muted); }
.rules li { display: flex; align-items: center; gap: 8px; transition: color .2s; }
.rules li::before { content: ""; flex: none; width: 15px; height: 15px; border: 1.5px solid var(--line-strong); border-radius: 50%; transition: background-color .2s, border-color .2s; }
.rules li.met { color: var(--ok); }
.rules li.met::before { border-color: var(--ok); background: var(--ok) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='white' stroke-width='3.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M5 12l5 5 9-10'/%3E%3C/svg%3E") center / 10px no-repeat; }

.sent { display: grid; gap: 16px; }
.sent .alert, .sent .sub { margin: 0; }

.note { margin: 24px 0 0; padding-top: 20px; border-top: 1px solid var(--line); font-size: 13px; line-height: 1.55; color: var(--muted); }
.panel-foot { display: none; font-size: 12px; color: var(--faint); text-align: center; }

/* ---------- motion ---------- */
.rise { animation: auth-rise .8s var(--ease) both; animation-delay: var(--d, 0s); }
@keyframes auth-rise { from { opacity: 0; transform: translateY(14px); } }
@keyframes auth-settle { from { transform: scale(1.08); } to { transform: scale(1); } }
@keyframes auth-pulse { 0%, 100% { opacity: .35; transform: scale(1); } 50% { opacity: .6; transform: scale(1.08); } }
@keyframes auth-spin { to { transform: rotate(360deg); } }

/* Desktop: GSAP (public/js/cms/login.js) owns every reveal while html.auth-anim is set */
html.auth-anim .rise, html.auth-anim .hero-photo { animation: none; }
html.auth-anim .hero-glow { animation: none; top: 0; left: 0; right: auto; }
html.auth-anim .btn { transition: background-color .2s, box-shadow .2s; }
html.auth-anim-pending .hero { clip-path: inset(0 0 0 100%); }
html.auth-anim-pending .panel-top,
html.auth-anim-pending .form-wrap,
html.auth-anim-pending .band,
html.auth-anim-pending .seam { opacity: 0; }
.w { display: inline-block; overflow: hidden; vertical-align: top; padding-bottom: .12em; margin-bottom: -.12em; }
.wi { display: inline-block; }

@media (prefers-reduced-motion: reduce) {
    .rise, .hero-photo, .hero-glow { animation: none; }
}

/* ---------- tablet / phone: full-screen photo, glass card, headline below ---------- */
@media (max-width: 1023px) {
    .shell { position: relative; isolation: isolate; display: flex; flex-direction: column; padding-bottom: calc(24px + env(safe-area-inset-bottom, 0px)); }
    .hero { display: contents; }
    .hero-photo, .hero::before { position: fixed; }
    .hero::before { background: linear-gradient(to bottom, rgba(10, 22, 40, .6) 0%, rgba(10, 22, 40, .3) 32%, rgba(10, 22, 40, .82) 68%, rgba(10, 22, 40, .94) 100%); }
    .hero-glow, .lede, .hero-foot, .panel-top, .band, .seam { display: none; }

    .brand { order: 1; padding: calc(24px + env(safe-area-inset-top, 0px)) 20px 0; color: var(--on-dark); }
    .panel { order: 2; margin: 28px 16px 0; padding: 4px 20px 20px; border: 1px solid var(--glass-line); border-radius: 24px; background: var(--glass); -webkit-backdrop-filter: blur(18px) saturate(140%); backdrop-filter: blur(18px) saturate(140%); color: var(--on-dark); box-shadow: 0 24px 60px -24px rgba(0, 0, 0, .6); }
    .thesis { order: 3; margin: 36px 0 0; padding: 0 20px; color: var(--on-dark); }
    .eyebrow { margin-bottom: 14px; }
    .hero h1 { margin: 0; font-size: clamp(32px, 7vw, 48px); }

    .form-wrap { padding-block: 24px 12px; }
    .kicker { color: var(--crystal); }
    .form-wrap h2, .field label, .check { color: var(--on-dark); }
    .sub { color: var(--on-dark-muted); }
    .control input { border-color: var(--glass-field-line); background: var(--glass-field); color: var(--on-dark); }
    .control input::placeholder { color: var(--on-dark-faint); }
    .control input:hover { border-color: rgba(255, 255, 255, .32); }
    .control input:focus { border-color: var(--crystal); background: rgba(255, 255, 255, .12); box-shadow: 0 0 0 4px rgba(74, 159, 212, .25); }
    .control input[readonly] { border-color: transparent; background: rgba(255, 255, 255, .04); color: var(--on-dark-muted); }
    .control input.is-invalid { border-color: #F08AA0; background: var(--glass-field); }
    .control > svg { color: var(--on-dark-faint); }
    .control:focus-within > svg { color: var(--crystal); }
    .pw-toggle { color: var(--on-dark-faint); }
    .pw-toggle:hover { color: var(--on-dark); background: rgba(255, 255, 255, .1); }
    .error-text { color: #F7B3C2; }
    .forgot { color: var(--crystal); }
    .note { border-top-color: var(--glass-line); color: var(--on-dark-faint); }
    .rules { color: var(--on-dark-muted); }
    .rules li::before { border-color: var(--glass-field-line); }
    .rules li.met { color: var(--ok-on-dark); }
    .rules li.met::before { border-color: var(--ok-on-dark); background-color: var(--ok-on-dark); }
    .back { color: var(--on-dark-muted); }
    .back:hover { color: var(--on-dark); }
    .btn.secondary { border-color: var(--glass-field-line); background: transparent; color: var(--on-dark); }
    .panel-foot { display: block; margin: 0; color: var(--on-dark-faint); }
}
