:root {
  --bg: #fbfbfd;
  --bg-soft: #f3f4f8;
  --ink: #0e0f13;
  --ink-2: #4a4d57;
  --ink-3: #8a8d97;
  --line: rgba(14, 15, 19, 0.08);
  --cyan: #12d6e0;
  --blue: #2f6bff;
  --violet: #8b3dff;
  --grad: linear-gradient(100deg, var(--cyan), var(--blue) 45%, var(--violet));
  --header-h: 72px;
  --ease: cubic-bezier(0.22, 1, 0.36, 1);
  --gutter: clamp(16px, 4vw, 48px);
}

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

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: "Pretendard Variable", Pretendard, -apple-system, BlinkMacSystemFont, system-ui, "Apple SD Gothic Neo", "Noto Sans KR", sans-serif;
  font-size: 16px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  word-break: keep-all;
  overflow-x: hidden;
}

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

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

.container { width: 100%; max-width: 1200px; margin: 0 auto; padding: 0 var(--gutter); }

/* ---------- Logo ---------- */
.logo {
  font-weight: 700;
  font-size: 18px;
  letter-spacing: 0.32em;
  text-transform: uppercase;
  margin-right: -0.32em; /* letter-spacing 끝 여백 보정 */
}
.logo--sm { font-size: 14px; }

/* ---------- Header ---------- */
.header {
  position: fixed;
  inset: 0 0 auto;
  z-index: 100;
  height: var(--header-h);
  transition: background-color 0.4s var(--ease), box-shadow 0.4s var(--ease), backdrop-filter 0.4s;
}
.header.is-scrolled {
  background: rgba(251, 251, 253, 0.72);
  backdrop-filter: saturate(180%) blur(16px);
  -webkit-backdrop-filter: saturate(180%) blur(16px);
  box-shadow: 0 1px 0 var(--line);
}
.header__inner {
  height: 100%;
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 var(--gutter);
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.nav { display: flex; gap: clamp(20px, 4vw, 40px); }
.nav__link {
  position: relative;
  font-size: 14px;
  font-weight: 500;
  letter-spacing: 0.04em;
  color: var(--ink-2);
  padding: 8px 0;
  transition: color 0.3s;
}
.nav__link::after {
  content: "";
  position: absolute;
  left: 0; right: 0; bottom: 2px;
  height: 1.5px;
  background: var(--grad);
  transform: scaleX(0);
  transform-origin: right;
  transition: transform 0.45s var(--ease);
}
.nav__link:hover,
.nav__link.is-active { color: var(--ink); }
.nav__link:hover::after,
.nav__link.is-active::after { transform: scaleX(1); transform-origin: left; }

/* ---------- Hero ---------- */
.hero {
  position: relative;
  min-height: 100vh;
  min-height: 100svh;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  isolation: isolate;
  padding: calc(var(--header-h) + 40px) var(--gutter) 120px;
}
.hero__canvas {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  z-index: -1;
}
.hero__orbs { position: absolute; inset: 0; z-index: -2; pointer-events: none; }
.orb {
  position: absolute;
  border-radius: 50%;
  filter: blur(80px);
  opacity: 0.38;
  will-change: transform;
}
.orb--1 { width: 46vmax; height: 46vmax; left: -12vmax; top: -14vmax; background: #9ff3f7; animation: drift1 18s ease-in-out infinite alternate; }
.orb--2 { width: 40vmax; height: 40vmax; right: -10vmax; top: 6vmax; background: #b9cbff; animation: drift2 22s ease-in-out infinite alternate; }
.orb--3 { width: 34vmax; height: 34vmax; left: 30%; bottom: -18vmax; background: #dcc4ff; animation: drift3 20s ease-in-out infinite alternate; }

@keyframes drift1 { to { transform: translate3d(8vmax, 6vmax, 0) scale(1.1); } }
@keyframes drift2 { to { transform: translate3d(-10vmax, 8vmax, 0) scale(0.92); } }
@keyframes drift3 { to { transform: translate3d(6vmax, -8vmax, 0) scale(1.08); } }

.hero__content {
  position: relative;
  max-width: 960px;
  text-align: center;
}
.hero__eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  font-size: 13px;
  font-weight: 500;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--ink-2);
  margin-bottom: 28px;
}
.hero__eyebrow::before {
  content: "";
  width: 8px; height: 8px;
  border-radius: 2px;
  background: var(--grad);
  animation: blink 2.4s steps(2, jump-none) infinite;
}
@keyframes blink { 50% { opacity: 0.25; } }

.hero__title {
  font-size: clamp(56px, 13vw, 168px);
  font-weight: 800;
  line-height: 0.92;
  letter-spacing: 0.06em;
  margin-right: -0.06em;
}
.hero__line { display: block; overflow: hidden; padding: 0.04em 0; }
.split { display: inline-block; }
.split .char {
  display: inline-block;
  transform: translate3d(0, 105%, 0);
  opacity: 0;
  animation: charUp 1.1s var(--ease) forwards;
  animation-delay: calc(0.25s + var(--i) * 0.06s);
}
/* 외곽선 글자: hover 시 그라데이션이 아래에서 차오름 */
.split--outline .char {
  color: transparent;
  -webkit-text-fill-color: transparent;
  -webkit-text-stroke: 1.5px var(--ink);
  background-image: var(--grad);
  background-repeat: no-repeat;
  background-position: 0 100%;
  background-size: 100% 0%;
  -webkit-background-clip: text;
  background-clip: text;
  transition: background-size 0.7s var(--ease), -webkit-text-stroke-color 0.7s var(--ease);
}
.split--outline:hover .char {
  background-size: 100% 100%;
  -webkit-text-stroke-color: transparent;
  transition-delay: calc(var(--i) * 0.04s);
}
@keyframes charUp { to { transform: none; opacity: 1; } }

.hero__lead {
  margin-top: 40px;
  font-size: clamp(20px, 2.6vw, 30px);
  font-weight: 600;
  letter-spacing: -0.02em;
  line-height: 1.4;
}
.hero__sub {
  margin-top: 14px;
  font-size: clamp(15px, 1.4vw, 17px);
  color: var(--ink-2);
  line-height: 1.75;
}
.hero__cta {
  margin-top: 40px;
  display: inline-flex;
  align-items: center;
  gap: 10px;
  height: 52px;
  padding: 0 26px;
  border-radius: 999px;
  background: var(--ink);
  color: #fff;
  font-size: 15px;
  font-weight: 600;
  letter-spacing: 0.02em;
  position: relative;
  overflow: hidden;
  transition: transform 0.4s var(--ease), box-shadow 0.4s var(--ease);
  box-shadow: 0 10px 30px -12px rgba(47, 107, 255, 0.55);
}
.hero__cta::before {
  content: "";
  position: absolute;
  inset: 0;
  background: var(--grad);
  opacity: 0;
  transition: opacity 0.4s var(--ease);
}
.hero__cta > * { position: relative; }
.hero__cta:hover::before { opacity: 1; }
.hero__cta svg { transition: transform 0.4s var(--ease); }
.hero__cta:hover svg { transform: translateY(3px); }

.reveal {
  opacity: 0;
  transform: translate3d(0, 18px, 0);
  animation: fadeUp 1s var(--ease) forwards;
  animation-delay: calc(0.3s + var(--d) * 0.1s);
}
@keyframes fadeUp { to { opacity: 1; transform: none; } }

.hero__scroll {
  position: absolute;
  bottom: 32px;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  font-size: 11px;
  letter-spacing: 0.24em;
  text-transform: uppercase;
  color: var(--ink-3);
  opacity: 0;
  animation: fadeUp 1s var(--ease) 1.6s forwards;
}
.hero__scroll i {
  width: 1px;
  height: 44px;
  background: var(--line);
  position: relative;
  overflow: hidden;
}
.hero__scroll i::after {
  content: "";
  position: absolute;
  left: 0; top: -40%;
  width: 100%; height: 40%;
  background: var(--ink);
  animation: scrollLine 2s var(--ease) infinite;
}
@keyframes scrollLine { to { top: 100%; } }

/* ---------- Section head ---------- */
.portfolio { padding: clamp(96px, 14vw, 180px) 0; position: relative; }
.section-head {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 24px 48px;
  flex-wrap: wrap;
  margin-bottom: clamp(40px, 6vw, 72px);
}
.section-head__label {
  font-size: 13px;
  font-weight: 600;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  background: var(--grad);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  margin-bottom: 14px;
}
.section-head__title {
  font-size: clamp(34px, 5.4vw, 64px);
  font-weight: 700;
  letter-spacing: -0.035em;
  line-height: 1.1;
}
.section-head__title sup {
  font-size: 0.26em;
  font-weight: 600;
  letter-spacing: 0.04em;
  color: var(--ink-3);
  vertical-align: top;
  margin-left: 0.4em;
  position: relative;
  top: 0.6em;
}
.section-head__desc {
  font-size: 16px;
  color: var(--ink-2);
  line-height: 1.75;
  text-align: right;
}

/* ---------- Work cards ---------- */
.works {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: clamp(16px, 2vw, 28px);
}
.card {
  display: flex;
  flex-direction: column;
  height: 100%;
  border-radius: 24px;
  background: #fff;
  box-shadow: 0 0 0 1px var(--line), 0 1px 2px rgba(14, 15, 19, 0.04);
  overflow: hidden;
  transition: transform 0.6s var(--ease), box-shadow 0.6s var(--ease);
}
.card:hover {
  transform: translateY(-6px);
  box-shadow:
    0 0 0 1px var(--line),
    0 40px 80px -40px rgba(47, 107, 255, 0.35),
    0 20px 40px -28px rgba(14, 15, 19, 0.18);
}

/* 스크린샷: 여백 있는 브랜드 톤 배경 위에 띄움 */
.card__media {
  position: relative;
  padding: clamp(20px, 2.4vw, 32px);
  background:
    radial-gradient(120% 140% at 0% 0%, #dffafb 0%, transparent 55%),
    radial-gradient(120% 140% at 100% 100%, #ece2ff 0%, transparent 60%),
    #eef1fb;
  overflow: hidden;
}
.card__media img {
  width: 100%;
  height: auto;
  aspect-ratio: 16 / 10;
  object-fit: cover;
  object-position: top left;
  border-radius: 12px;
  box-shadow: 0 0 0 1px rgba(14, 15, 19, 0.06), 0 24px 48px -20px rgba(47, 74, 160, 0.35);
  transition: transform 0.8s var(--ease);
}
.card:hover .card__media img { transform: translateY(-4px) scale(1.02); }

.card__body {
  display: flex;
  flex-direction: column;
  gap: 16px;
  padding: clamp(20px, 2vw, 26px);
  flex: 1;
}
.card__head { display: flex; align-items: center; gap: 14px; }
.card__icon {
  width: 44px;
  height: 44px;
  border-radius: 11px;
  background: #fff;
  box-shadow: 0 0 0 1px var(--line);
  padding: 2px;
  flex: none;
}
.card__title {
  font-size: 20px;
  font-weight: 700;
  letter-spacing: -0.02em;
  line-height: 1.25;
}
.card__meta { font-size: 13px; color: var(--ink-3); margin-top: 2px; }
.card__arrow {
  margin-left: auto;
  flex: none;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  border: 1px solid var(--line);
  color: var(--ink);
  position: relative;
  overflow: hidden;
  transition: color 0.4s var(--ease), border-color 0.4s var(--ease);
}
.card__arrow::before {
  content: "";
  position: absolute;
  inset: 0;
  background: var(--grad);
  opacity: 0;
  transition: opacity 0.4s var(--ease);
}
.card__arrow svg { position: relative; transition: transform 0.4s var(--ease); }
.card:hover .card__arrow { color: #fff; border-color: transparent; }
.card:hover .card__arrow::before { opacity: 1; }
.card:hover .card__arrow svg { transform: translate(1px, -1px); }
.card__desc { font-size: 15px; color: var(--ink-2); line-height: 1.7; }
.card__tags { display: flex; flex-wrap: wrap; gap: 6px; margin-top: auto; }
.card__tags li {
  font-size: 12px;
  font-weight: 500;
  padding: 5px 12px;
  border-radius: 999px;
  background: var(--bg-soft);
  color: var(--ink-2);
}

/* ---------- Scroll reveal ---------- */
.in-view {
  opacity: 0;
  transform: translate3d(0, 40px, 0);
  transition: opacity 1s var(--ease), transform 1s var(--ease);
}
.in-view.is-visible { opacity: 1; transform: none; }
.section-head__title.in-view { transition-delay: 0.08s; }

/* ---------- Footer ---------- */
.footer { border-top: 1px solid var(--line); padding: 40px 0; }
.footer__inner {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 20px 32px;
  flex-wrap: wrap;
}
.footer__info {
  margin: 16px 0 0;
  display: flex;
  flex-wrap: wrap;
  gap: 6px 24px;
  font-size: 13px;
  color: var(--ink-2);
}
.footer__info div { display: flex; gap: 8px; }
.footer__info dt { color: var(--ink-3); }
.footer__info dd { margin: 0; font-variant-numeric: tabular-nums; }
.footer__info a { transition: color 0.3s; }
.footer__info a:hover { color: var(--blue); }
.footer small { font-size: 13px; color: var(--ink-3); }

/* ---------- Responsive ---------- */
@media (max-width: 1024px) {
  .works { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 640px) {
  .works { grid-template-columns: 1fr; }
}
@media (max-width: 860px) {
  .section-head__desc { text-align: left; }
  .br-pc { display: none; }
}
@media (max-width: 520px) {
  :root { --header-h: 60px; }
  .logo { font-size: 16px; letter-spacing: 0.26em; margin-right: -0.26em; }
  .nav__link { font-size: 13px; }
  .hero__eyebrow { font-size: 11px; letter-spacing: 0.14em; }
  .split--outline .char { -webkit-text-stroke-width: 1px; }
}

/* ---------- Reduced motion ---------- */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    animation-delay: 0ms !important;
    transition-duration: 0.01ms !important;
  }
  html { scroll-behavior: auto; }
}
