/* Daily F&I — shared global styles */

html { scroll-behavior: smooth; -webkit-tap-highlight-color: transparent; }

body {
  font-family: 'Pretendard', system-ui, -apple-system, BlinkMacSystemFont, sans-serif;
  font-feature-settings: "ss01", "ss02", "case", "tnum";
  background-color: #262b4d; /* Brand navy */
  color: #e5e7eb;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* Korean typography baseline */
.ko { word-break: keep-all; line-break: strict; overflow-wrap: break-word; }

/* Selection */
::selection { background: #2777b0; color: #ffffff; }

/* Subtle grain overlay (fixed, performance-safe) */
.grain {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 60;
  opacity: 0.06;
  mix-blend-mode: overlay;
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='160' height='160'><filter id='n'><feTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='2' stitchTiles='stitch'/><feColorMatrix type='saturate' values='0'/></filter><rect width='100%25' height='100%25' filter='url(%23n)'/></svg>");
}

/* Ambient gradient mesh background (brand tints) */
.mesh-bg {
  position: absolute;
  inset: 0;
  pointer-events: none;
  z-index: 0;
  background:
    radial-gradient(900px 600px at 12% 8%,  rgba(39,119,176,0.22), transparent 60%),
    radial-gradient(700px 500px at 88% 18%, rgba(108,165,202,0.10), transparent 60%),
    radial-gradient(800px 600px at 50% 92%, rgba(39,119,176,0.14), transparent 60%);
}

/* Liquid glass surface */
.glass {
  background: rgba(255,255,255,0.04);
  backdrop-filter: blur(18px) saturate(140%);
  -webkit-backdrop-filter: blur(18px) saturate(140%);
  border: 1px solid rgba(255,255,255,0.08);
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.10), 0 30px 80px -40px rgba(0,0,0,0.6);
}

/* Magnetic CTA */
.btn-magnet {
  transition: transform 0.4s cubic-bezier(0.16, 1, 0.3, 1),
              box-shadow 0.4s cubic-bezier(0.16, 1, 0.3, 1),
              background-color 0.3s ease;
  will-change: transform;
}
.btn-magnet:hover  { transform: translateY(-2px) scale(1.02); }
.btn-magnet:active { transform: translateY(0) scale(0.98); }
.btn-magnet .arrow { transition: transform 0.4s cubic-bezier(0.16, 1, 0.3, 1); }
.btn-magnet:hover .arrow { transform: translateX(4px); }

/* Reveal on scroll (IntersectionObserver hooks) */
.reveal { opacity: 0; transform: translateY(1.5rem); transition: opacity 0.9s cubic-bezier(0.16,1,0.3,1), transform 0.9s cubic-bezier(0.16,1,0.3,1); }
.reveal.is-in { opacity: 1; transform: translateY(0); }

/* Letter fly-in (right → target, reading-order stagger) */
.lf-char {
  display: inline-block;
  transform: translateX(0.6em);
  opacity: 0;
  transition:
    transform 0.7s cubic-bezier(0.16, 1, 0.3, 1),
    opacity 0.55s cubic-bezier(0.16, 1, 0.3, 1);
  will-change: transform, opacity;
}
[data-letter-fly].lf-active .lf-char {
  transform: translateX(0);
  opacity: 1;
}
[data-letter-fly] .brand-underline-bar {
  opacity: 0;
  transform: scaleX(0);
  transform-origin: left center;
  transition: opacity 0.6s ease, transform 0.7s cubic-bezier(0.16, 1, 0.3, 1);
}
[data-letter-fly].lf-active .brand-underline-bar {
  opacity: 1;
  transform: scaleX(1);
  transition-delay: 1.0s;
}

/* Card lift — hover raise + shadow + border accent */
.card-lift {
  transition:
    transform 0.45s cubic-bezier(0.16, 1, 0.3, 1),
    box-shadow 0.45s cubic-bezier(0.16, 1, 0.3, 1),
    border-color 0.4s ease,
    background-color 0.4s ease;
  will-change: transform;
}
.card-lift:hover {
  transform: translateY(-6px);
  border-color: rgba(108, 165, 202, 0.35);
  background-color: rgba(255, 255, 255, 0.04);
  box-shadow: 0 28px 70px -28px rgba(39, 119, 176, 0.55), inset 0 1px 0 rgba(255, 255, 255, 0.06);
}

/* Card icon chip — rotates + scales on parent card hover */
.card-icon {
  transition: transform 0.6s cubic-bezier(0.16, 1, 0.3, 1);
}
.card-lift:hover .card-icon {
  transform: rotate(6deg) scale(1.1);
}

/* Notice tabs */
.notice-tab {
  color: rgb(161 161 170); /* zinc-400 */
}
.notice-tab:hover {
  color: #ffffff;
  background-color: rgba(255, 255, 255, 0.05);
}
.notice-tab.is-active {
  color: #ffffff;
  background-color: rgba(255, 255, 255, 0.10);
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.15);
}

/* Pin-scroll stepper — desktop only */
.step-item {
  transition:
    opacity 0.5s cubic-bezier(0.16, 1, 0.3, 1),
    transform 0.5s cubic-bezier(0.16, 1, 0.3, 1),
    border-color 0.5s ease,
    background-color 0.5s ease,
    box-shadow 0.5s ease;
}
@media (min-width: 1024px) {
  .step-item { opacity: 0.4; }
  .step-item.is-past { opacity: 0.65; }
  .step-item.is-active {
    opacity: 1;
    transform: translateY(-8px);
    border-color: rgba(108, 165, 202, 0.55) !important;
    background-color: rgba(39, 119, 176, 0.12) !important;
    box-shadow: 0 18px 50px -22px rgba(39, 119, 176, 0.55), inset 0 1px 0 rgba(255,255,255,0.08);
  }
}

/* Hide scrollbar for marquee strips */
.no-scrollbar::-webkit-scrollbar { display: none; }
.no-scrollbar { scrollbar-width: none; }

/* Document pages typography */
.doc h2 { color: #fff; font-weight: 700; font-size: 1.375rem; margin-top: 2.5rem; letter-spacing: -0.02em; }
.doc h3 { color: #fff; font-weight: 600; font-size: 1.0625rem; margin-top: 1.75rem; }
.doc p, .doc li { color: #a1a1aa; line-height: 1.8; font-size: 0.9375rem; }
.doc ul { list-style: disc; padding-left: 1.25rem; }
.doc ol { list-style: decimal; padding-left: 1.25rem; }
.doc strong { color: #fff; }

/* ==========================================================================
   Legal modal — 이용약관 / 전자금융거래 약관 뷰어 (read-only)
   Injected by layout.js as #termsModal. Brand tone: navy + glass + accent.
   ========================================================================== */
.legal-modal {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 1.5rem;
  opacity: 0;
  transition: opacity 0.32s cubic-bezier(0.16, 1, 0.3, 1);
}
.legal-modal.is-open {
  display: flex;
  opacity: 1;
}
.legal-modal__backdrop {
  position: absolute;
  inset: 0;
  background: radial-gradient(
    ellipse at center,
    rgba(15, 18, 36, 0.72) 0%,
    rgba(6, 8, 20, 0.88) 100%
  );
  backdrop-filter: blur(14px) saturate(160%);
  -webkit-backdrop-filter: blur(14px) saturate(160%);
  cursor: pointer;
}

/* ---------- Panel (glass surface with brand tint) ---------- */
.legal-modal__panel {
  position: relative;
  width: 100%;
  max-width: 960px;
  height: min(85vh, 920px);
  background:
    linear-gradient(180deg, rgba(39, 119, 176, 0.06) 0%, transparent 30%),
    rgba(26, 30, 58, 0.92);
  backdrop-filter: blur(24px) saturate(160%);
  -webkit-backdrop-filter: blur(24px) saturate(160%);
  border: 1px solid rgba(255, 255, 255, 0.10);
  border-radius: 1.5rem;
  box-shadow:
    0 50px 120px -30px rgba(0, 0, 0, 0.75),
    0 0 0 1px rgba(255, 255, 255, 0.04),
    inset 0 1px 0 rgba(255, 255, 255, 0.10);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  transform: translateY(20px) scale(0.975);
  transition: transform 0.5s cubic-bezier(0.16, 1, 0.3, 1);
}
.legal-modal.is-open .legal-modal__panel {
  transform: translateY(0) scale(1);
}

/* ---------- Header ---------- */
.legal-modal__header {
  flex: 0 0 auto;
  padding: 1.375rem 1.5rem 1.125rem;
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem;
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
}
.legal-modal__title-group {
  min-width: 0;
}
.legal-modal__eyebrow {
  font-size: 0.6875rem;
  font-weight: 600;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: rgba(108, 165, 202, 0.95);
  margin: 0 0 0.375rem 0;
}
.legal-modal__title {
  font-size: 1.375rem;
  font-weight: 700;
  color: #ffffff;
  margin: 0;
  letter-spacing: -0.025em;
  line-height: 1.2;
}
.legal-modal__close {
  flex: 0 0 auto;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 2.5rem;
  height: 2.5rem;
  border-radius: 0.75rem;
  color: #a1a1aa;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid rgba(255, 255, 255, 0.08);
  cursor: pointer;
  transition: color 0.25s ease, background-color 0.25s ease, border-color 0.25s ease, transform 0.25s ease;
}
.legal-modal__close:hover,
.legal-modal__close:focus-visible {
  color: #ffffff;
  background: rgba(255, 255, 255, 0.08);
  border-color: rgba(255, 255, 255, 0.18);
  transform: rotate(90deg);
  outline: none;
}

/* ---------- Body (scrollable text area) ---------- */
.legal-modal__body {
  position: relative;
  flex: 1 1 auto;
  overflow-y: auto;
  overflow-x: hidden;
  padding: 1.75rem 1.5rem 2rem;
  scrollbar-width: thin;
  scrollbar-color: rgba(255, 255, 255, 0.12) transparent;
  /* read-only: prevent selection */
  -webkit-user-select: none;
  -moz-user-select: none;
  -ms-user-select: none;
  user-select: none;
  -webkit-touch-callout: none;
  -webkit-user-drag: none;
}
.legal-modal__body::-webkit-scrollbar { width: 8px; }
.legal-modal__body::-webkit-scrollbar-track { background: transparent; }
.legal-modal__body::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.10);
  border-radius: 999px;
}
.legal-modal__body::-webkit-scrollbar-thumb:hover {
  background: rgba(255, 255, 255, 0.18);
}

/* ---------- States (loading / error) ---------- */
.legal-modal__state {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.875rem;
  padding: 2rem;
  text-align: center;
  color: #a1a1aa;
  font-size: 0.875rem;
  line-height: 1.6;
}
.legal-modal__state[hidden] { display: none; }
.legal-modal__state iconify-icon {
  color: #6ca5ca;
}

/* ---------- Article (the actual document content) ---------- */
.legal-modal__article[hidden] { display: none; }

.legal-modal__text {
  /* pre-wrap으로 줄바꿈 유지 + Korean 가독성 */
  white-space: pre-wrap;
  word-break: keep-all;
  overflow-wrap: break-word;
  line-break: strict;
  font-family: 'Pretendard', system-ui, -apple-system, sans-serif;
  font-size: 0.9375rem;
  line-height: 1.95;
  letter-spacing: -0.005em;
  color: #d4d4d8;
  margin: 0;
  padding: 0;
  background: transparent;
  font-feature-settings: "ss01", "ss02", "tnum", "case";
}

.legal-modal__footnote {
  margin-top: 2rem;
  padding: 0.875rem 1rem;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid rgba(255, 255, 255, 0.06);
  border-radius: 0.75rem;
  font-size: 0.75rem;
  color: rgba(161, 161, 170, 0.85);
}
.legal-modal__footnote iconify-icon {
  color: rgba(108, 165, 202, 0.9);
  flex: 0 0 auto;
}

/* ---------- Mobile: full-screen ---------- */
@media (max-width: 640px) {
  .legal-modal {
    padding: 0;
  }
  .legal-modal__panel {
    max-width: 100%;
    height: 100vh;
    height: 100dvh;
    border-radius: 0;
    border: 0;
  }
  .legal-modal__header {
    padding: 1.125rem 1.25rem 0.875rem;
  }
  .legal-modal__title {
    font-size: 1.125rem;
  }
  .legal-modal__body {
    padding: 1.25rem 1.25rem 1.75rem;
  }
  .legal-modal__text {
    font-size: 0.875rem;
    line-height: 1.85;
  }
}

/* ---------- Lock body scroll when modal is open ---------- */
html.legal-modal-lock,
html.legal-modal-lock body {
  overflow: hidden;
}

/* Reduced motion */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
}
