/* ==========================================================================
   Tiko Pay Base — 사이트 공용 셸
   · 디자인 언어: 다크 #131313 + 라임 #c3ff17, Pretendard, r24
   · 토큰 / 리셋 / 버튼 / 데스크톱 헤더 / 모바일 앱바·탭바 / 푸터 / 플래시 / 리빌
   · 랜딩(landing.css)과 인증(auth.css)이 이 파일 위에 얹힌다.
   ========================================================================== */

/* --------------------------------------------------------------- tokens -- */
:root {
  --ink:        #131313;
  --ink-2:      #171717;
  --ink-3:      #1c1c1c;
  --surface:    #242424;
  --line:       rgba(255, 255, 255, 0.10);
  --line-2:     rgba(255, 255, 255, 0.16);

  --lime:       #c3ff17;
  --lime-dim:   #a8e000;
  --blue:       #0099ff;

  --paper:      #fafafa;
  --paper-2:    #f5f5f5;
  --paper-3:    #ececec;
  --paper-line: #dedede;

  --t-hi:       #ffffff;
  --t-mid:      #dedede;
  --t-low:      #a4a4a4;
  --t-dim:      #5f5f5f;

  --on-paper-hi:  #131313;
  --on-paper-mid: #444444;
  --on-paper-low: #888888;

  --r-lg: 24px;
  --r-md: 20px;
  --r-sm: 16px;
  --r-xs: 12px;
  --r-pill: 999px;

  --header-h: 72px;
  --appbar-h: 56px;
  --tabbar-h: 62px;
  --wrap: min(1180px, calc(100% - 48px));

  --ease: cubic-bezier(0.22, 1, 0.36, 1);
  --safe-b: env(safe-area-inset-bottom, 0px);
  --safe-t: env(safe-area-inset-top, 0px);
}

/* ---------------------------------------------------------------- reset -- */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html {
  scroll-behavior: smooth;
  scroll-padding-top: calc(var(--header-h) + 16px);
  -webkit-text-size-adjust: 100%;
}

body {
  font-family: 'Pretendard Variable', Pretendard, -apple-system, BlinkMacSystemFont,
               system-ui, 'Segoe UI', Roboto, 'Helvetica Neue', sans-serif;
  background: var(--ink);
  color: var(--t-hi);
  line-height: 1.55;
  letter-spacing: -0.018em;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  overscroll-behavior-y: none;
}

a { color: inherit; text-decoration: none; }
ul, ol { list-style: none; }
img, svg { display: block; max-width: 100%; }
button { font: inherit; color: inherit; background: none; border: 0; cursor: pointer; }

.wrap { width: var(--wrap); margin-inline: auto; }
.sr-only {
  position: absolute; width: 1px; height: 1px; padding: 0; overflow: hidden;
  clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}

/* -------------------------------------------------------------- buttons -- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  height: 56px; padding: 0 30px;
  border-radius: var(--r-pill);
  font-size: 1rem; font-weight: 600; letter-spacing: -0.02em;
  white-space: nowrap;
  transition: transform 0.24s var(--ease), background 0.2s, color 0.2s, border-color 0.2s;
}
.btn--lime { background: var(--lime); color: var(--ink); }
.btn--lime:hover { background: #d3ff4d; transform: translateY(-2px); }
.btn--ink { background: var(--ink); color: var(--t-hi); }
.btn--ink:hover { background: #2a2a2a; transform: translateY(-2px); }
.btn--ghost { border: 1px solid var(--line-2); color: var(--t-hi); }
.btn--ghost:hover { background: rgba(255, 255, 255, 0.06); border-color: rgba(255, 255, 255, 0.3); }
.btn--sm { height: 42px; padding: 0 18px; font-size: 0.875rem; }
.btn--lg { height: 62px; padding: 0 38px; font-size: 1.0625rem; }
.btn--block { width: 100%; }
.btn:active { transform: scale(0.97); }

.btn__arrow {
  display: inline-flex; align-items: center; justify-content: center;
  width: 22px; height: 22px; transition: transform 0.24s var(--ease);
}
.btn:hover .btn__arrow { transform: translateX(3px); }

/* --------------------------------------------------- desktop site header -- */
.lp-header {
  position: fixed; inset: 0 0 auto 0; z-index: 90;
  height: var(--header-h);
  transition: background 0.3s, border-color 0.3s, backdrop-filter 0.3s;
  border-bottom: 1px solid transparent;
}
.lp-header.is-stuck {
  background: rgba(19, 19, 19, 0.72);
  backdrop-filter: blur(20px) saturate(160%);
  -webkit-backdrop-filter: blur(20px) saturate(160%);
  border-bottom-color: var(--line);
}
.lp-header__inner {
  display: flex; align-items: center; gap: 32px; height: 100%;
}

.lp-logo { display: inline-flex; align-items: center; gap: 9px; flex: none; }
.lp-logo__mark {
  width: 30px; height: 30px; border-radius: 9px;
  background: var(--lime); color: var(--ink);
  display: grid; place-items: center;
  font-size: 1.0625rem; font-weight: 800; line-height: 1;
}
.lp-logo__text { font-size: 1.1875rem; font-weight: 700; letter-spacing: -0.03em; }

.lp-nav { display: flex; align-items: center; gap: 30px; margin-right: auto; }
.lp-nav a {
  position: relative; font-size: 0.9375rem; font-weight: 500;
  color: var(--t-low); transition: color 0.2s;
}
.lp-nav a::after {
  content: ''; position: absolute; left: 0; right: 100%; bottom: -6px;
  height: 2px; background: var(--lime); transition: right 0.3s var(--ease);
}
.lp-nav a:hover { color: var(--t-hi); }
.lp-nav a:hover::after { right: 0; }

.lp-header__actions { display: flex; align-items: center; gap: 10px; flex: none; }
.lp-header__user {
  font-size: 0.8125rem; color: var(--t-dim);
  max-width: 150px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.lp-header__link { font-size: 0.875rem; font-weight: 500; color: var(--t-low); transition: color 0.2s; }
.lp-header__link:hover { color: var(--lime); }
.logout-form { display: inline; }

/* --------------------------------------------------- mobile app chrome ---- */
.appbar, .tabbar { display: none; }

.appbar {
  position: fixed; inset: 0 0 auto 0; z-index: 95;
  padding-top: var(--safe-t);
  background: rgba(19, 19, 19, 0.82);
  backdrop-filter: blur(24px) saturate(180%);
  -webkit-backdrop-filter: blur(24px) saturate(180%);
  border-bottom: 1px solid transparent;
  transition: transform 0.32s var(--ease), border-color 0.3s, background 0.3s;
}
.appbar.is-stuck { border-bottom-color: var(--line); }
.appbar.is-hidden { transform: translateY(calc(-100% - 1px)); }
.appbar__inner {
  height: var(--appbar-h);
  display: flex; align-items: center; gap: 10px;
  padding-inline: 18px;
}
.appbar__title { display: flex; align-items: center; gap: 8px; margin-right: auto; }
.appbar__spacer { flex: 1; }
.appbar__icon {
  width: 38px; height: 38px; border-radius: var(--r-pill);
  display: grid; place-items: center;
  background: rgba(255, 255, 255, 0.07);
  transition: background 0.2s, transform 0.2s var(--ease);
}
.appbar__icon:active { transform: scale(0.9); background: rgba(255, 255, 255, 0.14); }
.appbar__icon svg { width: 19px; height: 19px; }
/* 뒤로가기 + 화면 제목 (인증·대시보드 앱바 공용) */
.appbar__back {
  flex: none;
  width: 38px; height: 38px; margin-left: -8px; border-radius: var(--r-pill);
  display: grid; place-items: center;
  transition: background 0.2s, transform 0.2s var(--ease);
}
.appbar__back:active { transform: scale(0.9); background: rgba(255, 255, 255, 0.12); }
.appbar__back svg { width: 22px; height: 22px; }
.appbar__heading {
  font-size: 1rem; font-weight: 700; letter-spacing: -0.03em;
  margin-right: auto; min-width: 0;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}

.appbar__cta {
  height: 36px; padding: 0 15px; border-radius: var(--r-pill);
  background: var(--lime); color: var(--ink);
  font-size: 0.8125rem; font-weight: 700;
  display: inline-flex; align-items: center;
  transition: transform 0.2s var(--ease);
}
.appbar__cta:active { transform: scale(0.94); }

.tabbar {
  position: fixed; inset: auto 0 0 0; z-index: 95;
  padding-bottom: var(--safe-b);
  background: rgba(19, 19, 19, 0.86);
  backdrop-filter: blur(26px) saturate(180%);
  -webkit-backdrop-filter: blur(26px) saturate(180%);
  border-top: 1px solid var(--line);
}
.tabbar__inner {
  height: var(--tabbar-h);
  /* 탭 개수가 화면마다 다르다 (랜딩 4개 · 내 적립 5개).
     칸 수를 고정하면 초과분이 다음 줄로 밀리므로 개수에 맞춰 자동으로 나눈다. */
  display: grid; grid-auto-flow: column; grid-auto-columns: 1fr;
}
.tabbar__item {
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px;
  min-width: 0;
  color: var(--t-dim); font-size: 0.6875rem; font-weight: 500; letter-spacing: -0.01em;
  transition: color 0.2s;
  -webkit-tap-highlight-color: transparent;
}
.tabbar__item span { white-space: nowrap; }
.tabbar__item svg { width: 23px; height: 23px; transition: transform 0.28s var(--ease); }
.tabbar__item:active svg { transform: scale(0.85); }
.tabbar__item.is-active { color: var(--lime); }
.tabbar__item.is-active svg { transform: translateY(-1px); }

/* 5개 탭 + 좁은 단말(360px 안팎)에서 글자가 잘리지 않도록 한 단계 줄인다 */
@media (max-width: 380px) {
  .tabbar__item { font-size: 0.625rem; gap: 2px; }
  .tabbar__item svg { width: 21px; height: 21px; }
}

/* -------------------------------------------------------------- footer --- */
.lp-footer {
  background: #0d0d0d; border-top: 1px solid var(--line);
  padding: 66px 0 40px;
}
.lp-footer__grid {
  display: grid; grid-template-columns: 1.6fr repeat(3, 1fr); gap: 48px;
  padding-bottom: 44px; border-bottom: 1px solid var(--line);
}
.lp-footer__brand .lp-logo { margin-bottom: 20px; }
.lp-footer__company { font-size: 0.9375rem; font-weight: 700; margin-bottom: 12px; }
.lp-footer__lines { font-size: 0.8125rem; line-height: 1.9; color: var(--t-dim); }
.lp-footer__col h4 {
  font-size: 0.8125rem; font-weight: 700; color: var(--t-low);
  letter-spacing: 0.04em; margin-bottom: 16px; text-transform: uppercase;
}
.lp-footer__col a {
  display: block; font-size: 0.875rem; color: var(--t-dim);
  padding: 5px 0; transition: color 0.2s;
}
.lp-footer__col a:hover { color: var(--lime); }
.lp-footer__copy {
  padding-top: 26px;
  display: flex; align-items: center; justify-content: space-between; gap: 16px; flex-wrap: wrap;
  font-size: 0.75rem; color: var(--t-dim);
}

/* ------------------------------------------------------- flash messages -- */
.flash-messages {
  position: fixed; z-index: 120; top: calc(var(--header-h) + 12px); left: 50%;
  transform: translateX(-50%); width: min(560px, calc(100% - 32px));
  display: grid; gap: 8px;
}
.flash-message {
  padding: 13px 18px; border-radius: var(--r-xs);
  background: var(--surface); border: 1px solid var(--line);
  font-size: 0.875rem; box-shadow: 0 14px 34px rgba(0, 0, 0, 0.45);
}
.flash-message--success { border-color: rgba(195, 255, 23, 0.45); color: var(--lime); }
.flash-message--error { border-color: rgba(255, 92, 92, 0.5); color: #ff8f8f; }

/* ------------------------------------------------------ scroll reveal ----
   .js 게이트: 스크립트가 죽거나 꺼져 있으면 콘텐츠가 통째로 사라지면 안 된다. */
.js [data-reveal] {
  opacity: 0; transform: translateY(24px);
  transition: opacity 0.7s var(--ease), transform 0.7s var(--ease);
  transition-delay: var(--reveal-delay, 0ms);
}
.js [data-reveal].is-in { opacity: 1; transform: none; }

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .js [data-reveal] { opacity: 1; transform: none; transition: none; }
}

/* ==========================================================================
   Responsive — 셸
   ========================================================================== */
@media (max-width: 1080px) {
  :root { --wrap: min(1180px, calc(100% - 40px)); }
  .lp-footer__grid { grid-template-columns: 1fr 1fr; gap: 36px; }
}

/* 데스크톱 헤더가 물러나는 지점(900px)과 앱 셸이 켜지는 지점을 일치시킨다.
   어긋나면 그 사이 폭에서 내비게이션이 통째로 사라진다. */
@media (max-width: 900px) {
  :root {
    --wrap: calc(100% - 36px);
    --r-lg: 20px;
    --r-md: 18px;
  }

  html { scroll-padding-top: calc(var(--appbar-h) + 12px); }

  body {
    /* 앱처럼: 텍스트 드래그 선택·탭 하이라이트·바운스 제거 */
    -webkit-tap-highlight-color: transparent;
    -webkit-touch-callout: none;
    user-select: none;
    -webkit-user-select: none;
    overscroll-behavior: none;
    padding-bottom: calc(var(--tabbar-h) + var(--safe-b));
  }
  /* 본문 카피·입력값은 선택 가능하게 되돌린다 */
  p, h1, h2, h3, h4, li, dd, dt, label, input, textarea {
    user-select: text; -webkit-user-select: text;
  }

  .lp-header { display: none; }
  .appbar { display: block; }
  .tabbar { display: block; }

  .btn--lg { height: 58px; font-size: 1.0625rem; }

  .lp-footer { padding: 44px 0 28px; }
  .lp-footer__grid { grid-template-columns: 1fr; gap: 28px; padding-bottom: 28px; }
  .lp-footer__copy { flex-direction: column; align-items: flex-start; gap: 8px; }

  .flash-messages { top: calc(var(--appbar-h) + var(--safe-t) + 10px); }
}

@media (min-width: 600px) and (max-width: 900px) {
  :root { --wrap: calc(100% - 48px); }
  .lp-footer__grid { grid-template-columns: 1.4fr repeat(3, 1fr); }
}

/* 스탠드얼론(홈화면에서 실행)일 때만 적용되는 미세 조정 */
@media (display-mode: standalone) {
  .appbar { background: rgba(19, 19, 19, 0.94); }
  .install-hint { display: none !important; }
}
