/* cocode-house — 모노크롬 시네마. 팔레트·타이포는 design-brief.md 가 정본. */

:root {
  --bg: #050506;
  --panel: #19191a;
  --ink: #ffffff;
  --muted: #a6a6a8;
  --hair: #303033;
  --mono: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, monospace;
}

* { box-sizing: border-box; }
html { scroll-behavior: auto; }
html, body { overflow-x: clip; }
html, body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: "Pretendard Variable", Pretendard, -apple-system, "Apple SD Gothic Neo", sans-serif;
  line-height: 1.65;
  word-break: keep-all;
  overflow-wrap: break-word;
  -webkit-font-smoothing: antialiased;
}

/* ── 내비 — 필름 위에 뜨는 최소 크롬 ─────────────────────────── */
.nav {
  position: fixed;
  inset: 0 0 auto 0;
  z-index: 40;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: calc(env(safe-area-inset-top, 0px) + 0.875rem) clamp(1.25rem, 4vw, 3rem) 0.875rem;
  background: linear-gradient(rgb(5 5 6 / 0.72), rgb(5 5 6 / 0));
}
.nav__mark {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  color: var(--ink);
  text-decoration: none;
  font-weight: 700;
  font-size: 1.0625rem;
  letter-spacing: -0.02em;
}
.nav__mark svg { height: 1.0625rem; width: auto; display: block; }

/* ── 스크럽 스테이지 ─────────────────────────────────────────── */
.stage { position: relative; }
.film {
  position: sticky;
  top: 0;
  height: 100dvh;
  overflow: hidden;
  z-index: 0;
}
.film img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  background: var(--bg);
  will-change: opacity, transform;
}
/* 키프레임 스택 — 1층은 항상 보이고 이후 층이 스크럽으로 쌓인다 */
.kf--lazy { opacity: 0; transform: scale(1.06); }
/* 필름 위 미세 그레인 — 720p 소스의 질감 보정 */
.film__grain {
  position: absolute; inset: 0;
  background-image: radial-gradient(rgb(255 255 255 / 0.028) 1px, transparent 1.2px);
  background-size: 3px 3px;
  mix-blend-mode: overlay;
  pointer-events: none;
}
/* 카피 존 스크림 — 배경 구조물이 중앙에 몰려 있어 본문(제품 정보)과 겹치면
   부조화가 났다 (2026-08-19 피드백). 왼쪽 카피 컬럼을 항상 차분한 면으로
   가라앉히고, 이미지는 오른쪽에 살린다. 모바일은 아래쪽에서 올라온다. */
.film::after {
  content: "";
  position: absolute; inset: 0;
  background:
    linear-gradient(90deg, rgb(5 5 6 / 0.82) 0%, rgb(5 5 6 / 0.5) 34%, rgb(5 5 6 / 0) 62%),
    linear-gradient(0deg, rgb(5 5 6 / 0.55) 0%, rgb(5 5 6 / 0) 28%);
  pointer-events: none;
}
@media (max-width: 767px) {
  .film::after {
    background:
      linear-gradient(0deg, rgb(5 5 6 / 0.85) 0%, rgb(5 5 6 / 0.45) 42%, rgb(5 5 6 / 0.12) 70%),
      linear-gradient(180deg, rgb(5 5 6 / 0.5) 0%, rgb(5 5 6 / 0) 22%);
  }
}
/* 스테이지 → 정보 섹션 전환 — 필름이 뚝 끊기지 않고 지면색으로 가라앉는다 */
.stage::after {
  content: "";
  position: absolute;
  left: 0; right: 0; bottom: 0;
  height: 42dvh;
  background: linear-gradient(180deg, rgb(5 5 6 / 0) 0%, rgb(5 5 6 / 0.85) 70%, var(--bg) 100%);
  pointer-events: none;
  z-index: 1;
}

/* 챕터 — 시맨틱 플로우 블록이 필름 위를 흐른다. 스크린샷 세이프:
   뷰포트 게이트 opacity 없음, 전부 항상 렌더. */
.chapter {
  position: relative;
  z-index: 1;
  min-height: 120dvh;
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding: 0 clamp(1.25rem, 6vw, 6rem);
  max-width: 44rem;
}
.chapter:first-of-type { margin-top: -100dvh; min-height: 100dvh; }
.chapter:last-of-type { min-height: 130dvh; padding-bottom: 10dvh; }

/* 필름 소실 대비 가독 스크림 — 본문 뒤에만 얇게 */
.chapter > * {
  position: relative;
  text-shadow: 0 1px 24px rgb(0 0 0 / 0.55), 0 0 2px rgb(0 0 0 / 0.6);
}

.chapter h1, .chapter h2 {
  margin: 0 0 0.75rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  line-height: 1.22;
  font-size: clamp(1.75rem, 1.1rem + 3.4vw, 3.25rem);
  text-wrap: balance;
}
.chapter__eyebrow {
  margin: 0 0 1rem;
  font-family: var(--mono);
  font-size: 0.8125rem;
  letter-spacing: 0.06em;
  color: var(--muted);
}
.chapter__cap {
  margin: 0 0 1rem;
  font-family: var(--mono);
  font-size: 0.8125rem;
  letter-spacing: 0.08em;
  color: var(--muted);
}
.chapter__body {
  margin: 0;
  max-width: 30em;
  color: rgb(255 255 255 / 0.86);
  font-size: clamp(1rem, 0.9rem + 0.5vw, 1.1875rem);
}
.chapter__hint {
  margin: 3rem 0 0;
  font-family: var(--mono);
  font-size: 0.75rem;
  letter-spacing: 0.1em;
  color: var(--muted);
  animation: hint-drift 2.4s ease-in-out infinite;
}
@keyframes hint-drift {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(6px); }
}
.chapter__more { margin: 1.5rem 0 0; }

/* ── CTA — 각자 고유 형질 (공유 버튼 클래스 없음) ────────────── */
/* cta-start: 흰 알약. 호버 시 살짝 넓어지고 화살표가 배어나온다. */
.cta-start {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  background: var(--ink);
  color: #0a0a0c;
  border-radius: 999px;
  padding: 0.8125rem 1.75rem;
  font-weight: 700;
  font-size: 1rem;
  text-decoration: none;
  transition: padding 180ms cubic-bezier(0.22, 0.61, 0.36, 1), background 180ms;
}
.cta-start::after {
  content: "→";
  max-width: 0;
  overflow: hidden;
  transition: max-width 180ms cubic-bezier(0.22, 0.61, 0.36, 1);
}
.cta-start:hover { padding-right: 1.4rem; background: #f2f2f4; }
.cta-start:hover::after { max-width: 1.2em; }
.cta-start--nav { padding: 0.5rem 1.125rem; font-size: 0.875rem; }
.cta-start--nav:hover { padding-right: 0.9rem; }

/* cta-how: 밑줄 텍스트. 호버 시 밑줄이 두꺼워진다. */
.cta-how {
  color: var(--ink);
  font-weight: 600;
  font-size: 0.9375rem;
  text-decoration: underline;
  text-decoration-thickness: 1px;
  text-underline-offset: 5px;
  transition: text-decoration-thickness 140ms;
}
.cta-how:hover { text-decoration-thickness: 3px; }

/* cta-site: 모노 캡션 링크. 호버 시 글자색 상승. */
.cta-site {
  color: var(--muted);
  font-family: var(--mono);
  font-size: 0.8125rem;
  text-decoration: none;
  transition: color 140ms;
}
.cta-site:hover { color: var(--ink); }

/* ── 방식 · 포트폴리오 ───────────────────────────────────────── */
.method, .work {
  position: relative;
  z-index: 1;
  background: var(--bg);
  border-top: 1px solid var(--hair);
  padding: clamp(4.5rem, 10vh, 8rem) clamp(1.25rem, 6vw, 6rem);
}
.method__cap {
  margin: 0 0 1rem;
  font-family: var(--mono);
  font-size: 0.8125rem;
  letter-spacing: 0.08em;
  color: var(--muted);
}
.method h2, .work h2 {
  margin: 0 0 2.5rem;
  font-size: clamp(1.5rem, 1rem + 2.2vw, 2.5rem);
  font-weight: 700;
  letter-spacing: -0.02em;
  line-height: 1.28;
  text-wrap: balance;
}
.method__grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(17rem, 1fr));
  gap: 1.25rem;
}
.method__item {
  background: var(--panel);
  border-radius: 16px;
  padding: 1.75rem 1.5rem;
}
.method__item h3 {
  margin: 0 0 0.75rem;
  font-size: 1.1875rem;
  font-weight: 700;
  letter-spacing: -0.015em;
  line-height: 1.4;
}
.method__item p {
  margin: 0;
  color: var(--muted);
  font-size: 0.9375rem;
  line-height: 1.75;
}
.work h2 { margin-bottom: 1rem; }

/* ── 라이브 데모 — 목업 + 세그먼트 전환 ─────────────────────── */
.demo { margin: 2.25rem 0 2rem; }
.demo__seg {
  display: inline-flex;
  gap: 0.25rem;
  padding: 0.25rem;
  background: var(--panel);
  border: 1px solid var(--hair);
  border-radius: 999px;
  margin-bottom: 1.5rem;
}
.demo__seg-btn {
  appearance: none;
  border: 0;
  background: transparent;
  color: var(--muted);
  font: inherit;
  font-size: 0.875rem;
  font-weight: 600;
  padding: 0.4375rem 1.125rem;
  border-radius: 999px;
  cursor: pointer;
  transition: background 150ms, color 150ms;
}
.demo__seg-btn.is-active { background: var(--ink); color: #0a0a0c; }
.demo__seg-btn:not(.is-active):hover { color: var(--ink); }

.demo__stage {
  display: flex;
  justify-content: flex-start;
  overflow: hidden;
  transition: height 520ms cubic-bezier(0.22, 0.61, 0.36, 1);
}
.device {
  background: #0d0d0e;
  border: 1px solid var(--hair);
  box-shadow: inset 0 0 0 2px #232326;
  overflow: hidden;
  transform-origin: top left;
  /* 모드 전환 모핑 — 프레임이 늘어나는 동안 반응형 앱이 실시간으로 리플로우된다 */
  transition:
    width 520ms cubic-bezier(0.22, 0.61, 0.36, 1),
    border-radius 520ms cubic-bezier(0.22, 0.61, 0.36, 1),
    padding 520ms cubic-bezier(0.22, 0.61, 0.36, 1),
    transform 520ms cubic-bezier(0.22, 0.61, 0.36, 1);
}
/* 모드별 프레임 형태 — 논리 크기는 JS 가 scale 로 맞춘다 */
.demo__stage[data-mode="phone"]   .device { width: 390px;  border-radius: 44px; padding: 12px; }
.demo__stage[data-mode="tablet"]  .device { width: 834px;  border-radius: 28px; padding: 14px; }
.demo__stage[data-mode="desktop"] .device { width: 1280px; border-radius: 14px; padding: 0; }
.device__chrome {
  display: flex;
  align-items: center;
  gap: 0.375rem;
  padding: 0 0.75rem;
  max-height: 0;
  opacity: 0;
  overflow: hidden;
  border-bottom: 0 solid var(--hair);
  transition: max-height 520ms cubic-bezier(0.22, 0.61, 0.36, 1), opacity 300ms, padding 520ms;
}
.demo__stage[data-mode="desktop"] .device__chrome {
  max-height: 2.25rem;
  opacity: 1;
  padding: 0.5rem 0.75rem;
  border-bottom-width: 1px;
}
.device__chrome span { width: 9px; height: 9px; border-radius: 50%; background: #3a3a3d; }
.device__chrome em {
  font-style: normal;
  font-family: var(--mono);
  font-size: 0.6875rem;
  color: var(--muted);
  margin-left: 0.5rem;
}
.device__screen {
  position: relative;
  background: #000;
  overflow: hidden;
}
.device__screen {
  transition: height 520ms cubic-bezier(0.22, 0.61, 0.36, 1), border-radius 520ms cubic-bezier(0.22, 0.61, 0.36, 1);
}
.demo__stage[data-mode="phone"]   .device__screen { height: 780px; border-radius: 32px; }
.demo__stage[data-mode="tablet"]  .device__screen { height: 1040px; border-radius: 16px; }
.demo__stage[data-mode="desktop"] .device__screen { height: 800px; border-radius: 0; }
@media (prefers-reduced-motion: reduce) {
  .device, .device__screen, .device__chrome, .demo__stage { transition: none; }
}
.device__screen iframe {
  position: absolute; inset: 0;
  width: 100%; height: 100%;
  border: 0;
  background: #000;
}
.device__idle {
  position: absolute; inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 1.25rem;
  padding: 2rem;
  text-align: center;
}
.device__idle p { margin: 0; color: var(--muted); font-size: 0.9375rem; max-width: 18em; }
/* cta-demo: 점멸 점을 단 아웃라인 알약 — 실행 버튼의 고유 형질 */
.cta-demo {
  appearance: none;
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  background: transparent;
  border: 1px solid rgb(255 255 255 / 0.6);
  color: var(--ink);
  border-radius: 999px;
  padding: 0.75rem 1.5rem;
  font: inherit;
  font-size: 0.9375rem;
  font-weight: 700;
  cursor: pointer;
  transition: background 150ms, border-color 150ms;
}
.cta-demo::before {
  content: "";
  width: 8px; height: 8px;
  border-radius: 50%;
  background: var(--ink);
  animation: demo-pulse 1.8s ease-in-out infinite;
}
.cta-demo:hover { background: rgb(255 255 255 / 0.08); border-color: var(--ink); }
@keyframes demo-pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.25; }
}
@media (prefers-reduced-motion: reduce) { .cta-demo::before { animation: none; } }
.demo__note {
  margin: 1.25rem 0 0;
  color: var(--muted);
  font-size: 0.875rem;
  max-width: 38em;
}
.work__body { margin: 0 0 1.75rem; color: var(--muted); max-width: 36em; }
.work__links {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-wrap: wrap;
  gap: 0.625rem;
}
/* cta-store: 테두리 칩. 호버 시 면이 차오른다 — 다른 CTA 와 형질을 공유하지 않는다. */
.cta-store {
  display: inline-block;
  padding: 0.5rem 1rem;
  border: 1px solid var(--hair);
  border-radius: 10px;
  color: var(--ink);
  font-size: 0.875rem;
  font-weight: 600;
  text-decoration: none;
  transition: background 150ms, border-color 150ms;
}
.cta-store:hover { background: var(--panel); border-color: var(--muted); }

/* ── 클로징 ──────────────────────────────────────────────────── */
.close {
  position: relative;
  z-index: 1;
  background: var(--bg);
  border-top: 1px solid var(--hair);
  padding: clamp(5rem, 12vh, 9rem) clamp(1.25rem, 6vw, 6rem);
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 1.5rem;
}
.close h2 {
  margin: 0;
  font-size: clamp(1.625rem, 1.1rem + 2.6vw, 2.75rem);
  font-weight: 700;
  letter-spacing: -0.02em;
  line-height: 1.25;
  text-wrap: balance;
}
.close p { margin: 0; color: var(--muted); max-width: 34em; }

/* ── 푸터 ────────────────────────────────────────────────────── */
.footer {
  background: var(--panel);
  padding: 3rem clamp(1.25rem, 6vw, 6rem) calc(3.5rem + env(safe-area-inset-bottom, 0px));
  display: flex;
  flex-direction: column;
  gap: 0.875rem;
}
.footer__lockup {
  display: inline-flex;
  align-items: center;
  gap: 0.625rem;
  font-weight: 700;
  font-size: 1.0625rem;
  letter-spacing: -0.02em;
}
.footer__lockup svg { height: 1.375rem; width: auto; display: block; }
.footer__line { margin: 0; color: var(--muted); font-size: 0.875rem; }

/* ── 모션 축소 — 영상 자체를 싣지 않는다(스크립트가 판단). 포스터 위에
   같은 시맨틱 챕터가 그대로 흐른다. ─────────────────────────── */
@media (prefers-reduced-motion: reduce) {
  .chapter__hint { animation: none; }
}
