/* ===========================================================================
   달비(DALBI) 디자인 시스템
   ---------------------------------------------------------------------------
   테마는 **다크 하나로 고정**한다. 섹션마다 라이트로 뒤집지 않는다
   (관리자 화면까지 같은 토큰을 쓴다 - 두 벌을 두면 한쪽만 고치는 사고가 난다).

   모양 규칙(하나로 통일, 섞지 말 것)
     카드/패널  16px     --r-card
     입력/배지  10px     --r-input
     버튼/칩    꽉 둥글게 --r-pill

   색 규칙
     액센트는 #E8B05A 하나뿐이다. 섹션마다 다른 포인트색을 쓰지 말 것.
     액센트 위 글자는 반드시 --accent-on(어두운 잉크). 흰 글자는 대비가 2.4:1 로 AA 미달이다.

   모션
     transform / opacity 만 움직인다. scroll 이벤트 리스너는 쓰지 않고
     IntersectionObserver(.reveal)와 CSS 만 쓴다. 전부 prefers-reduced-motion 으로 꺼진다.
   =========================================================================== */

@import url("/static/font/SUIT.css");

:root {
  /* 바탕 */
  --bg: #0B0D12;
  --bg-soft: #0F121A;
  --bg-sunken: #070910;
  --surface: #161A23;
  --surface-2: #1C212C;

  /* 선 */
  --line: rgba(255, 255, 255, .08);
  --line-strong: rgba(255, 255, 255, .16);

  /* 글자 */
  --ink: #F2F3F5;
  --ink-soft: #9AA0AC;
  --ink-faint: #676D7C;

  /* 액센트 (달빛) */
  --accent: #E8B05A;
  --accent-deep: #C89250;
  --accent-dim: rgba(232, 176, 90, .13);
  --accent-line: rgba(232, 176, 90, .32);
  --accent-on: #1A1206;
  /* 같은 색조의 밝은 단계. 시머/보더빔/진행바에만 쓴다 - 새 포인트색이 아니다. */
  --accent-lite: #F3CF90;

  /* 상태 */
  --danger: #E8705F;
  --danger-dim: rgba(232, 112, 95, .14);
  --ok: #5EC08F;
  --ok-dim: rgba(94, 192, 143, .14);

  /* 모양 */
  --r-card: 16px;
  --r-input: 10px;
  --r-pill: 999px;
  --r-panel: 24px;   /* 카드보다 큰 면(히어로 시트·CTA 패널). 섞어 쓰지 말 것 */

  /* 그림자 - 다크에선 검정 그림자가 안 보인다. 바탕 색조로 틴트하고 위쪽에 하이라이트를 넣는다 */
  --elev-1: 0 1px 0 rgba(255, 255, 255, .04) inset, 0 2px 8px rgba(0, 0, 0, .40);
  --elev-2: 0 1px 0 rgba(255, 255, 255, .05) inset, 0 10px 30px rgba(0, 0, 0, .46);
  --elev-3: 0 1px 0 rgba(255, 255, 255, .06) inset, 0 24px 60px rgba(0, 0, 0, .54);

  --ease: cubic-bezier(.16, 1, .3, 1);
  --header-h: 68px;
  --wrap: 1240px;

  --font: 'SUIT', -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Malgun Gothic', sans-serif;
  --font-num: 'SUIT', ui-monospace, 'SFMono-Regular', Menlo, Consolas, monospace;
}

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

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

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font);
  font-size: 16px;
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  overflow-x: hidden;
  /* 한글은 어절 중간에서 끊으면 읽기가 나빠진다. 대신 긴 URL 은 쪼개 넘친 가로스크롤을 막는다. */
  word-break: keep-all;
  overflow-wrap: break-word;
}

img, svg, video { max-width: 100%; display: block; }
a { color: inherit; text-decoration: none; }
button, input, select, textarea { font: inherit; color: inherit; }
button { background: none; border: 0; cursor: pointer; }
h1, h2, h3, h4, p, figure { margin: 0; }
ul, ol { margin: 0; padding: 0; list-style: none; }
table { border-collapse: collapse; width: 100%; }

:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 3px;
  border-radius: 4px;
}

::selection { background: var(--accent); color: var(--accent-on); }

/* 숫자는 자릿수가 흔들리면 표가 덜덜 떨린다 */
.tnum, td, .num { font-variant-numeric: tabular-nums; }

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

.skip-link {
  position: absolute; left: 12px; top: -60px; z-index: 200;
  background: var(--accent); color: var(--accent-on);
  padding: 10px 18px; border-radius: var(--r-pill); font-weight: 700;
  transition: top .2s var(--ease);
}
.skip-link:focus { top: 12px; }

/* ---------------------------------------------------------------------------
   레이아웃
   --------------------------------------------------------------------------- */
.wrap { width: 100%; max-width: var(--wrap); margin: 0 auto; padding: 0 24px; }
.wrap-narrow { max-width: 880px; }

.sec { padding: 112px 0; position: relative; }
.sec-tight { padding: 72px 0; }

.stack { display: flex; flex-direction: column; }
.row { display: flex; align-items: center; gap: 12px; }
.row-between { display: flex; align-items: center; justify-content: space-between; gap: 16px; }
.wrapflex { flex-wrap: wrap; }
.grow { flex: 1 1 auto; min-width: 0; }

/* ---------------------------------------------------------------------------
   타이포
   --------------------------------------------------------------------------- */
/* text-wrap:balance - 마지막 줄에 한 단어만 남는 제목을 없앤다(미지원 브라우저는 그냥 무시). */
.display, .h1, .h2, .h3 { text-wrap: balance; }
.lead, .body { text-wrap: pretty; }

.display {
  font-size: clamp(2.4rem, 5.4vw, 4.1rem);
  line-height: 1.12;
  letter-spacing: -.035em;
  font-weight: 800;
}
.h1 { font-size: clamp(2rem, 3.8vw, 2.9rem); line-height: 1.2; letter-spacing: -.03em; font-weight: 800; }
.h2 { font-size: clamp(1.5rem, 2.6vw, 2.1rem); line-height: 1.28; letter-spacing: -.025em; font-weight: 800; }
.h3 { font-size: 1.22rem; line-height: 1.4; letter-spacing: -.015em; font-weight: 700; }

.lead { font-size: 1.1rem; color: var(--ink-soft); line-height: 1.75; max-width: 62ch; }
.body { color: var(--ink-soft); line-height: 1.75; }
.small { font-size: .875rem; color: var(--ink-soft); }
.tiny { font-size: .78rem; color: var(--ink-faint); }

.ink-accent { color: var(--accent); }
.ink-soft { color: var(--ink-soft); }
.ink-faint { color: var(--ink-faint); }

/* 섹션 라벨. 남발하면 모든 섹션이 똑같은 리듬이 된다 - 3섹션당 1개까지만 쓴다. */
.eyebrow {
  font-size: .76rem; font-weight: 700; letter-spacing: .16em;
  text-transform: uppercase; color: var(--accent);
}

/* ---------------------------------------------------------------------------
   버튼
   --------------------------------------------------------------------------- */
.btn {
  --btn-bg: var(--surface);
  --btn-ink: var(--ink);
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  padding: 13px 24px; border-radius: var(--r-pill);
  background: var(--btn-bg); color: var(--btn-ink);
  font-weight: 700; font-size: .95rem; white-space: nowrap;
  border: 1px solid var(--line);
  transition: transform .18s var(--ease), background .18s var(--ease),
              border-color .18s var(--ease), box-shadow .18s var(--ease), opacity .18s var(--ease);
}
.btn:hover { transform: translateY(-1px); border-color: var(--line-strong); }
.btn:active { transform: translateY(0) scale(.985); }
.btn[disabled], .btn.is-busy { opacity: .55; pointer-events: none; }

.btn-primary {
  --btn-bg: var(--accent);
  --btn-ink: var(--accent-on);   /* 액센트 위 흰 글자는 AA 미달. 반드시 어두운 잉크 */
  border-color: transparent;
  box-shadow: var(--elev-1);
}
.btn-primary:hover { --btn-bg: #F0BC6C; box-shadow: var(--elev-2); }

.btn-ghost { --btn-bg: transparent; border-color: var(--line-strong); }
.btn-ghost:hover { --btn-bg: rgba(255, 255, 255, .04); }

.btn-quiet {
  --btn-bg: transparent; --btn-ink: var(--ink-soft);
  border-color: transparent; padding: 10px 14px; font-weight: 600;
}
.btn-quiet:hover { --btn-ink: var(--ink); --btn-bg: rgba(255, 255, 255, .05); }

.btn-danger { --btn-bg: var(--danger-dim); --btn-ink: var(--danger); border-color: transparent; }
.btn-danger:hover { --btn-bg: rgba(232, 112, 95, .22); }

.btn-lg { padding: 16px 32px; font-size: 1.02rem; }
.btn-sm { padding: 8px 15px; font-size: .84rem; }
.btn-block { width: 100%; }

.ic { width: 1.15em; height: 1.15em; flex: none; }
.ic-lg { width: 1.5em; height: 1.5em; }

/* ---------------------------------------------------------------------------
   면 (카드 / 패널 / 유리)
   --------------------------------------------------------------------------- */
.card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-card);
  box-shadow: var(--elev-1);
}
.card-pad { padding: 26px; }

/* 유리판. 레퍼런스의 liquid glass 를 웹에서 근사한 것이지 애플 구현이 아니다.
   투명도 축소 환경에서는 불투명 배경으로 떨어진다. */
.glass {
  position: relative;
  background: linear-gradient(145deg, rgba(255, 255, 255, .07), rgba(255, 255, 255, .02));
  border: 1px solid rgba(255, 255, 255, .11);
  border-radius: var(--r-card);
  backdrop-filter: blur(18px) saturate(150%);
  -webkit-backdrop-filter: blur(18px) saturate(150%);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .14), 0 18px 48px rgba(0, 0, 0, .42);
}
@media (prefers-reduced-transparency: reduce) {
  .glass { background: var(--surface); backdrop-filter: none; -webkit-backdrop-filter: none; }
}

/* 커서를 따라가는 발광 테두리. --mx/--my 는 base.html 하단 스크립트가 넣는다. */
.spot { position: relative; isolation: isolate; overflow: hidden; }
.spot::before {
  content: ""; position: absolute; inset: -1px; z-index: -1; border-radius: inherit;
  background: radial-gradient(420px circle at var(--mx, 50%) var(--my, 0%),
              rgba(232, 176, 90, .18), transparent 62%);
  opacity: 0; transition: opacity .3s var(--ease);
}
.spot:hover::before { opacity: 1; }

.panel {
  background: linear-gradient(160deg, var(--surface) 0%, var(--bg-soft) 100%);
  border: 1px solid var(--line);
  border-radius: 24px;
  box-shadow: var(--elev-2);
}

.divider { height: 1px; background: var(--line); border: 0; margin: 0; }

/* ---------------------------------------------------------------------------
   배지 / 칩
   --------------------------------------------------------------------------- */
.badge {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 5px 11px; border-radius: var(--r-pill);
  font-size: .78rem; font-weight: 700; line-height: 1.4;
  background: rgba(255, 255, 255, .06); color: var(--ink-soft);
  border: 1px solid var(--line);
}
.badge-accent { background: var(--accent-dim); color: var(--accent); border-color: var(--accent-line); }
.badge-ok { background: var(--ok-dim); color: var(--ok); border-color: transparent; }
.badge-danger { background: var(--danger-dim); color: var(--danger); border-color: transparent; }

.chip {
  display: inline-flex; align-items: center; gap: 7px;
  padding: 9px 16px; border-radius: var(--r-pill);
  border: 1px solid var(--line-strong); background: transparent;
  color: var(--ink-soft); font-size: .88rem; font-weight: 600;
  transition: all .18s var(--ease);
}
.chip:hover { color: var(--ink); border-color: var(--accent-line); }
.chip.is-on { background: var(--accent); color: var(--accent-on); border-color: transparent; }

/* ---------------------------------------------------------------------------
   폼 - 라벨은 입력 위, 도움말/오류는 아래. placeholder 를 라벨로 쓰지 않는다.
   --------------------------------------------------------------------------- */
.field { display: flex; flex-direction: column; gap: 8px; margin-bottom: 20px; }
.field > label { font-size: .88rem; font-weight: 700; color: var(--ink); }
.field .hint { font-size: .8rem; color: var(--ink-faint); line-height: 1.55; }
.field .err { font-size: .8rem; color: var(--danger); font-weight: 600; }
.req { color: var(--accent); margin-left: 2px; }

.input, .select, .textarea {
  width: 100%; padding: 13px 15px;
  background: var(--bg-sunken);
  border: 1px solid var(--line-strong);
  border-radius: var(--r-input);
  color: var(--ink);
  transition: border-color .18s var(--ease), background .18s var(--ease);
}
.input::placeholder, .textarea::placeholder { color: var(--ink-faint); }
.input:focus, .select:focus, .textarea:focus {
  outline: none; border-color: var(--accent); background: var(--bg-soft);
}
.textarea { resize: vertical; min-height: 120px; line-height: 1.7; }
.select {
  appearance: none; padding-right: 42px; cursor: pointer;
  background-image: linear-gradient(45deg, transparent 50%, var(--ink-soft) 50%),
                    linear-gradient(135deg, var(--ink-soft) 50%, transparent 50%);
  background-position: calc(100% - 20px) 50%, calc(100% - 14px) 50%;
  background-size: 6px 6px, 6px 6px;
  background-repeat: no-repeat;
}
.select option { background: var(--surface); color: var(--ink); }

.check { display: flex; align-items: flex-start; gap: 10px; cursor: pointer; }
.check input { margin-top: 3px; accent-color: var(--accent); width: 16px; height: 16px; flex: none; }
.check span { font-size: .9rem; color: var(--ink-soft); line-height: 1.6; }

/* ---------------------------------------------------------------------------
   헤더 / 내비 - 데스크톱에서 반드시 한 줄, 높이 68px
   --------------------------------------------------------------------------- */
.hd {
  position: sticky; top: 0; z-index: 90;
  height: var(--header-h);
  background: rgba(11, 13, 18, .72);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border-bottom: 1px solid var(--line);
}
.hd-in { height: 100%; display: flex; align-items: center; gap: 28px; }
.hd-logo { display: flex; align-items: center; gap: 9px; font-weight: 800; font-size: 1.16rem; letter-spacing: -.02em; }
.hd-logo img { width: 32px; height: 32px; }
.hd-nav { display: flex; align-items: center; gap: 4px; margin-left: auto; }
.hd-nav a {
  padding: 8px 14px; border-radius: var(--r-pill);
  font-size: .92rem; font-weight: 600; color: var(--ink-soft);
  transition: color .18s var(--ease), background .18s var(--ease);
}
.hd-nav a:hover { color: var(--ink); background: rgba(255, 255, 255, .05); }
.hd-nav a.is-on { color: var(--ink); }
.hd-act { display: flex; align-items: center; gap: 10px; }

.hd-burger { display: none; padding: 8px; border-radius: var(--r-input); color: var(--ink); }
.hd-mobile { display: none; }

@media (max-width: 900px) {
  .hd-nav, .hd-act .hide-sm { display: none; }
  .hd-burger { display: inline-flex; }
  /* JS 없이도 열려야 한다 - <details> 로 만든다 */
  .hd-mobile { display: block; }
  .hd-mobile > summary { list-style: none; }
  .hd-mobile > summary::-webkit-details-marker { display: none; }
  .hd-sheet {
    position: fixed; left: 0; right: 0; top: var(--header-h); z-index: 95;
    background: var(--bg-soft); border-bottom: 1px solid var(--line);
    padding: 16px 24px 24px; display: flex; flex-direction: column; gap: 4px;
    box-shadow: var(--elev-3);
  }
  .hd-sheet a { padding: 13px 4px; font-weight: 700; border-bottom: 1px solid var(--line); }
  .hd-sheet a:last-of-type { border-bottom: 0; }
}

/* 포인트 잔액 표시 */
.pt-badge {
  display: inline-flex; align-items: center; gap: 7px;
  padding: 8px 14px; border-radius: var(--r-pill);
  background: var(--accent-dim); border: 1px solid var(--accent-line);
  color: var(--accent); font-weight: 800; font-size: .88rem;
  font-variant-numeric: tabular-nums;
}

/* ---------------------------------------------------------------------------
   푸터
   --------------------------------------------------------------------------- */
.ft { border-top: 1px solid var(--line); background: var(--bg-sunken); padding: 64px 0 40px; }
.ft-grid { display: grid; grid-template-columns: 1.6fr 1fr 1fr; gap: 48px; }
.ft h4 { font-size: .84rem; font-weight: 800; color: var(--ink); margin-bottom: 14px; letter-spacing: .02em; }
.ft a { display: block; padding: 5px 0; font-size: .9rem; color: var(--ink-soft); }
.ft a:hover { color: var(--accent); }
.ft-base { margin-top: 44px; padding-top: 24px; border-top: 1px solid var(--line); }
@media (max-width: 780px) { .ft-grid { grid-template-columns: 1fr; gap: 32px; } }

/* ---------------------------------------------------------------------------
   모션
   --------------------------------------------------------------------------- */
/* .reveal 은 <html class="js"> 일 때만 숨은 상태로 시작한다. JS 가 없으면 그냥 다 보인다. */
.js .reveal { opacity: 0; transform: translateY(22px); }
.js .reveal.is-in {
  opacity: 1; transform: none;
  transition: opacity .7s var(--ease), transform .7s var(--ease);
  transition-delay: var(--d, 0ms);
}

@keyframes dl-rise { from { opacity: 0; transform: translateY(16px); } to { opacity: 1; transform: none; } }
.rise { animation: dl-rise .7s var(--ease) both; animation-delay: var(--d, 0ms); }

@keyframes dl-spin { to { transform: rotate(360deg); } }
@keyframes dl-dash {
  0% { stroke-dasharray: 1 150; stroke-dashoffset: 0; }
  50% { stroke-dasharray: 90 150; stroke-dashoffset: -28; }
  100% { stroke-dasharray: 90 150; stroke-dashoffset: -118; }
}
/* AI 작업 대기용 원형 로더 */
.loader { width: 44px; height: 44px; animation: dl-spin 2s linear infinite; }
.loader circle {
  fill: none; stroke: var(--accent); stroke-width: 3.4; stroke-linecap: round;
  animation: dl-dash 1.5s ease-in-out infinite;
}
.loader-sm { width: 20px; height: 20px; }
.loader-sm circle { stroke-width: 4.2; }

@keyframes dl-shimmer { to { background-position: -200% 0; } }
.skel {
  background: linear-gradient(90deg, var(--surface) 0%, var(--surface-2) 40%, var(--surface) 80%);
  background-size: 200% 100%;
  animation: dl-shimmer 1.4s linear infinite;
  border-radius: var(--r-input);
}

@keyframes dl-float { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(-9px); } }
.float { animation: dl-float 5.5s ease-in-out infinite; }

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after {
    animation-duration: .001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: .001ms !important;
  }
  .js .reveal { opacity: 1; transform: none; }
}

/* ---------------------------------------------------------------------------
   토스트 / 모달
   --------------------------------------------------------------------------- */
.toast-wrap {
  position: fixed; right: 20px; bottom: 20px; z-index: 300;
  display: flex; flex-direction: column; gap: 10px; pointer-events: none;
}
.toast {
  display: flex; align-items: center; gap: 10px;
  padding: 13px 18px; border-radius: var(--r-pill);
  background: var(--surface-2); border: 1px solid var(--line-strong);
  box-shadow: var(--elev-3); font-size: .9rem; font-weight: 600;
  animation: dl-rise .35s var(--ease) both; max-width: min(92vw, 420px);
}
.toast-err { border-color: rgba(232, 112, 95, .5); color: var(--danger); }
.toast-ok { border-color: rgba(94, 192, 143, .45); color: var(--ok); }

.modal {
  position: fixed; inset: 0; z-index: 250;
  display: none; align-items: center; justify-content: center; padding: 20px;
  background: rgba(5, 6, 9, .72); backdrop-filter: blur(6px);
}
.modal.is-open { display: flex; }
.modal-box {
  width: 100%; max-width: 440px; padding: 32px;
  background: var(--surface); border: 1px solid var(--line-strong);
  border-radius: 20px; box-shadow: var(--elev-3);
  animation: dl-rise .3s var(--ease) both;
}

/* ---------------------------------------------------------------------------
   빈 상태 / 오류
   --------------------------------------------------------------------------- */
.empty { text-align: center; padding: 72px 24px; }
.empty img { width: 110px; margin: 0 auto 20px; opacity: .9; }
.empty h3 { margin-bottom: 8px; }
.empty p { color: var(--ink-soft); margin-bottom: 24px; }

/* ---------------------------------------------------------------------------
   유틸
   --------------------------------------------------------------------------- */
.mt-0 { margin-top: 0; }
.mt-8 { margin-top: 8px; }
.mt-12 { margin-top: 12px; }
.mt-16 { margin-top: 16px; }
.mt-24 { margin-top: 24px; }
.mt-32 { margin-top: 32px; }
.mt-48 { margin-top: 48px; }
.mb-8 { margin-bottom: 8px; }
.mb-16 { margin-bottom: 16px; }
.mb-24 { margin-bottom: 24px; }
.mb-32 { margin-bottom: 32px; }
.mb-48 { margin-bottom: 48px; }
.ta-c { text-align: center; }
.ta-r { text-align: right; }
[hidden] { display: none !important; }

/* ===========================================================================
   효과(FX) 레이어
   ---------------------------------------------------------------------------
   외부 레퍼런스에서 **라이선스를 확인한 것만** 가져왔다(근거: DESIGN_CREDITS.md).
     Magic UI (MIT)           border beam · shine · marquee · dot/grid pattern · number ticker
     Motion Primitives (MIT)  text shimmer · in-view 스태거
     shadcn/ui (MIT)          포커스링 · 카드/아코디언 간격 규약
   Shadertoy(기본 CC BY-NC-SA 3.0 = 비상업), Scrolltide·Shadcnblocks(유료 미구매),
   colorion 계열(Kinetics/Gradient Buttons/Text Effects)·Circle Loaders·Liquid Glass
   (라이선스 표기 없음 = 저작권 유보)는 **쓰지 않는다.** 코드를 복사하지도 말 것.

   React 라이브러리 코드는 이 프로젝트(Jinja + 바닐라 CSS)에 그대로 못 넣으므로
   효과만 기존 토큰 위에 다시 구현했다. 새 색조는 만들지 않는다.

   모션 원칙
     transform / opacity 만 움직인다. scroll 이벤트 리스너는 여전히 쓰지 않는다.
     스크롤에 붙어 연속으로 움직이는 것은 네이티브 스크롤 타임라인(animation-timeline)
     으로만 만들고, 한 번 등장하는 것은 기존 .reveal(IntersectionObserver)을 쓴다.
     같은 일을 두 체계로 만들면 한쪽만 고치는 사고가 난다.
   =========================================================================== */

/* conic-gradient 의 각도는 @property 로 선언해야 보간된다(그냥 --x 면 애니메이션이 안 먹는다). */
@property --dl-angle { syntax: "<angle>"; inherits: false; initial-value: 0deg; }

/* ---------------------------------------------------------------------------
   보더 빔 - 테두리를 한 바퀴 도는 액센트 호 (Magic UI Border Beam, MIT)
   1px 링만 그리므로 .card / .panel 어디에 붙여도 내용 레이아웃이 안 바뀐다.
   한 페이지에 2개까지만 쓸 것. 세 개가 동시에 돌면 어디를 봐야 할지 흐려진다.
   --------------------------------------------------------------------------- */
.beam { position: relative; }
.beam::before {
  content: ""; position: absolute; inset: 0; z-index: 2; pointer-events: none;
  border-radius: inherit; padding: 1px;
  background: conic-gradient(from var(--dl-angle),
              transparent 0 66%, var(--accent-line) 80%, var(--accent-lite) 91%, transparent 96%);
  /* 가운데를 파내 테두리만 남긴다. -webkit- 쪽은 xor, 표준은 exclude 로 이름이 다르다. */
  -webkit-mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0);
  -webkit-mask-composite: xor;
          mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0);
          mask-composite: exclude;
  animation: dl-angle var(--beam-dur, 7s) linear infinite;
}
@keyframes dl-angle { to { --dl-angle: 360deg; } }

/* ---------------------------------------------------------------------------
   샤인 - 표면을 한 번 지나가는 빛 (Magic UI Shine Border, MIT). hover 에서만 돈다.
   --------------------------------------------------------------------------- */
.shine { position: relative; overflow: hidden; }
.shine::after {
  content: ""; position: absolute; top: 0; bottom: 0; left: 0; width: 38%;
  background: linear-gradient(100deg, transparent, rgba(255, 255, 255, .10), transparent);
  transform: translateX(-180%) skewX(-16deg); opacity: 0; pointer-events: none;
}
.shine:hover::after { animation: dl-shine .95s var(--ease); }
@keyframes dl-shine {
  from { transform: translateX(-180%) skewX(-16deg); opacity: 1; }
  to { transform: translateX(380%) skewX(-16deg); opacity: 0; }
}

/* ---------------------------------------------------------------------------
   텍스트 시머 - 같은 색조의 밝은 단계만 흐른다 (Motion Primitives text-shimmer, MIT).
   --accent-lite 외의 색을 끼워 넣지 말 것(섹션마다 다른 포인트색이 생긴다).
   --------------------------------------------------------------------------- */
.shimmer {
  background: linear-gradient(100deg, var(--accent-deep) 12%, var(--accent-lite) 34%, var(--accent-deep) 58%);
  background-size: 240% 100%;
  -webkit-background-clip: text; background-clip: text;
  color: transparent;
  animation: dl-shimmer-x 6s linear infinite;
}
@keyframes dl-shimmer-x { to { background-position: -240% 0; } }

/* ---------------------------------------------------------------------------
   마퀴 - 끊김 없는 가로 띠 (Magic UI Marquee, MIT)
   **같은 내용의 .mq-row 를 세 개** 넣어야 이어진다(복제본은 aria-hidden).
   (복제 수 - 1) x 한 줄 폭 >= 화면 폭 이어야 끝에서 빈 틈이 안 보인다.
   두 개만 넣으면 한 줄이 화면보다 짧은 와이드 모니터에서 오른쪽이 비어 보인다(실제로 당함).
   --------------------------------------------------------------------------- */
.mq {
  --mq-gap: 30px; --mq-dur: 44s;
  display: flex; gap: var(--mq-gap); overflow: hidden; width: 100%;
  /* 양 끝을 흐려야 잘린 글자가 아니라 계속 흐르는 띠로 읽힌다. */
  -webkit-mask-image: linear-gradient(90deg, transparent, #000 7%, #000 93%, transparent);
          mask-image: linear-gradient(90deg, transparent, #000 7%, #000 93%, transparent);
}
.mq-row {
  display: flex; align-items: center; gap: var(--mq-gap); flex: 0 0 auto;
  animation: dl-mq var(--mq-dur) linear infinite;
}
@keyframes dl-mq { to { transform: translateX(calc(-100% - var(--mq-gap))); } }
.mq:hover .mq-row { animation-play-state: paused; }
.mq-rev .mq-row { animation-direction: reverse; }

/* ---------------------------------------------------------------------------
   패턴 배경 (Magic UI Dot/Grid Pattern, MIT)
   섹션 안에서 position:absolute 로 깔고, 부모에 position:relative 를 준다.
   --------------------------------------------------------------------------- */
.dots, .gridbg { position: absolute; inset: 0; z-index: 0; pointer-events: none; }
.dots {
  background-image: radial-gradient(var(--line-strong) 1px, transparent 1px);
  background-size: 20px 20px;
  -webkit-mask-image: radial-gradient(520px 340px at var(--px, 50%) var(--py, 0%), #000, transparent 74%);
          mask-image: radial-gradient(520px 340px at var(--px, 50%) var(--py, 0%), #000, transparent 74%);
}
.gridbg {
  background-image: linear-gradient(var(--line) 1px, transparent 1px),
                    linear-gradient(90deg, var(--line) 1px, transparent 1px);
  background-size: 64px 64px;
  -webkit-mask-image: radial-gradient(680px 420px at 50% 0%, #000, transparent 76%);
          mask-image: radial-gradient(680px 420px at 50% 0%, #000, transparent 76%);
}

/* ---------------------------------------------------------------------------
   숫자 등장 (Magic UI Number Ticker 를 자릿수 단위로 바꾼 것)
   CSS counter() 로 세면 천단위 쉼표가 사라져 10000 으로 찍힌다. 그래서 서버가 찍은
   쉼표 있는 문자열을 그대로 쓰고 글자만 차례로 올린다 - 표기와 숫자가 어긋나지 않는다.
   --------------------------------------------------------------------------- */
.digits { display: inline-flex; }
.digits > span { display: inline-block; }
.js .reveal .digits > span { opacity: 0; }
.js .reveal.is-in .digits > span {
  animation: dl-digit .5s var(--ease) both;
  animation-delay: calc(var(--i, 0) * 45ms);
}
@keyframes dl-digit { from { opacity: 0; transform: translateY(.5em); } to { opacity: 1; transform: none; } }

/* ---------------------------------------------------------------------------
   라이브 배지 - 점이 한 번씩 번진다
   --------------------------------------------------------------------------- */
.pill {
  display: inline-flex; align-items: center; gap: 9px;
  padding: 7px 15px 7px 12px; border-radius: var(--r-pill);
  background: var(--accent-dim); border: 1px solid var(--accent-line);
  color: var(--accent); font-size: .82rem; font-weight: 700; line-height: 1.5;
}
.pill-dot { position: relative; width: 7px; height: 7px; border-radius: 50%; background: var(--accent); flex: none; }
.pill-dot::after {
  content: ""; position: absolute; inset: -3px; border-radius: 50%;
  border: 1px solid var(--accent); animation: dl-ping 2.6s var(--ease) infinite;
}
@keyframes dl-ping { from { transform: scale(.55); opacity: .9; } to { transform: scale(2.2); opacity: 0; } }

/* ---------------------------------------------------------------------------
   스크롤 진행 바 (헤더 밑단). scroll 이벤트 없이 네이티브 타임라인으로만 움직인다.
   미지원 브라우저에서는 scaleX(0) 이라 그냥 안 보인다(레이아웃 영향 없음).
   --------------------------------------------------------------------------- */
.hd-prog {
  position: absolute; left: 0; right: 0; bottom: -1px; height: 2px; z-index: 1;
  transform: scaleX(0); transform-origin: 0 50%;
  background: linear-gradient(90deg, var(--accent-deep), var(--accent-lite));
}
@supports (animation-timeline: scroll()) {
  .hd-prog { animation: dl-prog linear both; animation-timeline: scroll(root block); }
}
@keyframes dl-prog { from { transform: scaleX(0); } to { transform: scaleX(1); } }

/* ---------------------------------------------------------------------------
   스크롤 연동 (view timeline). 등장 1회는 .reveal 이고, 여기 있는 건
   스크롤 위치에 계속 붙어 움직이는 것들이다. 한 요소에 .reveal 과 .vw-* 를
   같이 붙이지 말 것(transform 을 서로 덮어쓴다).
   --------------------------------------------------------------------------- */
@supports (animation-timeline: view()) {
  /* 결과물 시트가 스크롤에 따라 천천히 올라온다 */
  .vw-para {
    animation: dl-para linear both;
    animation-timeline: view(); animation-range: cover 0% cover 100%;
  }
  @keyframes dl-para { from { transform: translateY(30px); } to { transform: translateY(-30px); } }

  /* 들어오면서 확대 */
  .vw-zoom {
    animation: dl-vwzoom linear both;
    animation-timeline: view(); animation-range: entry 6% cover 46%;
  }
  @keyframes dl-vwzoom {
    from { opacity: .55; transform: scale(.955) translateY(24px); }
    to { opacity: 1; transform: none; }
  }

  /* 지금 화면 가운데에 있는 항목만 밝다(스티키 텔링) */
  .vw-step {
    animation: dl-vwstep linear both;
    animation-timeline: view(); animation-range: cover 0% cover 100%;
  }
  @keyframes dl-vwstep {
    0% { opacity: .38; transform: translateY(10px); }
    34%, 66% { opacity: 1; transform: none; }
    100% { opacity: .38; transform: translateY(-10px); }
  }
}

/* 모션 축소 환경에서는 스크롤 연동을 아예 끈다.
   스크롤 타임라인은 animation-duration 을 쓰지 않아 위쪽 전역 규칙으로는 안 멈춘다. */
@media (prefers-reduced-motion: reduce) {
  .hd-prog { display: none; }
  .vw-para, .vw-zoom, .vw-step { animation: none !important; opacity: 1; transform: none; }
  .beam::before, .shimmer, .mq-row, .pill-dot::after { animation: none !important; }
  .shimmer { color: var(--accent); -webkit-text-fill-color: var(--accent); }
}

/* 스티키 헤더 때문에 #how 같은 앵커로 점프하면 제목이 헤더 밑에 가린다.
   id 가 붙은 요소 전부에 헤더 높이만큼 여백을 준다. */
[id] { scroll-margin-top: calc(var(--header-h) + 24px); }
