/* 황인호 포트폴리오 — 색·글꼴·간격 토큰 */
:root {
  --bg: #F3F4F1;
  --surface: #FFFFFF;
  --ink: #15181D;
  --muted: #59606A;
  --line: #D8DBD5;
  --play: #0B6E4F;
  --play-bg: #E1EFE8;
  --wall: #22303A;
  --bezel: #15181D;
  --focus: #1F5FBF;
  --accent: #3B6BFF;
  --accent-2: #8A63FF;
  --ease-out: cubic-bezier(.2, .8, .2, 1);
  --spring: cubic-bezier(.34, 1.56, .64, 1);

  --sans: "IBM Plex Sans KR", "Apple SD Gothic Neo", "Malgun Gothic", system-ui, sans-serif;
  --mono: "IBM Plex Mono", ui-monospace, Consolas, monospace;

  --shot-h: clamp(300px, 46vw, 440px);
  --wide-h: clamp(170px, 26vw, 300px);
}

:root:not([data-theme="light"]) { color-scheme: light dark; }

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #14171B;
    --surface: #1B1F25;
    --ink: #E9EBEE;
    --muted: #A1A8B2;
    --line: #2D333B;
    --play: #5CC49A;
    --play-bg: #15302A;
    --bezel: #05070A;
    --focus: #8EC5FF;
    --accent: #7FA2FF;
    --accent-2: #B39BFF;
  }
}

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

html { scroll-behavior: smooth; -webkit-text-size-adjust: 100%; }
@media (prefers-reduced-motion: reduce) { html { scroll-behavior: auto; } }

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--sans);
  font-size: 16px;
  line-height: 1.7;
  word-break: keep-all;
  overflow-wrap: break-word;
}

a { color: inherit; }
img { max-width: 100%; display: block; }
h1, h2, h3, p, ul, dl, dd { margin: 0; }

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

.wrap { width: 100%; max-width: 1120px; margin: 0 auto; padding: 0 24px; }

.sr-only {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}

.skip {
  position: absolute; left: 16px; top: -48px; z-index: 10;
  background: var(--ink); color: var(--bg); padding: 8px 14px; border-radius: 8px;
  text-decoration: none; font-weight: 500;
}
.skip:focus { top: 12px; }

/* 머리글 */
.top { border-bottom: 1px solid var(--line); }
.top-in { display: flex; align-items: center; justify-content: space-between; height: 64px; }
.name { font-weight: 700; font-size: 18px; text-decoration: none; letter-spacing: -0.01em; }
.top nav { display: flex; gap: 24px; font-size: 15px; }
.top nav a { text-decoration: none; color: var(--muted); }
.top nav a:hover { color: var(--ink); }

/* 첫 화면 */
.hero {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 64px;
  align-items: center;
  padding-top: 80px;
  padding-bottom: 96px;
}
.hero h1 {
  font-size: clamp(36px, 5.6vw, 64px);
  line-height: 1.18;
  font-weight: 700;
  letter-spacing: -0.035em;
}
.lead {
  margin-top: 24px;
  max-width: 34em;
  font-size: 18px;
  color: var(--muted);
}
.facts {
  display: flex;
  flex-wrap: wrap;
  gap: 12px 40px;
  margin-top: 40px;
  padding-top: 24px;
  border-top: 1px solid var(--line);
  max-width: 34em;
}
.facts dt { font-size: 13.5px; color: var(--muted); }
.facts dd { font-size: 19px; font-weight: 500; }

/* 휴대폰 홈 화면 */
.phone-stage { perspective: 1100px; }
.phone {
  position: relative;
  isolation: isolate;
  overflow: hidden;
  width: 300px;
  aspect-ratio: 300 / 620;
  background: var(--wall);
  border: 10px solid var(--bezel);
  border-radius: 46px;
  padding: 14px 20px 20px;
  color: #E6EBF0;
  display: flex;
  flex-direction: column;
  transform: rotateX(var(--rx, 0deg)) rotateY(var(--ry, 0deg));
  transition: transform .6s var(--ease-out);
  box-shadow: 0 40px 80px -40px rgba(20, 30, 60, .55);
}
/* 화면 속 빛: 천천히 돌고, 퇴근하면 밝아진다 */
.phone::before {
  content: "";
  position: absolute;
  left: 50%; top: 50%;
  width: 240%; aspect-ratio: 1;
  transform: translate(-50%, -50%);
  z-index: -1;
  background:
    radial-gradient(circle at 40% 40%, rgba(70, 120, 255, .75), transparent 27%),
    radial-gradient(circle at 60% 58%, rgba(150, 95, 255, .65), transparent 29%),
    radial-gradient(circle at 46% 64%, rgba(40, 200, 170, .35), transparent 24%);
  filter: blur(8px);
  opacity: .9;
  transition: opacity 1.2s ease;
}
.phone.working::before { opacity: .25; }

.day { margin: 0 auto 30px; width: 64%; text-align: center; }
.dayline { height: 4px; border-radius: 4px; background: rgba(255, 255, 255, .16); overflow: hidden; }
.dayline span {
  display: block; height: 100%;
  background: linear-gradient(90deg, #5B8CFF, #A47BFF);
  transform-origin: left;
}
.day-state {
  margin-top: 9px;
  font-size: 12.5px; font-weight: 500;
  color: #AEBBC7;
  transition: color .4s ease;
}
.day-state.done { color: #9BE7C2; }
.status {
  display: flex; justify-content: space-between; align-items: center;
  font-size: 13px; font-weight: 500; padding: 0 6px;
}
.clock {
  margin: 32px 0 16px;
  text-align: center;
  font-size: 68px;
  font-weight: 300;
  line-height: 1;
  letter-spacing: -0.03em;
  color: #F4F7FA;
  font-variant-numeric: tabular-nums;
}
.apps {
  list-style: none;
  padding: 0;
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 26px 8px;
}
.app {
  display: flex; flex-direction: column; align-items: center; gap: 8px;
  text-decoration: none; font-size: 12.5px; color: #E6EBF0;
  border-radius: 14px; padding: 4px 0;
}
.app img {
  width: 60px; height: 60px; border-radius: 22%;
  object-fit: cover;
  transition: transform .2s var(--spring), box-shadow .2s ease;
}
.app:hover img, .app:focus-visible img {
  transform: scale(1.1);
  box-shadow: 0 10px 22px -8px rgba(0, 0, 0, .6);
}
.app:active img { transform: scale(.92); }
.app:focus-visible { outline-color: #8EC5FF; }

/* 프로젝트 */
.project {
  padding-top: 72px;
  padding-bottom: 80px;
  border-top: 1px solid var(--line);
  scroll-margin-top: 8px;
}
.proj-head {
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: 20px;
}
.proj-icon { width: 72px; height: 72px; border-radius: 22%; object-fit: cover; }
.proj-title { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 14px; }
.proj-title h2 { font-size: clamp(26px, 3.4vw, 34px); line-height: 1.25; font-weight: 700; letter-spacing: -0.025em; }
.alt-name { font-size: 0.55em; font-weight: 400; color: var(--muted); letter-spacing: 0; margin-left: 4px; }

.badge {
  display: inline-block;
  font-size: 13px; font-weight: 500; line-height: 1;
  padding: 7px 11px; border-radius: 999px;
}
.badge.play { color: var(--play); background: var(--play-bg); }
.badge.plain { color: var(--muted); border: 1px solid var(--line); }

.store {
  justify-self: end;
  display: inline-flex; align-items: center; gap: 8px;
  padding: 11px 18px;
  border: 1.5px solid var(--ink);
  border-radius: 10px;
  font-size: 15px; font-weight: 500;
  text-decoration: none;
  white-space: nowrap;
  background: linear-gradient(var(--ink), var(--ink)) no-repeat left / 0% 100%;
  transition: background-size .35s var(--ease-out), color .25s ease, transform .2s var(--spring);
}
.store:hover, .store:focus-visible { background-size: 100% 100%; color: var(--bg); }
.store:active { transform: scale(.97); }

.summary { margin-top: 20px; max-width: 38em; font-size: 18px; }

.meta {
  display: grid;
  grid-template-columns: minmax(0, 1.6fr) repeat(3, minmax(0, 1fr));
  gap: 16px 32px;
  margin-top: 28px;
  padding: 18px 0;
  position: relative;
}
.meta::before, .meta::after {
  content: "";
  position: absolute; left: 0; right: 0; height: 1px;
  background: var(--line);
  transform-origin: left;
}
.meta::before { top: 0; }
.meta::after { bottom: 0; }
.meta dt { font-size: 13px; color: var(--muted); }
.meta dd { font-size: 15px; }
.meta dd.mono { font-family: var(--mono); font-size: 13.5px; overflow-wrap: anywhere; }

.shots {
  display: flex;
  gap: 14px;
  margin-top: 32px;
  overflow-x: auto;
  scroll-snap-type: x proximity;
  padding-top: 8px;
  padding-bottom: 16px;
  scrollbar-width: thin;
  scrollbar-color: var(--line) transparent;
}
.shots img {
  height: var(--shot-h);
  width: auto;
  flex: none;
  border-radius: 16px;
  border: 1px solid var(--line);
  background: var(--surface);
  scroll-snap-align: start;
  transition: transform .3s var(--ease-out), box-shadow .3s ease;
}
.shots img:hover { transform: translateY(-6px); box-shadow: 0 18px 32px -16px rgba(20, 30, 60, .45); }
.shots.wide img { height: var(--wide-h); border-radius: 12px; }
.shots:focus-visible { outline-offset: 6px; }

.detail {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 24px 56px;
  margin-top: 36px;
}
.detail h3 { font-size: 17px; font-weight: 700; margin-bottom: 10px; }
.detail ul { padding-left: 1.1em; }
.detail li { margin: 8px 0; max-width: 36em; }
.detail li::marker { color: var(--muted); }

.stack {
  list-style: none;
  padding: 0;
  display: flex; flex-wrap: wrap; gap: 8px;
  margin-top: 32px;
}
.stack li {
  font-size: 13.5px;
  padding: 4px 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
}

/* 이력 */
.career {
  padding-top: 72px;
  padding-bottom: 88px;
  border-top: 1px solid var(--line);
  scroll-margin-top: 8px;
}
.career > h2 { font-size: clamp(26px, 3.4vw, 34px); line-height: 1.25; font-weight: 700; letter-spacing: -0.025em; }

.timeline { list-style: none; padding: 0; margin: 28px 0 0; position: relative; --p: 1; --x: 199px; }
/* 경력 선: 스크롤에 맞춰 위에서 아래로 그려진다 */
.timeline::before, .timeline::after {
  content: "";
  position: absolute; top: 0; bottom: 0; left: var(--x); width: 2px;
}
.timeline::before { background: var(--line); }
.timeline::after {
  background: linear-gradient(var(--accent), var(--accent-2));
  transform-origin: top;
  transform: scaleY(var(--p));
}
.entry {
  position: relative;
  display: grid;
  grid-template-columns: 180px minmax(0, 1fr);
  gap: 8px 40px;
  padding: 26px 0;
  border-bottom: 1px solid var(--line);
}
.entry::before {
  content: "";
  position: absolute; z-index: 1;
  left: calc(var(--x) - 5px); top: 33px;
  width: 12px; height: 12px; border-radius: 50%;
  background: var(--accent);
  border: 2px solid var(--bg);
  box-shadow: 0 0 0 4px color-mix(in srgb, var(--accent) 22%, transparent);
  transition: background-color .4s ease, box-shadow .4s ease, transform .5s var(--spring);
}
.entry.reveal:not(.lit)::before { background: var(--line); box-shadow: none; transform: scale(.6); }
.entry:first-child { border-top: 1px solid var(--line); }
.when { font-size: 15px; color: var(--muted); font-variant-numeric: tabular-nums; padding-top: 2px; }
.entry h3 { font-size: 19px; font-weight: 700; line-height: 1.4; }
.role { font-size: 15px; font-weight: 400; color: var(--muted); margin-left: 6px; }
.entry ul { list-style: disc; padding-left: 1.1em; margin-top: 8px; }
.entry ul li { margin: 6px 0; max-width: 46em; }
.entry ul li::marker { color: var(--muted); }

.career-more {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 32px 56px;
  margin-top: 48px;
}
.career-more h3 { font-size: 17px; font-weight: 700; margin-bottom: 12px; }
.plain-list > div { display: grid; grid-template-columns: 9.5em minmax(0, 1fr); gap: 4px 16px; padding: 10px 0; border-top: 1px solid var(--line); }
.plain-list dt { font-size: 14.5px; color: var(--muted); font-variant-numeric: tabular-nums; }
.plain-list dd { font-size: 15.5px; }

.career-more .span-2 { grid-column: 1 / -1; }
.issuer { color: var(--muted); font-size: 14px; margin-left: 6px; }

/* 이력 위 소개 */
.profile {
  display: grid;
  grid-template-columns: 148px minmax(0, 1fr);
  gap: 32px;
  align-items: center;
  margin-top: 28px;
  margin-bottom: 40px;
}
.photo {
  width: 148px;
  height: auto;
  aspect-ratio: 360 / 463;
  object-fit: cover;
  border-radius: 12px;
  border: 1px solid var(--line);
  background: var(--surface);
}
.profile-name { font-size: 22px; font-weight: 700; letter-spacing: -0.02em; }
.profile-role { color: var(--muted); font-size: 15px; margin-bottom: 10px; }
.profile-text p:last-child { max-width: 38em; }

/* AI 활용 */
.ai {
  padding-top: 72px;
  padding-bottom: 80px;
  border-top: 1px solid var(--line);
  scroll-margin-top: 8px;
}
.ai > h2 { font-size: clamp(26px, 3.4vw, 34px); line-height: 1.25; font-weight: 700; letter-spacing: -0.025em; }
.section-lead { margin-top: 16px; max-width: 40em; font-size: 17px; color: var(--muted); }
.ai-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 40px 56px;
  margin-top: 36px;
}
.ai-grid h3 { font-size: 17px; font-weight: 700; margin-bottom: 12px; }
.plain-list.stacked > div { grid-template-columns: 1fr; gap: 2px; }
.plain-list.stacked dt { color: var(--ink); font-weight: 500; font-size: 15px; }
.plain-list.stacked dd { color: var(--muted); font-size: 15px; }
.plain-list code {
  font-family: var(--mono);
  font-size: 13px;
  overflow-wrap: anywhere;
}
.plain-list dd code {
  display: inline-block;
  margin: 3px 4px 3px 0;
  padding: 1px 7px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--surface);
  color: var(--ink);
}

@media (max-width: 900px) {
  .career-more, .ai-grid { grid-template-columns: 1fr; }
}
@media (max-width: 560px) {
  .ai { padding-top: 56px; padding-bottom: 64px; }
  .profile { grid-template-columns: 96px minmax(0, 1fr); gap: 4px 18px; }
  .profile-text { display: contents; }
  .photo { grid-row: 1 / 3; width: 96px; }
  .profile-name { grid-column: 2; align-self: end; font-size: 20px; }
  .profile-role { grid-column: 2; align-self: start; margin-bottom: 0; }
  .profile-text p:last-child { grid-column: 1 / -1; margin-top: 16px; }
  .issuer { display: block; margin-left: 0; }
  .career { padding-top: 56px; padding-bottom: 64px; }
  .timeline { --x: 5px; }
  .entry { grid-template-columns: 1fr; gap: 2px; padding: 22px 0 22px 28px; }
  .entry::before { top: 29px; }
  .role { display: block; margin-left: 0; }
  .plain-list > div { grid-template-columns: 1fr; gap: 2px; }
}

/* 바닥글 */
.foot { border-top: 1px solid var(--line); }
.foot-in { padding-top: 36px; padding-bottom: 56px; font-size: 14px; color: var(--muted); display: grid; gap: 8px; }
.foot-in p { max-width: 46em; }
.foot a:hover { color: var(--ink); }

/* 화면 폭에 맞추기 */
@media (max-width: 900px) {
  .hero { grid-template-columns: 1fr; gap: 56px; padding-top: 56px; padding-bottom: 72px; }
  .phone-stage { justify-self: center; }
  .meta { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .detail { grid-template-columns: 1fr; }
}

@media (max-width: 560px) {
  .wrap { padding-left: 16px; padding-right: 16px; }
  .top nav { gap: 18px; }
  .lead, .summary { font-size: 16.5px; }
  .phone { width: 264px; border-width: 8px; border-radius: 40px; padding: 12px 14px 16px; }
  .clock { font-size: 56px; margin: 26px 0 14px; }
  .day { margin-bottom: 26px; }
  .app img { width: 54px; height: 54px; }
  .project { padding-top: 56px; padding-bottom: 64px; }
  .proj-head { grid-template-columns: auto 1fr; gap: 14px; }
  .proj-icon { width: 60px; height: 60px; }
  .store { grid-column: 1 / -1; justify-self: stretch; justify-content: center; }
  .meta { grid-template-columns: 1fr; }
}

/* ───────── 움직임 ───────── */

/* 맨 위 읽기 진행 막대 */
.progress {
  position: fixed; top: 0; left: 0; right: 0; z-index: 50;
  height: 3px;
  background: linear-gradient(90deg, var(--accent), var(--accent-2));
  transform-origin: left;
  transform: scaleX(0);
  pointer-events: none;
}

.hero h1 .line { display: block; overflow: hidden; padding-bottom: .06em; margin-bottom: -.06em; }
.hero h1 .line > span { display: block; }

@media (prefers-reduced-motion: no-preference) {
  /* 첫 화면: 제목이 아래에서 올라오고, 휴대폰이 떠오른 뒤 시계가 퇴근 시간까지 간다 */
  .hero h1 .line > span { animation: line-up 1s var(--ease-out) both; }
  .hero h1 .line:nth-child(2) > span { animation-delay: .12s; }
  .lead { animation: rise .9s var(--ease-out) .3s both; }
  .facts { animation: rise .9s var(--ease-out) .45s both; }
  .phone-stage { animation: phone-in 1.1s var(--ease-out) .1s both, float 6s ease-in-out 1.6s infinite; }
  .phone::before { animation: glow-spin 18s linear infinite; }
  .app { animation: app-in .6s var(--spring) both; animation-delay: calc(var(--i) * 90ms + 1.75s); }
  .app:hover img { animation: wiggle .28s ease-in-out infinite alternate; }

  /* 스크롤로 나타나는 블록 (JS 가 .reveal 을 붙였을 때만 숨긴다) */
  .fx.reveal:not(.in) { opacity: 0; }
  .fx.in { animation: rise .8s var(--ease-out) backwards; }

  /* 프로젝트 */
  .project.reveal:not(.in) :is(.proj-icon, .proj-title, .store, .summary, .detail, .shots img, .stack li),
  .project.reveal:not(.in) .meta::before,
  .project.reveal:not(.in) .meta::after,
  .project.reveal:not(.in) .meta > div { opacity: 0; }
  .project.in .proj-icon { animation: icon-in .9s var(--spring) backwards; }
  .project.in .proj-title { animation: rise .7s var(--ease-out) .12s backwards; }
  .project.in .store { animation: rise .7s var(--ease-out) .22s backwards; }
  .project.in .summary { animation: rise .7s var(--ease-out) .22s backwards; }
  .project.in .meta::before, .project.in .meta::after { animation: draw 1s var(--ease-out) .3s backwards; }
  .project.in .meta > div { animation: rise .6s var(--ease-out) backwards; }
  .project.in .meta > div:nth-child(1) { animation-delay: .35s; }
  .project.in .meta > div:nth-child(2) { animation-delay: .42s; }
  .project.in .meta > div:nth-child(3) { animation-delay: .49s; }
  .project.in .meta > div:nth-child(4) { animation-delay: .56s; }
  .project.in .shots img { animation: deal .9s var(--ease-out) backwards; animation-delay: calc(.35s + var(--n, 0) * 90ms); }
  .project.in .detail { animation: rise .8s var(--ease-out) .5s backwards; }
  .project.in .stack li { animation: pop .5s var(--spring) backwards; animation-delay: calc(.6s + var(--n, 0) * 45ms); }

  /* 휴대폰 아이콘을 눌렀을 때: 도착한 프로젝트 아이콘이 튄다 */
  .project.ping .proj-icon { animation: ping 1s var(--spring) .55s; }

  /* AI 활용: 이름표가 하나씩 튀어나온다 */
  .ai-grid > section.reveal:not(.in) dd code { opacity: 0; }
  .ai-grid > section.in dd code { animation: pop .45s var(--spring) backwards; animation-delay: calc(.25s + var(--n, 0) * 40ms); }

  /* 이력 */
  .profile.in .photo { animation: photo-in 1s var(--ease-out) backwards; }
}

@keyframes line-up { from { transform: translateY(105%); } }
@keyframes rise { from { opacity: 0; transform: translateY(26px); } }
@keyframes phone-in { from { opacity: 0; transform: translateY(70px) rotateX(22deg) scale(.92); } }
@keyframes float { 50% { transform: translateY(-12px); } }
@keyframes glow-spin { to { transform: translate(-50%, -50%) rotate(360deg); } }
@keyframes app-in { from { opacity: 0; transform: translateY(18px) scale(.4); } }
@keyframes wiggle { from { transform: scale(1.1) rotate(-4deg); } to { transform: scale(1.1) rotate(4deg); } }
@keyframes icon-in { from { opacity: 0; transform: scale(.3) rotate(-18deg); } }
@keyframes draw { from { transform: scaleX(0); } }
@keyframes deal { from { opacity: 0; transform: translateX(90px) rotate(3deg); } }
@keyframes pop { from { opacity: 0; transform: scale(.5); } }
@keyframes photo-in { from { opacity: 0; transform: scale(.85) rotate(-3deg); filter: blur(6px); } }
@keyframes ping {
  0% { transform: scale(1); box-shadow: 0 0 0 0 color-mix(in srgb, var(--accent) 55%, transparent); }
  30% { transform: scale(1.22) rotate(-8deg); }
  60% { transform: scale(.96); }
  100% { transform: scale(1); box-shadow: 0 0 0 22px transparent; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}
