/* =========================
   GLOBAL
========================= */
html, body {
  overflow-x: hidden;
  width: 100%;
}

:root {
  --bs-primary: #0A0A0A;
  --bs-sub: #666666;
  --bs-bg: #F5F5F7;
  --bs-accent: #AC9EF5;
  --bs-white: #FFFFFF;
}

html { scroll-behavior: auto !important; }

body {
  font-family: 'Pretendard', sans-serif;
  color: var(--bs-primary);
  background: var(--bs-white);
  overflow-x: hidden;
}

.font-logo { font-weight: 600; font-family: 'Pretendard', sans-serif; }

/* =========================
   REVEAL
========================= */
.reveal {
  opacity: 0;
  transform: translateY(20px);
  transition: all 0.8s cubic-bezier(0.2, 0.8, 0.2, 1);
}
.reveal.active {
  opacity: 1;
  transform: translateY(0);
}

/* =========================
   GLASS
========================= */
.glass-nav {
  background: rgba(255, 255, 255, 0.85);
  backdrop-filter: blur(15px);
  -webkit-backdrop-filter: blur(15px);
}
.glass {
  background: rgba(255, 255, 255, 0.4);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border: 1px solid rgba(255, 255, 255, 0.3);
  box-shadow: 0 20px 40px -10px rgba(0, 0, 0, 0.1);
}
.glass-light {
  background: rgba(255, 255, 255, 0.08);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border: 1px solid rgba(255, 255, 255, 0.15);
}
.glass-dark {
  background: rgba(10, 10, 10, 0.85);
  backdrop-filter: blur(24px);
  -webkit-backdrop-filter: blur(24px);
}

/* =========================
   MARQUEE
========================= */
.marquee {
  background: var(--bs-primary);
  overflow: hidden;
  white-space: nowrap;
  padding: 20px 0;
}
.marquee__track {
  display: inline-flex;
  animation: marquee-move 40s linear infinite;
}
.marquee__chunk {
  font-size: clamp(3rem, 10vw, 6rem);
  font-weight: 900;
  color: transparent;
  -webkit-text-stroke: 1px rgba(255,255,255,0.2);
  padding: 0 40px;
  letter-spacing: -0.05em;
}
@keyframes marquee-move {
  from { transform: translateX(0); }
  to { transform: translateX(-50%); }
}

/* =========================
   HERO HEIGHT FIX
========================= */
#home {
  padding-bottom: 96px;
  height: 100vh;
}
@supports (height: 100svh) { #home { height: 100svh; } }
@supports (height: 100dvh) { #home { height: 100dvh; } }

@media (min-width: 768px) {
  #home { padding-bottom: 120px; }
}

/* =========================
   PROGRESS BAR
========================= */
#progress-bar {
  position: fixed;
  top: 0;
  left: 0;
  height: 3px;
  background: var(--bs-accent);
  z-index: 11000;
  width: 0%;
  transition: width 0.1s;
}

/* =========================
   AI LOADING
========================= */
.ai-loading-circle {
  width: 40px;
  height: 40px;
  border: 2px solid transparent;
  border-top-color: var(--bs-accent);
  border-right-color: var(--bs-accent);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

.hero-gradient {
  background: linear-gradient(to bottom, rgba(0,0,0,0.4) 0%, rgba(0,0,0,0.8) 100%);
}

/* =========================
   AI RESULT AREA
========================= */
#ai-result-content {
  height: 380px !important;
  max-height: 380px !important;
  overflow-y: auto !important;
  padding-right: 12px;

  scrollbar-width: thin;
  scrollbar-color: rgba(172, 158, 245, 0.3) transparent;
}
#ai-result-content::-webkit-scrollbar { width: 4px; }
#ai-result-content::-webkit-scrollbar-thumb {
  background: rgba(172, 158, 245, 0.5);
  border-radius: 10px;
}

/* =========================
   TEXT HELPERS
========================= */
.force-one-line {
  white-space: nowrap !important;
  word-break: keep-all !important;
  display: inline-block;
  max-width: 100%;
  font-size: clamp(0.7rem, 4vw, 1.5rem);
}
.info-one-line {
  white-space: nowrap !important;
  font-size: clamp(0.9rem, 3.2vw, 1.2rem);
}

.keep-all {
  word-break: keep-all;
  overflow-wrap: normal;
}

/* =========================
   MOBILE CAROUSEL (BASE)
========================= */
@media (max-width: 767.98px) {
  .mobile-scroll-container{
    display:flex;
    overflow-x:auto;
    overflow-y:visible;
    -webkit-overflow-scrolling:touch;

    scroll-snap-type:x mandatory;
    scroll-padding-left: 16px;
    scroll-padding-right: 16px;

    gap: 16px;
    padding: 16px 16px 28px 16px;
    margin: 0 -16px;
    scrollbar-width:none;
  }
  .mobile-scroll-container::-webkit-scrollbar { display:none; }

  .mobile-scroll-item{
    flex: 0 0 86%;
    scroll-snap-align: start;
    min-width: 0;
    overflow: visible;
  }

  #mobile-menu {
    position: fixed;
    inset: 0;
    z-index: 20000 !important;
    background-color: #ffffff !important;
    transition: transform 0.4s cubic-bezier(0.16, 1, 0.3, 1);
    transform: translateX(100%);
    display: flex;
    flex-direction: column;
  }
  #mobile-menu.active { transform: translateX(0); }
}

/* ✅ Services는 px-6 상쇄를 24로 */
@media (max-width: 767.98px) {
  #services .mobile-scroll-container{
    margin: 0 -24px;
    padding: 16px 24px 28px 24px;
    scroll-padding-left: 24px;
    scroll-padding-right: 24px;
  }
}

/* =========================
   TOP BUTTON
========================= */
#to-top-btn {
  position: fixed;
  bottom: 30px;
  right: 30px;
  width: 56px;
  height: 56px;
  background-color: var(--bs-accent);
  color: white;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 99999;
  opacity: 0;
  visibility: hidden;
  transition: all 0.3s ease;
  box-shadow: 0 10px 25px rgba(172, 158, 245, 0.4);
  cursor: pointer;
}
#to-top-btn.visible {
  opacity: 1;
  visibility: visible;
}

/* =========================
   CASE STUDIES TITLE
========================= */
#case-studies .force-one-line{
  word-break: keep-all;
  display: block !important;
  width: 100% !important;
  white-space: nowrap !important;
  overflow: visible !important;
  text-overflow: initial !important;
  font-size: clamp(12px, 4.2vw, 30px) !important;
}

@media (max-width: 767.98px) {
  #case-studies .force-one-line{
    white-space: normal !important;
    display: -webkit-box !important;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden !important;

    font-size: clamp(16px, 4.6vw, 22px) !important;
    line-height: 1.15 !important;
  }
}
