/* ============================================
   COMMON — layout, header, footer, components
   ============================================ */

/* scrollbar */
::-webkit-scrollbar { display: block; width: 3px; background: transparent; }
::-webkit-scrollbar-thumb { border-radius: 10px; background: var(--black); }
::-webkit-scrollbar-track { background: rgba(0,0,0,0.1); }

/* lenis */
.lenis.lenis-smooth { scroll-behavior: auto; }

/* body */
body {
  font-family: var(--font-base);
  font-size: clamp(13px, 0.781vw, 15px);
  line-height: 1.4;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  overflow-x: hidden;
  color: var(--black);
  background: var(--white);
  letter-spacing: -0.05em;
  font-weight: 500;
  word-break: keep-all;
}

/* vertical grid lines */
body::before {
  content: '';
  position: fixed;
  top: 0; left: 30px;
  width: calc(100% - 30px);
  height: 100%;
  pointer-events: none;
  z-index: -1;
  background-image: repeating-linear-gradient(
    to right,
    rgba(150,150,150,0.12) 0,
    rgba(150,150,150,0.12) 1px,
    transparent 1px,
    transparent calc((100% - 30px) / 5)
  );
}

/* page container */
.page-container { opacity: 0; }

/* containers */
.main-container,
.sub-container {
  position: relative;
  z-index: 1;
  background: var(--white);
  transition: background-color 0.6s ease, color 0.6s ease;
}

.main-container::before,
.sub-container::before {
  content: '';
  position: absolute;
  left: 0; top: 100%;
  width: 100%;
  height: clamp(150px, 26vw, 500px);
  background: var(--white);
  clip-path: ellipse(100% 100% at 50% 0%);
  z-index: -1;
  transform: translateY(-50%);
}

/* dark mode */
body.dark-mode .main-container,
body.dark-mode .sub-container {
  background: var(--black);
  color: var(--beige);
}

/* beige mode */
body.beige-mode .main-container,
body.beige-mode .sub-container {
  background: var(--beige);
}

/* ============================================
   HEADER
   ============================================ */
.header {
  position: fixed;
  padding: 20px 30px;
  width: 100%;
  z-index: 100;
  display: flex;
  justify-content: center;
  transition: background 0.35s ease, backdrop-filter 0.35s ease, color 0.35s ease;
  /* 항상 텍스트 색상 명시 — 히어로 위에서도 안 보이는 현상 방지 */
  color: var(--black);
  background: transparent;
  backdrop-filter: none;
  -webkit-backdrop-filter: none;
}

/* 스크롤 후: 더 불투명하게 (본문 영역일 때만) */
.header.content-mode.scrolled {
  background: rgba(255, 255, 255, 0.96);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border-bottom: 1px solid rgba(10, 10, 10, 0.06);
}

.header.content-mode {
  color: var(--black);
  background: rgba(255, 255, 255, 0.85);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
}
.header.content-mode .hd-logo a,
.header.content-mode .hd-copy,
.header.content-mode .hd-nav a {
  color: var(--black) !important;
}
.header.content-mode .hd-toggle span,
.header.content-mode .hd-copy .dots i {
  background: var(--black) !important;
}

.hd-inner {
  width: 100%;
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: clamp(20px, 5vw, 100px);
}

.hd-logo {
  line-height: 1;
  flex-shrink: 0;
  font-family: var(--font-display);
  font-size: clamp(22px, 1.8vw, 30px); /* h1과 동일 폰트, nav보다 크게 */
  font-weight: 400;
  font-style: normal;
  letter-spacing: 0.01em;
  transition: all 0.6s ease;
}

.hd-copy {
  position: relative;
  margin-right: auto;
  line-height: 1.2;
  font-size: clamp(11px, 0.677vw, 13px);
  letter-spacing: 0;
  transition: opacity 0.6s ease,
              transform 0.6s ease,
              filter 0.6s ease,
              visibility 0s;
}

.hd-copy .dots { top: 50%; margin-top: -13px; }

.hd-nav {
  display: flex;
  gap: 40px;
  border-radius: 6px;
}

.hd-nav a {
  position: relative;
  transition: all 0.35s ease;
  font-size: 17px;
  display: inline-flex;
  align-items: center;
  text-transform: none;
}

.hd-nav a:hover { opacity: 0.5; }

/* contact block in header */
.hd-contact {
  position: relative;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 20px;
  padding: 10px;
  margin-top: -10px;
  background: var(--black);
  color: var(--white);
  height: 80px;
  width: 280px;
  cursor: pointer;
  overflow: hidden;
  transition: all 0.5s ease;
  border-radius: 5px;
}

.hd-contact * { transition: opacity 0.5s ease, transform 0.5s ease; }

.hd-contact p {
  line-height: 1.2;
  flex: 1;
  font-weight: 500;
  font-size: 12px;
  letter-spacing: 0;
  color: rgba(255,255,255,0.7);
}

.hd-thumb { width: 60px; flex-shrink: 0; }

.hd-thumb-img {
  position: relative;
  margin-top: auto;
  aspect-ratio: 1;
  overflow: hidden;
  background: var(--primary);
}

.hd-contact .arr {
  position: absolute;
  right: 2px; top: 0;
  border: 0;
  font-size: 1.3em;
  line-height: 1;
}

/* scrolled state — collapse contact block */
.header .hd-contact {
  height: 0;
  border-radius: 0;
  margin-top: -20px;
}

.header .hd-contact .hd-thumb-img,
.header .hd-contact p { opacity: 0; }

body:has(.main-container) .header:not(.scrolled) .hd-copy { opacity: 1; transform: none; filter: none; }
body:has(.main-container) .header:not(.scrolled) .hd-contact { height: 80px; margin-top: -10px; border-radius: 5px; }
body:has(.main-container) .header:not(.scrolled) .hd-contact .hd-thumb-img,
body:has(.main-container) .header:not(.scrolled) .hd-contact p { opacity: 1; }

/* hamburger */
.hd-toggle {
  display: none;
  width: 52px; height: 52px;
  position: relative;
  border: 0;
  background: none;
  cursor: pointer;
  z-index: 200;
}

.hd-toggle span {
  position: absolute;
  left: 50%;
  width: 24px; height: 2px;
  background: var(--black);
  transition: all 0.35s ease;
}

.hd-toggle span:nth-child(1) { top: 20px; transform: translateX(-50%); }
.hd-toggle span:nth-child(2) { top: 30px; transform: translateX(-50%); }

/* menu open */
body.menu-open { overflow: hidden; }
body.menu-open .hd-logo { z-index: 1; position: relative; }

/* mobile nav overlay */
body.menu-open::after {
  content: '';
  position: fixed;
  inset: 0;
  background: var(--white);
  z-index: 90;
}

/* ============================================
   FOOTER
   ============================================ */
.footer {
  position: sticky;
  bottom: 0;
  overflow: hidden;
  padding: clamp(120px, 17vw, 340px) clamp(20px, 1.5vw, 30px) clamp(20px, 1.5vw, 30px);
  display: flex;
  flex-direction: column;
}

.footer-bottom {
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  letter-spacing: 0;
}

.footer-bottom > div { width: 33.33%; }
.footer-bottom > div:nth-child(2) { text-align: center; }
.footer-bottom > div:nth-child(3) { text-align: right; }
.footer-bottom a { position: relative; font-weight: 500; }

.footer-copy {
  font-size: clamp(18px, 1.5vw, 30px);
  display: flex;
  justify-content: space-between;
  flex-direction: column;
  align-items: flex-end;
  width: 100%;
  margin-bottom: 20px;
}

.footer-copy p { line-height: 1.2; display: flex; gap: 5px; font-weight: 600; }
.footer-copy .arr { margin-left: auto; }

.footer-switch {
  position: relative;
  display: inline-block;
  width: 100px;
}

.footer-switch span {
  position: absolute;
  right: 0; top: 0;
  white-space: nowrap;
  opacity: 0;
  animation: footerToggle 4s infinite steps(1);
}

.footer-switch .en { animation-delay: 2s; }

@keyframes footerToggle {
  0%, 49.999% { opacity: 1; }
  50%, 100%   { opacity: 0; }
}

.footer-contact {
  display: flex;
  gap: clamp(5px, 0.5vw, 10px);
}

.footer-contact a {
  font-size: clamp(15px, 1.25vw, 24px);
  font-weight: 550;
}

.footer-meta {
  position: relative;
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: clamp(10px, 3vw, 60px);
  overflow: hidden;
}

.footer .arr {
  margin: 0;
  aspect-ratio: 1;
  width: clamp(38px, 4.5vw, 86px);
  padding: 0 clamp(2px, 0.26vw, 5px) clamp(2px, 0.26vw, 5px) 0;
  border-radius: 50%;
  background: var(--black);
  color: var(--white);
  font-size: clamp(28px, 3vw, 60px);
  font-weight: 300;
  vertical-align: middle;
}

.ft-bg {
  position: absolute;
  top: 0; left: 0;
  width: 100%; height: 100%;
  background: var(--primary);
  pointer-events: none;
  z-index: -1;
}

/* ============================================
   TYPOGRAPHY
   ============================================ */
.font-display { font-weight: 400; }

.btit {
  font-size: clamp(36px, 6.77vw, 130px);
  line-height: 1;
  letter-spacing: -0.04em;
  font-weight: 400;
}

.stit {
  font-size: clamp(22px, 1.875vw, 36px);
  line-height: 1.4;
  letter-spacing: -0.03em;
  font-weight: 600;
}

/* ============================================
   CHAR REVEAL
   ============================================ */
.char-reveal span {
  display: inline-block;
  opacity: 0;
  filter: blur(8px);
  transition: opacity 1s cubic-bezier(0.22,1,0.36,1),
              filter  1s cubic-bezier(0.22,1,0.36,1);
}

.char-reveal.show span { opacity: 1; filter: blur(0); }

/* ============================================
   GLASS NOISE OVERLAY
   ============================================ */
.glass-noise { position: relative; }

.glass-noise::before {
  content: '';
  position: absolute;
  left: -10%; top: -10%;
  width: 120%; height: 120%;
  z-index: 3;
  pointer-events: none;
  opacity: 0.08;
  background:
    linear-gradient(135deg, rgba(255,255,255,0.25) 0%, rgba(255,255,255,0.05) 100%),
    url('data:image/svg+xml,<svg xmlns="http://www.w3.org/2000/svg" width="200" height="200"><filter id="n"><feTurbulence type="fractalNoise" baseFrequency="0.75" numOctaves="4" stitchTiles="stitch"/><feColorMatrix type="saturate" values="0"/></filter><rect width="200" height="200" filter="url(%23n)" opacity="0.5"/></svg>');
  background-repeat: no-repeat, repeat;
  background-size: cover, 80px;
  background-blend-mode: overlay;
  will-change: transform;
  animation: glassMove 40s linear infinite;
}

@keyframes glassMove {
  0%   { transform: translate3d(0,0,0); }
  50%  { transform: translate3d(-5%,-5%,0); }
  100% { transform: translate3d(0,0,0); }
}

/* ============================================
   ARROW
   ============================================ */
.arr {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  margin-left: 10px;
  transform: rotate(-45deg);
  transform-origin: center;
  transition: all 0.35s ease;
  font-weight: 400;
  font-size: 1.3em;
}

.arr:hover { transform: rotate(0deg); }

/* ============================================
   BUTTONS
   ============================================ */
.more-btn {
  font-size: clamp(20px, 1.667vw, 32px);
  border: 2px solid var(--black);
  border-radius: 50px;
  padding: 0 clamp(10px, 1vw, 20px) 0 clamp(20px, 1.5vw, 30px);
  display: inline-flex;
  align-items: center;
}

.more-btn:hover .arr { transform: rotate(0deg); }

/* ============================================
   DOTS ANIMATION
   ============================================ */
.dots {
  position: absolute;
  top: clamp(4px, 0.573vw, 11px);
  width: 24px; height: 24px;
  margin-left: clamp(-40px, -3vw, -30px);
  animation: dotsSpin 2.6s cubic-bezier(0.4,0,0.2,1) infinite;
}

.dots i {
  position: absolute;
  top: 50%; left: 50%;
  width: 5px;
  aspect-ratio: 1;
  background: var(--black);
  border-radius: 50%;
  transform: translate(-50%,-50%);
  animation: dotsSpread 2.6s cubic-bezier(0.4,0,0.2,1) infinite;
}

.dots i:nth-child(1) { --dx: -5px; --dy: -5px; }
.dots i:nth-child(2) { --dx:  5px; --dy: -5px; }
.dots i:nth-child(3) { --dx: -5px; --dy:  5px; }
.dots i:nth-child(4) { --dx:  5px; --dy:  5px; }

.dots.big {
  margin: 0;
  left: 50%; top: 50%;
  margin-top: -20px; margin-left: -20px;
  width: 40px; height: 40px;
}

.dots.big i { width: 8px; background: var(--beige); }

@keyframes dotsSpread {
  0%   { transform: translate(-50%,-50%) scale(1); }
  40%  { transform: translate(calc(-50% + var(--dx)), calc(-50% + var(--dy))) scale(1); }
  60%  { transform: translate(calc(-50% + var(--dx)), calc(-50% + var(--dy))) scale(1); }
  100% { transform: translate(-50%,-50%) scale(1); }
}

@keyframes dotsSpin {
  0%   { transform: rotate(45deg); }
  40%  { transform: rotate(135deg); }
  60%  { transform: rotate(135deg); }
  100% { transform: rotate(225deg); }
}

/* ============================================
   BADGE
   ============================================ */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  vertical-align: top;
}

.badge-dot {
  display: block;
  width: 8px;
  aspect-ratio: 1;
  border-radius: 50%;
  background: var(--black);
}

.badge-dot.gold { background: #c9a227; }

/* ============================================
   CURSOR
   ============================================ */
.cursor {
  position: fixed;
  top: 0; left: 0;
  pointer-events: none;
  z-index: 9999;
  background: var(--primary);
  overflow: hidden;
  padding: 3px 5px;
  font-size: 17px;
  display: flex;
  align-items: center;
  justify-content: center;
  white-space: nowrap;
}

.cursor-label {
  position: fixed;
  top: -10px; left: 60px;
  z-index: 9999;
  padding: 3px 0;
  line-height: 1.2;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  white-space: nowrap;
  pointer-events: none;
  transform: translate(-50%,-50%);
  will-change: transform;
  font-size: 17px;
  color: var(--black);
  background: var(--primary);
}

.cursor-track {
  display: flex;
  gap: 20px;
  min-width: max-content;
  will-change: transform;
}

.cursor-track span { display: inline-block; }

.cursor-follow {
  position: fixed;
  top: 0; left: 0;
  pointer-events: none;
  z-index: 9999;
  background: var(--primary);
  overflow: hidden;
  padding: 3px 5px;
  font-size: 17px;
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  line-height: 1.2;
  white-space: nowrap;
}

/* Disable custom cursor on touch / tablet devices */
@media (pointer: coarse), (hover: none), (max-width: 1024px) {
  body { cursor: auto !important; }
  .cursor, .cursor-label, .cursor-follow, #cursor, #cursor-follower { display: none !important; }
  a, button { cursor: auto !important; }
}

/* ============================================
   TEXT SECTION (intro)
   ============================================ */
.text-section {
  position: relative;
  z-index: 1;
  display: flex;
  flex-direction: column;
  gap: 100px;
  padding: clamp(50px, 10vw, 200px) clamp(20px, 1.5vw, 30px) 0;
}

.flex-txt {
  position: relative;
  display: flex;
  padding-bottom: clamp(40px, 4vw, 80px);
  flex-direction: column;
  gap: clamp(5px, 1vw, 20px);
  padding-left: 45%;
}

.text-section .flex-txt::before {
  content: '';
  position: absolute;
  left: 0; bottom: 0;
  width: 100%; height: 3px;
  background: radial-gradient(circle, var(--black) 1.5px, transparent 1.5px) 0 50% / 14px 14px repeat-x;
  animation: dotFlow 2s linear infinite;
}

@keyframes dotFlow { to { background-position: 14px 50%; } }

.flex-side { }

.flex-content {
  position: relative;
  max-width: 530px;
  display: flex;
  flex-direction: column;
  gap: 30px;
}

.flex-content p {
  font-size: clamp(14px, 0.99vw, 19px);
  line-height: 1.5;
}

/* ============================================
   BLOB ICONS
   ============================================ */
.icon { width: 30px; aspect-ratio: 1; }

.blob {
  display: inline-block;
  background: var(--primary);
  animation-duration: 3s;
  animation-iteration-count: infinite;
  animation-direction: alternate;
  animation-timing-function: ease-in-out;
}

.b1 { width:16px; height:26px; border-radius:50%; box-shadow:12px 0 0 var(--primary); animation-name: blobMove1; }
.b2 { width:17px; height:17px; border-radius:50%; box-shadow:10px 0 0 var(--primary), 0 10px 0 var(--primary), 10px 10px 0 var(--primary); animation-name: blobMove2; }
.b3 { width:16px; height:28px; border-radius:100px 0 0 100px; box-shadow:12px 0 0 var(--primary); animation-name: blobMove3; }
.b4 { width:32px; height:20px; border-radius:40px; transform:rotate(-12deg); animation-name: blobMove1; }
.b5 { position:relative; width:34px; height:34px; background:none; animation-name: blobMove2; }
.b5::before, .b5::after { content:''; position:absolute; width:22px; height:14px; background:var(--primary); border-radius:3px; left:50%; top:50%; }
.b5::before { transform:translate(-50%,-100%) rotate(45deg); }
.b5::after  { transform:translate(-50%,-15%) rotate(45deg); }
.b6 { width:36px; height:26px; border-radius:50%; clip-path:polygon(50% 0%,100% 100%,0% 100%); animation-name: blobMove3; }
.b7 { width:26px; height:28px; border-radius:38% 62% 48% 52%; transform:rotate(8deg); animation-name: blobMove1; }
.b8 { position:relative; width:30px; height:30px; overflow:hidden; animation-name: blobMove2; }
.b8::before, .b8::after { content:''; position:absolute; width:30px; height:18px; background:var(--beige); border-radius:50%; left:50%; transform:translateX(-50%); }
.b8::before { top:-9px; }
.b8::after  { bottom:-9px; }

@keyframes blobMove1 { 0% { transform:rotate(0); }    100% { transform:rotate(14deg) translateX(8px); } }
@keyframes blobMove2 { 0% { transform:translateY(0) rotate(0); } 100% { transform:translateY(-8px) rotate(20deg); } }
@keyframes blobMove3 { 0% { transform:rotate(0); }    100% { transform:rotate(-18deg) translateX(-8px); } }

/* ============================================
   SCRAMBLE TEXT
   ============================================ */
.word  { display: inline-block; position: relative; }
.char  { display: inline-block; will-change: transform, filter; }

/* ============================================
   LIVE CLOCK — digit flip
   ============================================ */
.live-time {
  display: inline-flex;
  align-items: center;
  gap: 1px;
  font-variant-numeric: tabular-nums;
  letter-spacing: 0;
  line-height: 1;
}

.digit {
  position: relative;
  display: inline-block;
  overflow: hidden;
  height: 1.1em;
  width: 0.65em;
  vertical-align: middle;
}

.digit-cur,
.digit-next {
  position: absolute;
  top: 0; left: 0;
  width: 100%;
  text-align: center;
  line-height: 1.1;
}

.digit-next {
  transform: translateY(100%);
  opacity: 0;
}

.clock-sep {
  display: inline-block;
  vertical-align: middle;
  margin: 0 1px;
  opacity: 0.5;
  animation: sepBlink 1s step-start infinite;
}

@keyframes sepBlink {
  0%, 100% { opacity: 0.5; }
  50%       { opacity: 0.15; }
}

.clock-ampm {
  display: inline-block;
  vertical-align: middle;
  margin-left: 4px;
  font-size: 0.75em;
  opacity: 0.6;
  overflow: hidden;
  position: relative;
  height: 1.1em;
  line-height: 1.1;
}

/* ============================================
   RESPONSIVE — common
   ============================================ */
@media (max-width: 1024px) {
  .hd-contact { display: none; }
  .hd-copy    { display: none; }
}

@media (max-width: 768px) {
  .header {
    height: 52px;
    padding: 0 20px;
    box-sizing: border-box;
    display: flex;
    align-items: center;
  }
  .header .hd-inner {
    display: flex;
    justify-content: space-between;
    align-items: center;
    height: 100%;
    width: 100%;
    gap: 0;
  }
  
  .header .hd-logo {
    font-size: 22px;
    margin: 0;
    z-index: 201;
  }
  
  .header .hd-toggle {
    display: block;
    margin-left: auto;
    width: 52px;
    height: 52px;
    position: relative;
    z-index: 201;
  }
  
  .hd-toggle span {
    background: var(--black);
    width: 24px;
    height: 2px;
  }
  .hd-toggle span:nth-child(1) { top: 21px; transform: translateX(-50%); }
  .hd-toggle span:nth-child(2) { top: 29px; transform: translateX(-50%); }

  /* menu open state */
  body.menu-open::after {
    display: none; /* 기존 흰색 오버레이 비활성화 */
  }
  /* menu-open 시 헤더 자체의 백드롭 필터 해제하여 fixed 자식이 부모에 갇히지 않게 함 */
  body.menu-open .header {
    background: transparent !important;
    backdrop-filter: none !important;
    -webkit-backdrop-filter: none !important;
  }
  body.menu-open .header .hd-logo a {
    color: var(--white) !important;
  }
  body.menu-open .header .hd-toggle span {
    background: var(--white) !important;
  }
  body.menu-open .header .hd-toggle span:nth-child(1) {
    top: 25px;
    transform: translateX(-50%) rotate(45deg);
  }
  body.menu-open .header .hd-toggle span:nth-child(2) {
    top: 25px;
    transform: translateX(-50%) rotate(-45deg);
  }

  /* 반응형 전용 메뉴 UI (hd-nav) - fixed로 뷰포트 전체 차지 */
  .header .hd-nav {
    position: fixed;
    inset: 0;
    width: 100vw;
    height: 100vh;
    background: rgba(10, 10, 10, 0.95);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    gap: 30px;
    opacity: 0;
    pointer-events: none;
    transform: translateY(-10px);
    transition: opacity 0.4s ease, transform 0.4s ease;
    z-index: 200;
    box-sizing: border-box;
  }
  body.menu-open .header .hd-nav {
    opacity: 1;
    pointer-events: auto;
    transform: none;
  }
  .header .hd-nav a {
    font-size: 28px;
    color: var(--white);
    text-transform: uppercase;
    font-weight: 600;
  }
  .header .hd-nav a:hover {
    opacity: 0.6;
  }

  .footer-bottom { flex-direction: column; gap: 12px; }
  .footer-bottom > div { width: 100%; text-align: left !important; }

  .flex-txt { padding-left: 0; }
  .flex-side { padding-left: 30px; }
  .text-section { gap: 60px; }
}
