:root {
  --bg: #0b0b10;
  --surface: #14141c;
  --surface-2: #1c1c27;
  --line: #262633;
  --text: #ececf1;
  --muted: #9b9bad;
  --accent: #9a8cff;
  --accent-soft: rgba(154, 140, 255, 0.14);
  --gold: #f1c76b;
  --radius: 14px;
  --max: 1080px;
  --font: "Pretendard Variable", Pretendard, -apple-system, BlinkMacSystemFont, "Apple SD Gothic Neo", "Malgun Gothic", sans-serif;
  --mono: "JetBrains Mono", ui-monospace, SFMono-Regular, Consolas, monospace;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  font-size: 16px;
  line-height: 1.7;
  word-break: keep-all;
  -webkit-font-smoothing: antialiased;
}
img, video, iframe { display: block; max-width: 100%; }
a { color: inherit; text-decoration: none; }
h1, h2, h3 { line-height: 1.3; margin: 0; letter-spacing: -0.02em; }
p { margin: 0; }

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

/* ── Header / Footer ─────────────────────────── */
.site-header {
  position: sticky; top: 0; z-index: 10;
  background: transparent;
  border-bottom: 1px solid transparent;
  transition: transform .35s ease, background .3s, border-color .3s;
}
.site-header.scrolled { background: rgba(11, 11, 16, 0.8); backdrop-filter: blur(12px); border-bottom-color: var(--line); }
.site-header.hide { transform: translateY(-100%); }
.site-header .progress {
  position: absolute; left: 0; right: 0; bottom: -1px; height: 2px;
  background: var(--accent); transform: scaleX(0); transform-origin: left;
}
.nav a { position: relative; transition: color .2s; }
.nav a::after {
  content: ""; position: absolute; left: 0; right: 0; bottom: -4px; height: 1px;
  background: var(--accent); transform: scaleX(0); transition: transform .25s;
}
.nav a:hover::after, .nav a.active::after { transform: scaleX(1); }

/* 페이지 전환 */
body { animation: page-in .5s ease both; }
body.leaving { opacity: 0; transition: opacity .2s ease; }
@keyframes page-in { from { opacity: 0; } }

/* 스크롤 등장 */
.reveal { opacity: 0; transform: translateY(28px); transition: opacity .8s ease, transform .8s cubic-bezier(.2, .7, .2, 1); transition-delay: var(--d, 0ms); }
.reveal.in { opacity: 1; transform: none; }
.site-header .container { display: flex; align-items: center; justify-content: space-between; height: 60px; }
.logo { font-weight: 700; }
.nav { display: flex; gap: 24px; font-size: 15px; color: var(--muted); }
.nav a:hover, .nav a.active { color: var(--text); }

.site-footer { border-top: 1px solid var(--line); margin-top: 120px; padding: 40px 0; color: var(--muted); font-size: 14px; }
.site-footer .container { display: flex; flex-wrap: wrap; gap: 12px 24px; justify-content: space-between; }
.site-footer a:hover { color: var(--text); }

/* ── Common ─────────────────────────────────── */
.section { margin-top: 96px; }
.section-title { font-size: 14px; font-weight: 600; letter-spacing: 0.08em; text-transform: uppercase; color: var(--muted); margin-bottom: 24px; }
.tags { display: flex; flex-wrap: wrap; gap: 6px; }
.tag { font-size: 12px; padding: 2px 10px; border-radius: 99px; background: var(--surface-2); color: var(--muted); }
.badge { display: inline-flex; align-items: center; gap: 6px; font-size: 13px; color: var(--gold); }
.badge::before { content: "🏆"; }
.btn {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 10px 18px; border-radius: 99px;
  border: 1px solid var(--line); background: var(--surface);
  font-size: 15px; transition: border-color .2s, background .2s;
}
.btn:hover { border-color: var(--accent); }
.btn.primary { background: var(--accent); border-color: var(--accent); color: #0b0b10; font-weight: 600; }
.btn.primary:hover { filter: brightness(1.08); }

/* 로컬에서만 보이는 안내 박스 */
.ph {
  display: grid; place-items: center; text-align: center;
  min-height: 160px; padding: 20px;
  border: 1px dashed #4a4a63; border-radius: var(--radius);
  background: repeating-linear-gradient(45deg, transparent 0 10px, rgba(255,255,255,0.02) 10px 20px);
  color: #7d7d98; font-size: 13px;
}
.ph.inline { min-height: 0; display: block; text-align: left; padding: 10px 14px; }

/* ── Home: Hero ─────────────────────────────── */
.hero {
  position: relative; isolation: isolate; overflow: hidden;
  min-height: calc(100svh - 60px);
  display: flex; flex-direction: column; justify-content: center;
  padding: 80px 0 96px;
}
.hero::before {
  content: ""; position: absolute; inset: 0; z-index: -1; pointer-events: none;
  background:
    radial-gradient(600px 320px at 15% 25%, rgba(154, 140, 255, 0.2), transparent 70%),
    linear-gradient(to bottom, transparent 70%, var(--bg));
}
.hero-canvas { position: absolute; inset: 0; width: 100%; height: 100%; z-index: -2; }

/* 히어로 첫 등장 */
.hero .container > * { animation: rise 1s cubic-bezier(.2, .7, .2, 1) both; }
.hero .container > :nth-child(2) { animation-delay: .08s; }
.hero .container > :nth-child(3) { animation-delay: .18s; }
.hero .container > :nth-child(4) { animation-delay: .28s; }
.hero .container > :nth-child(5) { animation-delay: .4s; }
@keyframes rise { from { opacity: 0; transform: translateY(28px); filter: blur(6px); } }

.scroll-cue {
  position: absolute; left: 50%; bottom: 24px; transform: translateX(-50%);
  font-size: 11px; letter-spacing: .2em; text-transform: uppercase; color: var(--muted);
  padding-bottom: 28px; animation: rise 1s .7s both;
}
.scroll-cue::after {
  content: ""; position: absolute; left: 50%; bottom: 0; width: 1px; height: 22px;
  background: linear-gradient(var(--accent), transparent);
  animation: drip 1.8s ease-in-out infinite;
}
@keyframes drip { 0% { transform: scaleY(0); transform-origin: top; } 50% { transform: scaleY(1); transform-origin: top; } 51% { transform-origin: bottom; } 100% { transform: scaleY(0); transform-origin: bottom; } }
.hero .role { color: var(--accent); font-weight: 600; margin-bottom: 12px; }
.hero h1 { font-size: clamp(36px, 6vw, 60px); }
.hero .headline { font-size: clamp(18px, 2.4vw, 22px); color: var(--muted); margin-top: 16px; max-width: 640px; }
.actions { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 24px; }
.hero .actions { margin-top: 32px; }
.hero-awards { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 12px; margin-top: 56px; }
.hero-award {
  display: block; padding: 18px 20px; border-radius: var(--radius);
  background: var(--surface); border: 1px solid var(--line);
}
a.hero-award:hover { border-color: var(--gold); }
.hero-award .badge { font-size: 12px; }
.hero-award strong { display: block; margin-top: 4px; }
.hero-award span { color: var(--muted); font-size: 14px; }

/* ── Home: Project cards ────────────────────── */
.grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 28px; }
.card { display: block; }
.card .thumb {
  position: relative; aspect-ratio: 16 / 9; border-radius: var(--radius); overflow: hidden;
  background: var(--surface); border: 1px solid var(--line);
  transition: transform .5s cubic-bezier(.2, .7, .2, 1), border-color .3s, box-shadow .4s;
  will-change: transform;
}
.card .thumb::after {
  content: ""; position: absolute; inset: 0; pointer-events: none; opacity: 0; transition: opacity .3s;
  background: radial-gradient(380px circle at var(--mx, 50%) var(--my, 50%), rgba(255, 255, 255, 0.14), transparent 45%);
}
.card:hover .thumb { border-color: rgba(154, 140, 255, 0.5); box-shadow: 0 24px 60px -24px rgba(154, 140, 255, 0.45); }
.card:hover .thumb::after { opacity: 1; }
.card .thumb:hover { transition: transform .12s linear, border-color .3s, box-shadow .4s; }
.card .thumb img, .card .thumb video { width: 100%; height: 100%; object-fit: cover; transition: transform .4s ease; }
.card:hover .thumb img, .card:hover .thumb video { transform: scale(1.03); }
/* 카드가 홀수 개면 첫 카드를 넓게 펼쳐서 1 + 짝수로 맞춤 */
.grid:not(.filtered) > .card:first-child:nth-last-child(odd) { grid-column: 1 / -1; }
.grid:not(.filtered) > .card:first-child:nth-last-child(odd) .thumb { aspect-ratio: 21 / 9; }
.grid:not(.filtered) > .card:first-child:nth-last-child(odd) h3 { font-size: 28px; }
.card .body { padding: 16px 4px 0; }
.card .top { display: flex; justify-content: space-between; gap: 12px; color: var(--muted); font-size: 14px; }
.card h3 { font-size: 22px; margin: 6px 0; }
.card:hover h3 { color: var(--accent); }
.card p { color: var(--muted); font-size: 15px; margin-bottom: 12px; }
.card .badge { margin-bottom: 8px; }

.cover-fallback {
  width: 100%; height: 100%; display: grid; place-items: center; padding: 24px; text-align: center;
  background:
    radial-gradient(circle at 30% 30%, rgba(154, 140, 255, 0.35), transparent 60%),
    radial-gradient(circle at 80% 80%, rgba(80, 180, 255, 0.2), transparent 60%),
    var(--surface-2);
}
.cover-fallback span { font-size: clamp(20px, 3vw, 30px); font-weight: 700; letter-spacing: -0.02em; }

.list { border-top: 1px solid var(--line); }
.list-row {
  display: flex; justify-content: space-between; gap: 16px;
  padding: 16px 4px; border-bottom: 1px solid var(--line);
}
.list-row span { color: var(--muted); }
a.list-row:hover { color: var(--accent); }
.list-row .arrow { font-style: normal; display: inline-block; margin-left: 6px; transition: transform .2s; }
a.list-row:hover .arrow { transform: translateX(4px); }

/* ── Project detail ─────────────────────────── */
.p-hero { padding: 72px 0 32px; }
.back { color: var(--muted); font-size: 14px; }
.back:hover { color: var(--text); }
.p-hero .eyebrow { color: var(--accent); font-size: 14px; font-weight: 600; margin-top: 32px; }
.p-hero h1 { font-size: clamp(32px, 5vw, 48px); margin-top: 8px; }
.p-hero .lead { font-size: 19px; color: var(--muted); margin-top: 12px; max-width: 720px; }
.p-hero .badge { margin-top: 16px; }

.p-media { border-radius: var(--radius); overflow: hidden; background: var(--surface); }
.p-media.video { aspect-ratio: 16 / 9; }
.p-media iframe { width: 100%; height: 100%; border: 0; }
.p-media img, .p-media video { width: 100%; }

.meta {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 1px;
  margin: 32px 0 0; border-radius: var(--radius); overflow: hidden;
  background: var(--line); border: 1px solid var(--line);
}
.meta div { background: var(--surface); padding: 16px 18px; }
.meta dt { font-size: 12px; color: var(--muted); }
.meta dd { margin: 2px 0 0; font-weight: 600; }

.p-section { margin-top: 72px; }
.p-section > h2 { font-size: 24px; margin-bottom: 20px; }
.prose p + p { margin-top: 1em; }
.prose, .bullets { color: #d3d3de; max-width: 760px; }
.bullets { padding-left: 1.2em; margin: 0; }
.bullets li + li { margin-top: 6px; }

.feature {
  display: grid; grid-template-columns: 1fr 1fr; gap: 32px; align-items: start;
  padding: 32px 0; border-top: 1px solid var(--line);
}
.feature.no-media { grid-template-columns: 1fr; }
.feature h3 { font-size: 20px; margin-bottom: 14px; }
.feature .psr { display: grid; gap: 12px; margin-bottom: 14px; }
.feature .psr b { display: block; font-size: 12px; color: var(--accent); letter-spacing: 0.04em; }
.feature .f-media { border-radius: var(--radius); overflow: hidden; }
.feature .f-media img, .feature .f-media video { width: 100%; }

details.code { margin-top: 16px; border: 1px solid var(--line); border-radius: 10px; background: #0f0f15; }
details.code summary { cursor: pointer; padding: 10px 14px; font-size: 14px; color: var(--muted); list-style: none; }
details.code summary::before { content: "▸ "; }
details.code[open] summary::before { content: "▾ "; }
details.code pre { margin: 0; padding: 14px 16px 18px; overflow-x: auto; border-top: 1px solid var(--line); }
details.code code { font-family: var(--mono); font-size: 13px; line-height: 1.6; color: #cfd2ff; }
.code-link { display: inline-block; margin-top: 10px; font-size: 14px; color: var(--accent); }

.links { display: flex; flex-wrap: wrap; gap: 10px; }

.pager { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; margin-top: 96px; }
.pager a { padding: 20px; border-radius: var(--radius); background: var(--surface); border: 1px solid var(--line); }
.pager a:hover { border-color: var(--accent); }
.pager .next { text-align: right; grid-column: 2; }
.pager small { display: block; color: var(--muted); font-size: 13px; }

/* ── About ──────────────────────────────────── */
.about-hero { padding: 96px 0 0; }
.about-hero h1 { font-size: clamp(32px, 5vw, 48px); }
.about-hero p { color: var(--muted); margin-top: 12px; font-size: 18px; }
.about-intro { max-width: 680px; margin-top: 28px; }
.about-intro p { color: #d3d3de; font-size: 17px; line-height: 1.8; }
.about-intro p + p { margin-top: 0.8em; }
.timeline { display: grid; gap: 0; border-top: 1px solid var(--line); }
.timeline .row { display: grid; grid-template-columns: 180px 1fr; gap: 20px; padding: 18px 0; border-bottom: 1px solid var(--line); }
.timeline .when { color: var(--muted); font-size: 14px; padding-top: 2px; }
.timeline .what span { display: block; color: var(--muted); font-size: 15px; }
.skills { display: grid; gap: 16px; }
.skills .row { display: grid; grid-template-columns: 180px 1fr; gap: 20px; }
.skills .row > span { color: var(--muted); font-size: 14px; }

/* ── 역할 칩 · What I do · 필터 ─────────────── */
.tag.role { background: var(--accent-soft); color: var(--accent); }

.caps { display: grid; grid-template-columns: repeat(4, 1fr); gap: 16px; }
.cap {
  padding: 24px 22px; border-radius: var(--radius);
  background: var(--surface); border: 1px solid var(--line);
  transition: border-color .3s, transform .3s;
}
.cap:hover { border-color: rgba(154, 140, 255, 0.5); transform: translateY(-4px); }
.cap .num { font-size: 13px; color: var(--accent); font-weight: 600; }
.cap h3 { font-size: 19px; margin: 10px 0 8px; }
.cap p { color: var(--muted); font-size: 15px; }

.work-head { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 16px; margin-bottom: 24px; }
.work-head .section-title { margin: 0; }
.filters { display: flex; flex-wrap: wrap; gap: 6px; padding: 4px; border-radius: 99px; background: var(--surface); border: 1px solid var(--line); }
.filter {
  font: inherit; font-size: 14px; color: var(--muted); cursor: pointer;
  padding: 6px 14px; border: 0; border-radius: 99px; background: transparent;
  transition: color .2s, background .25s;
}
.filter span { margin-left: 6px; font-size: 12px; opacity: .6; }
.filter:hover { color: var(--text); }
.filter.active { background: var(--accent); color: #0b0b10; font-weight: 600; }
.card[hidden] { display: none; }
.card.pop { animation: pop .55s cubic-bezier(.2, .7, .2, 1) both; animation-delay: var(--pd, 0ms); }
@keyframes pop { from { opacity: 0; transform: translateY(20px) scale(.98); } }

/* ── 상세: 체험 흐름 · 현장 · 결과 ──────────── */
.hero-tags { margin-top: 16px; }
.roles-line { margin-bottom: 14px; }
.flow { list-style: none; counter-reset: step; margin: 0; padding: 0; display: grid; gap: 12px; max-width: 760px; }
.flow li {
  counter-increment: step; position: relative; padding: 16px 18px 16px 60px;
  border-radius: 12px; background: var(--surface); border: 1px solid var(--line); color: #d3d3de;
}
.flow li::before {
  content: counter(step); position: absolute; left: 18px; top: 14px;
  width: 28px; height: 28px; border-radius: 50%; display: grid; place-items: center;
  background: var(--accent-soft); color: var(--accent); font-size: 13px; font-weight: 700;
}
.gallery { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 16px; }
.gallery figure { margin: 0; }
.gallery img, .gallery video { width: 100%; border-radius: 12px; }
.gallery figcaption { font-size: 14px; color: var(--muted); margin-top: 8px; }
.results { list-style: none; margin: 0; padding: 0; display: grid; gap: 10px; max-width: 760px; }
.results li { position: relative; padding-left: 28px; color: #d3d3de; }
.results li::before { content: "✓"; position: absolute; left: 0; color: var(--accent); font-weight: 700; }

/* 움직임 줄이기 설정을 켠 사람에게는 애니메이션 끄기 */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; scroll-behavior: auto !important; }
  .reveal { opacity: 1; transform: none; }
}

/* ── Responsive ─────────────────────────────── */
@media (max-width: 960px) {
  .caps { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 760px) {
  .grid { grid-template-columns: 1fr; }
  .caps { grid-template-columns: 1fr; }
  .feature { grid-template-columns: 1fr; gap: 20px; }
  .timeline .row, .skills .row { grid-template-columns: 1fr; gap: 4px; }
  .hero { padding-top: 72px; }
  .nav { gap: 16px; }
  .pager { grid-template-columns: 1fr; }
  .pager .next { grid-column: 1; }
}
