/* ==========================================================================
   Mother Design 패턴 템플릿
   design_assets/motherdesign/tokens.css 를 먼저 로드할 것.
   6개 레이아웃 패턴: nav-boxed / hero-rail / statement / quad-grid /
                     editorial-3col / closing
   ========================================================================== */

/* ---- base --------------------------------------------------------------- */
.md {
  background: var(--md-bg);
  color: var(--md-text);
  font-family: var(--md-font-main);
  font-size: var(--md-fs-base);
  font-weight: var(--md-w-normal);
  line-height: var(--md-lh-ko);
  letter-spacing: var(--md-ls-ko);
  word-break: keep-all;
  -webkit-font-smoothing: antialiased;
}

.md *,
.md *::before,
.md *::after { box-sizing: border-box; }

.md h1, .md h2, .md h3, .md h4, .md p { margin: 0; }

/* 헤딩도 본문과 같은 16px — 위계는 weight와 위치로만. 이게 이 톤의 핵심. */
.md h2, .md h3, .md h4 {
  font-size: var(--md-fs-base);
  font-weight: var(--md-w-medium);
  line-height: var(--md-lh-ko);
  letter-spacing: inherit;
}

.md a {
  color: inherit;
  text-decoration: none;
  transition: opacity var(--md-speed-fast) var(--md-ease);
}
.md a:hover { opacity: 0.6; }
.md a:focus-visible {
  outline: 2px solid currentColor;
  outline-offset: 3px;
}

.md-section {
  background: var(--md-bg);
  color: var(--md-text);
  padding-inline: var(--md-margins);
  position: relative;
}
.md-section--pad     { padding-block: var(--md-v-space); }
.md-section--pad-half{ padding-block: var(--md-v-space-half); }
.md-section--pad-sm  { padding-block: var(--md-v-space-sm); }

/* ---- 1. 박스 내비 -------------------------------------------------------- */
/* 풀와이드 바가 아니라 떠 있는 두 개의 박스. 사이트가 가벼워 보이는 이유. */
.md-header {
  position: sticky;
  top: var(--md-margins);
  z-index: 50;
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: var(--md-gutter);
  padding-inline: var(--md-margins);
  pointer-events: none;
}
.md-header > * { pointer-events: auto; }

.md-navbox,
.md-controls {
  display: inline-flex;
  border: var(--md-border);
  background: var(--md-light);
  height: var(--md-header-h);
  border-radius: var(--md-radius);
}

/* `.md a { color: inherit }` 를 이겨야 해서 a.을 붙인다 */
.md a.md-navbox__brand {
  display: grid;
  place-items: center;
  width: var(--md-header-h);
  background: var(--md-dark);
  color: var(--md-light);
  border-right: var(--md-border);
  font-weight: var(--md-w-medium);
}

.md-navbox__list {
  display: flex;
  list-style: none;
  margin: 0;
  padding: 0;
}
.md-navbox__list li + li { border-left: var(--md-border); }
.md-navbox__list a {
  display: grid;
  place-items: center;
  height: 100%;
  padding-inline: 1rem;
  white-space: nowrap;
  transition: background var(--md-speed-fast) var(--md-ease),
              color var(--md-speed-fast) var(--md-ease);
}
/* 링크 호버가 색이 아니라 반전 — 액센트 컬러가 없으니 반전으로 처리 */
.md-navbox__list a:hover {
  opacity: 1;
  background: var(--md-dark);
  color: var(--md-light);
}
.md-navbox__list a[aria-current="page"] { font-weight: var(--md-w-medium); }

.md-controls button {
  display: grid;
  place-items: center;
  width: var(--md-header-h);
  height: 100%;
  border: 0;
  background: transparent;
  color: inherit;
  font: inherit;
  cursor: pointer;
  transition: background var(--md-speed-fast) var(--md-ease),
              color var(--md-speed-fast) var(--md-ease);
}
.md-controls button + button { border-left: var(--md-border); }
.md-controls button:hover { background: var(--md-dark); color: var(--md-light); }

/* 전화번호 — 풀 이식이라 CTA 버튼이 없으므로 내비 박스 안에 텍스트로.
   `.md a { color: inherit }` 를 이기려면 a. 필요. */
.md a.md-navbox__tel {
  display: grid;
  place-items: center;
  height: 100%;
  padding-inline: 1rem;
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
  transition: background var(--md-speed-fast) var(--md-ease),
              color var(--md-speed-fast) var(--md-ease);
}
.md a.md-navbox__tel:hover {
  opacity: 1;
  background: var(--md-dark);
  color: var(--md-light);
}

/* ---- 2. 가로 작업물 캐러셀 ---------------------------------------------- */
.md-rail {
  min-height: 720px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: var(--md-v-space-sm);
  overflow: hidden;
}
.md-rail__track {
  display: flex;
  gap: 17.78px;
  transform: translateX(var(--translate-x, 0));
  transition: transform var(--md-speed-slow) var(--md-ease);
  will-change: transform;
}
.md-rail__item {
  flex: 0 0 auto;
  width: clamp(240px, 17.4vw, 250px);
}
.md-rail__media {
  aspect-ratio: 16 / 9;
  width: 100%;
  background: var(--md-grey-light);
  overflow: hidden;
}
/* 빈 슬롯만 윤곽 표시 — 실제 이미지가 들어가면 자동으로 해제된다.
   grey 테마 섹션에서 배경과 같은 색이라 안 보이는 문제 방지. */
.md-rail__media:empty {
  background: #e8e8e8;
  box-shadow: inset 0 0 0 1px var(--md-hairline);
}
.md-rail__media img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  transition: transform var(--md-speed) var(--md-ease);
}
.md-rail__item:hover .md-rail__media img { transform: scale(1.03); }

/* 캡션 2행: 제목 600 / 태그라인 muted */
.md-rail__caption p:first-child { font-weight: var(--md-w-medium); }
.md-rail__caption p:last-child { color: var(--md-text-muted); }

/* ---- 2b. 센터 스테이지 캐러셀 (saesolmedia 히어로 패턴 이식) --------------
   세로형 케이스 카드 + 센터 확대. 원본은 카드 전체가 사전 제작 JPG지만
   여기선 텍스트를 실제 HTML로 분리 — 실데이터 수령 시 마크업만 교체.
   Mother 톤 유지: radius 0, weight 400/600, 컬러는 카드 사진이 전담. */
.md-stage {
  min-height: 720px;
  display: flex;
  align-items: center;
  overflow: hidden;
  padding-block: var(--md-v-space-sm);
}
/* 원본처럼 카드가 빈틈없이 맞붙고(gap 0), 센터 카드만 확대되어
   이웃 위로 떠오른다 — scale은 레이아웃에 영향이 없어 자연스럽게 겹침 */
.md-stage__track {
  display: flex;
  align-items: center;
  transform: translateX(var(--stage-x, 0px));
  transition: transform var(--md-speed-slow) var(--md-ease);
  will-change: transform;
}
.md-stage__card {
  position: relative;
  flex: 0 0 auto;
  width: clamp(240px, 21vw, 400px);
  aspect-ratio: 400 / 577;
  overflow: hidden;
  cursor: pointer;
  border: 0;
  padding: 0;
  font: inherit;
  text-align: left;
  color: var(--md-light);
  background: var(--md-grey-dark);
  transition: transform var(--md-speed-slow) var(--md-ease);
}
.md-stage__card.is-active {
  transform: scale(1.3);
  cursor: default;
  z-index: 1;
}
.md-stage__card img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
}
/* 텍스트 가독용 그라디언트 — 사진 위 흰 텍스트의 전제 조건 */
.md-stage__card::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(
    to top,
    rgba(0, 0, 0, 0.72) 0%,
    rgba(0, 0, 0, 0.35) 38%,
    rgba(0, 0, 0, 0.05) 65%,
    rgba(0, 0, 0, 0.15) 100%
  );
}
.md-stage__body {
  position: absolute;
  inset: 0;
  z-index: 1;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  gap: 0.5rem;
  padding: clamp(16px, 2vw, 28px);
}
.md-stage__title {
  font-size: clamp(22px, 2.4vw, 34px);
  font-weight: var(--md-w-medium);
  line-height: 1.15;
  letter-spacing: var(--md-ls-display);
}
.md-stage__meta {
  font-size: 14px;
  color: rgba(255, 255, 255, 0.78);
}
.md-stage__stats {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 0.75rem;
  margin-top: 1rem;
  padding-top: 1rem;
  border-top: 1px solid rgba(255, 255, 255, 0.25);
}
.md-stage__stats dt {
  font-size: 12px;
  color: rgba(255, 255, 255, 0.65);
  margin: 0 0 0.25rem;
}
.md-stage__stats dd {
  margin: 0;
  font-size: clamp(15px, 1.25vw, 18px);
  font-weight: var(--md-w-medium);
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}
@media (max-width: 700px) {
  .md-stage { min-height: 78vh; }
  .md-stage__card { width: min(72vw, 340px); }
  .md-stage__card.is-active { transform: scale(1.12); }
}

/* ---- 3. 매니페스토 ------------------------------------------------------- */
/* 크기를 안 키우고 여백만으로 무게를 준다. 폰트 사이즈 올리지 말 것. */
.md-statement {
  max-width: var(--md-narrow-w);
}

/* ---- 4. 사분면 그리드 (시그니처) ---------------------------------------- */
.md-quad {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  /* 헤어라인은 gap + 배경으로 그린다 — border 이중선 방지 */
  gap: 1px;
  background: var(--md-hairline);
  border-block: 1px solid var(--md-hairline);
}
.md-quad__cell {
  position: relative;
  display: grid;
  place-items: center;
  min-height: clamp(200px, 24vw, 328px);
  padding: var(--md-v-space-sm);
  background: var(--md-bg);
  cursor: pointer;
  border: 0;
  font: inherit;
  color: inherit;
  text-align: center;
  transition: background var(--md-speed) var(--md-ease),
              color var(--md-speed) var(--md-ease);
}
.md-quad__cell:hover,
.md-quad__cell:focus-visible {
  background: var(--md-dark);
  color: var(--md-light);
}
.md-quad__word {
  font-size: var(--md-fs-mega);
  font-weight: var(--md-w-normal);
  line-height: var(--md-lh-display);
  letter-spacing: var(--md-ls-display);
}

/* 기본 상태는 단어 하나만. 설명은 호버/포커스에서만 — 원본의 정적 사분면을
   유지하면서 설명이 필요한 콘텐츠를 수용하는 확장. opacity만 전환.
   absolute로 빼서 레이아웃에서 제외 — 안 그러면 숨은 설명이 자리를 차지해
   기본 상태에서 단어가 위로 밀린다. */
.md-quad__desc {
  position: absolute;
  left: 50%;
  bottom: clamp(24px, 4vw, 56px);
  translate: -50% 0;
  width: max-content;
  max-width: min(24ch, calc(100% - 2 * var(--md-v-space-sm)));
  font-size: var(--md-fs-base);
  line-height: var(--md-lh-ko);
  opacity: 0;
  transition: opacity var(--md-speed) var(--md-ease);
}
.md-quad__cell:hover .md-quad__desc,
.md-quad__cell:focus-visible .md-quad__desc { opacity: 1; }

/* 터치 기기엔 호버가 없다 — 항상 노출 */
@media (hover: none) {
  .md-quad__desc { opacity: 1; }
}

/* ---- 5. 3단 에디토리얼 --------------------------------------------------- */
/* 라벨 | 리드 | 대형 리스트. 불릿·아이콘·카드 없음. */
.md-editorial {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1.2fr) minmax(0, 3fr);
  gap: var(--md-gutter);
  align-items: start;
}
.md-editorial__label { font-weight: var(--md-w-medium); }
.md-editorial__lede { display: grid; gap: 1.25rem; max-width: 34ch; }

.md-editorial__list {
  list-style: none;
  margin: 0;
  padding: 0;
  font-size: var(--md-fs-display);
  line-height: var(--md-lh-display);
  letter-spacing: var(--md-ls-display);
}
.md-editorial__list li + li { margin-top: 0.15em; }
.md-editorial__list a { display: inline-block; }

/* 링크 밑줄 — 색 대신 언더라인으로 어포던스 */
.md-link {
  text-decoration: underline;
  text-underline-offset: 0.3em;
  text-decoration-color: var(--md-hairline);
  transition: text-decoration-color var(--md-speed-fast) var(--md-ease);
}
.md-link:hover { text-decoration-color: currentColor; opacity: 1; }

/* ---- 6. 클로징 ----------------------------------------------------------- */
.md-closing { max-width: var(--md-narrow-w); display: grid; gap: 1.5rem; }

/* ---- 스태거 등장 --------------------------------------------------------- */
.md-stagger > * {
  opacity: 0;
  transform: translateY(0.5rem);
  animation: md-rise var(--md-speed-slow) var(--md-ease) forwards;
  animation-delay: calc(var(--i, 0) * var(--md-stagger));
}
@keyframes md-rise {
  to { opacity: 1; transform: none; }
}
@media (prefers-reduced-motion: reduce) {
  .md-stagger > * { opacity: 1; transform: none; animation: none; }
}

/* ---- 반응형 -------------------------------------------------------------- */
@media (max-width: 900px) {
  .md-editorial { grid-template-columns: 1fr; gap: var(--md-v-space-sm); }
  .md-editorial__lede { max-width: none; }
  .md-quad { grid-template-columns: 1fr; }
  .md-rail { min-height: 60vh; }
}

@media (max-width: 600px) {
  .md-header { flex-direction: column; gap: 0.5rem; }
  .md-navbox { max-width: 100%; overflow-x: auto; }
}
