:root {
  --bg: #07070d;
  --surface: rgba(255, 255, 255, 0.04);
  --border: rgba(255, 255, 255, 0.09);
  --text: #ecebf5;
  --muted: #9a98b0;
  --a1: #7c5cff;
  --a2: #00d4ff;
  --a3: #ff4ecd;
  --grad: linear-gradient(120deg, var(--a1), var(--a2) 50%, var(--a3));
  --radius: 18px;
  --font: "Noto Sans KR", system-ui, sans-serif;
  --display: "Space Grotesk", "Noto Sans KR", sans-serif;
  --mono: "JetBrains Mono", ui-monospace, monospace;
}

* { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; }
body {
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  line-height: 1.7;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
}
a { color: inherit; text-decoration: none; }
.mono { font-family: var(--mono); }
::selection { background: var(--a1); color: #fff; }

/* ---------- background & effects ---------- */
#bg { position: fixed; inset: 0; z-index: -2; width: 100%; height: 100%; }
body::before {
  content: ""; position: fixed; inset: 0; z-index: -1; pointer-events: none;
  background:
    radial-gradient(600px circle at 15% 10%, rgba(124, 92, 255, 0.18), transparent 60%),
    radial-gradient(500px circle at 90% 30%, rgba(0, 212, 255, 0.12), transparent 60%),
    radial-gradient(600px circle at 50% 100%, rgba(255, 78, 205, 0.1), transparent 60%);
}
.cursor-glow {
  position: fixed; top: 0; left: 0; width: 420px; height: 420px; z-index: -1;
  border-radius: 50%; pointer-events: none;
  background: radial-gradient(circle, rgba(124, 92, 255, 0.22), transparent 65%);
  transform: translate(-50%, -50%); opacity: 0; transition: opacity 0.4s;
}
.progress {
  position: fixed; top: 0; left: 0; height: 3px; width: 100%; z-index: 100;
  background: var(--grad); transform-origin: 0 50%; transform: scaleX(0);
}

/* ---------- nav ---------- */
.nav {
  position: fixed; top: 16px; left: 50%; transform: translateX(-50%); z-index: 50;
  display: flex; align-items: center; gap: 32px;
  padding: 10px 14px 10px 22px; width: min(920px, calc(100% - 32px));
  justify-content: space-between;
  background: rgba(12, 12, 20, 0.55); backdrop-filter: blur(14px);
  border: 1px solid var(--border); border-radius: 999px;
}
.logo { font-family: var(--display); font-weight: 700; letter-spacing: -0.02em; }
.nav nav { display: flex; gap: 4px; }
.nav nav a {
  padding: 10px 14px; border-radius: 999px; font-size: 0.9rem; color: var(--muted);
  transition: color 0.2s, background 0.2s;
}
.nav nav a:hover, .nav nav a.active { color: var(--text); background: var(--surface); }

/* ---------- hero ---------- */
.hero {
  min-height: 100svh; display: flex; flex-direction: column; justify-content: center;
  padding: 120px 16px 80px; max-width: 1040px; margin: 0 auto; position: relative;
}
.hello { color: var(--a2); margin-bottom: 12px; }
.hero-title {
  font-family: var(--display); font-weight: 700; letter-spacing: -0.04em; line-height: 1.05;
  font-size: clamp(3.2rem, 11vw, 8rem);
  background: var(--grad); background-size: 200% auto;
  -webkit-background-clip: text; background-clip: text; color: transparent;
  animation: shine 6s linear 3;
}
@keyframes shine { to { background-position: 200% center; } }
.hero-role { font-family: var(--display); font-size: clamp(1.4rem, 4vw, 2.4rem); margin-top: 8px; min-height: 1.5em; }
.caret { color: var(--a3); animation: blink 1s steps(1) infinite; margin-left: 2px; }
.caret.done { animation: none; opacity: 0; }
@keyframes blink { 50% { opacity: 0; } }
.hero-tagline { color: var(--muted); font-size: 1.1rem; margin-top: 18px; max-width: 560px; }
.hero-cta { display: flex; gap: 12px; margin-top: 36px; flex-wrap: wrap; }

.btn {
  display: inline-flex; align-items: center; padding: 14px 26px; border-radius: 999px;
  font-weight: 600; transition: transform 0.25s cubic-bezier(.2,.8,.2,1), box-shadow 0.3s;
  will-change: transform;
}
.btn-primary { background: var(--grad); color: #0b0b12; box-shadow: 0 10px 40px -10px rgba(124, 92, 255, 0.7); }
.btn-primary:hover { box-shadow: 0 14px 50px -8px rgba(0, 212, 255, 0.7); }
.btn-ghost { border: 1px solid var(--border); background: var(--surface); }
.btn-ghost:hover { border-color: rgba(255,255,255,0.3); }

.scroll-hint {
  position: absolute; bottom: 32px; left: 50%; transform: translateX(-50%);
  width: 26px; height: 42px; border: 2px solid var(--border); border-radius: 14px;
}
.scroll-hint span {
  position: absolute; left: 50%; top: 8px; width: 4px; height: 8px; margin-left: -2px;
  background: var(--a2); border-radius: 2px; animation: scroll 1.8s 4;
}
@keyframes scroll { 0% { opacity: 0; transform: translateY(0); } 30% { opacity: 1; } 100% { opacity: 0; transform: translateY(14px); } }

/* ---------- sections ---------- */
.section { max-width: 1040px; margin: 0 auto; padding: 120px 16px; }
.section-title {
  font-family: var(--display); font-size: clamp(2rem, 5vw, 3.2rem); letter-spacing: -0.03em;
  margin-bottom: 48px; display: flex; align-items: baseline; gap: 16px;
}
.section-title .num { font-size: 0.95rem; color: var(--a1); }

.js .reveal { opacity: 0; transform: translateY(40px); transition: opacity 0.9s cubic-bezier(.2,.8,.2,1), transform 0.9s cubic-bezier(.2,.8,.2,1); }
.js .reveal.in { opacity: 1; transform: none; }

/* about */
.about-grid { display: grid; grid-template-columns: 1.4fr 1fr; gap: 48px; align-items: center; }
.about-text p { font-size: 1.15rem; color: var(--muted); margin-bottom: 16px; }
.about-text p:first-child { color: var(--text); font-size: 1.35rem; font-weight: 600; }
.stats { display: grid; gap: 14px; }
.stat {
  padding: 20px 24px; border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface);
  display: flex; align-items: baseline; justify-content: space-between;
}
.stat b { font-family: var(--display); font-size: 2.2rem; background: var(--grad); -webkit-background-clip: text; background-clip: text; color: transparent; }
.stat span { color: var(--muted); }

.marquee {
  margin-top: 72px; overflow: hidden; border-block: 1px solid var(--border); padding: 18px 0;
  mask-image: linear-gradient(90deg, transparent, #000 10%, #000 90%, transparent);
}
.marquee-track { display: flex; gap: 40px; width: max-content; animation: marquee 30s linear infinite; }
.marquee:hover .marquee-track { animation-play-state: paused; }
.marquee-track span { font-family: var(--display); font-size: 1.5rem; color: var(--muted); white-space: nowrap; transition: color 0.2s; }
.marquee-track span:hover { color: var(--text); }
.marquee-track span::before { content: "✦"; color: var(--a1); margin-right: 40px; font-size: 1rem; vertical-align: middle; }
@keyframes marquee { to { transform: translateX(-50%); } }

/* projects */
.projects { display: grid; grid-template-columns: repeat(2, 1fr); gap: 20px; perspective: 1000px; }
.card {
  position: relative; padding: 32px; border-radius: var(--radius); background: var(--surface);
  border: 1px solid var(--border); overflow: hidden; transform-style: preserve-3d;
  transition: transform 0.2s ease-out, border-color 0.3s; display: flex; flex-direction: column; min-height: 260px;
}
.card::before {
  content: ""; position: absolute; inset: 0; pointer-events: none; opacity: 0; transition: opacity 0.3s;
  background: radial-gradient(400px circle at var(--mx, 50%) var(--my, 50%), rgba(124, 92, 255, 0.2), transparent 50%);
}
.card:hover { border-color: rgba(124, 92, 255, 0.5); }
.card:hover::before { opacity: 1; }
.card-num { font-family: var(--mono); color: var(--muted); font-size: 0.85rem; }
.card h3 { font-family: var(--display); font-size: 1.5rem; margin: 14px 0 10px; transform: translateZ(30px); }
.card p { color: var(--muted); flex: 1; }
.tags { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 20px; }
.tags span { font-family: var(--mono); font-size: 0.75rem; padding: 4px 10px; border-radius: 999px; border: 1px solid var(--border); color: var(--a2); }
.card-arrow { position: absolute; top: 28px; right: 28px; font-size: 1.4rem; transition: transform 0.3s; }
.card:hover .card-arrow { transform: translate(4px, -4px) rotate(0deg); color: var(--a2); }

.card-meta { color: var(--a2); margin-left: 8px; }
.badge {
  position: absolute; top: 26px; right: 28px; font-size: 0.75rem; font-weight: 600;
  padding: 4px 12px; border-radius: 999px; color: #0b0b12; background: var(--grad);
}
.card .badge + .card-arrow { display: none; }
.section-lead { color: var(--muted); margin: -28px 0 36px; }

/* experience + credentials */
.exp-grid { display: grid; grid-template-columns: 1.3fr 1fr; gap: 56px; align-items: start; }
.creds { padding: 28px; border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface); }
.creds-title { font-size: 0.85rem; color: #a594ff; font-weight: 400; margin-bottom: 16px; }
.creds-list { list-style: none; display: grid; gap: 14px; }
.creds-list li { display: grid; grid-template-columns: 52px 1fr; column-gap: 12px; }
.creds-list .mono { color: var(--a2); font-size: 0.85rem; padding-top: 2px; }
.creds-list small { grid-column: 2; color: var(--muted); font-size: 0.85rem; }

/* timeline */
.timeline { list-style: none; position: relative; padding-left: 32px; }
.timeline::before { content: ""; position: absolute; left: 6px; top: 8px; bottom: 8px; width: 2px; background: var(--border); }
.timeline::after {
  content: ""; position: absolute; left: 6px; top: 8px; bottom: 8px; width: 2px;
  background: var(--grad); transform-origin: top; transform: scaleY(var(--fill, 0)); transition: transform 0.2s linear;
}
.timeline li { position: relative; padding-bottom: 48px; }
.timeline li::before {
  content: ""; position: absolute; left: -32px; top: 8px; width: 14px; height: 14px; border-radius: 50%;
  background: var(--bg); border: 2px solid var(--a1); box-shadow: 0 0 16px var(--a1); z-index: 1;
}
.timeline .period { font-family: var(--mono); color: var(--a2); font-size: 0.85rem; }
.timeline h3 { font-family: var(--display); font-size: 1.35rem; margin: 4px 0; }
.timeline h3 small { color: var(--muted); font-weight: 500; font-size: 1rem; margin-left: 8px; }
.timeline p { color: var(--muted); }

/* contact */
.contact { text-align: center; padding-bottom: 160px; }
.contact .section-title { justify-content: center; }
.contact-lead { color: var(--muted); font-size: 1.1rem; }
.contact-email {
  display: inline-block; margin: 28px 0 36px; font-family: var(--display); font-weight: 700;
  font-size: clamp(1.6rem, 6vw, 3.6rem); letter-spacing: -0.03em; word-break: break-all;
  background: var(--grad); background-size: 200% auto; -webkit-background-clip: text; background-clip: text; color: transparent;
  animation: shine 6s linear 3;
}
.contact-links { display: flex; justify-content: center; gap: 12px; flex-wrap: wrap; }

.footer { text-align: center; color: var(--muted); font-size: 0.8rem; padding: 32px 16px; border-top: 1px solid var(--border); }

/* ---------- responsive ---------- */
@media (max-width: 760px) {
  .nav { padding: 10px 10px 10px 18px; gap: 8px; }
  .nav nav a { padding: 12px 6px; font-size: 0.85rem; }
  .footer { padding-bottom: 104px; } /* 떠 있는 버튼이 맨 아래 글자를 가리지 않게 */
  .about-grid, .projects, .exp-grid { grid-template-columns: 1fr; }
  .section { padding: 90px 16px; }
  .cursor-glow { display: none; }
}
@media (max-width: 520px) {
  /* 좁은 화면: 로고를 숨기고 메뉴 5개가 바를 고르게 채우게 해서 마지막 메뉴가 밀려나지 않게 한다 */
  .nav .logo { display: none; }
  .nav { padding: 4px 6px; }
  .nav nav { flex: 1; justify-content: space-between; gap: 0; }
}
@media (max-width: 389px) {
  .nav nav a { padding: 12px 4px; font-size: 0.82rem; }
}
@media (max-width: 339px) {
  .nav nav a { padding: 12px 3px; font-size: 0.78rem; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
  html { scroll-behavior: auto; }
  .reveal { opacity: 1; transform: none; }
}

/* ---------- chatbot entry ---------- */
.link-btn { background: none; border: 0; padding: 10px 0; min-height: 44px; font: inherit; color: var(--a2); cursor: pointer; }
.link-btn:hover { text-decoration: underline; }
button.btn { border: 0; font: inherit; font-weight: 600; cursor: pointer; color: inherit; }
button.btn-primary { color: #0b0b12; }
button.btn-ghost { border: 1px solid var(--border); }
.ask-cta { margin: 28px auto 0; }
.contact-email { display: block; width: fit-content; margin-left: auto; margin-right: auto; }

.ask-fab {
  position: fixed; right: 20px; bottom: 20px; z-index: 60;
  display: flex; align-items: center; gap: 8px; padding: 14px 20px; border: 0; border-radius: 999px;
  font: inherit; font-weight: 700; color: #0b0b12; background: var(--grad); cursor: pointer;
  box-shadow: 0 12px 40px -8px rgba(124, 92, 255, 0.8); transition: transform 0.2s;
  animation: fab-pulse 2.6s ease-in-out 4;
}
.ask-fab:hover { transform: translateY(-3px) scale(1.04); }
@keyframes fab-pulse { 50% { box-shadow: 0 12px 50px -4px rgba(0, 212, 255, 0.9); } }

.wake {
  position: fixed; inset: 0; z-index: 200; display: grid; place-items: center; padding: 16px;
  background: rgba(5, 5, 10, 0.7); backdrop-filter: blur(8px);
}
.wake[hidden] { display: none; }
.wake-card {
  max-width: 440px; width: 100%; text-align: center; padding: 36px 28px; border-radius: 24px;
  background: #11111c; border: 1px solid var(--border); box-shadow: 0 30px 80px -20px rgba(124, 92, 255, 0.5);
}
.wake-card h3 { font-family: var(--display); font-size: 1.4rem; margin: 18px 0 10px; }
.wake-card p { color: var(--muted); font-size: 0.95rem; }
.wake-card b { color: var(--text); }
.wake-sub { margin-top: 10px; font-size: 0.85rem !important; }
.wake-actions { display: flex; gap: 10px; justify-content: center; margin-top: 24px; }
.wake-spinner {
  width: 48px; height: 48px; margin: 0 auto; border-radius: 50%;
  border: 4px solid rgba(255, 255, 255, 0.1); border-top-color: var(--a2); border-right-color: var(--a1);
  animation: spin 0.9s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }
@media (max-width: 760px) { .ask-fab span { display: none; } .ask-fab { padding: 16px; } }

/* 초대 코드 안내창 */
.gate-icon { font-size: 2.4rem; line-height: 1; }
.gate-form { display: flex; gap: 8px; margin-top: 20px; }
.gate-form input {
  flex: 1; min-width: 0; padding: 12px 16px; border-radius: 999px; font: inherit; color: var(--text);
  background: rgba(255, 255, 255, 0.06); border: 1px solid var(--border); outline: none;
}
.gate-form input:focus { border-color: var(--a2); }
.gate-form .btn { padding: 12px 20px; white-space: nowrap; }
.gate-link { color: var(--a2); text-decoration: underline; }
.gate .wake-actions { margin-top: 16px; }
.wake-card { min-width: 0; }
.gate-form input { width: 100%; }

/* ---------- 접근성 보강 ---------- */
/* 키보드로 이동할 때만 보이는 또렷한 포커스 표시 */
:where(a, button, input, [tabindex]):focus-visible { outline: 2px solid var(--a2); outline-offset: 3px; border-radius: 8px; }
.gate-form input:focus-visible { outline-offset: 2px; border-radius: 999px; }

/* 스크롤 안내 아이콘: 보이는 크기는 그대로, 누를 수 있는 영역만 48px 이상 */
.scroll-hint::before { content: ""; position: absolute; inset: -8px -12px; }

/* 움직임 멈추기: 모든 반복 애니메이션 정지 */
.still *, .still *::before, .still *::after { animation-play-state: paused !important; }
.still-toggle {
  font: inherit; font-size: 0.85rem; color: var(--muted); background: none; cursor: pointer;
  border: 1px solid var(--border); border-radius: 999px; padding: 10px 16px; min-height: 44px; margin-bottom: 12px;
}
.still-toggle:hover { color: var(--text); border-color: rgba(255, 255, 255, 0.3); }

/* 코드 입력칸 라벨과 안내 */
.gate-form { flex-wrap: wrap; }
.gate-label { flex-basis: 100%; text-align: left; font-size: 0.9rem; font-weight: 600; color: var(--text); padding-left: 6px; }
.gate-error { flex-basis: 100%; text-align: left; font-size: 0.85rem; color: #ff9bd9; padding-left: 6px; margin: 0; }
.gate-form input[aria-invalid="true"] { border-color: #ff9bd9; }

/* 자바스크립트가 꺼졌을 때 보이는 요약 */
.noscript-list { list-style: none; display: grid; gap: 10px; color: var(--muted); }
.noscript-list b { color: var(--text); }
.noscript-note { margin-top: 16px; color: var(--muted); }
