/* ════════════════════════════════════════════════════════════
   KidOS · Design Tokens + Shared Components
   ────────────────────────────────────────────────────────────
   G (Rainbow Playful) 시안을 기반으로 한 통합 디자인 시스템.
   모든 고객 대면 화면(키오스크 · 고객 웹)은 이 파일을 로드.

   사용법:
     <link rel="stylesheet" href="/frontend/tokens.css"/>

   토큰만 쓰고 싶으면 var(--g-green) 같이 참조.
   공용 컴포넌트가 필요하면 .g-btn-fill / .g-sticker-card 등
   "g-" 프리픽스 클래스 사용 (기존 클래스와 충돌 방지).
   ════════════════════════════════════════════════════════════ */

/* ── ① 디자인 토큰 ────────────────────────────────────── */
:root {
  /* Brand Rainbow (6색 + 1 red warning) */
  --g-green:   #2d8c3e;
  --g-blue:    #1a9cb8;
  --g-orange:  #e07820;
  --g-yellow:  #d4a800;
  --g-purple:  #7b35c9;
  --g-pink:    #c975c0;
  --g-red:     #c0392b;

  /* Neutrals */
  --g-dark:    #1a1a1a;
  --g-cream:   #fffdf5;       /* primary bg */
  --g-light:   #f5f0e6;       /* secondary bg (지붕·띠 등) */
  --g-border:  #e0d8ca;       /* subtle border */
  --g-muted:   #666;
  --g-muted-2: #999;

  /* Radii */
  --g-r-sm:    14px;
  --g-r-md:    24px;
  --g-r-lg:    40px;
  --g-r-pill:  100px;

  /* Hard border (signature) */
  --g-bw:      2.5px;          /* border width */
  --g-bw-thin: 2px;
  --g-stroke:  var(--g-bw) solid var(--g-dark);

  /* Sticker shadows (offset, no blur) */
  --g-sh-0:    0 0 0 var(--g-dark);
  --g-sh-2:    2px 2px 0 var(--g-dark);
  --g-sh-4:    4px 4px 0 var(--g-dark);
  --g-sh-6:    6px 6px 0 var(--g-dark);
  --g-sh-8:    8px 8px 0 var(--g-dark);

  /* Soft shadows (nav scroll, modals) */
  --g-shadow-soft: 0 4px 20px rgba(0,0,0,0.08);
  --g-shadow-lift: 0 8px 24px rgba(0,0,0,0.18);

  /* Typography */
  --g-font-body:    'Nunito', system-ui, -apple-system, sans-serif;
  --g-font-hand:    'Caveat', cursive;
  --g-fs-h1:        clamp(2.6rem, 5vw, 4.6rem);
  --g-fs-h2:        clamp(2rem, 4vw, 3.2rem);
  --g-fs-h3:        clamp(1.4rem, 2.4vw, 1.9rem);
  --g-fs-lead:      1.05rem;
  --g-fs-body:      0.975rem;
  --g-fs-sm:        0.85rem;
  --g-fs-xs:        0.72rem;
  --g-lh-tight:     1.05;
  --g-lh-normal:    1.55;
  --g-lh-relaxed:   1.75;

  /* Transitions */
  --g-ease-bounce:  cubic-bezier(0.34, 1.56, 0.64, 1);
  --g-ease-smooth:  cubic-bezier(0.2, 0.8, 0.2, 1);
  --g-dur-fast:     0.15s;
  --g-dur-base:     0.2s;
  --g-dur-slow:     0.5s;

  /* Layout */
  --g-nav-h:        68px;
  --g-pad-section:  96px;     /* desktop */
  --g-pad-edge:     72px;     /* desktop */
}

/* ── ② 최소 reset + 기본값 ─────────────────────────────── */
.g-reset, .g-reset *, .g-reset *::before, .g-reset *::after {
  box-sizing: border-box;
}
.g-body {
  font-family: var(--g-font-body);
  background: var(--g-cream);
  color: var(--g-dark);
  -webkit-font-smoothing: antialiased;
  line-height: var(--g-lh-normal);
}

/* ── ③ Keyframes (공용 애니메이션) ──────────────────────── */
@keyframes g-rise {
  from { opacity: 0; transform: translateY(28px) scale(0.97); }
  to   { opacity: 1; transform: translateY(0) scale(1); }
}
@keyframes g-blob-float {
  0%,100% { transform: translate(0,0) rotate(0); }
  33%     { transform: translate(10px,-14px) rotate(3deg); }
  66%     { transform: translate(-8px,8px) rotate(-2deg); }
}
@keyframes g-badge-spin {
  from { transform: rotate(0); }
  to   { transform: rotate(360deg); }
}
@keyframes g-ticker {
  from { transform: translateX(0); }
  to   { transform: translateX(-50%); }
}
@keyframes g-pulse {
  0%,100% { transform: scale(1); opacity: 1; }
  50%     { transform: scale(1.12); opacity: 0.8; }
}
@keyframes g-wobble {
  0%,100% { transform: rotate(-0.6deg); }
  50%     { transform: rotate(0.8deg); }
}

/* ── ④ 유틸리티 애니메이션 클래스 ───────────────────────── */
.g-rise      { animation: g-rise 0.8s var(--g-ease-bounce) forwards; opacity: 0; }
.g-rise-1    { animation-delay: 0.05s; }
.g-rise-2    { animation-delay: 0.15s; }
.g-rise-3    { animation-delay: 0.25s; }
.g-rise-4    { animation-delay: 0.35s; }
.g-rise-5    { animation-delay: 0.45s; }
.g-wobble    { animation: g-wobble 5.5s ease-in-out infinite; transform-origin: center; }
.g-spin      { animation: g-badge-spin 12s linear infinite; }
.g-spin-rev  { animation: g-badge-spin 12s linear infinite reverse; }
.g-pulse     { animation: g-pulse 2s ease-in-out infinite; }

.g-fade-in   { opacity: 0; transform: translateY(24px); transition: opacity 0.7s ease, transform 0.7s ease; }
.g-fade-in.visible { opacity: 1; transform: none; }

/* ── ⑤ 공용 컴포넌트: 버튼 ──────────────────────────────── */
.g-btn {
  font-family: var(--g-font-body);
  font-size: 0.925rem;
  font-weight: 800;
  padding: 14px 28px;
  border-radius: var(--g-r-pill);
  border: var(--g-bw) solid var(--g-dark);
  cursor: pointer;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  transition: all var(--g-dur-base) var(--g-ease-bounce);
  white-space: nowrap;
  line-height: 1.2;
}
.g-btn-fill    { background: var(--g-dark); color: #fff; }
.g-btn-fill:hover:not(:disabled) {
  background: var(--g-purple);
  border-color: var(--g-purple);
  transform: translateY(-3px);
  box-shadow: 0 8px 24px rgba(123,53,201,0.3);
}
.g-btn-outline { background: transparent; color: var(--g-dark); }
.g-btn-outline:hover:not(:disabled) {
  background: var(--g-yellow);
  border-color: var(--g-yellow);
  transform: translateY(-3px);
}

/* Color variants (bg = 채움, border = darken) */
.g-btn-green  { background: var(--g-green);  color: #fff; border-color: var(--g-dark); }
.g-btn-blue   { background: var(--g-blue);   color: #fff; }
.g-btn-orange { background: var(--g-orange); color: #fff; }
.g-btn-yellow { background: var(--g-yellow); color: var(--g-dark); }
.g-btn-purple { background: var(--g-purple); color: #fff; }
.g-btn-white  { background: #fff; color: var(--g-dark); }

.g-btn:hover:not(:disabled) { transform: translateY(-3px); }
.g-btn:active:not(:disabled){ transform: translateY(0); box-shadow: var(--g-sh-2); }
.g-btn:disabled             { opacity: 0.4; cursor: not-allowed; }
.g-btn.lg                   { padding: 18px 36px; font-size: 1rem; }
.g-btn.xl                   { padding: 22px 44px; font-size: 1.08rem; }
.g-btn.sm                   { padding: 10px 20px; font-size: 0.82rem; }

/* ── ⑥ Sticker Card (카드 + hover lift) ─────────────────── */
.g-sticker {
  background: #fff;
  border: var(--g-stroke);
  border-radius: var(--g-r-sm);
  padding: 20px 24px;
  transition: transform var(--g-dur-base) var(--g-ease-bounce),
              box-shadow var(--g-dur-base);
}
.g-sticker:hover { transform: translate(-2px, -2px); box-shadow: var(--g-sh-4); }
.g-sticker.md    { padding: 24px 28px; border-radius: var(--g-r-md); }
.g-sticker.lg    { padding: 32px 40px; border-radius: var(--g-r-lg); }
.g-sticker.flat  { background: var(--g-cream); }

/* ── ⑦ Pill 태그 ────────────────────────────────────────── */
.g-pill {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 6px 14px;
  border-radius: var(--g-r-pill);
  font-size: var(--g-fs-xs);
  font-weight: 800;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  background: var(--g-dark);
  color: #fff;
}
.g-pill-green  { background: var(--g-green);  color: #fff; }
.g-pill-blue   { background: var(--g-blue);   color: #fff; }
.g-pill-orange { background: var(--g-orange); color: #fff; }
.g-pill-yellow { background: var(--g-yellow); color: var(--g-dark); }
.g-pill-purple { background: var(--g-purple); color: #fff; }
.g-pill-outline{ background: transparent; border: var(--g-bw-thin) solid var(--g-dark); color: var(--g-dark); }

/* ── ⑧ Eyebrow / Label (손글씨 악센트) ──────────────────── */
.g-eyebrow {
  font-family: var(--g-font-hand);
  font-size: 1.3rem;
  font-weight: 700;
  display: inline-block;
}

/* ── ⑨ Blob 장식 (hero 배경용) ──────────────────────────── */
.g-blob {
  position: absolute;
  pointer-events: none;
  border-radius: 62% 38% 44% 56% / 54% 48% 52% 46%;
  animation: g-blob-float 8s ease-in-out infinite;
}
.g-blob.b2 { border-radius: 40% 60% 60% 40% / 60% 40% 60% 40%; animation-duration: 10s; animation-direction: reverse; }
.g-blob.yellow { background: var(--g-yellow); opacity: 0.25; }
.g-blob.pink   { background: var(--g-pink);   opacity: 0.20; }
.g-blob.blue   { background: var(--g-blue);   opacity: 0.18; }
.g-blob.green  { background: var(--g-green);  opacity: 0.18; }
.g-blob.purple { background: var(--g-purple); opacity: 0.18; }

/* ── ⑩ Rotating badge (히어로 원형 라벨) ─────────────────── */
.g-badge-circle {
  position: absolute;
  width: 100px; height: 100px;
  border: 3px solid var(--g-dark);
  border-radius: 50%;
  background: var(--g-yellow);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  font-family: var(--g-font-hand);
  font-size: 1.1rem;
  font-weight: 700;
  line-height: 1.2;
  text-align: center;
  color: var(--g-dark);
  box-shadow: var(--g-sh-4);
  animation: g-badge-spin 12s linear infinite;
}
.g-badge-circle > span { display: block; animation: g-badge-spin 12s linear infinite reverse; }

/* ── ⑪ Ticker bar ──────────────────────────────────────── */
.g-ticker-wrap {
  background: var(--g-dark);
  border-top: var(--g-stroke);
  border-bottom: var(--g-stroke);
  overflow: hidden;
  padding: 12px 0;
}
.g-ticker-inner {
  display: flex;
  animation: g-ticker 22s linear infinite;
  white-space: nowrap;
}
.g-ticker-item {
  display: inline-flex;
  align-items: center;
  gap: 16px;
  font-family: var(--g-font-hand);
  font-size: 1.3rem;
  font-weight: 700;
  color: #fff;
  padding: 0 32px;
}
.g-ticker-dot { width: 8px; height: 8px; border-radius: 50%; flex-shrink: 0; }

/* ── ⑫ 입력 필드 ───────────────────────────────────────── */
.g-input,
.g-select,
.g-textarea {
  font-family: var(--g-font-body);
  font-size: 1rem;
  font-weight: 600;
  padding: 14px 18px;
  border: var(--g-stroke);
  border-radius: var(--g-r-sm);
  background: #fff;
  color: var(--g-dark);
  outline: none;
  transition: box-shadow var(--g-dur-fast), transform var(--g-dur-fast);
  width: 100%;
}
.g-input:focus,
.g-select:focus,
.g-textarea:focus { box-shadow: var(--g-sh-2); transform: translate(-1px,-1px); }
.g-textarea { resize: vertical; min-height: 90px; line-height: var(--g-lh-normal); }

/* ── ⑬ 상단 내비게이션 바 (키오스크·웹 공용) ──────────────── */
.g-nav {
  position: fixed;
  top: 0; left: 0; right: 0;
  z-index: 100;
  height: var(--g-nav-h);
  display: flex;
  align-items: center;
  padding: 0 40px;
  background: var(--g-cream);
  border-bottom: var(--g-stroke);
  transition: box-shadow var(--g-dur-slow);
}
.g-nav.scrolled { box-shadow: var(--g-shadow-soft); }
.g-nav-logo { display: flex; align-items: center; text-decoration: none; flex-shrink: 0; color: inherit; }
.g-nav-logo img { height: 38px; width: auto; display: block; }
.g-nav-spacer { flex: 1; }
.g-nav-links { display: flex; align-items: center; gap: 4px; list-style: none; }
.g-nav-links a {
  font-size: 0.875rem;
  font-weight: 700;
  padding: 8px 16px;
  border-radius: var(--g-r-pill);
  color: var(--g-dark);
  text-decoration: none;
  transition: background var(--g-dur-fast), color var(--g-dur-fast);
}
.g-nav-links a:hover { background: var(--g-yellow); color: var(--g-dark); }
.g-nav-links a.cta { background: var(--g-dark); color: var(--g-cream); margin-left: 8px; }
.g-nav-links a.cta:hover { background: var(--g-green); color: #fff; }

/* ── ⑭ 섹션 라벨 ───────────────────────────────────────── */
.g-section-label {
  font-family: var(--g-font-hand);
  font-size: 1.3rem;
  font-weight: 700;
  margin-bottom: 12px;
}
.g-section-title {
  font-size: var(--g-fs-h2);
  font-weight: 900;
  line-height: var(--g-lh-tight);
  letter-spacing: -0.02em;
}

/* ── ⑮ 행 블록 (info row / stats) ─────────────────────── */
.g-info-row {
  display: grid;
  grid-template-columns: repeat(var(--cols, 4), 1fr);
  border-top: var(--g-stroke);
  border-bottom: var(--g-stroke);
}
.g-info-cell {
  padding: 28px 32px;
  border-right: var(--g-stroke);
}
.g-info-cell:last-child { border-right: none; }
.g-info-cell .g-info-label {
  font-size: var(--g-fs-xs);
  font-weight: 800;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  opacity: 0.6;
  margin-bottom: 8px;
}
.g-info-cell .g-info-value { font-size: 1.05rem; font-weight: 800; line-height: 1.3; }
.g-info-cell.green  { background: var(--g-green);  color: #fff; }
.g-info-cell.blue   { background: var(--g-blue);   color: #fff; }
.g-info-cell.orange { background: var(--g-orange); color: #fff; }
.g-info-cell.yellow { background: var(--g-yellow); color: var(--g-dark); }

/* ── ⑯ Toast (공용 알림) ───────────────────────────────── */
.g-toast {
  position: fixed;
  bottom: 20px; left: 50%;
  transform: translateX(-50%) translateY(80px);
  background: var(--g-dark);
  color: #fff;
  font-size: 0.88rem;
  font-weight: 800;
  padding: 12px 22px;
  border-radius: var(--g-r-pill);
  border: var(--g-stroke);
  box-shadow: var(--g-sh-4);
  transition: transform 0.3s var(--g-ease-bounce);
  pointer-events: none;
  white-space: nowrap;
  z-index: 999;
}
.g-toast.show    { transform: translateX(-50%) translateY(0); }
.g-toast.success { background: var(--g-green); }
.g-toast.error   { background: var(--g-red); color: #fff; }
.g-toast.warning { background: var(--g-yellow); color: var(--g-dark); }

/* ── ⑰ Modal backdrop ──────────────────────────────────── */
.g-modal-bd {
  position: fixed; inset: 0;
  background: rgba(26,26,26,0.6);
  backdrop-filter: blur(6px);
  display: none;
  align-items: center;
  justify-content: center;
  padding: 24px;
  z-index: 200;
}
.g-modal-bd.show { display: flex; }
.g-modal-panel {
  background: var(--g-cream);
  border: var(--g-stroke);
  border-radius: var(--g-r-md);
  box-shadow: var(--g-sh-8);
  width: 100%;
  max-width: 560px;
  max-height: 90vh;
  overflow-y: auto;
}

/* ── ⑱ 로고 placeholder (로고 확정 전까지) ─────────────── */
.g-logo-placeholder {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  font-family: var(--g-font-body);
  font-size: 1.2rem;
  font-weight: 900;
  color: var(--g-dark);
  text-decoration: none;
  letter-spacing: -0.02em;
}
.g-logo-placeholder::before {
  content: '';
  width: 34px; height: 34px;
  border-radius: 50%;
  background: conic-gradient(from 45deg,
    var(--g-green), var(--g-blue), var(--g-purple),
    var(--g-pink), var(--g-orange), var(--g-yellow), var(--g-green));
  border: 2.5px solid var(--g-dark);
  flex-shrink: 0;
}

/* ── ⑲ Step indicator (키오스크 progress) ─────────────── */
.g-steps { display: flex; align-items: center; gap: 8px; }
.g-step  { width: 32px; height: 6px; border-radius: var(--g-r-pill); background: var(--g-border); transition: background var(--g-dur-slow); }
.g-step.done   { background: var(--g-green); }
.g-step.active { background: var(--g-purple); animation: g-pulse 1.8s ease-in-out infinite; }

/* ── ⑳ Focus ring (키오스크 터치 UI 가독성) ────────────── */
.g-focus-ring:focus-visible {
  outline: 3px solid var(--g-purple);
  outline-offset: 3px;
}

/* ── ㉑ 반응형 브레이크 ─────────────────────────────────── */
@media (max-width: 900px) {
  :root {
    --g-pad-section: 64px;
    --g-pad-edge:    24px;
  }
  .g-nav { padding: 0 20px; }
  .g-nav-links { display: none; }
  .g-info-row { grid-template-columns: repeat(2, 1fr); }
  .g-info-cell:nth-child(2n) { border-right: none; }
}
