/* ===================================================
   기본 설정 / 디자인 토큰
   ---------------------------------------------------
   brittanychiang.com의 팔레트와 레이아웃 언어를
   참고했습니다: 짙은 네이비 배경, 민트 포인트,
   좌측 고정 헤더 + 우측 스크롤 콘텐츠.
   =================================================== */

:root {
  /* 다크(기본): slate-900 계열 + teal 포인트 */
  --bg:          #0f172a;
  --text:        #94a3b8;
  --heading:     #e2e8f0;
  --muted:       #64748b;
  --accent:      #5eead4;
  --accent-dim:  rgba(45, 212, 191, .1);
  --line:        #475569;
  --line-soft:   #1e293b;
  --card-hover:  rgba(30, 41, 59, .5);
  --card-inset:  rgba(148, 163, 184, .1);
  --thumb-border: rgba(148, 163, 184, .15);
  --spotlight:   rgba(29, 78, 216, .15);
  --grid-line:   rgba(148, 163, 184, .05);

  --font: "Pretendard Variable", Pretendard, -apple-system, BlinkMacSystemFont,
          "Segoe UI", "Noto Sans KR", "Malgun Gothic", sans-serif;
}

:root[data-theme="light"] {
  --bg:          #f8fafc;
  --text:        #475569;
  --heading:     #0f172a;
  --muted:       #64748b;
  --accent:      #0d9488;
  --accent-dim:  rgba(13, 148, 136, .09);
  --line:        #94a3b8;
  --line-soft:   #e2e8f0;
  --card-hover:  rgba(226, 232, 240, .6);
  --card-inset:  rgba(15, 23, 42, .04);
  --thumb-border: rgba(15, 23, 42, .12);
  --spotlight:   rgba(13, 148, 136, .08);
  --grid-line:   rgba(15, 23, 42, .045);
}

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

html {
  scroll-behavior: smooth;
  scroll-padding-top: 24px;
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after {
    animation-duration: .01ms !important;
    transition-duration: .01ms !important;
  }
}

body {
  margin: 0;
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  line-height: 1.7;
  -webkit-font-smoothing: antialiased;
  transition: background-color .25s ease, color .25s ease;
}

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

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

::selection { background: var(--accent); color: var(--bg); }

.skip-link {
  position: absolute;
  left: -9999px;
  top: 8px;
  background: var(--accent);
  color: var(--bg);
  padding: 10px 18px;
  border-radius: 8px;
  z-index: 200;
  font-weight: 600;
}
.skip-link:focus { left: 16px; }

/* 화면에는 숨기고 스크린리더에만 읽히는 텍스트 */
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  margin: -1px;
  padding: 0;
  overflow: hidden;
  clip: rect(0 0 0 0);
  clip-path: inset(50%);
  white-space: nowrap;
  border: 0;
}

/* ===================================================
   스크롤 등장 애니메이션 (main.js가 .is-visible 부여)
   =================================================== */

.js-reveal [data-reveal] {
  opacity: 0;
  transform: translateY(22px);
  transition: opacity .6s cubic-bezier(.22,.61,.36,1),
              transform .6s cubic-bezier(.22,.61,.36,1);
  transition-delay: var(--reveal-delay, 0ms);
}

.js-reveal [data-reveal].is-visible {
  opacity: 1;
  transform: none;
}

@media (prefers-reduced-motion: reduce) {
  .js-reveal [data-reveal] {
    opacity: 1;
    transform: none;
    transition: none;
  }
}

/* ---------------------------------------------------
   Lenis 관성 스크롤용 스타일 (공식 lenis.css 내용)

   Lenis는 html에 lenis / lenis-smooth / lenis-stopped
   클래스를 직접 관리하며, 정리 과정에서 "lenis"로 시작하는
   클래스를 모두 지웁니다. 따라서 우리가 별도 클래스를
   붙이지 말고 Lenis의 클래스에 맞춰 스타일을 정의합니다.

   scroll-behavior: smooth가 남아 있으면 Lenis의 스크롤
   제어와 충돌해 스크롤이 멈추므로 반드시 꺼야 합니다.
   --------------------------------------------------- */

html.lenis, html.lenis body { height: auto; }

html.lenis { scroll-behavior: auto !important; }

.lenis.lenis-smooth [data-lenis-prevent] { overscroll-behavior: contain; }

.lenis.lenis-stopped { overflow: hidden; }

/* ===================================================
   마우스 스포트라이트
   =================================================== */

.spotlight {
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  background: radial-gradient(
    600px circle at var(--mouse-x, 50%) var(--mouse-y, 0%),
    var(--spotlight),
    transparent 80%
  );
  transition: background .15s ease;
}

/* 배경에 아주 옅은 격자를 깔아 빈 여백의 허전함을 덜어 줍니다. */
body::before {
  content: "";
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  background-image:
    linear-gradient(var(--grid-line) 1px, transparent 1px),
    linear-gradient(90deg, var(--grid-line) 1px, transparent 1px);
  background-size: 64px 64px;
  mask-image: radial-gradient(ellipse 90% 70% at 50% 0%, #000 25%, transparent 75%);
  -webkit-mask-image: radial-gradient(ellipse 90% 70% at 50% 0%, #000 25%, transparent 75%);
}

/* ===================================================
   레이아웃: 좌측 고정 + 우측 스크롤
   =================================================== */

.layout {
  position: relative;
  z-index: 1;
  max-width: 1280px;
  margin: 0 auto;
  padding: 0 24px;
}

.side {
  position: relative;
  padding: 56px 0 24px;
}

/* 이름 뒤에 은은한 민트 글로우 */
.side::before {
  content: "";
  position: absolute;
  top: 20px;
  left: -80px;
  width: 420px;
  height: 300px;
  z-index: -1;
  pointer-events: none;
  background: radial-gradient(closest-side,
    color-mix(in srgb, var(--accent) 20%, transparent), transparent);
  filter: blur(24px);
  animation: glow-breathe 7s ease-in-out infinite;
}

@keyframes glow-breathe {
  0%, 100% { opacity: .65; transform: scale(1); }
  50%      { opacity: 1;   transform: scale(1.08); }
}

@media (prefers-reduced-motion: reduce) {
  .side::before { animation: none; }
}

#content {
  padding: 24px 0 72px;
}

@media (min-width: 1024px) {
  .layout {
    display: flex;
    justify-content: space-between;
    gap: 4rem;
    padding: 0 48px;
  }

  .side {
    position: sticky;
    top: 0;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    width: 46%;
    max-height: 100vh;
    padding: 96px 0;
  }

  #content {
    width: 54%;
    padding: 96px 0;
  }
}

/* ===================================================
   왼쪽 헤더
   =================================================== */

/* --- 이름: 첫 화면의 주인공 --- */

.side-name {
  margin: 0;
  font-size: clamp(3.2rem, 8.5vw, 5.2rem);
  font-weight: 800;
  letter-spacing: -.045em;
  line-height: 1.05;
  background: linear-gradient(120deg,
    var(--heading) 15%,
    color-mix(in srgb, var(--accent) 85%, var(--heading)) 95%);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  /* 왼쪽에서 오른쪽으로 닦아내듯 등장 */
  animation: name-wipe 1s cubic-bezier(.22,.61,.36,1) both;
}
.logo-dot {
  -webkit-text-fill-color: var(--accent);
  color: var(--accent);
}

@keyframes name-wipe {
  from { clip-path: inset(0 100% 0 0); transform: translateY(8px); }
  to   { clip-path: inset(0 -8% 0 0);  transform: none; }
}

/* --- 직함: 타이핑 효과 --- */

.side-role {
  display: flex;
  align-items: center;
  margin: 18px 0 0;
  min-height: 1.9rem;      /* 문구가 바뀌어도 아래 내용이 밀리지 않도록 */
  font-size: 1.2rem;
  font-weight: 600;
  color: var(--heading);
  animation: fade-up .7s cubic-bezier(.22,.61,.36,1) .5s both;
}

.caret {
  display: inline-block;
  width: 2px;
  height: 1.25em;
  margin-left: 3px;
  background: var(--accent);
  animation: caret-blink 1.1s step-end infinite;
}

@keyframes caret-blink {
  0%, 100% { opacity: 1; }
  50%      { opacity: 0; }
}

.side-tagline {
  margin: 18px 0 0;
  max-width: 34ch;
  color: var(--text);
  animation: fade-up .7s cubic-bezier(.22,.61,.36,1) .68s both;
}

.side-nav { animation: fade-up .7s cubic-bezier(.22,.61,.36,1) .86s both; }

.side-bottom { animation: fade-up .7s cubic-bezier(.22,.61,.36,1) 1s both; }

@keyframes fade-up {
  from { opacity: 0; transform: translateY(14px); }
  to   { opacity: 1; transform: none; }
}

/* 모션을 줄이는 사용자에게는 등장 연출을 걸지 않습니다. */
@media (prefers-reduced-motion: reduce) {
  .side-name, .side-role, .side-tagline, .side-nav, .side-bottom {
    animation: none;
  }
  .caret { animation: none; }
}

/* --- 스크롤 유도 --- */

.scroll-cue {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  color: var(--muted);
  transition: color .2s ease, opacity .35s ease, visibility .35s ease;
}
.scroll-cue:hover { color: var(--accent); }

/* 스크롤을 내리면 사라집니다 (main.js가 클래스를 붙임). */
.scroll-cue.is-hidden {
  opacity: 0;
  visibility: hidden;
}

.scroll-cue-track {
  position: relative;
  display: block;
  width: 20px;
  height: 32px;
  border: 1.5px solid currentColor;
  border-radius: 999px;
  opacity: .7;
}

.scroll-cue-dot {
  position: absolute;
  top: 6px;
  left: 50%;
  width: 3px;
  height: 6px;
  margin-left: -1.5px;
  border-radius: 999px;
  background: var(--accent);
  animation: cue-fall 1.8s cubic-bezier(.6,.05,.3,.95) infinite;
}

@keyframes cue-fall {
  0%       { transform: translateY(0);    opacity: 0; }
  25%      { opacity: 1; }
  75%      { transform: translateY(13px); opacity: 0; }
  100%     { transform: translateY(13px); opacity: 0; }
}

.scroll-cue-text {
  font-size: .74rem;
  font-weight: 700;
  letter-spacing: .14em;
}

@media (prefers-reduced-motion: reduce) {
  .scroll-cue-dot { animation: none; opacity: 1; }
}

/* --- 세로 내비게이션 (선이 자라나는 인터랙션) --- */

.side-nav {
  display: none;
  margin-top: 56px;
}

@media (min-width: 1024px) {
  .side-nav { display: block; }
}

.nav-link {
  display: flex;
  align-items: center;
  padding: 12px 0;
}

.nav-line {
  width: 32px;
  height: 1px;
  margin-right: 16px;
  background: var(--line);
  transition: width .25s ease, background-color .25s ease;
}

.nav-text {
  font-size: .8rem;
  font-weight: 700;
  letter-spacing: .16em;
  color: var(--muted);
  transition: color .25s ease;
}

.nav-link:hover .nav-line,
.nav-link.is-active .nav-line {
  width: 64px;
  background: var(--heading);
}
.nav-link:hover .nav-text,
.nav-link.is-active .nav-text {
  color: var(--heading);
}

/* --- 소셜 + 테마 토글 --- */

.side-bottom {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 22px;
  margin-top: 40px;
}

.side-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-left: -10px; /* 아이콘 여백만큼 당겨 왼쪽 정렬을 맞춥니다 */
}

/* 스크롤 유도는 좌측 열이 고정되는 데스크톱에서만 의미가 있습니다. */
.scroll-cue { display: none; }

@media (min-width: 1024px) {
  .scroll-cue { display: inline-flex; }
}

.social-list {
  display: flex;
  align-items: center;
  gap: 4px;
}

.social-list a {
  display: grid;
  place-items: center;
  width: 42px;
  height: 42px;
  color: var(--muted);
  transition: color .18s ease, transform .18s ease;
}
.social-list a:hover {
  color: var(--accent);
  transform: translateY(-2px);
}

.theme-toggle {
  display: grid;
  place-items: center;
  width: 42px;
  height: 42px;
  border: none;
  border-radius: 50%;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  transition: color .18s ease;
}
.theme-toggle:hover { color: var(--accent); }

.theme-toggle .icon-moon { display: none; }
:root[data-theme="light"] .theme-toggle .icon-sun  { display: none; }
:root[data-theme="light"] .theme-toggle .icon-moon { display: block; }

/* ===================================================
   오른쪽 콘텐츠 공통
   =================================================== */

.section {
  padding: 48px 0;
}
.section:first-child { padding-top: 8px; }

/* 모바일에서는 섹션 제목을 상단 고정 라벨처럼, 데스크톱에서는 숨기지 않고 표시 */
.section-heading {
  margin: 0 0 24px;
  font-size: .84rem;
  font-weight: 700;
  letter-spacing: .16em;
  color: var(--heading);
}

.section p {
  margin: 0 0 18px;
  max-width: 60ch;
}

.hl {
  color: var(--accent);
  font-weight: 500;
}

/* ===================================================
   소개: 기술 스택
   =================================================== */

.skills {
  display: grid;
  gap: 20px;
  margin-top: 36px;
}

.skill-group h3 {
  margin: 0 0 10px;
  font-size: .74rem;
  font-weight: 700;
  letter-spacing: .12em;
  color: var(--muted);
}

/* --- 민트 알약 태그 (Chiang 시그니처) --- */

.chip-list {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}
.chip-list li {
  padding: 4px 12px;
  border-radius: 999px;
  background: var(--accent-dim);
  color: var(--accent);
  font-size: .78rem;
  font-weight: 500;
  line-height: 1.6;
}

/* ===================================================
   프로젝트 필터
   =================================================== */

.filters {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 28px;
}

.filter-btn {
  padding: 6px 16px;
  border: 1px solid var(--line-soft);
  border-radius: 999px;
  background: transparent;
  color: var(--muted);
  font-family: inherit;
  font-size: .84rem;
  font-weight: 600;
  cursor: pointer;
  transition: all .18s ease;
}
.filter-btn:hover {
  color: var(--accent);
  border-color: var(--accent);
}
.filter-btn[aria-pressed="true"] {
  background: var(--accent-dim);
  border-color: transparent;
  color: var(--accent);
}

/* ===================================================
   프로젝트 목록 (행 기반, 호버 시 나머지 흐려짐)
   =================================================== */

.project-list {
  display: flex;
  flex-direction: column;
}

.project-group { margin-bottom: 20px; }

.project-subheading {
  margin: 0 0 18px;
  padding-left: 18px;
  font-size: .76rem;
  font-weight: 700;
  letter-spacing: .14em;
  color: var(--muted);
}

.row-list,
.feature-list {
  display: flex;
  flex-direction: column;
}

.project-row { margin-bottom: 14px; }

/* --- 카드 전체 클릭 (stretched-link 기법) ---
   제목 링크의 ::after를 카드 전체로 펼쳐서, 링크가 있는
   프로젝트는 카드 어디를 눌러도 해당 사이트로 이동합니다.
   보조 링크·태그는 z-index로 그 위에 올려 개별 클릭을 유지합니다. */

.row-inner .title-link::after,
.feature-inner .title-link::after {
  content: "";
  position: absolute;
  inset: 0;
  z-index: 1;
}

.row-links,
.chip-list {
  position: relative;
  z-index: 2;
}

.row-inner {
  position: relative;
  display: grid;
  grid-template-columns: 1fr;
  gap: 14px;
  padding: 18px;
  border-radius: 12px;
  transition: opacity .25s ease, background-color .25s ease,
              box-shadow .25s ease, transform .25s ease;
}

@media (min-width: 640px) {
  .row-inner {
    grid-template-columns: 150px 1fr;
    gap: 22px;
  }
}

/* 목록 위에 마우스가 있으면 그 목록 안의 항목을 흐리게 하고,
   호버 중인 항목만 또렷하게 + 배경이 은은하게 밝아짐.
   (대표작·일반 목록 각각 자기 그룹 안에서만 동작) */
@media (hover: hover) and (min-width: 640px) {
  .row-list:hover .row-inner,
  .feature-list:hover .feature-inner { opacity: .5; }

  .row-list .project-row:hover .row-inner,
  .feature-list .feature-card:hover .feature-inner {
    opacity: 1;
    background: var(--card-hover);
    box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--accent) 28%, transparent),
                0 8px 30px rgba(0, 0, 0, .18);
  }
}

.row-thumb {
  aspect-ratio: 16 / 10;
  border: 1px solid var(--thumb-border);
  border-radius: 6px;
  overflow: hidden;
  background: var(--line-soft);
  transition: border-color .25s ease;
}
.project-row:hover .row-thumb { border-color: var(--thumb-border); }

.row-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

/* --- 생성형 대체 썸네일 ---
   스크린샷이 없을 때 프로젝트마다 다른 색의 그라디언트 아트를
   만들어 줍니다. --h는 main.js가 제목에서 계산해 넣습니다. */

.thumb-placeholder {
  position: relative;
  width: 100%;
  height: 100%;
  display: grid;
  place-items: center;
  overflow: hidden;
  background:
    radial-gradient(115% 115% at 12% 10%,
      hsl(var(--h, 170) 72% 52% / .55), transparent 58%),
    radial-gradient(95% 95% at 88% 85%,
      hsl(calc(var(--h, 170) + 55) 78% 48% / .42), transparent 55%),
    linear-gradient(140deg,
      hsl(var(--h, 170) 42% 20%), hsl(calc(var(--h, 170) + 40) 48% 12%));
}

:root[data-theme="light"] .thumb-placeholder {
  background:
    radial-gradient(115% 115% at 12% 10%,
      hsl(var(--h, 170) 80% 72% / .75), transparent 58%),
    radial-gradient(95% 95% at 88% 85%,
      hsl(calc(var(--h, 170) + 55) 85% 68% / .6), transparent 55%),
    linear-gradient(140deg,
      hsl(var(--h, 170) 55% 88%), hsl(calc(var(--h, 170) + 40) 60% 78%));
}

/* 미세한 점 격자로 질감을 더합니다. */
.thumb-placeholder::after {
  content: "";
  position: absolute;
  inset: 0;
  background-image: radial-gradient(currentColor .5px, transparent .5px);
  background-size: 10px 10px;
  opacity: .16;
  color: #fff;
}
:root[data-theme="light"] .thumb-placeholder::after { color: #0f172a; }

.thumb-initial {
  position: relative;
  z-index: 1;
  font-size: 2.1rem;
  font-weight: 800;
  letter-spacing: -.04em;
  color: #fff;
  text-shadow: 0 2px 12px rgba(0, 0, 0, .35);
}
:root[data-theme="light"] .thumb-initial {
  color: hsl(var(--h, 170) 60% 22%);
  text-shadow: 0 1px 6px rgba(255, 255, 255, .5);
}

/* 호버 시 썸네일이 살짝 확대됩니다. */
.row-thumb .thumb-placeholder,
.feature-thumb .thumb-placeholder,
.row-thumb img,
.feature-thumb img {
  transition: transform .4s cubic-bezier(.22,.61,.36,1);
}
.project-row:hover .thumb-placeholder,
.feature-card:hover .thumb-placeholder,
.project-row:hover .row-thumb img,
.feature-card:hover .feature-thumb img {
  transform: scale(1.06);
}

.row-category {
  margin: 0 0 4px;
  font-size: .72rem;
  font-weight: 700;
  letter-spacing: .1em;
  color: var(--muted);
}

.row-title {
  margin: 0 0 6px;
  font-size: 1.05rem;
  font-weight: 700;
  color: var(--heading);
  line-height: 1.4;
}

.row-title .title-link {
  display: inline-flex;
  align-items: baseline;
  gap: 5px;
  transition: color .18s ease;
}
.project-row:hover .row-title .title-link { color: var(--accent); }

.arrow {
  display: inline-block;
  width: 14px;
  height: 14px;
  flex: none;
  transform: translateY(1px);
  transition: transform .2s ease;
}
.project-row:hover .arrow { transform: translate(3px, -2px); }

.row-desc {
  margin: 0 0 14px;
  font-size: .92rem;
  max-width: 56ch;
}

.row-links {
  display: flex;
  flex-wrap: wrap;
  gap: 14px;
  margin-bottom: 12px;
}
.row-links a {
  font-size: .82rem;
  font-weight: 600;
  color: var(--muted);
  transition: color .18s ease;
}
.row-links a:hover { color: var(--accent); }

/* ===================================================
   대표작 카드 (큰 가로형: 스크린샷 + 상세 설명)
   =================================================== */

.feature-card { margin-bottom: 18px; }

.feature-inner {
  position: relative; /* stretched-link 기준점 */
  display: grid;
  grid-template-columns: 1fr;
  gap: 18px;
  padding: 22px;
  border-radius: 14px;
  /* 대표작은 평소에도 옅은 테두리로 존재감을 줍니다. */
  box-shadow: inset 0 0 0 1px var(--card-inset);
  transition: opacity .25s ease, background-color .25s ease,
              box-shadow .25s ease;
}

@media (min-width: 640px) {
  .feature-inner {
    grid-template-columns: minmax(0, 5fr) minmax(0, 6fr);
    gap: 26px;
    align-items: start;
  }
}

.feature-thumb {
  aspect-ratio: 16 / 10;
  border: 1px solid var(--thumb-border);
  border-radius: 8px;
  overflow: hidden;
  background: var(--line-soft);
}

.feature-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.feature-thumb .thumb-placeholder { font-size: 3rem; }

.feature-title {
  margin: 0 0 8px;
  font-size: 1.3rem;
  font-weight: 800;
  letter-spacing: -.02em;
  color: var(--heading);
  line-height: 1.35;
}

.feature-card:hover .feature-title .title-link { color: var(--accent); }
.feature-card:hover .arrow { transform: translate(3px, -2px); }

.feature-desc {
  margin: 0 0 14px;
  font-size: .95rem;
  max-width: 56ch;
}

/* 핵심 성과 목록: 민트 마커 */
.feature-highlights {
  margin: 0 0 14px;
  display: flex;
  flex-direction: column;
  gap: 5px;
}
.feature-highlights li {
  position: relative;
  padding-left: 18px;
  font-size: .88rem;
}
.feature-highlights li::before {
  content: "▹";
  position: absolute;
  left: 0;
  color: var(--accent);
}

.empty-msg {
  padding: 40px 0;
  color: var(--muted);
}

/* ===================================================
   연락
   =================================================== */

.contact-cta {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin-top: 8px;
  font-size: clamp(1.1rem, 3vw, 1.45rem);
  font-weight: 700;
  color: var(--heading);
  border-bottom: 2px solid var(--accent);
  padding-bottom: 3px;
  transition: color .18s ease;
}
.contact-cta:hover { color: var(--accent); }
.contact-cta svg { transition: transform .2s ease; }
.contact-cta:hover svg { transform: translate(3px, -3px); }

.colophon {
  margin-top: 72px;
  font-size: .84rem;
  color: var(--muted);
}
.colophon p { margin: 0 0 6px; max-width: 52ch; }
.colophon a {
  color: var(--text);
  font-weight: 600;
  transition: color .18s ease;
}
.colophon a:hover { color: var(--accent); }

/* ===================================================
   반응형 보정
   =================================================== */

@media (max-width: 1023px) {
  .side-bottom { margin-top: 28px; }
}
