/* ============================================================
   아이오코딩 — ELEVATE layer
   시네마틱 로딩 · accent-gradient · serif 포인트 · 링 호버 · 마퀴
   (기법/퀄리티 이식: 스토리를 연출로 살리는 레이어)
   ============================================================ */

:root {
  /* on-brand accent gradient (rings, progress, hovers) */
  --grad: linear-gradient(100deg, #FFB07A 0%, #FF6A2B 46%, #E8470F 100%);
  --grad-soft: linear-gradient(100deg, rgba(255,176,122,.9), rgba(232,71,15,.9));
  --serif: 'Instrument Serif', 'Pretendard', Georgia, serif;
}

/* editorial serif accent — Latin/number only (eyebrows, indices, .io labels) */
.serif { font-family: var(--serif); font-style: italic; font-weight: 400; letter-spacing: 0; }

.accent-gradient { background: var(--grad); }

/* ============================================================
   LOADING SCREEN
   ============================================================ */
.loader {
  position: fixed; inset: 0; z-index: 9999;
  background: var(--navy); color: #fff;
  display: grid; grid-template-rows: auto 1fr auto;
  padding: clamp(20px, 4vw, 48px);
  overflow: hidden;
  transition: opacity .7s var(--ease), visibility .7s var(--ease);
}
/* 화이트/라이트 배경 트윅 — 로더도 함께 전환(텍스트/카운터/바 색 대응) */
body:is([data-bg="light"],[data-bg="white"]) .loader { background: var(--paper-2); color: var(--navy); }
body:is([data-bg="light"],[data-bg="white"]) .loader__top { color: rgba(14,33,67,.45); }
body:is([data-bg="light"],[data-bg="white"]) .loader__sub { color: rgba(14,33,67,.4); }
body:is([data-bg="light"],[data-bg="white"]) .loader__count { color: var(--navy); }
body:is([data-bg="light"],[data-bg="white"]) .loader__bar { background: rgba(14,33,67,.1); }
.loader.done { opacity: 0; visibility: hidden; pointer-events: none; }
.loader__top { font-size: .72rem; letter-spacing: .34em; text-transform: uppercase; color: rgba(255,255,255,.5); }
.loader__mid { display: grid; place-items: center; padding-inline: 6vw; }
/* 물 차오름 워드: base(은은한 외곽 글씨) 위에 fill(흰 글씨)이 아래→위로 차오름.
   두 레이어를 정확히 겹쳐 같은 글자를 쓰되, fill 은 clip-path 로 수위를 올린다. */
.loader__word {
  position: relative; display: inline-block;
  font-family: var(--sans); font-weight: 800; font-style: normal;
  font-size: clamp(2.4rem, 8.4vw, 6.4rem); line-height: 1.1; letter-spacing: -.03em;
  text-align: center; white-space: nowrap;
}
/* 일반 텍스트(핵심어 아님): 은은한 흰색 */
.loader__word .lw-plain { color: rgba(255,255,255,.42); }

/* 핵심어 물차오름 — background-clip:text 로 "글자 모양 안에만" 물이 채워진다.
   ① 글자 자체 색은 흐린 윤곽(아직 물 밖).
   ② ::before 가 흰 물. 물 표면은 wavy gradient + 좌우로 흐르는 애니메이션,
      차오름은 --level(0→100%) 을 transition 으로 끌어올려 표현. */
.loader__word .lw-key {
  position: relative; display: inline-block;
  color: rgba(255,255,255,.2);                 /* 물 밖(흐린 윤곽) */
  background: none;
}
.loader__word .lw-key::before {
  content: attr(data-t);
  position: absolute; inset: 0;
  --level: 0%;                                  /* 수위 (0=바닥) */
  color: transparent;
  background:
    /* ① 수면 물결: 좌우로 흐르는 둥근 파동(밝은 마루) */
    radial-gradient(120% 14px at 0% calc(100% - var(--level)), rgba(255,255,255,.95), rgba(255,255,255,0) 70%),
    radial-gradient(120% 14px at 50% calc(100% - var(--level) + 5px), rgba(255,255,255,.95), rgba(255,255,255,0) 70%),
    radial-gradient(120% 14px at 100% calc(100% - var(--level)), rgba(255,255,255,.95), rgba(255,255,255,0) 70%),
    /* ② 물 본체: 수위 아래는 흰색 채움 */
    linear-gradient(to top, #fff calc(100% - var(--level)), transparent calc(100% - var(--level)));
  background-repeat: repeat-x, repeat-x, repeat-x, no-repeat;
  background-size: 60px 100%, 80px 100%, 70px 100%, 100% 100%;
  -webkit-background-clip: text; background-clip: text;
  transition: --level 1.15s cubic-bezier(.3,0,.3,1);
  animation: lwWave 1.5s linear infinite;        /* 물 표면 좌우 요동 */
}
.loader__word .lw-key.is-filled::before { --level: 110%; }
/* 좌우 물결: 마루 레이어들의 x 위치를 서로 다른 속도로 흘려 출렁이게 */
@keyframes lwWave {
  0%   { background-position:   0px 0,   0px 0,   0px 0, 0 0; }
  100% { background-position: 60px 0, -80px 0,  70px 0, 0 0; }
}
/* --level 을 애니메이트 가능한 커스텀 속성으로 등록 */
@property --level { syntax: '<length-percentage>'; inherits: false; initial-value: 0%; }

/* 화이트 배경 트윅 — 물색을 네이비로 */
body:is([data-bg="light"],[data-bg="white"]) .loader__word .lw-plain { color: rgba(14,33,67,.4); }
body:is([data-bg="light"],[data-bg="white"]) .loader__word .lw-key { color: rgba(14,33,67,.16); }
body:is([data-bg="light"],[data-bg="white"]) .loader__word .lw-key::before {
  background:
    radial-gradient(120% 14px at 0% calc(100% - var(--level)), rgba(14,33,67,.95), rgba(14,33,67,0) 70%),
    radial-gradient(120% 14px at 50% calc(100% - var(--level) + 5px), rgba(14,33,67,.95), rgba(14,33,67,0) 70%),
    radial-gradient(120% 14px at 100% calc(100% - var(--level)), rgba(14,33,67,.95), rgba(14,33,67,0) 70%),
    linear-gradient(to top, var(--navy) calc(100% - var(--level)), transparent calc(100% - var(--level)));
  background-repeat: repeat-x, repeat-x, repeat-x, no-repeat;
  background-size: 60px 100%, 80px 100%, 70px 100%, 100% 100%;
  -webkit-background-clip: text; background-clip: text;
}
@media (prefers-reduced-motion: reduce) {
  .loader__word .lw-key::before { transition: none; animation: none; --level: 108%; }
}

.loader__bottom { display: flex; align-items: flex-end; justify-content: space-between; gap: 1rem; }
.loader__sub { font-size: .8rem; color: rgba(255,255,255,.45); max-width: 22ch; line-height: 1.5; }
.loader__count {
  font-family: var(--serif); font-style: italic; font-weight: 400;
  font-size: clamp(3.6rem, 11vw, 8.5rem); line-height: .82; letter-spacing: -.02em;
  font-variant-numeric: tabular-nums; color: #fff; padding-right: .04em;
}
.loader__bar { position: absolute; left: 0; right: 0; bottom: 0; height: 3px; background: rgba(255,255,255,.12); }
.loader__fill { height: 100%; width: 100%; transform: scaleX(0); transform-origin: left;
  background: var(--grad); box-shadow: 0 0 12px rgba(255,106,43,.5); transition: transform .15s linear; }

/* lock scroll while loading */
body.is-loading { overflow: hidden; height: 100vh; }

@media (prefers-reduced-motion: reduce) {
  .loader__word.swap { animation: none; }
}

/* ============================================================
   GRADIENT-RING HOVER  (buttons / cards / CTAs)
   the gradient border lives in a ::before that fades in on hover
   ============================================================ */
.ring { position: relative; isolation: isolate; }
.ring::before {
  content: ""; position: absolute; inset: -2px; border-radius: inherit; z-index: -1;
  background: var(--grad); opacity: 0; transition: opacity .4s var(--ease);
  background-size: 200% 100%;
}
.ring:hover::before { opacity: 1; animation: ringShift 4s ease infinite; }
@keyframes ringShift { 0%,100% { background-position: 0% 50%; } 50% { background-position: 100% 50%; } }

/* ghost button → on hover reveal gradient ring instead of solid navy fill */
.btn-ghost.ring { transition: transform .35s var(--ease), color .35s var(--ease); }
.btn-ghost.ring::after {
  content: ""; position: absolute; inset: 0; border-radius: inherit; z-index: -1;
  background: var(--bg); transition: background .35s var(--ease);
}
.hero .btn-ghost.ring::after { background: var(--navy); }
.btn-ghost.ring:hover { color: #fff; border-color: transparent; transform: translateY(-3px); }

/* cta cards (contact) get the ring too */
.cta-card.ring { border-radius: 18px; }
.cta-card.ring::before { inset: -1.5px; }

/* ============================================================
   MARQUEE band (connective tissue between acts)
   ============================================================ */
.marquee {
  position: relative; overflow: hidden; padding: clamp(2.2rem, 5vw, 4rem) 0;
  background: var(--navy); color: #fff; border-block: 1px solid var(--line-navy);
}
.marquee__row { display: flex; width: max-content; will-change: transform; }
.marquee__row span {
  font-family: var(--sans); font-weight: 800; font-style: normal; font-size: clamp(1.5rem, 3.4vw, 2.8rem);
  letter-spacing: -.02em; white-space: nowrap; padding-right: .7em; color: rgba(255,255,255,.92);
}
.marquee__row span em { color: var(--orange); font-style: normal; font-weight: 800; }
.marquee__row span i { color: var(--orange-soft); font-style: normal; margin: 0 .45em; font-size: .8em; vertical-align: middle; }
.marquee--light { background: var(--paper-2); color: var(--navy); border-color: var(--line); }
.marquee--light .marquee__row span { color: var(--navy); }

/* ============================================================
   SCROLL PROGRESS — make the existing rail a gradient
   ============================================================ */
.scroll-rail__fill { background: var(--grad) !important; }

/* a slim vertical "story spine" dot that rides the side (desktop) */
.spine { position: fixed; right: 22px; top: 50%; transform: translateY(-50%); z-index: 90; display: none; flex-direction: column; gap: 10px; }
@media (min-width: 1100px) { .spine { display: flex; } }
.spine a { width: 8px; height: 8px; border-radius: 50%; background: var(--line); transition: all .35s var(--ease); position: relative; }
.spine a.on { background: var(--orange); transform: scale(1.5); }
.spine a::after { content: attr(data-label); position: absolute; right: 18px; top: 50%; transform: translateY(-50%); white-space: nowrap; font-size: .68rem; font-weight: 700; letter-spacing: .04em; color: var(--navy); opacity: 0; pointer-events: none; transition: opacity .3s; }
.spine a:hover::after { opacity: 1; }
body[data-bg="dark"] .spine a::after, .nav.on-dark ~ * .spine a::after { color: #fff; }

/* ============================================================
   CUSTOM CURSOR — orange ring, mix-blend-difference, spring follow
   (faithful to the reference: native cursor stays; ring is an overlay)
   ============================================================ */
.cursor {
  position: fixed; top: 0; left: 0; width: 32px; height: 32px; z-index: 100;
  border: 1px solid var(--orange); border-radius: 50%;
  pointer-events: none; mix-blend-mode: difference;
  transform: translate(-50px, -50px); will-change: transform;
  display: none;
}
.cursor__dot { position: absolute; inset: 10px; background: var(--orange); border-radius: 50%; }
.cursor.is-hover { width: 56px; height: 56px; }
.cursor.is-hover .cursor__dot { inset: 24px; opacity: .4; }
/* only on fine-pointer (desktop) devices */
@media (hover: hover) and (pointer: fine) {
  .cursor { display: block; }
}
@media (prefers-reduced-motion: reduce) { .cursor { display: none !important; } }

/* ============================================================
   PROBLEM frags on white-bg mode
   ============================================================ */
body[data-bg="white"] .frag { background: #fff; border-color: #E7EAF0; }
body[data-bg="white"] .frag--muted { background: #F6F8FB; }

/* ============================================================
   상담 신청 모달 (consult)
   ============================================================ */
body.cmodal-open { overflow: hidden; }
.cmodal { position: fixed; inset: 0; z-index: 1000; display: grid; place-items: center; padding: clamp(16px, 4vw, 40px); }
.cmodal[hidden] { display: none; }
.cmodal__backdrop { position: absolute; inset: 0; background: rgba(8,18,38,.62); backdrop-filter: blur(4px); opacity: 0; transition: opacity .28s var(--ease); }
.cmodal.is-open .cmodal__backdrop { opacity: 1; }
.cmodal__panel {
  position: relative; z-index: 1; width: min(480px, 100%); max-height: 92vh; overflow: auto;
  background: var(--paper-2); color: var(--navy); border-radius: 22px;
  padding: clamp(1.6rem, 4vw, 2.4rem); box-shadow: 0 40px 100px -30px rgba(8,18,38,.7);
  transform: translateY(16px) scale(.98); opacity: 0; transition: transform .3s var(--ease-io), opacity .3s var(--ease);
}
.cmodal.is-open .cmodal__panel { transform: none; opacity: 1; }
.cmodal__x { position: absolute; top: 14px; right: 16px; width: 34px; height: 34px; border-radius: 50%; font-size: 1rem; color: var(--navy-soft); background: var(--ivory); }
.cmodal__x:hover { background: var(--line); }
.cmodal__eyebrow { font-size: .72rem; font-weight: 800; letter-spacing: .16em; text-transform: uppercase; color: var(--orange); }
.cmodal__title { font-size: clamp(1.4rem, 3.6vw, 1.9rem); font-weight: 800; letter-spacing: -.02em; margin: .5rem 0 .5rem; }
.cmodal__lead { font-size: .95rem; color: var(--navy-soft); line-height: 1.6; margin-bottom: 1.3rem; }
.cform { display: flex; flex-direction: column; gap: .9rem; }
.cform__row { display: flex; flex-direction: column; gap: .35rem; }
.cform__k { font-size: .82rem; font-weight: 700; color: var(--navy); }
.cform__k i { color: var(--orange); font-style: normal; }
.cform input, .cform textarea {
  font-family: inherit; font-size: 1rem; color: var(--navy);
  padding: .8em .9em; border: 1.5px solid var(--line); border-radius: 12px; background: var(--paper); width: 100%;
  transition: border-color .2s var(--ease);
}
.cform input:focus, .cform textarea:focus { outline: none; border-color: var(--orange); }
.cform textarea { resize: vertical; min-height: 70px; }
.cform__msg { font-size: .86rem; min-height: 1.1em; color: var(--navy-soft); }
.cform__msg.is-error { color: var(--orange-deep); font-weight: 600; }
.cform__submit { justify-content: center; margin-top: .3rem; }
.cform__submit[disabled] { opacity: .6; pointer-events: none; }
.cform__note { font-size: .76rem; color: var(--navy-soft); text-align: center; }
.cform__done { text-align: center; display: flex; flex-direction: column; align-items: center; gap: .7rem; padding: 1.5rem 0 .5rem; }
.cform__done[hidden] { display: none; }
.cform__check { width: 56px; height: 56px; border-radius: 50%; background: rgba(31,157,99,.14); color: #1f9d63; font-size: 1.7rem; display: grid; place-items: center; }
.cform__done b { font-size: 1.2rem; font-weight: 800; }
.cform__done p { font-size: .92rem; color: var(--navy-soft); line-height: 1.6; }
/* cta-card 가 button 일 때도 좌측 정렬 유지 */
.contact__cta button.cta-card { text-align: left; font: inherit; width: 100%; cursor: pointer; }
