/* ============ Intra Ai — auth ============ */
.auth { display: grid; grid-template-columns: 1fr 1fr; min-height: 100vh; min-height: 100dvh; }

/* ---------- Side ---------- */
.auth__side {
  position: relative; overflow: hidden;
  background: radial-gradient(ellipse at 50% 45%, #161616, #000 70%);
  border-right: 1px solid var(--line);
  display: flex; flex-direction: column; justify-content: space-between;
  padding: 36px 44px 48px;
}
.side__grid {
  position: absolute; inset: 0; pointer-events: none;
  background-image: linear-gradient(var(--line) 1px, transparent 1px), linear-gradient(90deg, var(--line) 1px, transparent 1px);
  background-size: 48px 48px;
  mask-image: radial-gradient(circle at 50% 45%, #000 10%, transparent 65%);
  -webkit-mask-image: radial-gradient(circle at 50% 45%, #000 10%, transparent 65%);
  animation: grid-move 20s linear infinite;
}
@keyframes grid-move { to { background-position: 48px 48px; } }
.side__logo { position: relative; z-index: 1; }

.core { position: relative; width: min(340px, 70%); aspect-ratio: 1; margin: 0 auto; }
.core__ring { position: absolute; inset: 0; border-radius: 50%; border: 1px solid rgba(255,255,255,0.18); }
.core__ring.r1 { border-style: dashed; animation: spin 40s linear infinite; }
.core__ring.r2 { inset: 16%; border-color: rgba(255,255,255,0.28); border-top-color: #fff; animation: spin 8s linear infinite; }
.core__ring.r3 { inset: 32%; border-color: rgba(255,255,255,0.15); border-bottom-color: #fff; animation: spin 5s linear infinite reverse; }
.core__dot { position: absolute; inset: 44%; border-radius: 50%; background: #fff; box-shadow: 0 0 60px 16px rgba(255,255,255,0.25); animation: pulse 3s var(--ease-in-out) infinite; }
.core__sat { position: absolute; left: 50%; top: 50%; width: 8px; height: 8px; margin: -4px; border-radius: 50%; background: #fff; }
.core__sat.s1 { animation: orb 7s linear infinite; }
.core__sat.s2 { animation: orb 11s linear infinite; width: 5px; height: 5px; margin: -2.5px; }
.core__sat.s3 { animation: orb 15s linear infinite reverse; width: 6px; height: 6px; margin: -3px; opacity: 0.6; }
.core__sat.s1 { --r: 120px; animation-name: orb; } .core__sat.s2 { --r: 160px; animation-name: orb; } .core__sat.s3 { --r: 95px; animation-name: orb; }
@keyframes orb { from { transform: rotate(0deg) translateX(var(--r)); } to { transform: rotate(360deg) translateX(var(--r)); } }

.side__copy { position: relative; z-index: 1; }
.side__quote { font-size: clamp(22px, 2.2vw, 30px); line-height: 1.2; letter-spacing: -0.03em; font-weight: 500; margin: 0 0 26px; max-width: 460px; min-height: 2.4em; }
.side__list { list-style: none; padding: 0; margin: 0; display: grid; gap: 12px; color: var(--ink-2); font-size: 15px; }
.side__list li { display: flex; align-items: center; gap: 12px; opacity: 0; transform: translateX(-12px); animation: slide-in 0.8s var(--ease) forwards; }
.side__list li:nth-child(1) { animation-delay: 0.5s; }
.side__list li:nth-child(2) { animation-delay: 0.65s; }
.side__list li:nth-child(3) { animation-delay: 0.8s; }
.side__list .icon { width: 32px; height: 32px; padding: 7px; border: 1px solid var(--line-2); border-radius: 9px; color: #fff; }
@keyframes slide-in { to { opacity: 1; transform: none; } }

/* ---------- Main ---------- */
.auth__main { position: relative; display: flex; flex-direction: column; align-items: center; justify-content: center; padding: 100px 24px 70px; }
.auth__top { position: absolute; top: 28px; left: 32px; right: 32px; display: flex; align-items: center; justify-content: flex-end; }
.auth__mlogo { display: none; }
.back { display: inline-flex; align-items: center; gap: 8px; font-size: 14px; color: var(--ink-2); padding: 8px 14px; border-radius: 999px; border: 1px solid var(--line); transition: color 0.3s, border-color 0.3s; }
.back svg { width: 16px; height: 16px; transition: transform 0.4s var(--ease); }
.back:hover { color: #fff; border-color: var(--line-2); }
.back:hover svg { transform: translateX(-3px); }

.auth__card { width: 100%; max-width: 420px; animation: card-in 1s var(--ease) 0.15s both; transition: opacity 0.5s var(--ease), transform 0.5s var(--ease), filter 0.5s var(--ease); }
.auth__card.is-hidden { animation: card-out 0.5s var(--ease) forwards; pointer-events: none; }
@keyframes card-out { to { opacity: 0; transform: scale(0.96); filter: blur(8px); visibility: hidden; } }
@keyframes card-in { from { opacity: 0; transform: translateY(24px); filter: blur(8px); } to { opacity: 1; transform: none; filter: none; } }

.tabs { position: relative; display: grid; grid-template-columns: 1fr 1fr; padding: 4px; border-radius: 999px; border: 1px solid var(--line-2); margin-bottom: 36px; }
.tabs button { position: relative; z-index: 1; height: 38px; border-radius: 999px; font-size: 14px; font-weight: 500; color: var(--ink-2); transition: color 0.4s var(--ease); }
.tabs button[aria-selected="true"] { color: #000; }
.tabs__thumb { position: absolute; top: 4px; bottom: 4px; left: 4px; width: calc(50% - 4px); border-radius: 999px; background: #fff; transition: transform 0.55s var(--ease); }
.auth--login .tabs__thumb { transform: translateX(100%); }

.auth__title { font-size: 34px; letter-spacing: -0.04em; line-height: 1.1; margin: 0 0 8px; font-weight: 600; }
.auth__sub { color: var(--ink-2); margin: 0 0 30px; }
.swap-out { animation: swap-out 0.25s var(--ease) forwards; }
.swap-in { animation: swap-in 0.45s var(--ease) both; }
@keyframes swap-out { to { opacity: 0; transform: translateY(-6px); } }
@keyframes swap-in { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }

/* register-only blocks collapse smoothly in login mode */
.collapse { display: grid; grid-template-rows: 1fr; transition: grid-template-rows 0.55s var(--ease), opacity 0.4s var(--ease); }
.collapse__in { min-height: 0; overflow: hidden; padding: 4px; margin: -4px; }
.auth--login .collapse { grid-template-rows: 0fr; opacity: 0; }

/* fields */
.field { position: relative; margin-bottom: 16px; display: block; }
.field input {
  width: 100%; height: 58px; padding: 22px 46px 6px 46px;
  background: rgba(255,255,255,0.03); border: 1px solid var(--line-2); border-radius: 14px;
  outline: none; font-size: 15px;
  transition: border-color 0.3s var(--ease), background-color 0.3s var(--ease), box-shadow 0.3s var(--ease), height 0.5s var(--ease), padding 0.5s var(--ease);
}
.field input:hover { border-color: rgba(255,255,255,0.28); }
.field input:focus { border-color: #fff; background: rgba(255,255,255,0.05); box-shadow: 0 0 0 4px rgba(255,255,255,0.08); }
.field label { position: absolute; left: 46px; top: 19px; font-size: 15px; color: var(--ink-3); pointer-events: none; transform-origin: left top; transition: transform 0.3s var(--ease), color 0.3s var(--ease), opacity 0.3s; }
.field input:focus + label, .field input:not(:placeholder-shown) + label { transform: translateY(-10px) scale(0.78); color: var(--ink-2); }
.field__icon { position: absolute; left: 15px; top: 17px; width: 20px; height: 20px; color: var(--ink-3); transition: color 0.3s var(--ease), transform 0.4s var(--ease); pointer-events: none; }
.field:focus-within .field__icon { color: #fff; transform: scale(1.1); }
.field__eye { position: absolute; right: 8px; top: 9px; width: 40px; height: 40px; border-radius: 10px; display: grid; place-items: center; color: var(--ink-3); transition: color 0.3s, background-color 0.3s; }
.field__eye:hover { color: #fff; background: rgba(255,255,255,0.06); }
.field__eye .icon { width: 20px; height: 20px; }
.field__eye .slash { stroke-dasharray: 23; stroke-dashoffset: 0; transition: stroke-dashoffset 0.4s var(--ease); }
.field__eye.is-on .slash { stroke-dashoffset: 23; }
.field__err { display: block; font-size: 13px; color: #fff; min-height: 0; max-height: 0; overflow: hidden; opacity: 0; transition: max-height 0.4s var(--ease), opacity 0.3s, margin 0.4s; }
.field.is-invalid input { border-color: #fff; border-style: dashed; animation: shake 0.45s var(--ease); }
.field.is-invalid .field__err, .check__err.is-on { max-height: 40px; opacity: 1; margin-top: 6px; }
.field.is-invalid .field__err::before, .check__err.is-on::before { content: "— "; color: var(--ink-3); }
.field.is-valid .field__icon { color: #fff; }
@keyframes shake { 20%, 60% { transform: translateX(-5px); } 40%, 80% { transform: translateX(5px); } }

.strength { margin: -4px 0 18px; }
.strength__bars { display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px; }
.strength__bars i { height: 3px; border-radius: 3px; background: var(--line-2); position: relative; overflow: hidden; }
.strength__bars i::after { content: ""; position: absolute; inset: 0; background: #fff; transform: scaleX(0); transform-origin: left; transition: transform 0.5s var(--ease); }
.strength[data-level="1"] i:nth-child(-n+1)::after,
.strength[data-level="2"] i:nth-child(-n+2)::after,
.strength[data-level="3"] i:nth-child(-n+3)::after,
.strength[data-level="4"] i:nth-child(-n+4)::after { transform: scaleX(1); }
.strength__label { display: block; font-size: 12px; color: var(--ink-3); margin-top: 8px; }

.check { display: flex; gap: 12px; align-items: flex-start; font-size: 14px; color: var(--ink-2); cursor: pointer; margin-bottom: 4px; }
.check input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.check__box { flex: none; width: 20px; height: 20px; border-radius: 6px; border: 1px solid var(--line-2); display: grid; place-items: center; margin-top: 1px; transition: background-color 0.3s var(--ease), border-color 0.3s; overflow: hidden; }
.check__box svg { width: 13px; height: 13px; color: #000; stroke-dasharray: 24; stroke-dashoffset: 24; transition: stroke-dashoffset 0.4s var(--ease) 0.05s; }
.check input:checked + .check__box { background: #fff; border-color: #fff; }
.check input:checked + .check__box svg { stroke-dashoffset: 0; }
.check input:focus-visible + .check__box { outline: 2px solid #fff; outline-offset: 2px; }
.check__err { margin-bottom: 4px; }

.form__error { min-height: 0; margin: 0; font-size: 14px; padding: 0 14px; border-radius: 12px; background: rgba(255,255,255,0.06); border: 1px solid transparent; max-height: 0; overflow: hidden; opacity: 0; transition: all 0.4s var(--ease); }
.form__error.is-on { max-height: 80px; opacity: 1; padding: 12px 14px; margin-top: 10px; border-color: var(--line-2); }

.submit { margin-top: 22px; }
.submit__spin, .submit__check { position: absolute; opacity: 0; transition: opacity 0.3s, transform 0.4s var(--ease); }
.submit__spin { width: 20px; height: 20px; border-radius: 50%; border: 2px solid rgba(0,0,0,0.2); border-top-color: #000; animation: spin 0.8s linear infinite; }
.submit__check { width: 22px; height: 22px; transform: scale(0.4); }
.submit__label { transition: opacity 0.3s, transform 0.4s var(--ease); }
.submit.is-loading .submit__label { opacity: 0; transform: translateY(-8px); }
.submit.is-loading .submit__spin { opacity: 1; }
.submit.is-done .submit__label { opacity: 0; }
.submit.is-done .submit__check { opacity: 1; transform: scale(1); }
.submit:disabled { cursor: default; }

.auth__switch { text-align: center; color: var(--ink-3); font-size: 14px; margin: 24px 0 0; }
.auth__switch button { color: #fff; font-weight: 500; text-decoration: underline; text-underline-offset: 3px; text-decoration-color: var(--line-2); transition: text-decoration-color 0.3s; }
.auth__switch button:hover { text-decoration-color: #fff; }

.auth__foot { position: absolute; bottom: 22px; left: 0; right: 0; text-align: center; font-size: 11px; color: var(--ink-3); margin: 0; padding: 0 20px; }

/* ---------- Welcome overlay ---------- */
.welcome { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center; pointer-events: none; opacity: 0; transition: opacity 0.5s var(--ease); padding: 24px; }
.welcome.is-on { opacity: 1; }
.welcome__mark svg { width: 88px; height: 88px; }
.welcome__mark circle { stroke-dasharray: 230; stroke-dashoffset: 230; }
.welcome__mark path { stroke-dasharray: 50; stroke-dashoffset: 50; }
.welcome.is-on .welcome__mark circle { transition: stroke-dashoffset 0.9s var(--ease) 0.1s; stroke-dashoffset: 0; }
.welcome.is-on .welcome__mark path { transition: stroke-dashoffset 0.5s var(--ease) 0.7s; stroke-dashoffset: 0; }
.welcome h2 { font-size: 34px; letter-spacing: -0.04em; margin: 26px 0 6px; font-weight: 600; opacity: 0; transform: translateY(10px); transition: all 0.7s var(--ease) 0.5s; }
.welcome p { color: var(--ink-2); margin: 0 0 26px; opacity: 0; transition: opacity 0.7s var(--ease) 0.7s; }
.welcome.is-on h2, .welcome.is-on p { opacity: 1; transform: none; }
.welcome__bar { width: 180px; height: 2px; background: var(--line-2); border-radius: 2px; overflow: hidden; }
.welcome__bar i { display: block; height: 100%; background: #fff; transform: scaleX(0); transform-origin: left; }
.welcome.is-on .welcome__bar i { transition: transform 1.6s var(--ease-in-out) 0.6s; transform: scaleX(1); }

/* ---------- Responsive ---------- */
@media (max-width: 900px) {
  .auth { grid-template-columns: 1fr; }
  .auth__side { display: none; }
  .auth__top { justify-content: space-between; left: 20px; right: 20px; top: 20px; }
  .auth__mlogo { display: inline-flex; }
  .auth__main { padding: 100px 20px 70px; }
}
@media (max-width: 420px) {
  .auth__title { font-size: 28px; }
  .back { padding: 8px 12px; font-size: 13px; }
}
