/* ─────────────────────────────────────────────
   ZENION — Global Design System
───────────────────────────────────────────── */
@import url('https://fonts.googleapis.com/css2?family=Cormorant+Garamond:ital,wght@0,300;0,400;0,600;1,300;1,400&family=Inter:wght@300;400;500;600&family=Noto+Sans+KR:wght@300;400;500;700&display=swap');

:root {
  /* Core Palette */
  --z-bg:        #06080F;
  --z-bg2:       #0C1220;
  --z-bg3:       #111827;
  --z-border:    rgba(255,255,255,0.07);
  --z-white:     #F0EDE8;
  --z-muted:     #6B7280;
  --z-accent:    #5B8FFF;
  --z-gold:      #C9A84C;

  /* Terracotta */
  --tc-primary:  #C8553D;
  --tc-mid:      #E07A5F;
  --tc-warm:     #F0C090;
  --tc-dark:     #1A0800;

  /* IT */
  --it-primary:  #00D4FF;
  --it-mid:      #0066FF;
  --it-dark:     #050D1F;

  /* Legal */
  --lg-primary:  #C9A84C;
  --lg-mid:      #8B1A1A;
  --lg-dark:     #08050F;

  /* Typography */
  --font-display: 'Cormorant Garamond', Georgia, serif;
  --font-body:    'Noto Sans KR', 'Inter', sans-serif;

  /* Spacing */
  --section-pad: clamp(80px, 10vw, 140px);

  /* Transitions */
  --ease-out:    cubic-bezier(0.16, 1, 0.3, 1);
  --ease-in-out: cubic-bezier(0.45, 0, 0.55, 1);
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html {
  scroll-behavior: smooth;
  font-size: 16px;
  overflow-x: hidden;
  max-width: 100%;
}
@supports (overflow-x: clip) {
  html { overflow-x: clip; }
}

body {
  background: var(--z-bg);
  color: var(--z-white);
  font-family: var(--font-body);
  line-height: 1.7;
  overflow-x: hidden;
  max-width: 100vw;
  -webkit-font-smoothing: antialiased;
}
@supports (overflow-x: clip) {
  body { overflow-x: clip; }
}

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

/* ── 성능: 스크롤/애니 구간 합성 레이어 분리 (떨림 완화) ── */
.hero-sticky, .scroll-video-sticky, .it-hero { contain: layout style; transform: translateZ(0); }
@media (prefers-reduced-motion: reduce) {
  .hero-sticky, .scroll-video-sticky, .it-hero { contain: none; transform: none; }
}

/* 모바일: 이미지 가로 overflow 방지 (사진 잘림/깨짐 방지) */
img {
  max-width: 100%;
  vertical-align: middle;
}

/* ── Scrollbar ── */
::-webkit-scrollbar { width: 4px; }
::-webkit-scrollbar-track { background: var(--z-bg); }
::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.15); border-radius: 2px; }

/* ── Selection ── */
::selection { background: rgba(91,143,255,0.3); }

/* ── Utility ── */
.sr-only { position:absolute; width:1px; height:1px; overflow:hidden; clip:rect(0,0,0,0); }

/* ── NAV ── */
.z-nav {
  position: fixed;
  top: 0; left: 0; right: 0;
  z-index: 9000;
  padding: 0 5vw;
  padding-top: env(safe-area-inset-top, 0);
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 70px;
  height: calc(70px + env(safe-area-inset-top, 0));
  transition: background 0.4s var(--ease-out), backdrop-filter 0.4s;
}
.z-nav.scrolled {
  background: rgba(6,8,15,0.85);
  backdrop-filter: blur(20px);
  border-bottom: 1px solid var(--z-border);
}
.z-nav__logo {
  font-family: var(--font-display);
  font-size: 1.6rem;
  font-weight: 600;
  letter-spacing: 0.12em;
  color: var(--z-white);
  text-decoration: none;
  transition: opacity 0.3s;
}
.z-nav__logo:hover { opacity: 0.7; }

.z-nav__links {
  display: flex;
  align-items: center;
  gap: 2rem;
  list-style: none;
}
.z-nav__links a {
  color: rgba(240,237,232,0.75);
  text-decoration: none;
  font-size: 0.85rem;
  font-weight: 400;
  letter-spacing: 0.05em;
  transition: color 0.3s;
  position: relative;
}
.z-nav__links a::after {
  content: '';
  position: absolute;
  bottom: -3px; left: 0;
  width: 0; height: 1px;
  background: var(--z-accent);
  transition: width 0.3s var(--ease-out);
}
.z-nav__links a:hover { color: var(--z-white); }
.z-nav__links a:hover::after { width: 100%; }

/* Dropdown */
.z-nav__dropdown { position: relative; }
.z-nav__dropdown > a,
.z-nav__dropdown > button {
  cursor: pointer;
  min-height: 44px;
  min-width: 44px;
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
}
/* Invisible bridge: fills gap between trigger and menu so hover doesn't drop */
.z-nav__dropdown::after {
  content: '';
  position: absolute;
  top: 100%;
  left: -20px;
  right: -20px;
  height: 22px;
}
.z-nav__dropdown-menu {
  position: absolute;
  top: calc(100% + 18px);
  left: 50%;
  transform: translateX(-50%) translateY(-6px);
  min-width: 192px;
  background: rgba(10,15,28,0.98);
  backdrop-filter: blur(22px);
  border: 1px solid var(--z-border);
  border-radius: 14px;
  padding: 10px 0;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.28s var(--ease-out), transform 0.28s var(--ease-out);
  list-style: none;
  box-shadow: 0 18px 48px rgba(0,0,0,0.5);
}
.z-nav__dropdown:hover .z-nav__dropdown-menu,
.z-nav__dropdown.open .z-nav__dropdown-menu {
  opacity: 1;
  pointer-events: all;
  transform: translateX(-50%) translateY(0);
}
.z-nav__dropdown-menu li a {
  display: block;
  padding: 12px 20px;
  font-size: 0.83rem;
  color: rgba(240,237,232,0.7);
  transition: all 0.2s;
  -webkit-tap-highlight-color: transparent;
  min-height: 44px;
  line-height: 1.4;
  box-sizing: border-box;
  display: flex;
  align-items: center;
}
.z-nav__dropdown-menu li a:hover {
  color: var(--z-white);
  background: rgba(255,255,255,0.05);
  padding-left: 26px;
}
.z-nav__dropdown-menu li a::after { display: none; }

/* Mobile hamburger */
.z-nav__burger {
  display: none;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  gap: 5px;
  cursor: pointer;
  padding: 12px;
  min-width: 48px;
  min-height: 48px;
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
  border: none;
  background: transparent;
  color: inherit;
  font: inherit;
}
.z-nav__burger span {
  display: block;
  width: 24px; height: 1.5px;
  background: var(--z-white);
  transition: all 0.3s;
}
.z-nav.is-open .z-nav__burger span:nth-child(1) {
  transform: translateY(6.5px) rotate(45deg);
}
.z-nav.is-open .z-nav__burger span:nth-child(2) {
  opacity: 0;
}
.z-nav.is-open .z-nav__burger span:nth-child(3) {
  transform: translateY(-6.5px) rotate(-45deg);
}

/* ── SECTION BASE ── */
.z-section {
  padding: var(--section-pad) 5vw;
  position: relative;
}

/* ── GLASS CARD ── */
.glass-card {
  background: rgba(255,255,255,0.03);
  border: 1px solid var(--z-border);
  border-radius: 20px;
  backdrop-filter: blur(10px);
  transition: all 0.5s var(--ease-out);
}
.glass-card:hover {
  background: rgba(255,255,255,0.06);
  border-color: rgba(255,255,255,0.14);
  transform: translateY(-4px);
  box-shadow: 0 24px 60px rgba(0,0,0,0.4);
}

/* ── BUTTONS ── */
.z-btn {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 14px 32px;
  border-radius: 100px;
  font-family: var(--font-body);
  font-size: 0.875rem;
  font-weight: 500;
  letter-spacing: 0.04em;
  text-decoration: none;
  cursor: pointer;
  border: none;
  transition: all 0.35s var(--ease-out);
  position: relative;
  overflow: hidden;
}
.z-btn::before {
  content: '';
  position: absolute;
  inset: 0;
  background: rgba(255,255,255,0.08);
  opacity: 0;
  transition: opacity 0.3s;
}
.z-btn:hover::before { opacity: 1; }

.z-btn--primary {
  background: var(--z-accent);
  color: #fff;
  box-shadow: 0 0 30px rgba(91,143,255,0.3);
}
.z-btn--primary:hover { box-shadow: 0 0 50px rgba(91,143,255,0.5); transform: translateY(-2px); }

.z-btn--outline {
  background: transparent;
  color: var(--z-white);
  border: 1px solid rgba(255,255,255,0.25);
}
.z-btn--outline:hover { border-color: rgba(255,255,255,0.6); transform: translateY(-2px); }

.z-btn--gold {
  background: linear-gradient(135deg, #C9A84C, #E8CC80);
  color: #0A0700;
  box-shadow: 0 0 30px rgba(201,168,76,0.3);
}
.z-btn--gold:hover { box-shadow: 0 0 50px rgba(201,168,76,0.5); transform: translateY(-2px); }

/* ── HEADLINE STYLES ── */
.z-eyebrow {
  font-size: 0.75rem;
  letter-spacing: 0.25em;
  text-transform: uppercase;
  color: var(--z-muted);
  margin-bottom: 16px;
}
.z-h1 {
  font-family: var(--font-display);
  font-size: clamp(3rem, 7vw, 7rem);
  font-weight: 300;
  line-height: 1.05;
  letter-spacing: -0.02em;
}
.z-h2 {
  font-family: var(--font-display);
  font-size: clamp(2rem, 4.5vw, 4.5rem);
  font-weight: 300;
  line-height: 1.1;
}
.z-h3 {
  font-family: var(--font-display);
  font-size: clamp(1.4rem, 2.5vw, 2.5rem);
  font-weight: 400;
  line-height: 1.2;
}

/* ── REVEAL ANIMATION ── */
.reveal {
  opacity: 0;
  transform: translateY(40px);
  transition: opacity 0.9s var(--ease-out), transform 0.9s var(--ease-out);
}
.reveal.visible {
  opacity: 1;
  transform: translateY(0);
}
.reveal-delay-1 { transition-delay: 0.15s; }
.reveal-delay-2 { transition-delay: 0.3s; }
.reveal-delay-3 { transition-delay: 0.45s; }
.reveal-delay-4 { transition-delay: 0.6s; }

/* ── FOOTER ── */
.z-footer {
  padding: 60px 5vw 40px;
  border-top: 1px solid var(--z-border);
}
.z-footer__grid {
  display: grid;
  grid-template-columns: 2fr 1fr 1fr 1fr;
  gap: 40px;
  margin-bottom: 50px;
}
.z-footer__brand {
  font-family: var(--font-display);
  font-size: 1.8rem;
  font-weight: 600;
  letter-spacing: 0.1em;
  margin-bottom: 12px;
}
.z-footer__desc {
  color: var(--z-muted);
  font-size: 0.85rem;
  line-height: 1.8;
  max-width: 280px;
}
.z-footer__col h4 {
  font-size: 0.75rem;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--z-muted);
  margin-bottom: 20px;
}
.z-footer__col ul { list-style: none; }
.z-footer__col ul li { margin-bottom: 10px; }
.z-footer__col ul li a {
  color: rgba(240,237,232,0.55);
  text-decoration: none;
  font-size: 0.87rem;
  transition: color 0.3s;
}
.z-footer__col ul li a:hover { color: var(--z-white); }
.z-footer__bottom {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding-top: 30px;
  border-top: 1px solid var(--z-border);
  color: var(--z-muted);
  font-size: 0.8rem;
}

/* ── DIVIDER LINE ── */
.z-line {
  width: 40px; height: 1px;
  background: var(--z-accent);
  margin-bottom: 20px;
}

/* ── 3D CARD PERSPECTIVE ── */
.perspective-card {
  transform-style: preserve-3d;
  perspective: 1000px;
}
.perspective-card-inner {
  transition: transform 0.1s ease;
  transform-style: preserve-3d;
}

/* ── TAG / BADGE ── */
.z-tag {
  display: inline-block;
  padding: 5px 14px;
  border-radius: 100px;
  font-size: 0.72rem;
  font-weight: 500;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}
.z-tag--accent { background: rgba(91,143,255,0.12); color: var(--z-accent); border: 1px solid rgba(91,143,255,0.2); }
.z-tag--gold   { background: rgba(201,168,76,0.12); color: var(--z-gold);   border: 1px solid rgba(201,168,76,0.2); }
.z-tag--terra  { background: rgba(200,85,61,0.12);  color: #E07A5F;          border: 1px solid rgba(200,85,61,0.2);  }

/* ── MOBILE ── */
@media (max-width: 768px) {
  .z-nav__links {
    display: none;
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: rgba(6,8,15,0.98);
    backdrop-filter: blur(20px);
    border-bottom: 1px solid var(--z-border);
    padding: 20px 5vw 28px;
    flex-direction: column;
    gap: 0;
    max-height: calc(100vh - 70px);
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
  }
  .z-nav.is-open .z-nav__links { display: flex; }
  .z-nav__links > li {
    border-bottom: 1px solid rgba(255,255,255,0.06);
  }
  .z-nav__links > li:last-child { border-bottom: none; }
  .z-nav__links a,
  .z-nav__links button {
    display: block;
    width: 100%;
    padding: 14px 0;
    text-align: left;
    min-height: 48px;
    align-items: center;
    box-sizing: border-box;
  }
  .z-nav__dropdown-menu {
    position: static;
    transform: none;
    min-width: 100%;
    margin-top: 0;
    padding: 0 0 8px 12px;
    background: transparent;
    border: none;
    box-shadow: none;
    max-height: 0;
    overflow: hidden;
    opacity: 0;
    transition: max-height 0.25s ease, opacity 0.2s ease, padding 0.2s ease;
  }
  .z-nav__dropdown.open .z-nav__dropdown-menu {
    max-height: 220px;
    opacity: 1;
    padding: 0 0 8px 12px;
  }
  .z-nav__dropdown-menu li a {
    padding: 10px 12px;
    min-height: 44px;
  }
  .z-nav__burger { display: flex; }
  .z-footer__grid { grid-template-columns: 1fr 1fr; }
  .z-footer__bottom { flex-direction: column; gap: 10px; text-align: center; }
}

/* ═══════════════════════════════════════════════════════
   모바일 전용 UI/UX 애니메이션 (웹과 다르게 딱·이쁘게)
═══════════════════════════════════════════════════════ */
@media (max-width: 768px) {
  :root {
    --ease-mobile: cubic-bezier(0.22, 1, 0.36, 1);
    --ease-out-mobile: cubic-bezier(0.16, 1, 0.3, 1);
  }

  /* Reveal: 모바일은 짧고 스냅하게, 살짝 스케일로 등장 */
  .reveal {
    opacity: 0;
    transform: translateY(24px) scale(0.98);
    transition: opacity 0.5s var(--ease-mobile), transform 0.5s var(--ease-mobile);
  }
  .reveal.visible {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
  .reveal-delay-1 { transition-delay: 0.06s; }
  .reveal-delay-2 { transition-delay: 0.12s; }
  .reveal-delay-3 { transition-delay: 0.18s; }
  .reveal-delay-4 { transition-delay: 0.24s; }

  /* 네비 메뉴 열림: 메뉴 항목만 순차 등장 (딱딱 뜨게) */
  .z-nav__links > li {
    opacity: 0;
    transform: translateY(-10px);
    transition: opacity 0.28s var(--ease-mobile), transform 0.28s var(--ease-mobile), border-color 0.2s;
  }
  .z-nav.is-open .z-nav__links > li {
    opacity: 1;
    transform: translateY(0);
  }
  .z-nav.is-open .z-nav__links > li:nth-child(1) { transition-delay: 0.05s; }
  .z-nav.is-open .z-nav__links > li:nth-child(2) { transition-delay: 0.1s; }
  .z-nav.is-open .z-nav__links > li:nth-child(3) { transition-delay: 0.15s; }
  .z-nav.is-open .z-nav__links > li:nth-child(4) { transition-delay: 0.2s; }
  .z-nav.is-open .z-nav__links > li:nth-child(5) { transition-delay: 0.25s; }
  .z-nav.is-open .z-nav__links > li:nth-child(6) { transition-delay: 0.3s; }
  .z-nav.is-open .z-nav__links > li:nth-child(7) { transition-delay: 0.35s; }
  .z-nav.is-open .z-nav__links > li:nth-child(8) { transition-delay: 0.4s; }

  /* 드롭다운 펼침: 부드럽게 */
  .z-nav__dropdown.open .z-nav__dropdown-menu {
    transition: max-height 0.35s var(--ease-mobile), opacity 0.25s ease, padding 0.25s ease;
  }

  /* 터치 피드백: 버튼·카드·링크 탭 시 살짝 눌림 */
  .z-btn,
  .z-nav__links a,
  .z-nav__links button,
  .z-nav__burger,
  .sector-card,
  .service-card,
  .portfolio-card,
  .product-card,
  .news-card,
  .it-estimate-card,
  .glass-card,
  .tc-model-preview__card,
  .gallery-item {
    transition: transform 0.2s var(--ease-out-mobile), opacity 0.2s, box-shadow 0.2s;
  }
  .z-btn:active,
  .z-nav__links a:active,
  .z-nav__links button:active,
  .z-nav__burger:active {
    transform: scale(0.97);
  }
  .sector-card:active,
  .service-card:active,
  .portfolio-card:active,
  .product-card:active,
  .news-card:active,
  .it-estimate-card:active,
  .tc-model-preview__card:active,
  .gallery-item:active {
    transform: scale(0.98);
    opacity: 0.92;
  }
}

/* 모바일 전용 키프레임 (섹터/페이지에서 사용 가능) */
@media (max-width: 768px) {
  @keyframes mobile-fade-up {
    from { opacity: 0; transform: translateY(20px); }
    to { opacity: 1; transform: translateY(0); }
  }
  @keyframes mobile-pop-in {
    from { opacity: 0; transform: scale(0.94); }
    to { opacity: 1; transform: scale(1); }
  }
  @keyframes mobile-slide-up {
    from { opacity: 0; transform: translateY(100%); }
    to { opacity: 1; transform: translateY(0); }
  }
  @keyframes mobile-overlay-in {
    from { opacity: 0; }
    to { opacity: 1; }
  }
}

/* 모바일: 모달/패널 하단 슬라이드업 (공통 클래스) */
@media (max-width: 768px) {
  .it-estimate-modal .it-estimate-modal__panel {
    transform: translateY(100%);
    transition: none;
  }
  .it-estimate-modal.is-open .it-estimate-modal__backdrop {
    animation: mobile-overlay-in 0.22s var(--ease-out) forwards;
  }
  .it-estimate-modal.is-open .it-estimate-modal__panel {
    animation: mobile-slide-up 0.32s var(--ease-mobile) forwards;
  }
  .it-portfolio-modal.is-open .it-portfolio-modal__backdrop {
    animation: mobile-overlay-in 0.2s ease forwards;
  }
  .it-portfolio-modal.is-open .it-portfolio-modal__box {
    animation: mobile-pop-in 0.28s var(--ease-mobile) forwards;
  }
}

/* 터치 기기 전역: 탭 하이라이트 제거, 탭 반응 일관 */
@media (hover: none) and (pointer: coarse) {
  .z-btn:focus-visible,
  .z-nav__burger:focus-visible,
  a:focus-visible {
    outline: 2px solid var(--z-accent);
    outline-offset: 2px;
  }
}

@media (max-width: 768px) {
  .it-estimate-modal .it-estimate-modal__panel {
    border-radius: 20px 20px 0 0;
    max-height: 90dvh;
  }
}

/* prefers-reduced-motion 시 모바일 애니도 축소 */
@media (max-width: 768px) and (prefers-reduced-motion: reduce) {
  .reveal { transition-duration: 0.15s; }
  .z-nav__links,
  .z-nav__links > li { transition-duration: 0.1s; }
  .z-btn:active,
  .sector-card:active,
  .service-card:active,
  .portfolio-card:active,
  .product-card:active,
  .news-card:active,
  .it-estimate-card:active { transform: none; opacity: 1; }
}

/* ── SVG ICON SYSTEM ── */
[data-icon] {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  line-height: 1;
}
[data-icon] svg {
  display: block;
  width: 1em;
  height: 1em;
  flex-shrink: 0;
}
.z-icon-sm  { font-size: 18px; }
.z-icon-md  { font-size: 24px; }
.z-icon-lg  { font-size: 32px; }
.z-icon-xl  { font-size: 48px; }

/* Sector card icon overrides */
.sector-card__icon [data-icon] { font-size: 22px; }
/* About value icons */
.about__value-icon [data-icon] { font-size: 22px; }
/* Service card icons */
.service-card__icon [data-icon] { font-size: 26px; }
/* Why card icons */
.why-card__icon [data-icon] { font-size: 28px; }
/* Intro strip icons */
.tc-intro-strip__icon [data-icon] { font-size: 22px; }
/* Terracotta highlight icons */
.tc-highlight__icon [data-icon] { font-size: 24px; }
/* Synergy card icons */
.synergy-card__icon [data-icon] { font-size: 28px; }
/* Timeline icons not used but stack items */
.stack-item__icon [data-icon] { font-size: 28px; }
/* Portfolio bg icon */
.portfolio-card__bg-icon [data-icon] { font-size: 64px; opacity: 0.06; }

/* ── CUSTOM CURSOR ── */
.cursor-dot {
  position: fixed;
  width: 8px; height: 8px;
  background: var(--z-accent);
  border-radius: 50%;
  pointer-events: none;
  z-index: 99999;
  transition: transform 0.15s var(--ease-out), opacity 0.3s;
  transform: translate(-50%, -50%);
}
.cursor-ring {
  position: fixed;
  width: 36px; height: 36px;
  border: 1px solid rgba(91,143,255,0.5);
  border-radius: 50%;
  pointer-events: none;
  z-index: 99998;
  transition: transform 0.35s var(--ease-out), width 0.3s, height 0.3s, opacity 0.3s;
  transform: translate(-50%, -50%);
}
body:hover .cursor-dot { opacity: 1; }

@media (pointer: coarse) {
  .cursor-dot,
  .cursor-ring {
    display: none;
  }
}
