/* 로그인 화면 — ProjectM 로그인(web/src/features/auth/LoginPage.tsx·LoginPage.css·BrandPanel.css·LoginForm.tsx)의
   다크 테마와 같은 모양(이 앱은 테마 전환이 없어 다크 고정). 값(색·그라디언트·반경·그림자·간격·글자 크기·768px 분기)은
   ProjectM 다크 토큰(src/styles/tokens/semantic.css :root · effects.css)을 그대로 옮겼다.
   다른 점(WCAG AA 때문): 안내 글자·placeholder 는 ProjectM 다크의 회색보다 한 단계 밝게.

   글꼴: Pretendard Variable(SIL OFL 1.1 — 저작권·라이선스 문구는 글꼴 안 name 표에 그대로 있다). ProjectM 의
   한글 글꼴과 같다(라틴은 ProjectM 이 Google Sans Flex 를 쓰지만 그 서브셋엔 라이선스 문구가 없어 여기선 Pretendard 로).
   원본 가변 글꼴은 2MB 라 굵기 축을 400~700 으로 줄이고 이 화면(login.html·login.js)의 글자 + ASCII 만 남겼다.
   ponytail: 문구에 새 한글을 넣으면 그 글자만 대체 글꼴로 보인다. 다시 만들 때(fontTools + brotli):
     python -m fontTools.varLib.instancer PretendardVariable.woff2 wght=400:700 -o pv.ttf
     pyftsubset pv.ttf --text-file=<login.html+login.js 글자> --unicodes=U+0020-007E --flavor=woff2 \
       --layout-features='*' --name-IDs='*' --name-languages='*' --output-file=pretendard-login.woff2
   (원본: projectM/web/node_modules/pretendard/dist/web/variable/woff2/PretendardVariable.woff2) */
@font-face { font-family: 'Pretendard Variable'; font-weight: 400 700; font-style: normal; font-display: swap;
  src: url('fonts/pretendard-login.woff2') format('woff2-variations'), url('fonts/pretendard-login.woff2') format('woff2'); }

:root {
  color-scheme: dark;
  /* ProjectM 다크 토큰 */
  --bg-canvas: #12100e;        /* 페이지·입력칸 */
  --surface: #262220;          /* 카드 = --bg-surface-raised */
  --ink: #faf9f7;              /* --text-primary */
  --ink-0: #070a08;
  --muted: #958f88;            /* ProjectM --text-tertiary #8b857e 는 카드 위 4.3:1 — AA 맞추려 살짝 밝게(4.9) */
  --placeholder: #8b857e;      /* ProjectM 은 --text-disabled #5a5650(2.6:1) — 입력칸 위 5.2:1 로 */
  --soft: #a9a29c;             /* --text-secondary — 빌드 이름 */
  --hairline: rgba(255, 255, 255, .10);
  --hairline-soft: rgba(255, 255, 255, .06);
  --green-400: #1fe97c;
  --green-500: #00e070;
  --green-600: #0fb85c;
  --green-800: #0a6534;
  --lime-500: #57e100;
  --yellow-500: #ffd60a;
  --red-500: #f2444c;
  --danger: #ff6b6b;           /* --text-danger (다크 = red-400) */
  --shadow-md: 0 6px 18px rgba(0, 0, 0, .45);
  --glow-accent-strong: 0 0 48px rgba(0, 224, 112, .45), 0 0 14px rgba(87, 225, 0, .30);
  --font: 'Pretendard Variable', Pretendard, -apple-system, BlinkMacSystemFont, system-ui, 'Apple SD Gothic Neo', 'Malgun Gothic', sans-serif;
}

*, *::before, *::after { box-sizing: border-box; }
html, body { margin: 0; }
body {
  background: var(--bg-canvas);
  color: var(--ink);
  font: 400 13px/1.5 var(--font);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}
h1, h2, p { margin: 0; }
button, input { font: inherit; color: inherit; }

/* 리본 표식 정의만 담은 그림 — display:none 이면 그라디언트가 안 그려지는 브라우저가 있어 크기 0 으로 숨긴다. */
.login-defs { position: absolute; width: 0; height: 0; overflow: hidden; }

/* ── 페이지 + 카드 뒤 빛무리 (LoginPage.css .pm-page-bleed) ── */
.login {
  position: relative;
  min-height: 100vh;
  min-height: 100dvh;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  padding: 32px 16px;
}
.login-bleed {
  position: absolute; left: 50%; top: 50%; z-index: 0;
  width: min(920px, 92vw); height: 620px; border-radius: 44%;
  transform: translate(-50%, -50%);
  background: linear-gradient(135deg, var(--green-600), var(--lime-500) 55%, var(--yellow-500));
  filter: blur(90px); opacity: .34;
  animation: login-drift 11s ease-in-out infinite alternate;
  pointer-events: none;
}
@keyframes login-drift {
  0%   { transform: translate(-52%, -48%) scale(1)    rotate(0deg); }
  100% { transform: translate(-48%, -52%) scale(1.12) rotate(6deg); }
}

.login-card {
  position: relative; z-index: 1;
  display: grid;
  width: 100%;
  max-width: 1000px;
  overflow: hidden;
  border-radius: 20px;
  border: 1px solid var(--hairline-soft);
  background: var(--surface);
  box-shadow: var(--shadow-md);
}

/* ── 왼쪽 브랜드 칸 (BrandPanel.css) — 좁은 화면에선 숨김 ── */
.login-brand {
  position: relative; isolation: isolate; overflow: hidden;
  display: none;
  flex-direction: column; justify-content: space-between;
  padding: 32px;
  background: var(--green-800);
  color: #fff;
}
.login-brand-grad {
  position: absolute; inset: -45%; z-index: -3; border-radius: 42%;
  background: conic-gradient(from 0deg at 50% 50%,
    var(--green-600), var(--lime-500), var(--yellow-500), var(--green-500), var(--green-800), var(--green-600));
  filter: blur(52px) saturate(1.1);
  animation: login-spin 20s linear infinite;
}
.login-brand-grain {
  position: absolute; inset: 0; z-index: -2; opacity: .16; mix-blend-mode: overlay;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='140' height='140'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='2' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
}
.login-brand-scrim {
  position: absolute; inset: 0; z-index: -1;
  /* ProjectM 은 transparent 38% → .55 — 돌아가는 노랑이 글자 밑을 지날 때 흰 글자 대비가 2.2:1 까지 떨어져
     (프레임 20개 실측) 아래쪽만 조금 더 눌렀다: 최악 프레임에서 머리말 5.0 · 작은 제목 4.7 · 본문 6.2 : 1. */
  background: linear-gradient(180deg, transparent 32%, rgba(7, 10, 8, .47) 58%, rgba(7, 10, 8, .66) 100%);
}
@keyframes login-spin { to { transform: rotate(360deg); } }

/* 락업 = 흰 리본 + 워드마크 ("PROJECT M" 락업과 같은 높이 15px) */
.login-lockup {
  display: flex; align-items: center; gap: 11px;
  filter: drop-shadow(0 2px 10px rgba(7, 10, 8, .28));
}
.login-lockup-mark { display: block; height: 15px; width: auto; aspect-ratio: 26.22 / 14.79; }
.login-lockup-name { font-size: 20px; font-weight: 500; line-height: 1; letter-spacing: .02em; }

.login-brand-copy { position: relative; max-width: 360px; margin-bottom: 36px; }
.login-brand-eyebrow { font-size: 14px; font-weight: 600; line-height: 1.35; opacity: .85; margin-bottom: 12px; }
.login-brand-head { font-size: 38px; font-weight: 700; line-height: 1.2; letter-spacing: -.01em; margin-bottom: 14px; word-break: keep-all; }
.login-brand-sub { font-size: 16px; line-height: 1.55; opacity: .92; word-break: keep-all; }

/* ── 오른쪽 폼 (LoginPage.tsx / LoginForm.tsx) ── */
.login-pane {
  position: relative;
  display: flex; flex-direction: column; justify-content: center;
  padding: 32px;
}
.login-inner { width: 100%; max-width: 384px; margin: 0 auto; }

.login-logo { display: block; height: 32px; width: auto; aspect-ratio: 26.22 / 14.79; margin: 0 auto 20px; }
.login-title { font-size: 24px; font-weight: 600; line-height: 1.2; text-align: center; }
.login-lead { margin: 6px 0 40px; color: var(--muted); text-align: center; }

.login-field { margin-bottom: 16px; }
.login-field label { display: block; margin-bottom: 6px; color: var(--ink); }
.login-field input {
  width: 100%; height: 44px;
  padding: 0 14px;
  background: var(--bg-canvas);
  color: var(--ink);
  font-size: 14px;
  border: 1px solid var(--hairline);
  border-radius: 10px;
  outline: none;
  transition: border-color .15s;
}
.login-field input::placeholder { color: var(--placeholder); opacity: 1; }
/* 굵기 2px 로 바뀌는 만큼 안쪽 여백을 1px 줄여 글자가 움직이지 않게 */
.login-field input:focus { border: 2px solid var(--green-500); padding: 0 13px; }
.login-field input[aria-invalid="true"] { border: 2px solid var(--red-500); padding: 0 13px; }

.login-pw { position: relative; }
.login-pw input, .login-pw input:focus, .login-pw input[aria-invalid="true"] { padding-right: 44px; }
.login-pw-toggle {
  position: absolute; right: 8px; top: 50%; transform: translateY(-50%);
  width: 32px; height: 32px;
  display: flex; align-items: center; justify-content: center;
  padding: 0; border: 0; border-radius: 10px;
  background: transparent; color: var(--placeholder);
  cursor: pointer; transition: color .15s;
}
.login-pw-toggle:hover { color: var(--ink); }
.login-pw-toggle:focus-visible { outline: 2px solid var(--green-500); outline-offset: 0; color: var(--ink); }
.login-pw-toggle svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.login-eye-off, .login-pw-toggle[aria-pressed="true"] .login-eye { display: none; }
.login-pw-toggle[aria-pressed="true"] .login-eye-off { display: block; }

/* 오류 — ProjectM 의 formError(빨간 글자 + 동그라미 아이콘) 줄. 제목은 굵게, 내용은 그 뒤. login.js 가 display 를 켠다. */
#login-error {
  display: none;
  align-items: flex-start; gap: 6px;
  margin-bottom: 16px;
  color: var(--danger);
  animation: login-shake .32s ease-in-out;
}
.login-alert-icon { flex: none; width: 14px; height: 14px; margin-top: 3px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.login-alert-body { display: flex; flex-direction: column; gap: 1px; min-width: 0; word-break: keep-all; }
.login-alert-body strong { font-weight: 600; }
.login-alert-body strong:empty { display: none; }
@keyframes login-shake {
  0%, 100% { transform: translateX(0); }
  25% { transform: translateX(-4px); }
  75% { transform: translateX(4px); }
}

#login-submit {
  width: 100%; height: 44px;
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  border: 0; border-radius: 16px;
  background: var(--green-500); color: var(--ink-0);
  font-size: 14px; font-weight: 600; line-height: 1;
  cursor: pointer;
  transition: filter .2s, box-shadow .2s, opacity .2s;
}
#login-submit:hover:not(:disabled) { filter: brightness(1.05); box-shadow: var(--glow-accent-strong); }
#login-submit:focus-visible { outline: 2px solid var(--green-500); outline-offset: 2px; }
#login-submit:disabled { opacity: .6; cursor: not-allowed; }
/* 진행 중 — login.js 가 글자를 바꾸고 aria-busy 를 켠다. 글자를 통째로 바꾸므로 회전 원은 ::before 로. */
#login-submit[aria-busy="true"]::before {
  content: ""; width: 16px; height: 16px; border-radius: 50%;
  border: 2px solid rgba(7, 10, 8, .3); border-top-color: var(--ink-0);
  animation: login-spin .8s linear infinite;
}

.login-foot { margin-top: 8px; color: var(--muted); font-size: 11px; line-height: 1.35; text-align: center; word-break: keep-all; }
.login-foot a { color: var(--green-400); text-decoration: none; }   /* --text-link (다크) — 카드 위 9.8:1 */
.login-foot a:hover { text-decoration: underline; text-underline-offset: 2px; }
.login-foot a:focus-visible { outline: 2px solid var(--green-500); outline-offset: 2px; border-radius: 2px; }

/* 빌드 이름 — ProjectM BuildTag(카드 바닥 가운데, 11px, 데이터 숫자) */
.login-build {
  position: absolute; left: 50%; bottom: 12px; transform: translateX(-50%);
  margin: 0; padding: 2px 6px;
  font-size: 11px; line-height: 1.35; font-variant-numeric: tabular-nums; white-space: nowrap;
  color: var(--soft);
  /* 카드 가운데라 반쯤 초록 칸 위에 걸친다 — 옅은 어두운 받침으로 어느 쪽에서도 대비 4.5:1 이상 */
  background: rgba(18, 16, 14, .75);
  border-radius: 6px;
}

@media (min-width: 640px) {
  .login-pane { padding: 48px; }
}
@media (min-width: 768px) {
  .login-card { min-height: 640px; grid-template-columns: 1.05fr 1fr; }
  .login-brand { display: flex; }
}

@media (prefers-reduced-motion: reduce) {
  .login-bleed, .login-brand-grad, #login-error { animation: none; }
  #login-submit[aria-busy="true"]::before { animation-duration: 2.4s; }
}
