/* ============================================================
   shared/hero.css — 풀스크린(100vw × 100vh) 히어로 슬라이드
   it-studio / architecture-studio 공용.
   팔레트 변수(--navy, --line 등)는 각 페이지의 <style>에 정의된 값을 그대로 사용하고,
   여기서는 레이아웃·미디어·컨트롤과 "미디어 위 텍스트 반전"만 담당한다.
   각 페이지의 <style> 뒤에 로드해야 이 파일이 우선 적용된다.
   ============================================================ */

/* 고정 헤더(60px) 아래로 앵커 이동 시 제목이 가려지지 않도록 */
html {
  scroll-padding-top: 72px;
}

.hero {
  position: relative;
  min-height: 100vh;
  min-height: 100svh;
  display: flex;
  align-items: center;
  overflow: hidden;
  /* 상단은 고정 헤더, 하단은 슬라이드 컨트롤(마크·카운터) 여백 */
  padding: 110px 0 120px;
}
.hero .wrap {
  position: relative;
  z-index: 3;
  width: 100%;
}

/* 페이지 CSS의 구분선(border-bottom: 1px solid var(--line))은 밝은 색이라
   미디어가 깔리면 화면 맨 아래에 흰 줄로 남는다. 미디어 위에서는 없앤다.
   (에셋이 없는 폴백 히어로에서는 아래 섹션과의 경계로 필요하므로 그대로 둔다)
   배경을 어둡게 깔아, 사진이 아직 디코딩되기 전에도 흰 글자가 읽히게 한다. */
.hero.has-media {
  border-bottom: none;
  background: #0b0f16;
}

/* ---- 미디어 스트립 (슬라이드 카드) ---- */
.hero-media {
  position: absolute;
  inset: 0;
  z-index: 1;
  background: #0b0f16;
}
.hero-strip {
  display: flex;
  height: 100%;
  transition: transform 0.85s cubic-bezier(0.77, 0, 0.18, 1);
}
.hero-slide {
  flex: 0 0 100%;
  min-width: 100%;
  height: 100%;
  overflow: hidden;
}
.hero-slide img,
.hero-slide video {
  width: 100%;
  height: 100%;
  object-fit: cover; /* 비율이 안 맞아도 비율 유지한 채 화면을 꽉 채움 */
  object-position: center;
  display: block;
}
/* 파일명 토큰(_BLUR-n·_GRAYSCALE)의 필터 — 값은 hero.js가 CSS 변수로 넣는다.
   변수로 받는 이유: 모바일에서는 같은 px 블러도 훨씬 강하게 느껴지므로
   아래 반응형 블록에서 강도를 계수로 줄이기 위해서다. */
.hero-slide .fx {
  filter: grayscale(var(--gs, 0)) blur(var(--blur, 0px));
}

/* 미디어(z-index 1)와 본문(.wrap, z-index 3) 사이에 깔리는 가독성 확보용 검은 레이어.
   영상은 장면마다 밝기가 크게 달라 그라데이션으로는 글자가 묻히는 구간이 생기므로,
   화면 전체를 일정한 농도로 덮는 평면 레이어를 쓴다. (미디어가 있을 때만 켜짐) */
.hero-overlay {
  position: absolute;
  inset: 0;
  z-index: 2;
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.9s ease;
  background: rgba(0, 0, 0, 0.755);
}
.hero.has-media .hero-overlay {
  opacity: 1;
}
/* 사진 자체에 파일명 토큰(_BLUR-n·_GRAYSCALE)으로 처리를 입힌 페이지는
   검은 평면 레이어가 이중 처리가 되므로 끈다.
   히어로에 data-hero-overlay="off"를 선언한 페이지(architecture-studio)에만 적용. */
.hero[data-hero-overlay="off"] .hero-overlay {
  display: none;
}

/* ---- 미디어 위 텍스트 반전 ---- */
.hero.has-media h1 {
  color: #fff;
}
/* 미디어 위에서는 형광펜식 밑줄을 쓰지 않는다 — 흰 배경 띠가 사진을 가린다 */
.hero.has-media h1 .hl {
  box-shadow: none;
}
.hero.has-media p.sub {
  color: rgba(255, 255, 255, 0.88);
}
.hero.has-media .hero-badge {
  background: rgba(8, 14, 24, 0.45);
  color: #fff;
  border-color: rgba(255, 255, 255, 0.42);
  backdrop-filter: blur(6px);
}
.hero.has-media .chip {
  background: rgba(8, 14, 24, 0.35);
  color: rgba(255, 255, 255, 0.92);
  border-color: rgba(255, 255, 255, 0.28);
  backdrop-filter: blur(4px);
}
.hero.has-media .btn-ghost {
  background: transparent;
  color: #fff;
  border-color: rgba(255, 255, 255, 0.75);
}

/* 히어로 버튼을 전부 흰색 아웃라인으로 통일하고, 호버 시 반투명 흰색으로 채운다.
   페이지가 data-hero-buttons="white"를 선언한 경우에만 적용된다.
   (미디어가 없을 때는 배경이 밝아 흰 버튼이 묻히므로 has-media에서만) */
.hero[data-hero-buttons="white"].has-media .btn {
  background: transparent;
  color: #fff;
  border: 1.5px solid rgba(255, 255, 255, 0.8);
  transition:
    background-color 0.28s ease,
    border-color 0.28s ease,
    transform 0.15s ease,
    box-shadow 0.15s ease;
}
.hero[data-hero-buttons="white"].has-media .btn:hover {
  background: rgba(255, 255, 255, 0.22);
  border-color: #fff;
}

/* ---- 좌우 화살표 ---- */
.hero-arrow {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  z-index: 4;
  width: 52px;
  height: 76px;
  background: transparent;
  border: none;
  padding: 0;
  cursor: pointer;
  color: #fff;
  font-size: 40px;
  line-height: 1;
  font-family: inherit;
  opacity: 0.6;
  transition: opacity 0.2s ease;
}
.hero-arrow:hover {
  opacity: 1;
}
.hero-arrow.prev {
  left: 12px;
}
.hero-arrow.next {
  right: 12px;
}

/* ---- 하단 슬라이드 마크 (일자 → 선택 시 십자) ----
   24×24 정방형 viewBox의 인라인 SVG 아이콘. 가로·세로 팔 길이(18)와
   굵기(3)가 같아 십자가 정확히 정방형으로 떨어진다.
   폰트 글리프와 달리 OS·폰트에 상관없이 항상 같은 모양으로 그려지고,
   회전 없이 모양만 바뀌므로 XPLUS의 X↔+ 회전 연출과는 다르다. */
.hero-marks {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 34px;
  display: flex;
  justify-content: center;
  align-items: center;
  flex-wrap: wrap;
  gap: 12px;
  z-index: 4;
  padding: 0 24px;
}
.hero-marks button {
  width: 22px;
  height: 22px; /* 정방형 */
  border: none;
  padding: 0;
  cursor: pointer;
  opacity: 0.5;
  background-color: transparent;
  background-repeat: no-repeat;
  background-position: center;
  background-size: 100% 100%;
  transition:
    opacity 0.25s ease,
    transform 0.3s ease;
  /* 비선택: 일자 */
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Crect x='3' y='10.5' width='18' height='3' fill='%23ffffff'/%3E%3C/svg%3E");
}
/* 선택: 십자 */
.hero-marks button.on {
  opacity: 1;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Crect x='3' y='10.5' width='18' height='3' fill='%23ffffff'/%3E%3Crect x='10.5' y='3' width='3' height='18' fill='%23ffffff'/%3E%3C/svg%3E");
}
.hero-marks button:hover {
  opacity: 0.85;
}
.hero-marks button.on:hover {
  opacity: 1;
}

/* ---- 캐러셀 위 안내문구 ---- */
.hero-note {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 32px;
  z-index: 4;
  padding: 0 24px;
  text-align: center;
  color: rgba(255, 255, 255, 0.9);
  font-size: 12.5px;
  font-weight: 500;
  letter-spacing: 0.09em;
  line-height: 1.5;
  text-shadow: 0 1px 6px rgba(0, 0, 0, 0.45);
  pointer-events: none;
}
/* 마크가 있으면 그 위로 올린다 (마크가 없으면 마크 자리에 그대로 앉는다) */
.hero.has-marks .hero-note {
  bottom: 66px;
}

/* ---- 우측 하단 메타 줄: [ 제목 ] [ 01 / 08 ] ---- */
.hero-meta {
  position: absolute;
  right: 26px;
  bottom: 30px;
  z-index: 4;
  display: flex;
  align-items: baseline;
  justify-content: flex-end;
  gap: 16px;
  /* 가운데 정렬된 마크 줄까지 넘어가지 않도록 제한 — 넘치는 제목은 말줄임 */
  max-width: 34%;
}
/* 파일명의 _TITLE- 값. 번호 왼쪽에서 우측정렬로 붙는다. */
.hero-title {
  min-width: 0; /* 좁아지면 말줄임으로 줄어들 수 있게 */
  text-align: right;
  color: rgba(255, 255, 255, 0.93);
  font-size: 13.5px;
  font-weight: 600;
  letter-spacing: 0.01em;
  text-shadow: 0 1px 6px rgba(0, 0, 0, 0.5);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.hero-counter {
  flex: none; /* 번호는 항상 온전히 보이게 */
  color: rgba(255, 255, 255, 0.85);
  font-size: 13px;
  letter-spacing: 0.1em;
  font-variant-numeric: tabular-nums;
}
.hero-counter strong {
  font-weight: 700;
  font-size: 17px;
  color: #fff;
}

/* ---- 반응형 (모바일: 스크린과 텍스트를 위·아래로 분리) ----
   데스크톱은 사진 위에 텍스트를 얹지만, 좁은 화면에서는 사진과 글자가
   서로를 가려 둘 다 죽는다. 그래서 모바일에서는
     · 상단 --hero-media-h 만큼은 슬라이드(스크린)만 온전히 보여주고
     · 하단은 같은 어두운 캔버스(#0b0f16) 위에 텍스트·버튼 패널을 쌓는다.
   사진 하단을 패널 배경색으로 녹이고, 패널 배경에 PHILIP STUDIO 워드마크를
   깔아 두 영역이 한 컴포넌트의 위·아래로 읽히게 한다.
   좌우 끝선은 페이지 공통 여백(.wrap의 20px) 하나로 통일한다. */
@media (max-width: 640px) {
  .hero-arrow {
    display: none;
  } /* 모바일은 스와이프로 넘김 */

  /* 폴백(미디어 없음) 히어로 — 밝은 그라데이션 위 단일 레이아웃 유지 */
  .hero {
    padding: 96px 0 60px;
  }

  .hero.has-media {
    --hero-header-h: 60px; /* 고정 헤더 높이 */
    --hero-media-h: 46svh; /* 상단 스크린 영역 높이 — 첫 화면에 첫 CTA까지 들어오는 선 */
    --hero-gutter: 20px; /* 페이지 공통 좌우 여백(.wrap과 동일) */
    display: block;
    min-height: 100svh;
    padding: var(--hero-header-h) 0 0;
  }

  /* 상단: 미디어를 absolute 배경에서 흐름 안의 고정 높이 블록으로 되돌린다 */
  .hero.has-media .hero-media {
    position: relative;
    inset: auto;
    height: var(--hero-media-h);
  }
  /* 텍스트가 더는 사진 위에 없으므로 전면 검은 레이어는 필요 없다.
     대신 사진 하단만 패널 배경색으로 녹여, 스크린→패널이 한 장처럼 이어진다. */
  .hero.has-media .hero-overlay {
    display: none;
  }
  .hero.has-media .hero-media::after {
    content: "";
    position: absolute;
    left: 0;
    right: 0;
    bottom: 0;
    height: 30%;
    background: linear-gradient(
      180deg,
      rgba(11, 15, 22, 0) 0%,
      rgba(11, 15, 22, 0.92) 100%
    );
    pointer-events: none;
  }
  /* 좁은 화면에서는 같은 px 블러도 훨씬 강하게 느껴진다 — 강도를 40%로 줄인다 */
  .hero-slide .fx {
    filter: grayscale(var(--gs, 0)) blur(calc(var(--blur, 0px) * 0.4));
  }
  /* 스크린 중앙의 PHILIP STUDIO 워드마크 — 텍스트가 빠져 사진만 남은
     모바일 스크린을 홍보 컷처럼 보이게 하는 브랜드 스탬프.
     얇은 대문자 + 넓은 자간(럭셔리 워드마크 문법), Montserrat는
     페이지 <head>에서 로드한다. text-indent는 자간이 마지막 글자
     오른쪽에도 붙어 중앙이 왼쪽으로 쏠리는 것을 상쇄한다. */
  .hero.has-media .hero-media::before {
    content: "PHILIP STUDIO";
    position: absolute;
    inset: 0;
    z-index: 2;
    display: flex;
    align-items: center;
    justify-content: center;
    pointer-events: none;
    font-family: "Montserrat", "Futura", "Avenir Next", Pretendard, sans-serif;
    font-weight: 200;
    font-size: 15px;
    letter-spacing: 0.42em;
    text-indent: 0.42em;
    color: rgba(255, 255, 255, 0.94);
    /* 영상 슬라이드 안의 밝은 장면·텍스트와 겹쳐도 읽히도록 이중 섀도.
       화면을 어둡게 덮지 않고 글자 주변만 가라앉힌다. */
    text-shadow:
      0 0 3px rgba(0, 0, 0, 0.55),
      0 1px 20px rgba(0, 0, 0, 0.6);
  }

  /* 슬라이드 컨트롤(메타·마크·안내문구)을 스크린 영역 하단에 붙인다.
     bottom을 "히어로 전체(100%) − 헤더 − 미디어 높이 + 오프셋"으로 잡으면
     요소 아래끝이 미디어 아래끝에서 오프셋만큼 위에 앉는다.
     아래에서부터 메타(14px) → 마크(44px) → 안내문구(74px) 순으로 쌓는다. */
  .hero-meta {
    left: var(--hero-gutter);
    right: var(--hero-gutter);
    bottom: calc(100% - var(--hero-header-h) - var(--hero-media-h) + 14px);
    gap: 10px;
    max-width: none;
  }
  .hero-title {
    font-size: 12px;
  }
  /* 슬라이드가 많아지면 마크가 두 줄로 넘치므로 모바일에서는 촘촘하게 */
  .hero-marks {
    gap: 8px;
    bottom: calc(100% - var(--hero-header-h) - var(--hero-media-h) + 44px);
    padding: 0 var(--hero-gutter);
  }
  .hero-marks button {
    width: 18px;
    height: 18px;
  }
  .hero-note {
    bottom: calc(100% - var(--hero-header-h) - var(--hero-media-h) + 14px);
    font-size: 11px;
    letter-spacing: 0.04em;
    padding: 0 var(--hero-gutter);
  }
  .hero.has-marks .hero-note {
    bottom: calc(100% - var(--hero-header-h) - var(--hero-media-h) + 74px);
  }

  /* 하단: 텍스트·버튼 패널 — 남은 화면을 채우고 세로 중앙 정렬 */
  .hero.has-media .wrap {
    display: flex;
    flex-direction: column;
    justify-content: center;
    min-height: calc(100svh - var(--hero-header-h) - var(--hero-media-h));
    padding: 28px var(--hero-gutter) 44px;
  }
  .hero.has-media .hero-badge {
    margin-bottom: 16px;
    font-size: 12px;
  }
  .hero.has-media h1 {
    font-size: 22px;
    line-height: 1.4;
  }
  .hero.has-media p.sub {
    margin-top: 12px;
    font-size: 14.5px;
  }
  /* 버튼은 전폭 스택 — 엄지 터치 최소 높이 48px 확보 */
  .hero.has-media .hero-ctas {
    flex-direction: column;
    gap: 10px;
    margin-top: 20px;
  }
  .hero.has-media .hero-ctas .btn {
    width: 100%;
    min-height: 48px;
    text-align: center;
  }
  .hero.has-media .hero-chips {
    margin-top: 20px;
    gap: 6px;
  }
  .hero.has-media .chip {
    font-size: 11.5px;
  }

  /* 패널 배경의 PHILIP STUDIO 워드마크 — 위 스크린과 같은 캔버스에 찍힌
     로고로, 패널이 스크린의 연장임을 브랜드로 못박는다 (본문 z-index 3 아래) */
  .hero.has-media::after {
    content: "PHILIP\A STUDIO";
    white-space: pre;
    position: absolute;
    z-index: 2;
    left: 0;
    right: 0;
    top: calc(var(--hero-header-h) + var(--hero-media-h));
    bottom: 0;
    display: flex;
    align-items: flex-end;
    justify-content: flex-end;
    padding: 0 6px 2px 0;
    font-family: "Montserrat", "Futura", "Avenir Next", Pretendard, sans-serif;
    font-size: 78px;
    line-height: 0.9;
    font-weight: 300;
    letter-spacing: -0.02em;
    text-align: right;
    color: rgba(255, 255, 255, 0.05);
    pointer-events: none;
    overflow: hidden;
  }
}

@media (prefers-reduced-motion: reduce) {
  .hero-strip,
  .hero-marks button {
    transition: none;
  }
}
