/* 서버 대문 화면의 스타일이다. CSP 때문에 웹 글꼴 없이 시스템 글꼴을 쓰고, 밝은 화면과 어두운 화면을 모두 지원한다. */
:root {
  color-scheme: light dark;
  --paper: #f3f5f8;
  --surface: #ffffff;
  --ink: #111827;
  --ink-soft: #4b5563;
  --ink-faint: #6b7280;
  --line: #e2e6ec;
  --line-strong: #cbd2db;
  --focus: #2f6fe0;
  --danger: #be123c;
  /* 두 앱 칸은 각 앱의 상표 색을 쓴다(라라 globals.css의 brand, 메이트앱 styles.css의 accent). */
  --lala: #1e40af;
  --lala-tint: #e8eefc;
  --mateapp: #315f99;
  --mateapp-tint: #eaf1f9;
  --shadow: 0 1px 2px rgb(17 24 39 / 0.05), 0 12px 32px rgb(17 24 39 / 0.07);
  --radius-card: 16px;
  --radius-item: 12px;
  --font: Pretendard, "Noto Sans KR", "Apple SD Gothic Neo", "Malgun Gothic", system-ui, sans-serif;
}

@media (prefers-color-scheme: dark) {
  :root {
    --paper: #0d1117;
    --surface: #161b23;
    --ink: #e6e9ef;
    --ink-soft: #a7b0bd;
    --ink-faint: #8b94a3;
    --line: #262e3a;
    --line-strong: #3a4556;
    --focus: #8ab4ff;
    --danger: #fb7185;
    --lala: #a5bdff;
    --lala-tint: #1b2744;
    --mateapp: #a3c0e4;
    --mateapp-tint: #182638;
    --shadow: 0 1px 2px rgb(0 0 0 / 0.4);
  }
}

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

[hidden] {
  display: none !important;
}

html {
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
}

body {
  margin: 0;
  min-height: 100vh;
  min-height: 100dvh;
  display: grid;
  place-items: center;
  padding: 24px 16px;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--font);
  font-size: 1rem;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

.gate {
  width: 100%;
  max-width: 420px;
  display: grid;
  gap: 28px;
  padding: 36px 32px 32px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-card);
  box-shadow: var(--shadow);
}

.brand {
  display: grid;
  justify-items: center;
  gap: 14px;
  text-align: center;
}

.brand-mark {
  width: 48px;
  height: 48px;
}

.brand-mark rect {
  fill: var(--ink);
}

.brand-mark path {
  fill: var(--surface);
}

.brand-name {
  margin: 0;
  font-size: 1.375rem;
  font-weight: 700;
  letter-spacing: -0.01em;
  word-break: keep-all;
}

/* 칸 사이 간격은 여백으로 둔다. 비어 있는 상태 안내 칸이 간격을 차지하지 않게 하려는 것이다(읽기 프로그램용으로 칸은 남겨 둔다). */
.step > * {
  margin: 0;
}

.step > * + * {
  margin-top: 16px;
}

.step > .notice:empty {
  margin-top: 0;
}

.step-title {
  color: var(--ink-faint);
  font-size: 0.8125rem;
  font-weight: 600;
  letter-spacing: 0.02em;
  text-align: center;
}

/* 화면이 바뀌면 화면 낭독기가 읽도록 초점을 제목으로 옮긴다. 제목은 누르는 요소가 아니라 테두리를 그리지 않는다(구글 단추가 다른 출처 iframe이라 마우스로 눌러도 :focus-visible이 참이 된다). */
.step-title:focus {
  outline: none;
}

.google-slot {
  display: grid;
  justify-items: center;
  min-height: 44px;
}

/* 구글 단추를 불러오는 동안 같은 자리에 같은 크기의 자리 표시를 둔다(불러온 뒤 화면이 밀리지 않게). */
.google-slot[aria-busy="true"]::before {
  content: "";
  display: block;
  width: min(100%, 400px);
  height: 44px;
  border-radius: 6px;
  background: linear-gradient(90deg, var(--line) 25%, var(--paper) 50%, var(--line) 75%);
  background-size: 200% 100%;
}

.notice {
  color: var(--ink-soft);
  font-size: 0.875rem;
  line-height: 1.25rem;
  text-align: center;
}

.notice[data-tone="error"] {
  color: var(--danger);
  font-weight: 600;
}

.text-button,
.switch-button {
  display: block;
  min-height: 44px;
  margin-inline: auto;
  padding: 0 16px;
  border-radius: 10px;
  font: inherit;
  font-size: 0.9375rem;
  font-weight: 600;
  cursor: pointer;
}

.text-button {
  border: 1px solid var(--line-strong);
  background: transparent;
  color: var(--ink);
}

.text-button:hover {
  background: var(--paper);
}

/* 앱 칸 아래의 보조 행동이다. 테두리 없이 두어 앱 칸보다 눈에 덜 띄게 한다. */
.switch-button {
  border: 0;
  background: transparent;
  color: var(--ink-soft);
}

.switch-button:hover {
  background: var(--paper);
  color: var(--ink);
}

.text-button:focus-visible,
.switch-button:focus-visible,
.app:focus-visible {
  outline: 2px solid var(--focus);
  outline-offset: 2px;
}

.account {
  display: grid;
  grid-template-columns: 40px minmax(0, 1fr);
  align-items: center;
  gap: 12px;
  padding: 12px 14px;
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: var(--radius-item);
}

.account-avatar {
  display: grid;
  place-items: center;
  width: 40px;
  height: 40px;
  border: 1px solid var(--line);
  border-radius: 50%;
  background: var(--surface);
  color: var(--ink-soft);
  font-weight: 700;
}

.account-text {
  display: grid;
  min-width: 0;
  margin: 0;
}

.account-name {
  overflow: hidden;
  font-weight: 600;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.account-email {
  color: var(--ink-soft);
  font-size: 0.875rem;
  overflow-wrap: anywhere;
}

.apps {
  display: grid;
  gap: 10px;
}

.app {
  --app: var(--ink);
  --app-tint: var(--paper);
  display: grid;
  grid-template-columns: 44px minmax(0, 1fr) 20px;
  align-items: center;
  gap: 14px;
  min-height: 72px;
  padding: 14px 16px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-item);
  color: var(--ink);
  text-decoration: none;
}

.app-lala {
  --app: var(--lala);
  --app-tint: var(--lala-tint);
}

.app-mateapp {
  --app: var(--mateapp);
  --app-tint: var(--mateapp-tint);
}

.app:hover {
  background: var(--app-tint);
  border-color: var(--app);
}

.app:active {
  transform: translateY(1px);
}

/* 칸 배경이 배지 색과 같아지면 배지가 묻히므로 배지를 흰 면으로 바꾼다. */
.app:hover .app-badge {
  background: var(--surface);
}

.app-badge {
  display: grid;
  place-items: center;
  width: 44px;
  height: 44px;
  border-radius: 12px;
  background: var(--app-tint);
  color: var(--app);
  font-size: 1.125rem;
  font-weight: 700;
}

.app-text {
  display: grid;
  min-width: 0;
}

.app-name {
  font-size: 1.0625rem;
  font-weight: 700;
}

.app-desc {
  color: var(--ink-soft);
  font-size: 0.875rem;
}

.app-arrow {
  width: 20px;
  height: 20px;
  color: var(--ink-faint);
}

.app-arrow path {
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.app:hover .app-arrow {
  color: var(--app);
}

/* 움직임을 줄이라는 설정이 없을 때만 상태 변화를 짧게 보여 준다. */
@media (prefers-reduced-motion: no-preference) {
  .step:not([hidden]) {
    animation: gate-rise 200ms ease-out;
  }

  .google-slot[aria-busy="true"]::before {
    animation: gate-shimmer 1.4s ease-in-out infinite;
  }

  .app {
    transition: background-color 150ms ease, border-color 150ms ease, transform 150ms ease;
  }

  .app-arrow {
    transition: color 150ms ease, transform 150ms ease;
  }

  .app:hover .app-arrow {
    transform: translateX(2px);
  }

  @keyframes gate-rise {
    from {
      opacity: 0;
      transform: translateY(6px);
    }
    to {
      opacity: 1;
      transform: none;
    }
  }

  @keyframes gate-shimmer {
    from {
      background-position: 100% 0;
    }
    to {
      background-position: -100% 0;
    }
  }
}

/* 휴대폰에서는 화면 위쪽에 두고 안쪽 여백을 줄인다. */
@media (max-width: 480px) {
  body {
    place-items: start center;
    padding: max(16px, 8vh) 16px 16px;
  }

  .gate {
    gap: 24px;
    padding: 28px 20px 24px;
  }
}
