:root {
  color-scheme: dark;
  --bg: #0b0c0e;
  --bg-2: #121316;
  --ink: #f3f1ea;
  --ink-2: #c9c7c0;
  --muted: #8e8d88;
  --line: rgba(255, 255, 255, .09);
  --line-2: rgba(255, 255, 255, .16);
  --accent: #8f8bff;
  --step: 78svh;
  --gutter: clamp(16px, 4vw, 52px);
  --mono: ui-monospace, "SF Mono", SFMono-Regular, Menlo, Consolas, monospace;
}

* { box-sizing: border-box; }
html { scroll-snap-type: y proximity; scroll-behavior: smooth; background: var(--bg); }
@media (prefers-reduced-motion: reduce) { html { scroll-behavior: auto; } }
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: "Pretendard Variable", Pretendard, -apple-system, "Apple SD Gothic Neo", "Malgun Gothic", sans-serif;
  font-size: 16px;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}
h1, h2, h3, h4, p { margin: 0; word-break: keep-all; }
a { color: inherit; text-decoration: none; }
button { font: inherit; color: inherit; }
img { display: block; max-width: 100%; }
a, button { -webkit-tap-highlight-color: transparent; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; border-radius: 6px; }
::selection { background: color-mix(in srgb, var(--accent) 45%, transparent); }
.wrap { width: min(100% - var(--gutter) * 2, 1240px); margin-inline: auto; }

.skip-link { position: fixed; z-index: 60; top: -80px; left: 16px; padding: 10px 14px; border-radius: 8px; background: var(--ink); color: var(--bg); font-weight: 600; }
.skip-link:focus { top: 12px; }

/* ---------- header ---------- */
.site-header {
  position: fixed; z-index: 40; inset: 0 0 auto;
  display: flex; align-items: center; justify-content: space-between; gap: 20px;
  height: 68px; padding: 0 var(--gutter);
  pointer-events: none;
}
.site-header > * { pointer-events: auto; }
.site-header::before {
  content: ""; position: absolute; inset: 0; z-index: -1;
  background: rgba(11, 12, 14, .86); border-bottom: 1px solid var(--line);
  backdrop-filter: blur(14px) saturate(140%); -webkit-backdrop-filter: blur(14px) saturate(140%);
  opacity: 0; transition: opacity .3s ease;
}
.site-header.is-solid::before { opacity: 1; }
.logo { font-size: 21px; font-weight: 720; letter-spacing: -.05em; }
.logo-dot { color: var(--accent); transition: color .6s ease; }
.site-header nav { display: flex; align-items: center; gap: 6px; }
.site-header nav a {
  padding: 8px 14px; border-radius: 99px;
  color: var(--ink-2); font-size: 13.5px; font-weight: 560;
  transition: background .2s, color .2s;
}
.site-header nav a:hover { background: rgba(255,255,255,.07); color: var(--ink); }
.nav-store { border: 1px solid var(--line-2); }

/* ---------- showcase ---------- */
.showcase { position: relative; height: calc(100svh + var(--steps, 10) * var(--step)); }
.stage { position: sticky; top: 0; height: 100svh; overflow: hidden; isolation: isolate; }
.stage-canvas { position: absolute; inset: 0; width: 100%; height: 100%; display: block; z-index: 1; touch-action: pan-y; }
.stage-glow {
  position: absolute; z-index: 0; inset: 0;
  background:
    radial-gradient(60% 55% at var(--glow-x, 62%) 58%, color-mix(in srgb, var(--accent) 22%, transparent), transparent 70%),
    radial-gradient(90% 60% at 50% 115%, color-mix(in srgb, var(--accent) 10%, transparent), transparent 70%),
    var(--bg);
  transition: --accent .8s ease;
}
@property --accent { syntax: "<color>"; inherits: true; initial-value: #8f8bff; }
:root { transition: --accent .9s ease; }
.stage-vignette {
  position: absolute; z-index: 2; inset: 0; pointer-events: none;
  background:
    linear-gradient(180deg, rgba(11,12,14,.55), transparent 18%, transparent 70%, rgba(11,12,14,.75)),
    radial-gradient(120% 90% at 50% 50%, transparent 55%, rgba(0,0,0,.45));
}
.snaps { position: absolute; inset: 0; pointer-events: none; }
.snaps span { position: absolute; left: 0; width: 1px; height: 1px; scroll-snap-align: start; }

.kicker {
  display: inline-flex; align-items: center; gap: 10px;
  color: var(--ink-2); font-family: var(--mono); font-size: 11.5px; font-weight: 500; letter-spacing: .14em;
}
.kicker-dot { width: 6px; height: 6px; border-radius: 50%; background: var(--accent); box-shadow: 0 0 12px var(--accent); transition: background .6s; }

/* intro (스크롤 전 첫 화면) */
.intro {
  position: absolute; z-index: 5; left: var(--gutter); top: clamp(104px, 17vh, 170px);
  max-width: 640px;
  transition: opacity .5s ease, transform .5s ease;
}
.intro h1 {
  margin: 22px 0 18px;
  font-size: clamp(38px, 6vw, 84px); font-weight: 680; letter-spacing: -.055em; line-height: 1.08;
}
.intro h1 em { font-style: normal; color: transparent; background: linear-gradient(100deg, var(--ink) 10%, var(--accent) 120%); -webkit-background-clip: text; background-clip: text; }
.intro-sub { color: var(--ink-2); font-size: clamp(15px, 1.5vw, 18px); line-height: 1.6; }
.intro-cta { display: inline-flex; align-items: center; gap: 16px; margin-top: 30px; color: var(--ink-2); font-size: 13.5px; font-weight: 560; }
.intro-cta-line { position: relative; width: 56px; height: 1px; background: var(--line-2); overflow: hidden; }
.intro-cta-line::after { content: ""; position: absolute; inset: 0; width: 40%; background: var(--ink); animation: slide 1.8s ease-in-out infinite; }
@keyframes slide { from { transform: translateX(-100%); } to { transform: translateX(260%); } }
.is-away .intro { opacity: 0; transform: translateY(-16px); pointer-events: none; }

/* project panel */
.panel {
  position: absolute; z-index: 5; left: var(--gutter); bottom: clamp(56px, 10vh, 104px);
  width: min(430px, 36vw);
  transition: opacity .45s ease, transform .45s ease;
}
.panel[hidden] { display: block; opacity: 0; transform: translateY(14px); pointer-events: none; }
.panel-inner { transition: opacity .28s ease, transform .28s ease, filter .28s ease; }
.panel-inner.is-swapping { opacity: 0; transform: translateY(8px); filter: blur(4px); }
.p-top { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.p-index { font-family: var(--mono); font-size: 12px; color: var(--muted); letter-spacing: .08em; }
.p-index b { color: var(--ink); font-weight: 600; }
.badge {
  display: inline-flex; align-items: center; gap: 7px; height: 26px; padding: 0 11px;
  border: 1px solid var(--line-2); border-radius: 99px;
  font-size: 12px; font-weight: 600; color: var(--ink-2); white-space: nowrap;
}
.badge::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.badge-main { color: var(--bg); background: var(--accent); border-color: transparent; }
.badge-live::before { background: #5fd38a; }
.badge-soon::before { background: #f2c14e; }
.badge-dev { border-style: dashed; }
.badge-dev::before { background: var(--accent); animation: pulse 1.6s ease-in-out infinite; }
@keyframes pulse { 50% { opacity: .25; } }
.p-name { margin: 16px 0 4px; font-size: clamp(34px, 4.2vw, 58px); font-weight: 700; letter-spacing: -.05em; line-height: 1.04; }
.p-name.is-long { font-size: clamp(28px, 3.1vw, 42px); line-height: 1.15; }
.p-sub { color: var(--muted); font-size: 14.5px; font-weight: 520; }
.p-tagline { margin-top: 18px; color: var(--ink); font-size: clamp(16px, 1.35vw, 19px); font-weight: 520; line-height: 1.55; letter-spacing: -.01em; }
.p-desc { margin-top: 10px; color: var(--ink-2); font-size: 14.5px; line-height: 1.7; }
.p-meta { display: flex; align-items: center; flex-wrap: wrap; gap: 8px; margin-top: 20px; }
.chip { height: 26px; display: inline-flex; align-items: center; padding: 0 10px; border-radius: 7px; background: rgba(255,255,255,.07); color: var(--ink-2); font-family: var(--mono); font-size: 11.5px; letter-spacing: .04em; }
.rating { display: inline-flex; align-items: center; gap: 6px; margin-left: 4px; color: var(--ink-2); font-size: 13px; }
.rating b { color: var(--ink); font-weight: 650; }
.rating .stars { color: #f5c451; letter-spacing: 1px; }
.p-actions { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 26px; }
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 9px;
  height: 46px; padding: 0 20px; border-radius: 99px;
  font-size: 14.5px; font-weight: 640; white-space: nowrap;
  transition: transform .2s ease, background .2s ease, box-shadow .2s ease;
}
.btn-primary { background: var(--ink); color: var(--bg); }
.btn-primary:hover { transform: translateY(-1px); box-shadow: 0 10px 30px -8px color-mix(in srgb, var(--accent) 70%, transparent); }
.btn-ghost { border: 1px solid var(--line-2); color: var(--ink); }
.btn-ghost:hover { background: rgba(255,255,255,.07); }
.btn svg { width: 16px; height: 16px; flex: none; }
.p-note { display: inline-flex; align-items: center; gap: 10px; height: 46px; color: var(--muted); font-size: 14px; }

/* rail (오른쪽 프로젝트 목록) */
.rail {
  position: absolute; z-index: 5; right: calc(var(--gutter) - 8px); top: 50%; transform: translateY(-50%);
  display: flex; flex-direction: column; gap: 2px;
  transition: opacity .4s ease;
}
.rail button {
  display: flex; align-items: center; justify-content: flex-end; gap: 12px;
  min-height: 30px; padding: 4px 8px; border: 0; background: none; cursor: pointer;
  color: var(--muted); font-size: 12.5px; font-weight: 560; text-align: right;
}
.rail .r-name { opacity: 0; transform: translateX(6px); transition: opacity .25s, transform .25s, color .25s; white-space: nowrap; }
.rail .r-num { font-family: var(--mono); font-size: 11px; width: 18px; text-align: right; }
.rail .r-bar { width: 14px; height: 2px; border-radius: 2px; background: var(--line-2); transition: width .3s ease, background .3s ease; }
.rail:hover .r-name, .rail button:focus-visible .r-name { opacity: .75; transform: none; }
.rail button:hover .r-name { opacity: 1; color: var(--ink); }
.rail button[aria-current="true"] { color: var(--ink); }
.rail button[aria-current="true"] .r-name { opacity: 1; transform: none; }
.rail button[aria-current="true"] .r-bar { width: 30px; background: var(--accent); }
.rail .r-sep { height: 1px; margin: 8px 8px 8px auto; width: 30px; background: var(--line); }

.stage-foot { position: absolute; z-index: 5; left: 0; right: 0; bottom: 0; }
.progress { height: 2px; background: rgba(255,255,255,.06); }
.progress-bar { display: block; height: 100%; width: 100%; transform-origin: 0 50%; transform: scaleX(0); background: var(--accent); }
.stage-controls { position: absolute; z-index: 5; right: var(--gutter); bottom: clamp(56px, 10vh, 104px); display: flex; gap: 8px; }
.ctrl {
  width: 46px; height: 46px; border-radius: 50%; border: 1px solid var(--line-2); background: rgba(11,12,14,.4);
  cursor: pointer; font-size: 17px; backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px);
  transition: background .2s, opacity .2s;
}
.ctrl:hover { background: rgba(255,255,255,.1); }
.ctrl:disabled { opacity: .3; cursor: default; }

/* WebGL 없이 볼 때 */
.no-webgl .stage-canvas { display: none; }
.p-icon { display: none; }
.no-webgl .p-icon { display: block; width: 84px; height: 84px; margin-bottom: 18px; border-radius: 20px; }

/* ---------- 전체 목록 ---------- */
.all { position: relative; padding: clamp(96px, 14vh, 160px) 0 clamp(56px, 8vh, 88px); background: var(--bg); scroll-snap-align: start; }
.all-head h2 { margin-top: 18px; font-size: clamp(32px, 4.4vw, 60px); font-weight: 690; letter-spacing: -.05em; line-height: 1.1; }
.group { margin-top: clamp(56px, 8vh, 88px); }
.group-head { display: flex; align-items: baseline; gap: 12px; padding-bottom: 16px; border-bottom: 1px solid var(--line); }
.group-head h3 { font-size: 15px; font-weight: 650; }
.group-count { color: var(--muted); font-family: var(--mono); font-size: 12px; }
.list { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); column-gap: 40px; }
.item {
  display: grid; grid-template-columns: 64px minmax(0, 1fr); gap: 20px; align-items: start;
  padding: 26px 0; border-bottom: 1px solid var(--line);
}
.item-icon { width: 64px; height: 64px; border-radius: 15px; background: var(--bg-2); box-shadow: 0 0 0 1px rgba(255,255,255,.06), 0 10px 28px -12px var(--item-accent, #000); object-fit: cover; }
.item-icon.is-dev { opacity: .92; }
.item-top { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.item-name { font-size: 19px; font-weight: 680; letter-spacing: -.03em; }
.item-name button { padding: 0; border: 0; background: none; cursor: pointer; font: inherit; text-align: left; }
.item-name button:hover { color: var(--item-accent); }
.item-sub { color: var(--muted); font-size: 13.5px; }
.item-tag { margin-top: 8px; color: var(--ink-2); font-size: 14.5px; line-height: 1.6; }
.item-foot { display: flex; align-items: center; gap: 8px 14px; flex-wrap: wrap; margin-top: 14px; }
.item-foot .chip { height: 22px; font-size: 11px; }
.item-links { display: flex; gap: 14px; margin-left: auto; }
.item-links a { font-size: 13.5px; font-weight: 600; color: var(--ink); border-bottom: 1px solid var(--line-2); padding-bottom: 2px; transition: border-color .2s; }
.item-links a:hover { border-color: var(--ink); }
.item .badge-main { background: var(--item-accent); }
.item .badge { height: 22px; font-size: 11px; padding: 0 9px; }

.contact { padding: 0 0 clamp(96px, 14vh, 150px); background: var(--bg); }
.contact-inner {
  display: flex; align-items: flex-end; justify-content: space-between; gap: 32px; flex-wrap: wrap;
  padding-top: clamp(56px, 8vh, 88px); border-top: 1px solid var(--line);
}
.contact h2 { margin-top: 18px; font-size: clamp(28px, 3.4vw, 46px); font-weight: 680; letter-spacing: -.045em; line-height: 1.2; }
.contact-mail {
  display: inline-flex; align-items: center; gap: 18px;
  padding-bottom: 10px; border-bottom: 1.5px solid var(--line-2);
  font-size: clamp(19px, 2.2vw, 30px); font-weight: 620; letter-spacing: -.03em;
  transition: border-color .25s, gap .25s, color .25s;
}
.contact-mail:hover { border-color: var(--accent); gap: 26px; }
.contact-arrow { color: var(--accent); font-weight: 400; }
.site-footer { padding: 36px 0 48px; border-top: 1px solid var(--line); color: var(--muted); font-size: 13px; }
.footer-inner { display: flex; align-items: center; gap: 18px; flex-wrap: wrap; }
.footer-logo { color: var(--ink); font-size: 16px; font-weight: 720; letter-spacing: -.05em; }
.footer-inner a { color: var(--ink-2); }
.footer-inner .footer-mail { margin-left: auto; }
.footer-inner a:hover { color: var(--ink); }

/* ---------- 반응형 ---------- */
@media (max-width: 1100px) {
  .rail .r-name { display: none; }
}
@media (max-width: 820px) {
  :root { --step: 72svh; }
  .site-header { height: 60px; }
  .site-header nav a[href="#all"] { display: none; }
  .intro { top: 92px; right: var(--gutter); }
  .intro h1 { margin: 16px 0 12px; }
  .panel { left: 16px; right: 16px; bottom: 30px; width: auto; }
  .p-name { margin-top: 12px; font-size: 34px; }
  .p-name.is-long { font-size: 26px; }
  .p-tagline { margin-top: 10px; font-size: 15.5px; }
  .p-desc { display: none; }
  .p-meta { margin-top: 12px; }
  .p-actions { margin-top: 16px; }
  .btn { height: 42px; padding: 0 16px; font-size: 14px; }
  .p-note { height: 42px; }
  .rail { display: none; }
  .stage-controls { right: 16px; bottom: auto; top: 72px; }
  .ctrl { width: 40px; height: 40px; font-size: 15px; }
  .list { grid-template-columns: 1fr; }
  .item { grid-template-columns: 52px minmax(0, 1fr); gap: 16px; padding: 22px 0; }
  .item-icon { width: 52px; height: 52px; border-radius: 12px; }
  .item-links { margin-left: 0; width: 100%; }
  .footer-inner a, .footer-inner .footer-mail { margin-left: 0; width: 100%; }
  .contact-mail { font-size: 20px; }
}
.is-intro .stage-controls { opacity: 0; pointer-events: none; }
.stage-controls { transition: opacity .4s ease; }
