/* =========================================================
   Base.css
   - 전역 토큰/리셋
   - 공통 앱 셸(헤더/내비게이션)
   - 공지 팝업 레이어
   - 공통 모바일 헤더 반응형
   ========================================================= */

/* [01] Design Tokens (Color / Radius / Typography / Layout) */
:root {
  --bg: #f6f5ef;
  --bg-soft: #eceadf;
  --surface: rgba(255, 255, 255, 0.72);
  --surface-strong: #ffffff;
  --line: rgba(14, 31, 51, 0.12);
  --text: #102033;
  --muted: #5f6977;
  --brand: #d3ff34;
  --brand-strong: #c2f01e;
  --brand-deep: #102033;
  --accent: #60b2ff;
  --shadow: 0 28px 80px rgba(16, 32, 51, 0.12);
  --radius-xl: 34px;
  --radius-lg: 24px;
  --radius-md: 18px;
  --content: 1180px;
  --font-body:
    "Apple SD Gothic Neo", "Noto Sans KR", "Malgun Gothic", "Segoe UI", sans-serif;
  --font-display:
    "Iowan Old Style", "Palatino Linotype", "Times New Roman", serif;
}

/* [02] Reset + Document Defaults */
* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  font-family: var(--font-body);
  color: var(--text);
  background:
    linear-gradient(rgba(82, 95, 225, 0.035) 1px, transparent 1px),
    linear-gradient(90deg, rgba(82, 95, 225, 0.035) 1px, transparent 1px),
    radial-gradient(circle at top left, rgba(212, 255, 56, 0.1), transparent 20%),
    radial-gradient(circle at 85% 12%, rgba(157, 184, 255, 0.1), transparent 16%),
    linear-gradient(180deg, #f8f6ef 0%, #f5f1e8 40%, #faf8f2 100%);
  background-size: 36px 36px, 36px 36px, auto, auto, auto;
}

body.menu-open {
  overflow: hidden;
}

body.notice-popup-open {
  overflow: hidden;
}

/* [03] Common Element Defaults */
a {
  color: inherit;
  text-decoration: none;
}

button,
input,
select,
textarea {
  font: inherit;
}

img {
  max-width: 100%;
  display: block;
}

[hidden] {
  display: none !important;
}

/* [04] Shared Width Container */
.page,
.footer,
.notice-strip {
  width: min(calc(100% - 2rem), var(--content));
  margin: 0 auto;
}

/* [05] App Shell Background Effects */
.app-shell {
  position: relative;
  min-height: 100vh;
}

.app-shell::before,
.app-shell::after {
  content: "";
  position: fixed;
  width: 26rem;
  height: 26rem;
  border-radius: 50%;
  filter: blur(80px);
  z-index: -1;
  opacity: 0.4;
}

.app-shell::before {
  right: -10rem;
  top: -8rem;
  background: rgba(211, 255, 52, 0.42);
}

.app-shell::after {
  left: -8rem;
  bottom: 10%;
  background: rgba(96, 178, 255, 0.24);
}

/* [06] Global Topbar / Brand / Navigation (Desktop) */
.topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  padding-top: 0;
  background:
    linear-gradient(90deg, rgba(255, 255, 255, 0.94), rgba(248, 250, 255, 0.9)),
    linear-gradient(rgba(82, 95, 225, 0.04) 1px, transparent 1px);
  backdrop-filter: blur(18px);
  border-bottom: 1px solid rgba(82, 95, 225, 0.08);
  background-size: auto, 32px 32px;
}

.topbar-inner {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: flex-start;
  gap: 1rem;
  width: min(100%, 1880px);
  max-width: none;
  min-height: 3.85rem;
  margin: 0 auto;
  padding: 0.46rem clamp(1.15rem, 2.6vw, 2.5rem);
  border: 0;
  border-radius: 0;
  background: transparent;
  backdrop-filter: none;
  box-shadow: none;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 0.9rem;
  flex: 0 0 auto;
  margin-right: clamp(1rem, 2vw, 2rem);
  padding: 0.28rem 0.7rem 0.28rem 0;
}

.brand-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 2.9rem;
  height: 2.9rem;
  padding: 0.18rem;
  overflow: hidden;
  border-radius: 12px;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.98), rgba(246, 248, 255, 0.94));
  box-shadow: inset 0 0 0 1px rgba(82, 95, 225, 0.08);
}

.brand-mark {
  width: 100%;
  height: 100%;
  object-fit: contain;
  object-position: center;
}

.brand-copy {
  display: grid;
  gap: 0.1rem;
}

.brand-copy strong {
  color: #0b104a;
  font-size: 0.98rem;
  font-weight: 800;
  letter-spacing: 0.12em;
}

.brand-copy span {
  color: #6b7386;
  font-size: 0.76rem;
  font-weight: 600;
}

.nav {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  flex: 1 1 auto;
  gap: clamp(0.7rem, 1.3vw, 1rem);
  margin-left: auto;
  padding-left: 1.1rem;
}

.nav-link {
  color: #5d6678;
  font-size: 0.86rem;
  font-weight: 800;
  transition: color 0.24s ease, transform 0.24s ease;
}

.nav-link:hover,
.nav-link.active,
.nav-link:focus-visible {
  color: #525fe1;
  transform: translateY(-1px);
}

.nav-cta {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 2.55rem;
  padding: 0 1.1rem;
  border-radius: 999px;
  background: #525fe1;
  color: #ffffff;
  font-size: 0.88rem;
  font-weight: 800;
  box-shadow: 0 12px 24px rgba(82, 95, 225, 0.16);
}

.nav-cta,
.nav-cta:visited,
.nav-cta:hover,
.nav-cta:focus-visible {
  color: #ffffff !important;
}

/* 모바일에서만 노출되는 햄버거 버튼. */
.menu-button {
  display: none;
  width: 2.8rem;
  height: 2.8rem;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: rgba(82, 95, 225, 0.08);
}

.menu-button span {
  display: block;
  width: 1.15rem;
  height: 2px;
  margin: 0.22rem auto;
  background: #1d295a;
}

/* 페이지 기본 하단 여백 */
.page {
  padding-bottom: 4rem;
}

/* [07] Notice Popup Layer (Overlay + Window) */
.notice-popup-layer {
  position: fixed;
  inset: 0;
  z-index: 80;
  display: grid;
  place-items: center;
  padding: 1.5rem;
}

/* hidden 속성 적용 시 사용자 에이전트 스타일(display:none)을 덮어쓰지 않도록 강제한다. */
.notice-popup-layer[hidden] {
  display: none !important;
  pointer-events: none;
}

/* 팝업 정렬 포지션 프리셋 */
.notice-popup-layer.is-top-left {
  align-items: start;
  justify-items: start;
}

.notice-popup-layer.is-middle-left {
  justify-items: start;
}

.notice-popup-layer.is-middle-right {
  justify-items: end;
}

.notice-popup-layer.is-top-right {
  align-items: start;
  justify-items: end;
}

.notice-popup-layer.is-bottom-left {
  align-items: end;
  justify-items: start;
}

.notice-popup-layer.is-bottom-right {
  align-items: end;
  justify-items: end;
}

/* 배경 딤 처리 */
.notice-popup-backdrop {
  position: absolute;
  inset: 0;
  border: 0;
  background: rgba(10, 18, 30, 0.44);
  backdrop-filter: blur(8px);
}

/* 팝업 본문 컨테이너 */
.notice-popup-window {
  --notice-popup-cover-height: clamp(17rem, 34vh, 23rem);
  --notice-popup-content-max-height: min(36vh, 22rem);
  position: relative;
  z-index: 1;
  width: min(100%, 42rem);
  max-height: min(86vh, 58rem);
  display: grid;
  gap: 1rem;
  padding: 1.4rem;
  border: 1px solid rgba(16, 32, 51, 0.12);
  border-radius: 28px;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.96), rgba(248, 245, 236, 0.98));
  box-shadow: 0 32px 90px rgba(8, 15, 30, 0.22);
  overflow: hidden;
}

.notice-popup-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem;
}

.notice-popup-kicker {
  display: inline-flex;
  align-items: center;
  min-height: 2rem;
  padding: 0 0.8rem;
  border-radius: 999px;
  background: rgba(82, 95, 225, 0.1);
  color: #4453d5;
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.08em;
}

.notice-popup-header h2 {
  margin: 0.85rem 0 0;
  font-size: clamp(1.45rem, 2vw, 2rem);
  line-height: 1.22;
}

.notice-popup-close {
  flex: 0 0 auto;
  width: 2.8rem;
  height: 2.8rem;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: rgba(16, 32, 51, 0.08);
  color: var(--text);
  font-size: 1.45rem;
  line-height: 1;
  cursor: pointer;
}

.notice-popup-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 0.65rem;
  color: var(--muted);
  font-size: 0.9rem;
}

.notice-popup-meta span {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
}

.notice-popup-meta span::before {
  content: "";
  width: 0.3rem;
  height: 0.3rem;
  border-radius: 50%;
  background: rgba(82, 95, 225, 0.36);
}

.notice-popup-meta span:first-child::before {
  display: none;
}

.notice-popup-cover {
  min-height: var(--notice-popup-cover-height);
  overflow: hidden;
  border-radius: 20px;
  background: rgba(68, 83, 213, 0.06);
}

.notice-popup-cover img {
  display: block;
  width: 100%;
  height: var(--notice-popup-cover-height);
  object-fit: cover;
  object-position: center top;
}

/* 팝업 본문 콘텐츠 공통/요약 타입 */
.notice-popup-content {
  max-height: var(--notice-popup-content-max-height);
  padding: 1rem 1rem 0.35rem;
  border-radius: 22px;
  background: rgba(255, 255, 255, 0.72);
  overflow: auto;
  line-height: 1.75;
  color: var(--text);
}

.notice-popup-content.is-summary {
  padding: 1.1rem 1.15rem;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.82), rgba(247, 247, 250, 0.94));
  font-size: 1rem;
  line-height: 1.82;
}

.notice-popup-content.is-summary p {
  margin: 0;
}

.notice-popup-content.is-summary p + p {
  margin-top: 0.8rem;
}

.notice-popup-content > *:first-child {
  margin-top: 0;
}

.notice-popup-content > *:last-child {
  margin-bottom: 0;
}

.notice-popup-content img {
  width: 100%;
  height: auto;
  border-radius: 16px;
}

.notice-popup-content a {
  color: #4453d5;
  text-decoration: underline;
}

.notice-popup-content table {
  width: 100%;
  border-collapse: collapse;
}

.notice-popup-content th,
.notice-popup-content td {
  padding: 0.6rem;
  border: 1px solid rgba(16, 32, 51, 0.1);
}

/* 팝업 하단 액션 */
.notice-popup-actions,
.notice-popup-footer {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  justify-content: space-between;
}

.notice-popup-actions {
  justify-content: flex-start;
}

.notice-popup-text-button {
  padding: 0;
  border: 0;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
}

.notice-popup-text-button:hover,
.notice-popup-text-button:focus-visible,
.notice-popup-close:hover,
.notice-popup-close:focus-visible {
  color: #4453d5;
}

/* [08] Responsive - Tablet and Below */
@media (max-width: 820px) {
  .topbar-inner {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    align-items: center;
    min-height: 4.8rem;
    padding: 0.75rem 0.95rem;
  }

  .brand {
    display: grid;
    grid-template-columns: auto minmax(0, 1fr);
    align-items: center;
    gap: 0.72rem;
    width: 100%;
    min-width: 0;
    margin-right: auto;
    padding-right: 0;
  }

  .brand-badge {
    width: 2.7rem;
    height: 2.7rem;
  }

  .brand-copy {
    min-width: 0;
    overflow: hidden;
  }

  .brand-copy strong {
    display: block;
    font-size: 0.98rem;
    letter-spacing: 0.1em;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }

  .brand-copy span {
    display: block;
    font-size: 0.74rem;
    line-height: 1.35;
    word-break: keep-all;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }

  .menu-button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex-direction: column;
    justify-self: end;
    margin-left: 0;
    flex: 0 0 auto;
    border: 1px solid rgba(82, 95, 225, 0.1);
    background: rgba(82, 95, 225, 0.12);
    box-shadow: 0 10px 24px rgba(16, 32, 51, 0.08);
  }

  /* 모바일에서는 내비게이션을 드롭다운 패널로 전환한다. */
  .nav {
    position: absolute;
    inset: calc(100% + 0.7rem) 0.75rem auto;
    display: grid;
    gap: 0.2rem;
    padding: 0.8rem;
    border: 1px solid rgba(16, 32, 51, 0.08);
    border-radius: 22px;
    background: rgba(255, 255, 255, 0.96);
    box-shadow: var(--shadow);
    opacity: 0;
    visibility: hidden;
    transform: translateY(-8px);
    transition: opacity 0.2s ease, transform 0.2s ease, visibility 0.2s ease;
  }

  .nav.is-open {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
  }

  .nav-link,
  .nav-cta {
    display: inline-flex;
    align-items: center;
    width: 100%;
    min-height: 3rem;
    justify-content: flex-start;
  }
}

/* [09] Responsive - Small Mobile */
@media (max-width: 560px) {
  .topbar-inner {
    min-height: 4.2rem;
    padding: 0.62rem 0.82rem;
  }

  .brand {
    gap: 0.62rem;
    margin-right: 0;
  }

  .brand-badge {
    width: 2.45rem;
    height: 2.45rem;
    border-radius: 12px;
  }

  .brand-copy strong {
    font-size: 0.84rem;
    letter-spacing: 0.08em;
  }

  .brand-copy span {
    display: none;
  }

  .menu-button {
    width: 2.45rem;
    height: 2.45rem;
  }

  .nav {
    inset: calc(100% + 0.55rem) 0.7rem auto;
  }
}
