/* ==========================================================================
   D—ONE · style.css
   ========================================================================== */

:root {
  --ink: #0b0b0b;
  --paper: #efede8;
  --muted: #8b8a85;
  --line: rgba(239, 237, 232, 0.14);
  --accent: #fe302c;
  --stage: #e7e5e0;

  --gutter: clamp(16px, 3vw, 40px);
  --font: "Pretendard Variable", Pretendard, -apple-system, BlinkMacSystemFont, system-ui, sans-serif;
  --ease-out: cubic-bezier(0.16, 1, 0.3, 1);
}

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

html {
  -webkit-text-size-adjust: 100%;
  scroll-behavior: smooth;
}
html.lenis { scroll-behavior: auto; }

body {
  margin: 0;
  background: var(--ink);
  color: var(--paper);
  font-family: var(--font);
  font-size: 16px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  word-break: keep-all;
  overflow-x: clip;
}

/* 필름 그레인 — 정적인 노이즈 한 장이라 성능 부담이 거의 없다 */
body::after {
  content: "";
  position: fixed;
  inset: 0;
  z-index: 90;
  pointer-events: none;
  opacity: 0.07;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='160' height='160'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.9' numOctaves='2' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
}

img { display: block; max-width: 100%; height: auto; }
a { color: inherit; text-decoration: none; }
figure, p, h1, h2, ul, dl, dd { margin: 0; }
ul { padding: 0; list-style: none; }

:focus-visible { outline: 2px solid var(--accent); outline-offset: 4px; }

.label {
  font-size: 13px;
  letter-spacing: 0.02em;
  color: var(--muted);
}

/* Lenis 권장 스타일 */
html.lenis, html.lenis body { height: auto; }
.lenis:not(.lenis-autoToggle).lenis-stopped { overflow: clip; }
.lenis.lenis-smooth iframe { pointer-events: none; }

/* ==========================================================================
   Intro
   ========================================================================== */

.intro { display: none; }
html.is-intro { overflow: hidden; }

html.is-intro .intro {
  display: block;
  position: fixed;
  inset: 0;
  z-index: 100;
  background: var(--stage);
  color: var(--ink);
  overflow: hidden;
  cursor: pointer;
}

.intro__stage {
  position: absolute;
  inset: 0;
  perspective: 1400px;
}

.intro__dot {
  position: absolute;
  left: 50%;
  top: 50%;
  width: 10px;
  height: 10px;
  margin: -5px 0 0 -5px;
  border-radius: 50%;
  background: var(--ink);
  transform: scale(0);
}

.intro__card {
  position: absolute;
  left: 50%;
  top: 50%;
  overflow: hidden;
  background: #cfcdc8;
  will-change: transform;
  backface-visibility: hidden;
  visibility: hidden;
}
.intro__card img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}
/* 마지막에 풀블리드가 되는 카드 — 히어로 이미지와 같은 크롭으로 맞춰 이음새를 없앤다 */
.intro__card--hero img { object-position: 50% 50%; }

.intro__label,
.intro__count {
  position: absolute;
  z-index: 2;
  font-size: 13px;
  line-height: 1.3;
  letter-spacing: 0.02em;
}
.intro__label {
  top: var(--gutter);
  left: var(--gutter);
  font-weight: 700;
}
.intro__label span { font-weight: 400; color: #6d6c68; }
.intro__count {
  right: var(--gutter);
  bottom: var(--gutter);
  font-variant-numeric: tabular-nums;
}

.intro__skip {
  position: absolute;
  z-index: 2;
  left: var(--gutter);
  bottom: var(--gutter);
  padding: 0;
  border: 0;
  background: none;
  color: #6d6c68;
  font: inherit;
  font-size: 13px;
  cursor: pointer;
}

/* ==========================================================================
   Nav
   ========================================================================== */

.nav {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 50;
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: var(--gutter);
  mix-blend-mode: difference;
  color: #fff;
  font-size: 14px;
  transition: transform 0.6s var(--ease-out);
}
.nav.is-hidden { transform: translateY(-110%); }

.nav__logo {
  font-weight: 800;
  letter-spacing: -0.02em;
}
.nav__links { display: flex; gap: clamp(16px, 2.4vw, 32px); }
.nav__links a { position: relative; }
.nav__links a::after {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  bottom: -2px;
  height: 1px;
  background: currentColor;
  transform: scaleX(0);
  transform-origin: right;
  transition: transform 0.5s var(--ease-out);
}
.nav__links a:hover::after { transform: scaleX(1); transform-origin: left; }

/* ==========================================================================
   Hero
   ========================================================================== */

.hero {
  position: relative;
  height: 100vh;
  height: 100svh;
  min-height: 520px;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  padding: calc(var(--gutter) * 3 + 14px) var(--gutter) var(--gutter);
}

.hero__media {
  position: absolute;
  inset: 0;
  z-index: -2;
}
.hero__media img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: 50% 50%;
}

.hero__shade {
  position: absolute;
  inset: 0;
  z-index: -1;
  background:
    linear-gradient(to bottom, rgba(0, 0, 0, 0.45), transparent 28%),
    linear-gradient(to top, rgba(0, 0, 0, 0.7), transparent 55%);
}

.hero__top {
  display: flex;
  justify-content: space-between;
  font-size: 13px;
  letter-spacing: 0.02em;
}

.hero__title {
  font-size: clamp(4.5rem, 21vw, 22rem);
  font-weight: 800;
  line-height: 0.82;
  letter-spacing: -0.055em;
  margin-left: -0.04em;
}

.line { display: block; overflow: hidden; padding-bottom: 0.04em; }
.line > span { display: block; }

.hero__row {
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  gap: 24px;
  margin-top: clamp(16px, 2vw, 28px);
}
.hero__lede {
  font-size: clamp(15px, 1.3vw, 18px);
  max-width: 28ch;
}
.hero__scroll {
  font-size: 13px;
  color: rgba(239, 237, 232, 0.75);
  display: flex;
  align-items: center;
  gap: 10px;
}
.hero__scroll::before {
  content: "";
  width: 40px;
  height: 1px;
  background: currentColor;
  transform-origin: left;
  animation: scrollcue 2.4s var(--ease-out) infinite;
}
@keyframes scrollcue {
  0% { transform: scaleX(0); }
  50% { transform: scaleX(1); transform-origin: left; }
  50.1% { transform-origin: right; }
  100% { transform: scaleX(0); transform-origin: right; }
}

/* 애니메이션 초기 상태 — GSAP가 실패하면 html.anim이 빠지면서 그대로 보인다 */
html.anim [data-hr],
html.anim .hero__title .line > span { opacity: 0; }
html.anim [data-reveal],
html.anim .nav { opacity: 0; }
html.anim .work__frame { clip-path: inset(100% 0 0 0); }

/* ==========================================================================
   About
   ========================================================================== */

.about {
  padding: clamp(96px, 16vw, 220px) var(--gutter) clamp(80px, 12vw, 160px);
}

.about__statement {
  margin-top: 28px;
  font-size: clamp(2rem, 5.4vw, 5.6rem);
  font-weight: 650;
  line-height: 1.04;
  letter-spacing: -0.035em;
  max-width: 18ch;
}
.about__statement .w { display: inline-block; }

.about__grid {
  display: grid;
  gap: 40px;
  margin-top: clamp(56px, 8vw, 120px);
}
.about__body {
  color: rgba(239, 237, 232, 0.78);
  max-width: 34ch;
  font-size: clamp(15px, 1.25vw, 18px);
}
.about__list li {
  display: flex;
  gap: 20px;
  padding: 14px 0;
  border-top: 1px solid var(--line);
  font-size: clamp(16px, 1.5vw, 22px);
  font-weight: 500;
}
.about__list li:last-child { border-bottom: 1px solid var(--line); }
.about__list span {
  color: var(--muted);
  font-size: 13px;
  padding-top: 0.3em;
  font-variant-numeric: tabular-nums;
}

@media (min-width: 900px) {
  .about__grid {
    grid-template-columns: repeat(12, 1fr);
  }
  .about__body { grid-column: 1 / span 5; }
  .about__list { grid-column: 7 / span 6; }
}

/* ==========================================================================
   Marquee
   ========================================================================== */

.marquee {
  overflow: hidden;
  padding: 18px 0;
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
}
.marquee__track {
  display: flex;
  width: max-content;
  align-items: center;
  gap: 0.6em;
  font-size: clamp(2.4rem, 7vw, 6.5rem);
  font-weight: 800;
  letter-spacing: -0.04em;
  line-height: 1;
  white-space: nowrap;
  will-change: transform;
  padding-right: 0.6em;
}
.marquee__track i {
  font-style: normal;
  font-size: 0.45em;
  color: var(--accent);
}

/* ==========================================================================
   Work
   ========================================================================== */

.work {
  padding: clamp(96px, 14vw, 200px) var(--gutter);
}
.work__head {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  margin-bottom: clamp(40px, 6vw, 80px);
}
.work__count {
  font-size: 13px;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
}

.work__grid {
  display: grid;
  gap: clamp(56px, 8vw, 120px) var(--gutter);
}

.work__frame {
  position: relative;
  overflow: hidden;
  background: var(--tone, #222);
}
.work__frame img {
  width: 100%;
  /* 호버 확대는 개별 속성(scale)으로 — GSAP가 쓰는 transform과 충돌하지 않는다 */
  transition: scale 1.2s var(--ease-out);
}
.work__item:hover .work__frame img { scale: 1.04; }

.work__item figcaption {
  display: grid;
  grid-template-columns: 40px 1fr auto;
  gap: 12px;
  padding-top: 14px;
  font-size: 13px;
  color: var(--muted);
}
.work__item figcaption span:nth-child(2) { color: var(--paper); }

@media (min-width: 900px) {
  .work__grid { grid-template-columns: repeat(12, 1fr); }
  .work__item:nth-child(1) { grid-column: 1 / span 7; }
  .work__item:nth-child(2) { grid-column: 9 / span 4; margin-top: 32vh; }
  .work__item:nth-child(3) { grid-column: 2 / span 4; }
  .work__item:nth-child(4) { grid-column: 7 / span 5; margin-top: 18vh; }
  .work__item:nth-child(5) { grid-column: 3 / span 8; }
}

/* 3D로 볼 수 있는 카드 */
.work__link { display: block; }
.work__badge {
  position: absolute;
  top: 14px;
  right: 14px;
  z-index: 1;
  padding: 6px 11px;
  border-radius: 999px;
  background: rgba(11, 11, 11, 0.72);
  color: var(--paper);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.04em;
  -webkit-backdrop-filter: blur(6px);
  backdrop-filter: blur(6px);
}
.work__cta { color: var(--paper); }
.work__cta i {
  display: inline-block;
  font-style: normal;
  transition: transform 0.5s var(--ease-out);
}
.work__link:hover .work__cta i { transform: translate(3px, -3px); }

/* ==========================================================================
   3D Viewer
   ========================================================================== */

.viewer[hidden] { display: none; }
.viewer {
  position: fixed;
  inset: 0;
  z-index: 80;
  color: var(--ink);
}
html.is-viewer { overflow: hidden; }

.viewer__ghost {
  position: fixed;
  overflow: hidden;
  background: var(--tone, #769ece);
}
.viewer__ghost img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.viewer__stage {
  position: absolute;
  inset: 0;
}
.viewer__stage canvas {
  display: block;
  width: 100%;
  height: 100%;
  touch-action: none;
  cursor: grab;
}
.viewer__stage canvas:active { cursor: grabbing; }

.viewer__bar {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  z-index: 2;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  padding: var(--gutter);
  pointer-events: none;
}
.viewer__back {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 12px 20px;
  border: 0;
  border-radius: 999px;
  background: var(--paper);
  color: var(--ink);
  font: inherit;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  pointer-events: auto;
  transition: background-color 0.4s var(--ease-out), color 0.4s var(--ease-out);
}
.viewer__back i { font-style: normal; transition: transform 0.5s var(--ease-out); }
.viewer__back:hover { background: var(--ink); color: var(--paper); }
.viewer__back:focus-visible { outline: 2px solid var(--ink); outline-offset: 3px; }
.viewer__back:hover i { transform: translateX(-4px); }

.viewer__title {
  font-size: 13px;
  font-weight: 600;
  color: rgba(11, 11, 11, 0.85);
}
.viewer__num { color: rgba(11, 11, 11, 0.5); margin-right: 4px; }

.viewer__status,
.viewer__hint {
  position: absolute;
  left: 50%;
  bottom: calc(var(--gutter) + env(safe-area-inset-bottom));
  z-index: 2;
  transform: translateX(-50%);
  font-size: 13px;
  color: rgba(11, 11, 11, 0.7);
  white-space: nowrap;
  pointer-events: none;
  font-variant-numeric: tabular-nums;
}

/* ==========================================================================
   Contact & Footer
   ========================================================================== */

.contact {
  padding: clamp(96px, 14vw, 200px) var(--gutter) clamp(80px, 10vw, 140px);
  border-top: 1px solid var(--line);
}
.contact__title {
  margin-top: 28px;
  font-size: clamp(3rem, 10vw, 10rem);
  font-weight: 800;
  line-height: 0.92;
  letter-spacing: -0.05em;
}
.contact__mail {
  display: inline-flex;
  align-items: center;
  gap: 16px;
  margin-top: clamp(40px, 6vw, 72px);
  padding: 18px 28px;
  border-radius: 999px;
  background: var(--paper);
  color: var(--ink);
  font-size: clamp(16px, 1.6vw, 20px);
  font-weight: 600;
  transition: background-color 0.4s var(--ease-out), color 0.4s var(--ease-out);
}
.contact__mail i {
  font-style: normal;
  transition: transform 0.5s var(--ease-out);
}
.contact__mail:hover { background: var(--accent); color: #fff; }
.contact__mail:hover i { transform: translateX(6px); }

.footer {
  display: grid;
  gap: 24px;
  padding: 32px var(--gutter) calc(32px + env(safe-area-inset-bottom));
  border-top: 1px solid var(--line);
  font-size: 12px;
  color: var(--muted);
}
.footer__biz {
  display: flex;
  flex-wrap: wrap;
  gap: 6px 20px;
}
.footer__biz div { display: flex; gap: 6px; }
.footer__biz dt { color: rgba(239, 237, 232, 0.5); }
.footer__biz dd { color: rgba(239, 237, 232, 0.8); }

@media (min-width: 900px) {
  .footer { grid-template-columns: 1fr auto; align-items: end; }
}

/* ==========================================================================
   Mobile
   ========================================================================== */

@media (max-width: 599px) {
  .nav__links { gap: 14px; font-size: 13px; }
  .hero__index { display: none; }
  .hero__row { flex-direction: column; align-items: flex-start; }
  .hero__scroll { display: none; }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .hero__scroll::before { animation: none; transform: scaleX(1); }
  .work__frame img, .nav { transition: none; }
  .work__item:hover .work__frame img { scale: 1; }
}
