/* ============================================================
   HJIT Login — static stylesheet
   Brand tokens, reset, layout, components, responsive.
   ============================================================ */

/* ---------- Fonts ---------- */
@font-face {
  font-family: 'Hanjin Group Sans';
  src: url('../assets/fonts/HanjinGroupSans-Regular.woff2') format('woff2');
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: 'Hanjin Group Sans';
  src: url('../assets/fonts/HanjinGroupSans-Bold.woff2') format('woff2');
  font-weight: 700;
  font-style: normal;
  font-display: swap;
}

/* ---------- Brand tokens ---------- */
:root {
  --hj-dark-blue:    #051469;
  --hj-cobalt-blue:  #1E64DC;
  --hj-cyan-blue:    #00CDFF;
  --hj-blue-gray-1:  #E1F0FF;
  --hj-blue-gray-2:  #BED7EB;
  --hj-blue-gray-3:  #A0BED7;
  --hj-blue-gray-4:  #82A0BE;
  --hj-blue-gray-5:  #6487AA;
  --hj-blue-gray-6:  #466996;
  --hj-blue-gray-7:  #285082;
  --hj-white:        #FFFFFF;

  /* Dark mode (default) surface tokens */
  --bg:              var(--hj-dark-blue);
  --card-bg:         rgba(255, 255, 255, 0.04);
  --card-border:     rgba(255, 255, 255, 0.10);
  --fg:              #FFFFFF;
  --fg-muted:        rgba(255, 255, 255, 0.70);
  --fg-faint:        rgba(255, 255, 255, 0.55);
  --label:           rgba(255, 255, 255, 0.65);
  --field-bg:        rgba(255, 255, 255, 0.04);
  --field-border:    rgba(255, 255, 255, 0.18);
  --field-focus:     var(--hj-cyan-blue);
  --primary-bg:      var(--hj-cyan-blue);
  --primary-fg:      var(--hj-dark-blue);
  --tablist-bg:      rgba(255, 255, 255, 0.04);
  --tablist-border:  rgba(255, 255, 255, 0.08);
  --tab-active-bg:   var(--hj-cyan-blue);
  --tab-active-fg:   var(--hj-dark-blue);
  --tab-inactive-fg: rgba(255, 255, 255, 0.70);
  --link:            var(--hj-cyan-blue);
}

/* ---------- Reset ---------- */
*, *::before, *::after { box-sizing: border-box; }

html, body { margin: 0; padding: 0; }

html { height: 100%; }
body {
  min-height: 100%;
  background: var(--bg);
  color: var(--fg);
  font-family: 'Hanjin Group Sans', 'Noto Sans KR', -apple-system, BlinkMacSystemFont, system-ui, sans-serif;
  font-size: 14px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

button, input, select, textarea { font-family: inherit; color: inherit; }
button { border: 0; background: transparent; padding: 0; cursor: pointer; }
input { -webkit-appearance: none; appearance: none; }

a { color: var(--link); }

input::placeholder { color: var(--hj-blue-gray-4); }
::selection { background: rgba(0, 205, 255, 0.4); }

.visually-hidden {
  position: absolute !important;
  width: 1px; height: 1px;
  padding: 0; margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

/* ---------- Background ---------- */
.bg {
  position: fixed; inset: 0;
  z-index: 0;
  overflow: hidden;
  background: var(--bg);
  pointer-events: none;
}
.bg-atmosphere {
  position: absolute; inset: 0;
  background:
    radial-gradient(120% 80% at 80% 20%, rgba(0, 205, 255, 0.18), transparent 60%),
    radial-gradient(120% 80% at 0% 100%, rgba(30, 100, 220, 0.25), transparent 60%);
}
.bg-supergraphic {
  position: absolute; inset: 0;
  width: 100%; height: 100%;
}

/* ---------- Notice banner ---------- */
.notice-banner {
  position: relative;
  z-index: 6;
  background: var(--hj-dark-blue);
  color: #fff;
  border-bottom: 2px solid var(--hj-cyan-blue);
}
.notice-banner.is-warn {
  background: #7A1F1F;
  border-bottom-color: #FFB23A;
}
.notice-banner__inner {
  max-width: 1280px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 12px 24px;
}
.notice-banner__tag {
  display: inline-flex; align-items: center; gap: 6px;
  flex-shrink: 0;
  padding: 4px 9px;
  border-radius: 2px;
  background: rgba(0, 205, 255, 0.18);
  color: var(--hj-cyan-blue);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}
.notice-banner.is-warn .notice-banner__tag {
  background: rgba(255, 178, 58, 0.20);
  color: #FFD37A;
}
.notice-banner__body {
  flex: 1;
  font-size: 13px;
  line-height: 1.5;
  min-width: 0;
}
.notice-banner__title {
  font-weight: 600;
  margin-right: 8px;
  color: #fff;
}
.notice-banner__text { color: rgba(255, 255, 255, 0.72); }
.notice-banner.is-warn .notice-banner__text { color: rgba(255, 255, 255, 0.78); }
.notice-banner__actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}
.notice-banner__link {
  font-size: 12.5px;
  font-weight: 600;
  letter-spacing: 0.01em;
  color: #fff;
  text-decoration: none;
  padding: 6px 10px;
  border-radius: 2px;
  border: 1px solid rgba(255, 255, 255, 0.25);
}
.notice-banner__link:hover { background: rgba(255, 255, 255, 0.06); }
.notice-banner__close {
  width: 28px; height: 28px;
  color: rgba(255, 255, 255, 0.72);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 2px;
}
.notice-banner__close:hover {
  color: #fff;
  background: rgba(255, 255, 255, 0.06);
}
@media (max-width: 720px) {
  .notice-banner__inner {
    flex-direction: column;
    align-items: flex-start;
    gap: 10px;
    padding: 12px 14px;
  }
  .notice-banner__actions { align-self: stretch; justify-content: space-between; }
}

/* Use 100dvh on capable browsers — avoids the iOS URL-bar gap that
   otherwise creates a few pixels of overflow. */
@supports (height: 100dvh) {
  .page { min-height: 100dvh; }
}

/* ---------- Page layout ---------- */
.page {
  position: relative;
  z-index: 3;
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 48px 32px 64px;
}
@media (max-width: 720px) {
  .page { padding: 40px 16px 56px; }
}

/* ---------- Login card ---------- */
.card {
  width: 100%;
  max-width: 460px;
  padding: 36px 44px 30px;
  background: var(--card-bg);
  border: 1px solid var(--card-border);
  border-radius: 6px;
  box-shadow:
    0 30px 80px rgba(0, 0, 0, 0.45),
    inset 0 1px 0 rgba(255, 255, 255, 0.05);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
}
@media (max-width: 720px) {
  .card { padding: 28px 22px 24px; }
}
.card__brand {
  display: flex;
  justify-content: center;
  margin-bottom: 22px;
}
.card__logo {
  height: 38px;
  width: auto;
  display: block;
  /* original logo is dark — invert + brand-tinted glow on dark mode */
  filter: brightness(0) invert(1);
}
.card__title-block {
  text-align: center;
  margin-bottom: 22px;
}
.card__title {
  margin: 0;
  font-size: 22px;
  font-weight: 600;
  letter-spacing: -0.01em;
  color: #fff;
}
.card__subtitle {
  margin: 6px 0 0;
  font-size: 13px;
  line-height: 1.5;
  color: var(--fg-muted);
}

/* ---------- Tabs ---------- */
.tabs {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  background: var(--tablist-bg);
  border: 1px solid var(--tablist-border);
  border-radius: 4px;
  padding: 4px;
  margin-bottom: 28px;
}
.tabs__tab {
  height: 40px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  border-radius: 2px;
  font-size: 13px;
  font-weight: 600;
  letter-spacing: 0.01em;
  color: var(--tab-inactive-fg);
  transition: background-color 160ms ease, color 160ms ease;
}
.tabs__tab:hover { color: #fff; }
.tabs__tab.is-active {
  background: var(--tab-active-bg);
  color: var(--tab-active-fg);
}
.tabs__tab svg { display: block; }

/* ---------- Panels ---------- */
.panel {
  display: none;
  flex-direction: column;
  gap: 16px;
  animation: hjFadeIn 200ms ease;
}
.panel.is-active { display: flex; }

/* 인증 본문(패널 + '이 기기의 앱으로 로그인' 버튼)을 감싸 카드 높이를 고정한다.
   min-height 를 panel 이 아니라 여기에 두어야, 짧은 탭(패스키/모바일)에서 남는 공간이
   '패널 버튼 ↔ SSO 버튼' 사이가 아니라 카드 맨 아래로 가서 탭별 간격이 일관된다.
   값은 가장 큰 ID/PW 패널(약 190) + SSO 버튼(약 52+14) 기준. */
.auth-body { min-height: 256px; }

@keyframes hjFadeIn {
  from { opacity: 0; transform: translateY(4px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* ---------- Field ---------- */
.field { display: block; }
/* 공통 ID input — 탭 nav 와 인증 panel 사이에 위치.
   .tabs 의 margin-bottom (28px) 이 탭과 ID input 사이를 띄우지만,
   ID input 자체에는 별도 margin 없어 panel 과 붙어 보임 → 명시적으로 띄움.
   16px = 옛 카드 키 (590.667) 정확 매칭. */
.field--shared { margin-bottom: 16px; }
.field__label {
  display: block;
  font-size: 12px;
  font-weight: 500;
  letter-spacing: 0.02em;
  color: var(--label);
  margin-bottom: 8px;
}
.field__control {
  display: flex;
  align-items: center;
  gap: 10px;
  height: 52px;
  padding: 0 14px;
  background: var(--field-bg);
  border: 1.5px solid var(--field-border);
  border-radius: 4px;
  transition: border-color 160ms ease, box-shadow 160ms ease;
}
.field__control:focus-within {
  border-color: var(--field-focus);
  box-shadow: 0 0 0 4px rgba(0, 205, 255, 0.12);
}
.field__icon {
  color: var(--fg-faint);
  display: inline-flex;
}
.field__control input {
  flex: 1;
  min-width: 0;
  height: 100%;
  border: 0;
  background: transparent;
  outline: none;
  font-size: 15px;
  color: var(--fg);
  letter-spacing: 0.01em;
}
.field__suffix {
  width: 32px; height: 32px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: var(--fg-faint);
  border-radius: 2px;
}
.field__suffix:hover { color: #fff; }

/* ---------- Buttons ---------- */
.btn-primary {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  height: 52px;
  background: var(--primary-bg);
  color: var(--primary-fg);
  font-size: 15px;
  font-weight: 700;
  letter-spacing: 0.01em;
  border-radius: 4px;
  transition: filter 160ms ease, transform 80ms ease;
}
.btn-primary:hover { filter: brightness(1.06); }
.btn-primary:active { transform: translateY(1px); }
.btn-primary:disabled,
.btn-primary.is-loading {
  cursor: progress;
  filter: brightness(0.85);
}
.btn-primary.is-loading::before {
  content: '';
  width: 16px; height: 16px;
  margin-right: 10px;
  border-radius: 50%;
  border: 2px solid currentColor;
  border-right-color: transparent;
  animation: hjSpin 700ms linear infinite;
}
@keyframes hjSpin { to { transform: rotate(360deg); } }

/* ---------- Row helpers ---------- */
.row-between {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 12px;
}

/* ---------- Checkbox ---------- */
.check {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  cursor: pointer;
  user-select: none;
  font-size: 13px;
  color: var(--fg-muted);
}
.check--standalone { align-self: flex-start; margin-top: -2px; }
.check input { position: absolute; opacity: 0; pointer-events: none; }
.check__box {
  width: 18px; height: 18px;
  border-radius: 3px;
  border: 1.5px solid rgba(255, 255, 255, 0.35);
  background: transparent;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: background-color 120ms ease, border-color 120ms ease;
}
.check__box::after {
  content: '';
  width: 10px; height: 6px;
  border-left: 2px solid var(--hj-dark-blue);
  border-bottom: 2px solid var(--hj-dark-blue);
  transform: rotate(-45deg) translate(1px, -1px);
  opacity: 0;
}
.check input:checked + .check__box {
  background: var(--hj-cyan-blue);
  border-color: var(--hj-cyan-blue);
}
.check input:checked + .check__box::after { opacity: 1; }
.check input:focus-visible + .check__box {
  box-shadow: 0 0 0 3px rgba(0, 205, 255, 0.25);
}

/* ---------- Links ---------- */
.link {
  color: var(--link);
  text-decoration: none;
  font-weight: 500;
  font-size: 13px;
}
.link:hover { text-decoration: underline; }
.link--btn { background: transparent; padding: 0; font-size: 13px; }

/* ---------- Meta rows ---------- */
.meta-row {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 12.5px;
  color: var(--fg-faint);
  margin-top: 4px;
}
.meta-row--center { justify-content: center; text-align: center; }

/* ---------- Mobile waiting state ---------- */
.mobile-wait {
  display: flex;
  flex-direction: column;
  gap: 18px;
  padding: 18px;
  border: 1px solid rgba(0, 205, 255, 0.25);
  background: rgba(0, 205, 255, 0.06);
  border-radius: 4px;
  animation: hjFadeIn 220ms ease;
}
.mobile-wait__head {
  display: flex;
  align-items: center;
  gap: 14px;
}
.mobile-wait__phone {
  position: relative;
  width: 44px; height: 44px;
  border-radius: 4px;
  background: rgba(0, 205, 255, 0.12);
  color: var(--hj-cyan-blue);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.mobile-wait__pulse {
  position: absolute; inset: 0;
  border-radius: 4px;
  border: 2px solid var(--hj-cyan-blue);
  opacity: 0.9;
  animation: hjPulse 1.6s ease-out infinite;
}
@keyframes hjPulse {
  0%   { transform: scale(1); opacity: 0.9; }
  100% { transform: scale(1.6); opacity: 0; }
}
.mobile-wait__title {
  font-size: 14px;
  font-weight: 600;
  color: #fff;
  margin-bottom: 2px;
}
.mobile-wait__sub {
  font-size: 12.5px;
  color: var(--fg-muted);
  line-height: 1.5;
}
.mobile-wait__code {
  font-size: 36px;
  font-weight: 700;
  letter-spacing: 0.18em;
  text-align: center;
  color: var(--hj-cyan-blue);
  font-variant-numeric: tabular-nums;
}

/* ---------- Bottom support / version ---------- */
.support-note {
  position: fixed;
  bottom: 0; left: 0; right: 0;
  padding: 18px 32px;
  text-align: center;
  font-size: 12px;
  color: var(--fg-faint);
  pointer-events: none;
  z-index: 5;
}
.support-note .link { pointer-events: auto; font-size: 12px; }
.version-tag {
  position: fixed;
  bottom: 16px;
  right: 24px;
  font-size: 11px;
  color: rgba(255, 255, 255, 0.4);
  letter-spacing: 0.04em;
  pointer-events: none;
  z-index: 5;
}
@media (max-width: 720px) {
  .page {
    /* On mobile the support note and version tag flow inline below the
       card — don't force the card area itself to fill the viewport, or
       the page will always exceed 100vh and scroll. */
    min-height: 0;
    padding: 40px 16px 24px;
  }
  .support-note {
    position: static;
    padding: 12px 16px 4px;
  }
  .version-tag {
    position: static;
    text-align: center;
    margin: 4px 0 16px;
    right: 0;
  }
}

/* ---------- Reduced motion ---------- */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}

[hidden] {
  display: none !important;
}

.version-tag a {
    pointer-events: auto;
}