/* ============================================================
   family/main.css — 메인 2종(main01 슬로건 왼쪽 · main02 슬로건 중앙) 공통
   소유: main01·main02 워커 1인. 페이지 CSS 는 레이아웃(카피·컨트롤)만 얹는다.
   시안: Cover02 main01-01 176:40234 · main01-02 233:21582 · main02-01 233:21708 · main02-02 224:21467
   (1920×920 풀스크린 첫 화면 — 헤더는 공유 data-chrome="dark" 가 위에 겹친다)
   ============================================================ */

.mh-main { background: var(--navy-900); }

/* ── 히어로 셸 — 1920×920 = 첫 화면 전체 (헤더가 위에 겹침) ── */
.mh {
  --mh-rail: 1520px;                           /* 시안: 좌우 200 @1920 (서브 레일 1400 과 다름) */
  --mh-fade: 1.1s;                             /* 슬라이드 크로스페이드 */
  position: relative;
  height: 100vh;
  height: 100svh;
  min-height: 560px;
  overflow: hidden;
  color: #ffffff;
  background: var(--navy-900);
  isolation: isolate;
}
.mh-rail { width: min(var(--mh-rail), calc(100% - var(--gutter) * 2)); margin-inline: auto; }

/* ── 슬라이드 스택 — 고정 슬롯, 페이드 교체 ── */
.mh-slides { position: absolute; inset: 0; z-index: 0; margin: 0; padding: 0; list-style: none; }
.mh-slide {
  position: absolute;
  inset: 0;
  overflow: hidden;
  opacity: 0;
  z-index: 0;
}
.mh-slide.is-active { opacity: 1; z-index: 2; }
.mh-slide.is-prev   { opacity: 1; z-index: 1; }
/* 첫 페인트에는 전환을 걸지 않는다 — JS 가 두 프레임 뒤 .is-ready 를 붙인다 (motion §6) */
.mh.is-ready .mh-slide { transition: opacity var(--mh-fade) var(--ease); }
.mh.is-ready .mh-slide.is-prev { transition: none; }

.mh-slide__img,
.mh-slide__blur {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: var(--mh-pos, 50% 50%);
  transform: scale(var(--mh-zoom, 1));
  transform-origin: var(--mh-origin, 50% 50%);
  max-width: none;
}

/* Progressive blur — 시안 IMG 레이어(블러 효과): 왼쪽 약한 블러 → 오른쪽 선명.
   블러 복제 레이어 + mask 그라데이션 (렌더 대조로 추정한 값 — notes.md) */
.mh-slide__blur {
  filter: blur(clamp(2px, 0.21vw, 4px));
  -webkit-mask-image: linear-gradient(to right, #000 0%, #000 36%, transparent 62%);
          mask-image: linear-gradient(to right, #000 0%, #000 36%, transparent 62%);
  pointer-events: none;
}

/* 오버레이 — 이미지마다 시안 프레임의 값을 그대로 (이미지가 어느 메인에 있든 같은 처리) */
.mh-ov { position: absolute; left: 0; right: 0; pointer-events: none; }
.mh-ov--full   { top: 0; bottom: 0; }
.mh-ov--top    { top: 0; height: 23.9%; background: linear-gradient(to bottom, rgba(0,0,0,.45), rgba(0,0,0,0)); }   /* 220/920 */
.mh-ov--bottom { bottom: 0; height: 31.1%; }                                                                        /* 634→920 (300 중 286) */

/* 비료·들판 (main01-01 176:40234) */
.mh-slide[data-key="field"] .mh-ov--full   { background: linear-gradient(to right, rgba(0,0,0,.09) 0%, rgba(0,0,0,.09) 44.231%, rgba(0,0,0,0) 100%); }
.mh-slide[data-key="field"] .mh-ov--top    { height: 27%; background: linear-gradient(to bottom, rgba(0,0,0,.38), rgba(0,0,0,0)); }   /* -12→248 */
.mh-slide[data-key="field"] .mh-ov--bottom { height: 19.5%; background: linear-gradient(to bottom, rgba(0,0,0,0), rgba(0,0,0,.8)); } /* 741→920 */
/* 비료·포대 (main01-02 233:21582) — tone 0.3 × opacity 0.3 */
.mh-slide[data-key="bags"]   .mh-ov--full   { background: rgba(0,0,0,.09); }
.mh-slide[data-key="bags"]   .mh-ov--bottom { background: linear-gradient(to bottom, rgba(0,0,0,0), rgba(0,0,0,.667)); }
.mh-slide[data-key="bags"]   { --mh-pos: 50% 50%; }
/* 시멘트·공장 (main02-01 233:21708) — 남색 톤 + 중앙 비네트 */
.mh-slide[data-key="plant"]  .mh-ov--full   {
  background:
    radial-gradient(ellipse 66.67% 55.56% at 50% 52.2%, rgba(11,28,69,.55) 0%, rgba(11,28,69,.25) 55%, rgba(11,28,69,0) 100%),
    rgba(11,28,69,.22);
}
.mh-slide[data-key="plant"]  .mh-ov--bottom { background: linear-gradient(to bottom, rgba(11,28,69,0), rgba(11,28,69,.667)); }
/* 시멘트·미분말 (main02-02 224:21467) — 시안 크롭: 폭 111.46% · 좌 -8.6% · 상 -19.28% = cover 후 1.1146배, 기준점 75% 83.3% */
.mh-slide[data-key="powder"] .mh-ov--full   { background: rgba(0,0,0,.15); }
.mh-slide[data-key="powder"] .mh-ov--bottom { background: linear-gradient(to bottom, rgba(0,0,0,0), rgba(0,0,0,.572)); }
.mh-slide[data-key="powder"] { --mh-zoom: 1.1146; --mh-origin: 75% 83.3%; }

/* 좁은 폭 — 세로 화면에서 피사체가 보이도록 크롭 위치만 이동 */
@media (max-width: 839.98px) {
  .mh-slide[data-key="bags"]   { --mh-pos: 72% 50%; }
  .mh-slide[data-key="plant"]  { --mh-pos: 66% 50%; }
  .mh-slide[data-key="powder"] { --mh-pos: 72% 50%; --mh-origin: 72% 70%; }
  .mh-slide__blur { -webkit-mask-image: linear-gradient(to right, #000 0%, #000 20%, transparent 50%); mask-image: linear-gradient(to right, #000 0%, #000 20%, transparent 50%); }
}

/* ── 하단 법적 고지 행 — 시안: 히어로 하단 y880 (푸터 인스턴스 없음) ── */
.mh-legal {
  position: absolute;
  z-index: 5;
  left: 0; right: 0;
  bottom: clamp(4px, 0.55vw, 10px);     /* 글자 y880~895 = 44 행(중앙 정렬)의 하단 10 */
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0 24px;
  font-size: 12px;
  line-height: 1.25;
}
.mh-legal__copy {
  margin: 0;
  font-family: var(--font-latin);
  font-weight: 400;                 /* 시안 Outfit Light 300 — 미로딩, 가장 가까운 400 (공유 후보) */
  letter-spacing: 1px;
  color: rgba(255,255,255,.5);
}
.mh-legal__link {
  display: inline-flex;
  align-items: center;
  min-height: var(--hit-min);          /* 터치 44 — 행 높이 44 안에서 글자 세로 중앙 */
  color: rgba(255,255,255,.6);
}

/* ── 히어로 버튼 — 공유 .btn 위에 얹는 로컬 크기·변형 (시안 Button 7:81 Primary / 7:89 Ghost-white)
   시안: 좌 28 · 우 24 · 상하 15 · 16 Bold · 높이 49(Ghost 51, 1px 테두리). 공유 .btn 는 서브 크기라 다름 → 공유 후보 */
.mh-btn { padding: 15px 24px 15px 28px; line-height: 1.2; }
.mh-btn--ghost { background: transparent; border: 1px solid #ffffff; }
.mh-btn--ghost:hover { background: transparent; }

/* 컨트롤 공통 — 키보드 포커스는 base.css 공유 규칙 */
.mh button { -webkit-tap-highlight-color: transparent; }

/* ── 슬라이드 전환 시 카피 페이드 (11-18 지시: "슬라이드 될때마다 텍스트가 페이드") ──
   이미지 크로스페이드(1.1s) 동안 문구가 잠깐 옅어졌다가 아래에서 떠오른다. 자식 순차 80ms. */
[data-hero-copy].is-swap > * { animation: mh-copy-in 1s cubic-bezier(.22, .61, .36, 1) both; }
[data-hero-copy].is-swap > *:nth-child(2) { animation-delay: .08s; }
[data-hero-copy].is-swap > *:nth-child(3) { animation-delay: .16s; }
[data-hero-copy].is-swap > *:nth-child(4) { animation-delay: .24s; }
@keyframes mh-copy-in {
  0%   { opacity: 1; transform: none; }
  22%  { opacity: 0; transform: translateY(0); }
  23%  { opacity: 0; transform: translateY(18px); }
  100% { opacity: 1; transform: none; }
}
/* ── 첫 진입 페이드 (11-18 지시: "메인시안 둘 다 처음 딱 켜질때도 페이드") ──
   CSS 애니메이션이라 첫 페인트부터 걸린다(깜빡임 없음). 순서: 이미지(남색 바탕에서 서서히 + 살짝 줌아웃)
   → 카피 자식 순차로 아래에서 → 컨트롤(빠른메뉴·화살표·탭·카운터) 마지막. 위치는 translate 속성이라 transform 애니메이션과 겹치지 않는다.
   첫 슬라이드 전환 때 .is-swap 이 붙으면 카피는 전환 애니메이션으로 넘어간다. */
.mh-slides { animation: mh-intro-img 1.8s cubic-bezier(.22, .61, .36, 1) both; }
[data-hero-copy]:not(.is-swap) > * { animation: mh-intro-up 1.1s cubic-bezier(.22, .61, .36, 1) .45s both; }
[data-hero-copy]:not(.is-swap) > *:nth-child(2) { animation-delay: .57s; }
[data-hero-copy]:not(.is-swap) > *:nth-child(3) { animation-delay: .69s; }
[data-hero-copy]:not(.is-swap) > *:nth-child(4) { animation-delay: .81s; }
.mh > :not(.mh-slides):not([data-hero-copy]) { animation: mh-intro-fade .9s ease 1s both; }
@keyframes mh-intro-img  { from { opacity: 0; transform: scale(1.06); } to { opacity: 1; transform: none; } }
@keyframes mh-intro-up   { from { opacity: 0; transform: translateY(28px); } to { opacity: 1; transform: none; } }
@keyframes mh-intro-fade { from { opacity: 0; } to { opacity: 1; } }

@media (prefers-reduced-motion: reduce) { [data-hero-copy] > *, .mh-slides, .mh > * { animation: none !important; } }
